1 # RUN: not llvm-mc -triple=riscv32 -mattr=+c -mattr=-rvc-hints < %s 2>&1 \
6 c.lw ra
, 4(sp
) # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
7 c.sw sp
, 4(sp
) # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
8 c.beqz t0
, .LBB # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
9 c.bnez s8
, .LBB # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
10 c.addi4spn s4
, sp
, 12 # CHECK: :[[@LINE]]:13: error: invalid operand for instruction
11 c.srli s7
, 12 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
12 c.
srai t0
, 12 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
13 c.andi t1
, 12 # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
14 c.
and t1
, a0
# CHECK: :[[@LINE]]:8: error: invalid operand for instruction
15 c.
or a0
, s8
# CHECK: :[[@LINE]]:12: error: invalid operand for instruction
16 c.
xor t2
, a0
# CHECK: :[[@LINE]]:8: error: invalid operand for instruction
17 c.
sub a0
, s8
# CHECK: :[[@LINE]]:12: error: invalid operand for instruction
20 c.lwsp x0
, 4(sp
) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
21 c.lwsp zero
, 4(sp
) # CHECK: :[[@LINE]]:9: error: invalid operand for instruction
22 c.jr x0
# CHECK: :[[@LINE]]:7: error: invalid operand for instruction
23 c.jalr zero
# CHECK: :[[@LINE]]:9: error: invalid operand for instruction
24 c.
addi x0
, x0
, 1 # CHECK: :[[@LINE]]:13: error: immediate must be zero
25 c.
li zero
, 2 # CHECK: :[[@LINE]]:1: error: instruction use requires an option to be enabled
26 c.slli zero
, zero
, 4 # CHECK: :[[@LINE]]:15: error: invalid operand for instruction
27 c.mv zero
, s0
# CHECK: :[[@LINE]]:1: error: instruction use requires an option to be enabled
28 c.mv ra
, x0
# CHECK: :[[@LINE]]:11: error: invalid operand for instruction
29 c.
add ra
, ra
, x0
# CHECK: :[[@LINE]]:16: error: invalid operand for instruction
30 c.
add zero
, zero
, sp
# CHECK: :[[@LINE]]:14: error: invalid operand for instruction
33 c.lui x0
, 4 # CHECK: :[[@LINE]]:1: error: instruction use requires an option to be enabled
34 c.lui x2
, 4 # CHECK: :[[@LINE]]:7: error: invalid operand for instruction
37 c.addi4spn a0
, a0
, 12 # CHECK: :[[@LINE]]:17: error: invalid operand for instruction
38 c.addi16sp t0
, 16 # CHECK: :[[@LINE]]:13: error: invalid operand for instruction
40 # Out of range immediates
42 ## uimmlog2xlennonzero
43 c.slli t0
, 64 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [1, 31]
44 c.srli a0
, 32 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [1, 31]
45 c.
srai a0
, 0 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [1, 31]
48 c.
li t0
, 128 # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-32, 31]
49 c.
li t0
, foo
# CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-32, 31]
50 c.
li t0
, %lo
(foo
) # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-32, 31]
51 c.
li t0
, %hi
(foo
) # CHECK: :[[@LINE]]:10: error: immediate must be an integer in the range [-32, 31]
52 c.andi a0
, -33 # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [-32, 31]
53 c.andi a0
, foo
# CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [-32, 31]
54 c.andi a0
, %lo
(foo
) # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [-32, 31]
55 c.andi a0
, %hi
(foo
) # CHECK: :[[@LINE]]:12: error: immediate must be an integer in the range [-32, 31]
58 c.
addi t0
, 0 # CHECK: :[[@LINE]]:1: error: instruction use requires an option to be enabled
59 c.
addi t0
, -33 # CHECK: :[[@LINE]]:12: error: immediate must be non-zero in the range [-32, 31]
60 c.
addi t0
, 32 # CHECK: :[[@LINE]]:12: error: immediate must be non-zero in the range [-32, 31]
61 c.
addi t0
, foo
# CHECK: :[[@LINE]]:12: error: immediate must be non-zero in the range [-32, 31]
62 c.
addi t0
, %lo
(foo
) # CHECK: :[[@LINE]]:12: error: immediate must be non-zero in the range [-32, 31]
63 c.
addi t0
, %hi
(foo
) # CHECK: :[[@LINE]]:12: error: immediate must be non-zero in the range [-32, 31]
66 c.lui t0
, 0 # CHECK: :[[@LINE]]:11: error: immediate must be in [0xfffe0, 0xfffff] or [1, 31]
67 c.lui t0
, 32 # CHECK: :[[@LINE]]:11: error: immediate must be in [0xfffe0, 0xfffff] or [1, 31]
68 c.lui t0
, 0xffffdf # CHECK: :[[@LINE]]:11: error: immediate must be in [0xfffe0, 0xfffff] or [1, 31]
69 c.lui t0
, 0x1000000 # CHECK: :[[@LINE]]:11: error: immediate must be in [0xfffe0, 0xfffff] or [1, 31]
72 c.lwsp ra
, 256(sp
) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 4 bytes in the range [0, 252]
73 c.swsp ra
, -4(sp
) # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 4 bytes in the range [0, 252]
75 c.lw s0
, -4(sp
) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 4 bytes in the range [0, 124]
76 c.sw s0
, 128(sp
) # CHECK: :[[@LINE]]:11: error: immediate must be a multiple of 4 bytes in the range [0, 124]
79 c.bnez s1
, -258 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-256, 254]
80 c.beqz a0
, 256 # CHECK: :[[@LINE]]:13: error: immediate must be a multiple of 2 bytes in the range [-256, 254]
83 c.j
2048 # CHECK: :[[@LINE]]:5: error: immediate must be a multiple of 2 bytes in the range [-2048, 2046]
84 c.jal
-2050 # CHECK: :[[@LINE]]:7: error: immediate must be a multiple of 2 bytes in the range [-2048, 2046]
86 ## uimm10_lsb00nonzero
87 c.addi4spn a0
, sp
, 0 # CHECK: :[[@LINE]]:21: error: immediate must be a multiple of 4 bytes in the range [4, 1020]
88 c.addi4spn a0
, sp
, 1024 # CHECK: :[[@LINE]]:21: error: immediate must be a multiple of 4 bytes in the range [4, 1020]
90 ## simm10_lsb0000nonzero
91 c.addi16sp sp
, -528 # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 16 bytes and non-zero in the range [-512, 496]
92 c.addi16sp sp
, 512 # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 16 bytes and non-zero in the range [-512, 496]
93 c.addi16sp sp
, 0 # CHECK: :[[@LINE]]:17: error: immediate must be a multiple of 16 bytes and non-zero in the range [-512, 496]