1# RUN: llvm-mc -triple=riscv64 -mattr=+c -riscv-no-aliases < %s \
2# RUN:     | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s
3# RUN: llvm-mc -filetype=obj -triple riscv64 -mattr=+c < %s \
4# RUN:     | llvm-objdump -d -M no-aliases - \
5# RUN:     | FileCheck -check-prefixes=CHECK-EXPAND,CHECK-INST %s
6
7# The following check prefixes are used in this test:
8# CHECK-INST.....Match the canonical instr (tests alias to instr. mapping)
9# CHECK-EXPAND...Match canonical instr. unconditionally (tests alias expansion)
10# CHECK-INST: {{^}}
11
12# CHECK-EXPAND: c.li a0, 0
13li x10, 0
14# CHECK-EXPAND: c.li a0, 1
15li x10, 1
16# CHECK-EXPAND: c.li a0, -1
17li x10, -1
18# CHECK-EXPAND: addi a0, zero, 2047
19li x10, 2047
20# CHECK-EXPAND: addi a0, zero, -2047
21li x10, -2047
22# CHECK-EXPAND: c.lui a1, 1
23# CHECK-EXPAND: addiw a1, a1, -2048
24li x11, 2048
25# CHECK-EXPAND: addi a1, zero, -2048
26li x11, -2048
27# CHECK-EXPAND: c.lui a1, 1
28# CHECK-EXPAND: addiw a1, a1, -2047
29li x11, 2049
30# CHECK-EXPAND: c.lui a1, 1048575
31# CHECK-EXPAND: addiw a1, a1, 2047
32li x11, -2049
33# CHECK-EXPAND: c.lui a1, 1
34# CHECK-EXPAND: c.addiw a1, -1
35li x11, 4095
36# CHECK-EXPAND: lui a1, 1048575
37# CHECK-EXPAND: c.addiw a1, 1
38li x11, -4095
39# CHECK-EXPAND: c.lui a2, 1
40li x12, 4096
41# CHECK-EXPAND: lui a2, 1048575
42li x12, -4096
43# CHECK-EXPAND: c.lui a2, 1
44# CHECK-EXPAND: c.addiw a2, 1
45li x12, 4097
46# CHECK-EXPAND: lui a2, 1048575
47# CHECK-EXPAND: c.addiw a2, -1
48li x12, -4097
49# CHECK-EXPAND: lui a2, 524288
50# CHECK-EXPAND: c.addiw a2, -1
51li x12, 2147483647
52# CHECK-EXPAND: lui a2, 524288
53# CHECK-EXPAND: c.addiw a2, 1
54li x12, -2147483647
55# CHECK-EXPAND: lui a2, 524288
56li x12, -2147483648
57# CHECK-EXPAND: lui a2, 524288
58li x12, -0x80000000
59
60# CHECK-EXPAND: c.li a2, 1
61# CHECK-EXPAND: c.slli a2, 31
62li x12, 0x80000000
63# CHECK-EXPAND: c.li a2, 1
64# CHECK-EXPAND: c.slli a2, 32
65# CHECK-EXPAND: c.addi a2, -1
66li x12, 0xFFFFFFFF
67
68# CHECK-EXPAND: c.li t0, 1
69# CHECK-EXPAND: c.slli t0, 32
70li t0, 0x100000000
71# CHECK-EXPAND: c.li t1, -1
72# CHECK-EXPAND: c.slli t1, 63
73li t1, 0x8000000000000000
74# CHECK-EXPAND: c.li t1, -1
75# CHECK-EXPAND: c.slli t1, 63
76li t1, -0x8000000000000000
77# CHECK-EXPAND: lui t2, 9321
78# CHECK-EXPAND: addiw t2, t2, -1329
79# CHECK-EXPAND: c.slli t2, 35
80li t2, 0x1234567800000000
81# CHECK-EXPAND: c.li t3, 7
82# CHECK-EXPAND: c.slli t3, 36
83# CHECK-EXPAND: c.addi t3, 11
84# CHECK-EXPAND: c.slli t3, 24
85# CHECK-EXPAND: c.addi t3, 15
86li t3, 0x700000000B00000F
87# CHECK-EXPAND: lui t4, 583
88# CHECK-EXPAND: addiw t4, t4, -1875
89# CHECK-EXPAND: c.slli t4, 14
90# CHECK-EXPAND: addi t4, t4, -947
91# CHECK-EXPAND: c.slli t4, 12
92# CHECK-EXPAND: addi t4, t4, 1511
93# CHECK-EXPAND: c.slli t4, 13
94# CHECK-EXPAND: addi t4, t4, -272
95li t4, 0x123456789abcdef0
96# CHECK-EXPAND: c.li t5, -1
97li t5, 0xFFFFFFFFFFFFFFFF
98
99# CHECK-EXPAND: c.ld s0, 0(s1)
100c.ld x8, (x9)
101# CHECK-EXPAND: c.sd s0, 0(s1)
102c.sd x8, (x9)
103# CHECK-EXPAND: c.ldsp s0, 0(sp)
104c.ldsp x8, (x2)
105# CHECK-EXPAND: c.sdsp s0, 0(sp)
106c.sdsp x8, (x2)
107