forked from OSchip/llvm-project
[RISCV] Add additional CSR instruction aliases (imm. operands)
This patch adds CSR instructions aliases for the cases where the instruction takes an immediate operand but the alias doesn't have the i suffix. This is necessary for gas/gcc compatibility. gas doesn't do a similar conversion for fsflags or fsrm, so this should be complete. Differential Revision: https://reviews.llvm.org/D55008 Patch by Luís Marques. llvm-svn: 347991
This commit is contained in:
parent
de4b88e5ac
commit
4830fdd21a
|
@ -580,6 +580,16 @@ def : InstAlias<"csrwi $csr, $imm", (CSRRWI X0, csr_sysreg:$csr, uimm5:$imm)>;
|
|||
def : InstAlias<"csrsi $csr, $imm", (CSRRSI X0, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
def : InstAlias<"csrci $csr, $imm", (CSRRCI X0, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
|
||||
let EmitPriority = 0 in {
|
||||
def : InstAlias<"csrw $csr, $imm", (CSRRWI X0, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
def : InstAlias<"csrs $csr, $imm", (CSRRSI X0, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
def : InstAlias<"csrc $csr, $imm", (CSRRCI X0, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
|
||||
def : InstAlias<"csrrw $rd, $csr, $imm", (CSRRWI GPR:$rd, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
def : InstAlias<"csrrs $rd, $csr, $imm", (CSRRSI GPR:$rd, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
def : InstAlias<"csrrc $rd, $csr, $imm", (CSRRCI GPR:$rd, csr_sysreg:$csr, uimm5:$imm)>;
|
||||
}
|
||||
|
||||
def : InstAlias<"sfence.vma", (SFENCE_VMA X0, X0)>;
|
||||
def : InstAlias<"sfence.vma $rs", (SFENCE_VMA GPR:$rs, X0)>;
|
||||
|
||||
|
|
|
@ -181,6 +181,26 @@ csrsi 0xfff, 0x10
|
|||
# CHECK-S-OBJ: csrci sscratch, 17
|
||||
csrci 0x140, 0x11
|
||||
|
||||
# CHECK-S-OBJ-NOALIAS: csrrwi zero, 336, 7
|
||||
# CHECK-S-OBJ: csrwi 336, 7
|
||||
csrw 0x150, 7
|
||||
# CHECK-S-OBJ-NOALIAS: csrrsi zero, 336, 7
|
||||
# CHECK-S-OBJ: csrsi 336, 7
|
||||
csrs 0x150, 7
|
||||
# CHECK-S-OBJ-NOALIAS: csrrci zero, 336, 7
|
||||
# CHECK-S-OBJ: csrci 336, 7
|
||||
csrc 0x150, 7
|
||||
|
||||
# CHECK-S-OBJ-NOALIAS: csrrwi t0, 336, 15
|
||||
# CHECK-S-OBJ: csrrwi t0, 336, 15
|
||||
csrrw t0, 0x150, 0xf
|
||||
# CHECK-S-OBJ-NOALIAS: csrrsi t0, 4095, 16
|
||||
# CHECK-S-OBJ: csrrsi t0, 4095, 16
|
||||
csrrs t0, 0xfff, 0x10
|
||||
# CHECK-S-OBJ-NOALIAS: csrrci t0, sscratch, 17
|
||||
# CHECK-S-OBJ: csrrci t0, sscratch, 17
|
||||
csrrc t0, 0x140, 0x11
|
||||
|
||||
# CHECK-S-OBJ-NOALIAS: sfence.vma zero, zero
|
||||
# CHECK-S-OBJ: sfence.vma
|
||||
sfence.vma
|
||||
|
|
Loading…
Reference in New Issue