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