[PATCH] D124460: [RISCV] Add out of range immediate tests for shifts and rotates on rv64.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 08:41:47 PDT 2022
craig.topper created this revision.
craig.topper added reviewers: asb, luismarques, reames, jrtc27.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
We were only testing the shared instruction mnemonics in rv32 tests.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124460
Files:
llvm/test/MC/RISCV/rv64i-invalid.s
llvm/test/MC/RISCV/rv64zbbp-invalid.s
Index: llvm/test/MC/RISCV/rv64zbbp-invalid.s
===================================================================
--- llvm/test/MC/RISCV/rv64zbbp-invalid.s
+++ llvm/test/MC/RISCV/rv64zbbp-invalid.s
@@ -9,6 +9,8 @@
# Immediate operand out of range
roriw t0, t1, 32 # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [0, 31]
roriw t0, t1, -1 # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [0, 31]
+rori t0, t1, 64 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
+rori t0, t1, -1 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
# Too few operands
packw t0, t1 # CHECK: :[[@LINE]]:1: error: too few operands for instruction
# Too few operands
Index: llvm/test/MC/RISCV/rv64i-invalid.s
===================================================================
--- llvm/test/MC/RISCV/rv64i-invalid.s
+++ llvm/test/MC/RISCV/rv64i-invalid.s
@@ -6,6 +6,11 @@
srliw a0, a0, -1 # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [0, 31]
sraiw a0, a0, -19 # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [0, 31]
+## uimm6
+slli a0, a0, 64 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
+srli a0, a0, -1 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
+srai a0, a0, -19 # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
+
## simm12
addiw a0, a1, -2049 # CHECK: :[[@LINE]]:15: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047]
ld ra, 2048(sp) # CHECK: :[[@LINE]]:8: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047]
@@ -16,5 +21,10 @@
srliw a0, a0, %lo(a) # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [0, 31]
sraiw a0, a0, %hi(2) # CHECK: :[[@LINE]]:15: error: immediate must be an integer in the range [0, 31]
+## uim6
+slli a0, a0, %lo(1) # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
+srli a0, a0, %lo(a) # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
+srai a0, a0, %hi(2) # CHECK: :[[@LINE]]:14: error: immediate must be an integer in the range [0, 63]
+
## simm12
addiw a0, a1, %hi(foo) # CHECK: :[[@LINE]]:15: error: operand must be a symbol with %lo/%pcrel_lo/%tprel_lo modifier or an integer in the range [-2048, 2047]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124460.425231.patch
Type: text/x-patch
Size: 2503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220426/22deec6a/attachment.bin>
More information about the llvm-commits
mailing list