[PATCH] D57320: [RISCV] Allow parsing immediates that use tilde & exclaim
Lewis Revill via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 19 03:25:21 PDT 2019
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363783: [RISCV] Allow parsing immediates that use tilde & exclaim (authored by lewis-revill, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D57320?vs=183863&id=205534#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57320/new/
https://reviews.llvm.org/D57320
Files:
llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/trunk/test/MC/RISCV/rv32i-valid.s
Index: llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ llvm/trunk/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -1053,6 +1053,8 @@
case AsmToken::LParen:
case AsmToken::Minus:
case AsmToken::Plus:
+ case AsmToken::Exclaim:
+ case AsmToken::Tilde:
case AsmToken::Integer:
case AsmToken::String: {
if (getParser().parseExpression(Res))
@@ -1119,6 +1121,8 @@
case AsmToken::LParen:
case AsmToken::Minus:
case AsmToken::Plus:
+ case AsmToken::Exclaim:
+ case AsmToken::Tilde:
case AsmToken::Integer:
case AsmToken::String:
case AsmToken::Identifier:
Index: llvm/trunk/test/MC/RISCV/rv32i-valid.s
===================================================================
--- llvm/trunk/test/MC/RISCV/rv32i-valid.s
+++ llvm/trunk/test/MC/RISCV/rv32i-valid.s
@@ -96,6 +96,12 @@
jalr a0, a1, -2048
# CHECK-ASM-AND-OBJ: jalr a0, a1, -2048
# CHECK-ASM: encoding: [0x67,0x85,0x05,0x80]
+jalr a0, a1, ~2047
+# CHECK-ASM-AND-OBJ: jalr a0, a1, 0
+# CHECK-ASM: encoding: [0x67,0x85,0x05,0x00]
+jalr a0, a1, !1
+# CHECK-ASM-AND-OBJ: jalr a0, a1, -2048
+# CHECK-ASM: encoding: [0x67,0x85,0x05,0x80]
jalr a0, a1, %lo(2048)
# CHECK-ASM-AND-OBJ: jalr t2, t1, 2047
# CHECK-ASM: encoding: [0xe7,0x03,0xf3,0x7f]
@@ -140,6 +146,12 @@
lh t1, -2048(zero)
# CHECK-ASM-AND-OBJ: lh t1, -2048(zero)
# CHECK-ASM: encoding: [0x03,0x13,0x00,0x80]
+lh t1, ~2047(zero)
+# CHECK-ASM-AND-OBJ: lh t1, 0(zero)
+# CHECK-ASM: encoding: [0x03,0x13,0x00,0x00]
+lh t1, !1(zero)
+# CHECK-ASM-AND-OBJ: lh t1, -2048(zero)
+# CHECK-ASM: encoding: [0x03,0x13,0x00,0x80]
lh t1, %lo(2048)(zero)
# CHECK-ASM-AND-OBJ: lh sp, 2047(a0)
# CHECK-ASM: encoding: [0x03,0x11,0xf5,0x7f]
@@ -175,6 +187,12 @@
sh t3, -2048(t5)
# CHECK-ASM-AND-OBJ: sh t3, -2048(t5)
# CHECK-ASM: encoding: [0x23,0x10,0xcf,0x81]
+sh t3, ~2047(t5)
+# CHECK-ASM-AND-OBJ: sh t3, 0(t5)
+# CHECK-ASM: encoding: [0x23,0x10,0xcf,0x01]
+sh t3, !1(t5)
+# CHECK-ASM-AND-OBJ: sh t3, -2048(t5)
+# CHECK-ASM: encoding: [0x23,0x10,0xcf,0x81]
sh t3, %lo(2048)(t5)
# CHECK-ASM-AND-OBJ: sw ra, 999(zero)
# CHECK-ASM: encoding: [0xa3,0x23,0x10,0x3e]
@@ -220,6 +238,12 @@
ori a0, a1, -2048
# CHECK-ASM-AND-OBJ: ori a0, a1, -2048
# CHECK-ASM: encoding: [0x13,0xe5,0x05,0x80]
+ori a0, a1, ~2047
+# CHECK-ASM-AND-OBJ: ori a0, a1, 0
+# CHECK-ASM: encoding: [0x13,0xe5,0x05,0x00]
+ori a0, a1, !1
+# CHECK-ASM-AND-OBJ: ori a0, a1, -2048
+# CHECK-ASM: encoding: [0x13,0xe5,0x05,0x80]
ori a0, a1, %lo(2048)
# CHECK-ASM-AND-OBJ: andi ra, sp, 2047
# CHECK-ASM: encoding: [0x93,0x70,0xf1,0x7f]
@@ -313,6 +337,12 @@
# CHECK-ASM-AND-OBJ: csrrw t0, 4095, t1
# CHECK-ASM: encoding: [0xf3,0x12,0xf3,0xff]
csrrw t0, 0xfff, t1
+# CHECK-ASM-AND-OBJ: csrrw s0, 4095, s1
+# CHECK-ASM: encoding: [0x73,0x94,0xf4,0xff]
+csrrw s0, ~(-4096), s1
+# CHECK-ASM-AND-OBJ: csrrw s0, fflags, s1
+# CHECK-ASM: encoding: [0x73,0x94,0x14,0x00]
+csrrw s0, !0, s1
# CHECK-ASM-AND-OBJ: csrrs s0, cycle, zero
# CHECK-ASM: encoding: [0x73,0x24,0x00,0xc0]
csrrs s0, 0xc00, x0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57320.205534.patch
Type: text/x-patch
Size: 3145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190619/d3b18747/attachment.bin>
More information about the llvm-commits
mailing list