[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / MC / RISCV / rv32a-valid.s
blob1f66680c27114f2d59c8197bd607281965d612f0
1 # RUN: llvm-mc %s -triple=riscv32 -mattr=+a -riscv-no-aliases -show-encoding \
2 # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
3 # RUN: llvm-mc %s -triple=riscv64 -mattr=+a -riscv-no-aliases -show-encoding \
4 # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
5 # RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+a < %s \
6 # RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
7 # RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
8 # RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+a < %s \
9 # RUN: | llvm-objdump --mattr=+a -M no-aliases -d -r - \
10 # RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
12 # CHECK-ASM-AND-OBJ: lr.w t0, (t1)
13 # CHECK-ASM: encoding: [0xaf,0x22,0x03,0x10]
14 lr.w t0, (t1)
15 # CHECK-ASM-AND-OBJ: lr.w.aq t1, (t2)
16 # CHECK-ASM: encoding: [0x2f,0xa3,0x03,0x14]
17 lr.w.aq t1, (t2)
18 # CHECK-ASM-AND-OBJ: lr.w.rl t2, (t3)
19 # CHECK-ASM: encoding: [0xaf,0x23,0x0e,0x12]
20 lr.w.rl t2, (t3)
21 # CHECK-ASM-AND-OBJ: lr.w.aqrl t3, (t4)
22 # CHECK-ASM: encoding: [0x2f,0xae,0x0e,0x16]
23 lr.w.aqrl t3, (t4)
25 # CHECK-ASM-AND-OBJ: sc.w t6, t5, (t4)
26 # CHECK-ASM: encoding: [0xaf,0xaf,0xee,0x19]
27 sc.w t6, t5, (t4)
28 # CHECK-ASM-AND-OBJ: sc.w.aq t5, t4, (t3)
29 # CHECK-ASM: encoding: [0x2f,0x2f,0xde,0x1d]
30 sc.w.aq t5, t4, (t3)
31 # CHECK-ASM-AND-OBJ: sc.w.rl t4, t3, (t2)
32 # CHECK-ASM: encoding: [0xaf,0xae,0xc3,0x1b]
33 sc.w.rl t4, t3, (t2)
34 # CHECK-ASM-AND-OBJ: sc.w.aqrl t3, t2, (t1)
35 # CHECK-ASM: encoding: [0x2f,0x2e,0x73,0x1e]
36 sc.w.aqrl t3, t2, (t1)
38 # CHECK-ASM-AND-OBJ: amoswap.w a4, ra, (s0)
39 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x08]
40 amoswap.w a4, ra, (s0)
41 # CHECK-ASM-AND-OBJ: amoadd.w a1, a2, (a3)
42 # CHECK-ASM: encoding: [0xaf,0xa5,0xc6,0x00]
43 amoadd.w a1, a2, (a3)
44 # CHECK-ASM-AND-OBJ: amoxor.w a2, a3, (a4)
45 # CHECK-ASM: encoding: [0x2f,0x26,0xd7,0x20]
46 amoxor.w a2, a3, (a4)
47 # CHECK-ASM-AND-OBJ: amoand.w a3, a4, (a5)
48 # CHECK-ASM: encoding: [0xaf,0xa6,0xe7,0x60]
49 amoand.w a3, a4, (a5)
50 # CHECK-ASM-AND-OBJ: amoor.w a4, a5, (a6)
51 # CHECK-ASM: encoding: [0x2f,0x27,0xf8,0x40]
52 amoor.w a4, a5, (a6)
53 # CHECK-ASM-AND-OBJ: amomin.w a5, a6, (a7)
54 # CHECK-ASM: encoding: [0xaf,0xa7,0x08,0x81]
55 amomin.w a5, a6, (a7)
56 # CHECK-ASM-AND-OBJ: amomax.w s7, s6, (s5)
57 # CHECK-ASM: encoding: [0xaf,0xab,0x6a,0xa1]
58 amomax.w s7, s6, (s5)
59 # CHECK-ASM-AND-OBJ: amominu.w s6, s5, (s4)
60 # CHECK-ASM: encoding: [0x2f,0x2b,0x5a,0xc1]
61 amominu.w s6, s5, (s4)
62 # CHECK-ASM-AND-OBJ: amomaxu.w s5, s4, (s3)
63 # CHECK-ASM: encoding: [0xaf,0xaa,0x49,0xe1]
64 amomaxu.w s5, s4, (s3)
66 # CHECK-ASM-AND-OBJ: amoswap.w.aq a4, ra, (s0)
67 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x0c]
68 amoswap.w.aq a4, ra, (s0)
69 # CHECK-ASM-AND-OBJ: amoadd.w.aq a1, a2, (a3)
70 # CHECK-ASM: encoding: [0xaf,0xa5,0xc6,0x04]
71 amoadd.w.aq a1, a2, (a3)
72 # CHECK-ASM-AND-OBJ: amoxor.w.aq a2, a3, (a4)
73 # CHECK-ASM: encoding: [0x2f,0x26,0xd7,0x24]
74 amoxor.w.aq a2, a3, (a4)
75 # CHECK-ASM-AND-OBJ: amoand.w.aq a3, a4, (a5)
76 # CHECK-ASM: encoding: [0xaf,0xa6,0xe7,0x64]
77 amoand.w.aq a3, a4, (a5)
78 # CHECK-ASM-AND-OBJ: amoor.w.aq a4, a5, (a6)
79 # CHECK-ASM: encoding: [0x2f,0x27,0xf8,0x44]
80 amoor.w.aq a4, a5, (a6)
81 # CHECK-ASM-AND-OBJ: amomin.w.aq a5, a6, (a7)
82 # CHECK-ASM: encoding: [0xaf,0xa7,0x08,0x85]
83 amomin.w.aq a5, a6, (a7)
84 # CHECK-ASM-AND-OBJ: amomax.w.aq s7, s6, (s5)
85 # CHECK-ASM: encoding: [0xaf,0xab,0x6a,0xa5]
86 amomax.w.aq s7, s6, (s5)
87 # CHECK-ASM-AND-OBJ: amominu.w.aq s6, s5, (s4)
88 # CHECK-ASM: encoding: [0x2f,0x2b,0x5a,0xc5]
89 amominu.w.aq s6, s5, (s4)
90 # CHECK-ASM-AND-OBJ: amomaxu.w.aq s5, s4, (s3)
91 # CHECK-ASM: encoding: [0xaf,0xaa,0x49,0xe5]
92 amomaxu.w.aq s5, s4, (s3)
94 # CHECK-ASM-AND-OBJ: amoswap.w.rl a4, ra, (s0)
95 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x0a]
96 amoswap.w.rl a4, ra, (s0)
97 # CHECK-ASM-AND-OBJ: amoadd.w.rl a1, a2, (a3)
98 # CHECK-ASM: encoding: [0xaf,0xa5,0xc6,0x02]
99 amoadd.w.rl a1, a2, (a3)
100 # CHECK-ASM-AND-OBJ: amoxor.w.rl a2, a3, (a4)
101 # CHECK-ASM: encoding: [0x2f,0x26,0xd7,0x22]
102 amoxor.w.rl a2, a3, (a4)
103 # CHECK-ASM-AND-OBJ: amoand.w.rl a3, a4, (a5)
104 # CHECK-ASM: encoding: [0xaf,0xa6,0xe7,0x62]
105 amoand.w.rl a3, a4, (a5)
106 # CHECK-ASM-AND-OBJ: amoor.w.rl a4, a5, (a6)
107 # CHECK-ASM: encoding: [0x2f,0x27,0xf8,0x42]
108 amoor.w.rl a4, a5, (a6)
109 # CHECK-ASM-AND-OBJ: amomin.w.rl a5, a6, (a7)
110 # CHECK-ASM: encoding: [0xaf,0xa7,0x08,0x83]
111 amomin.w.rl a5, a6, (a7)
112 # CHECK-ASM-AND-OBJ: amomax.w.rl s7, s6, (s5)
113 # CHECK-ASM: encoding: [0xaf,0xab,0x6a,0xa3]
114 amomax.w.rl s7, s6, (s5)
115 # CHECK-ASM-AND-OBJ: amominu.w.rl s6, s5, (s4)
116 # CHECK-ASM: encoding: [0x2f,0x2b,0x5a,0xc3]
117 amominu.w.rl s6, s5, (s4)
118 # CHECK-ASM-AND-OBJ: amomaxu.w.rl s5, s4, (s3)
119 # CHECK-ASM: encoding: [0xaf,0xaa,0x49,0xe3]
120 amomaxu.w.rl s5, s4, (s3)
122 # CHECK-ASM-AND-OBJ: amoswap.w.aqrl a4, ra, (s0)
123 # CHECK-ASM: encoding: [0x2f,0x27,0x14,0x0e]
124 amoswap.w.aqrl a4, ra, (s0)
125 # CHECK-ASM-AND-OBJ: amoadd.w.aqrl a1, a2, (a3)
126 # CHECK-ASM: encoding: [0xaf,0xa5,0xc6,0x06]
127 amoadd.w.aqrl a1, a2, (a3)
128 # CHECK-ASM-AND-OBJ: amoxor.w.aqrl a2, a3, (a4)
129 # CHECK-ASM: encoding: [0x2f,0x26,0xd7,0x26]
130 amoxor.w.aqrl a2, a3, (a4)
131 # CHECK-ASM-AND-OBJ: amoand.w.aqrl a3, a4, (a5)
132 # CHECK-ASM: encoding: [0xaf,0xa6,0xe7,0x66]
133 amoand.w.aqrl a3, a4, (a5)
134 # CHECK-ASM-AND-OBJ: amoor.w.aqrl a4, a5, (a6)
135 # CHECK-ASM: encoding: [0x2f,0x27,0xf8,0x46]
136 amoor.w.aqrl a4, a5, (a6)
137 # CHECK-ASM-AND-OBJ: amomin.w.aqrl a5, a6, (a7)
138 # CHECK-ASM: encoding: [0xaf,0xa7,0x08,0x87]
139 amomin.w.aqrl a5, a6, (a7)
140 # CHECK-ASM-AND-OBJ: amomax.w.aqrl s7, s6, (s5)
141 # CHECK-ASM: encoding: [0xaf,0xab,0x6a,0xa7]
142 amomax.w.aqrl s7, s6, (s5)
143 # CHECK-ASM-AND-OBJ: amominu.w.aqrl s6, s5, (s4)
144 # CHECK-ASM: encoding: [0x2f,0x2b,0x5a,0xc7]
145 amominu.w.aqrl s6, s5, (s4)
146 # CHECK-ASM-AND-OBJ: amomaxu.w.aqrl s5, s4, (s3)
147 # CHECK-ASM: encoding: [0xaf,0xaa,0x49,0xe7]
148 amomaxu.w.aqrl s5, s4, (s3)