mirror of
https://github.com/golang/go
synced 2024-09-29 23:24:29 -06:00
cmd/internal/obj/riscv: add NOT pseudo-instruction
Add a NOT pseudo-instruction that translates to XORI $-1. Change-Id: I2be4cfe2939e988cd7f8d30260b704701d78475f Reviewed-on: https://go-review.googlesource.com/c/go/+/221688 Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
32dbccde78
commit
dc3255391a
6
src/cmd/asm/internal/asm/testdata/riscvenc.s
vendored
6
src/cmd/asm/internal/asm/testdata/riscvenc.s
vendored
@ -305,10 +305,14 @@ start:
|
||||
MOVD F0, 4(X5) // 27b20200
|
||||
MOVD F0, F1 // d3000022
|
||||
|
||||
// NOT pseudo-instruction
|
||||
NOT X5 // 93c2f2ff
|
||||
NOT X5, X6 // 13c3f2ff
|
||||
|
||||
// These jumps can get printed as jumps to 2 because they go to the
|
||||
// second instruction in the function (the first instruction is an
|
||||
// invisible stack pointer adjustment).
|
||||
JMP start // JMP 2 // 6ff09fc6
|
||||
JMP start // JMP 2 // 6ff01fc6
|
||||
JMP (X5) // 67800200
|
||||
JMP 4(X5) // 67804200
|
||||
|
||||
|
@ -239,6 +239,7 @@ var Anames = []string{
|
||||
"MOVHU",
|
||||
"MOVW",
|
||||
"MOVWU",
|
||||
"NOT",
|
||||
"SEQZ",
|
||||
"SNEZ",
|
||||
"LAST",
|
||||
|
@ -589,6 +589,7 @@ const (
|
||||
AMOVHU
|
||||
AMOVW
|
||||
AMOVWU
|
||||
ANOT
|
||||
ASEQZ
|
||||
ASNEZ
|
||||
|
||||
|
@ -1849,6 +1849,15 @@ func instructionsForProg(p *obj.Prog) []*instruction {
|
||||
ins.rs1 = uint32(p.From.Reg)
|
||||
ins.rs2 = REG_F0
|
||||
|
||||
case ANOT:
|
||||
// NOT rs, rd -> XORI $-1, rs, rd
|
||||
ins.as = AXORI
|
||||
ins.rs1, ins.rs2 = uint32(p.From.Reg), obj.REG_NONE
|
||||
if ins.rd == obj.REG_NONE {
|
||||
ins.rd = ins.rs1
|
||||
}
|
||||
ins.imm = -1
|
||||
|
||||
case ASEQZ:
|
||||
// SEQZ rs, rd -> SLTIU $1, rs, rd
|
||||
ins.as = ASLTIU
|
||||
|
Loading…
Reference in New Issue
Block a user