Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-const-rv64.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s
4 ---
5 name: const_i8
6 body: |
7 bb.0.entry:
8 ; CHECK-LABEL: name: const_i8
9 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -127
10 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
11 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
12 ; CHECK-NEXT: PseudoRET implicit $x10
13 %0:_(s8) = G_CONSTANT i8 129
14 %1:_(s64) = G_ANYEXT %0(s8)
15 $x10 = COPY %1(s64)
16 PseudoRET implicit $x10
17
18 ...
19 ---
20 name: const_i15
21 body: |
22 bb.0.entry:
23 ; CHECK-LABEL: name: const_i15
24 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 15
25 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
26 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
27 ; CHECK-NEXT: PseudoRET implicit $x10
28 %0:_(s15) = G_CONSTANT i15 15
29 %1:_(s64) = G_ANYEXT %0(s15)
30 $x10 = COPY %1(s64)
31 PseudoRET implicit $x10
32
33 ...
34 ---
35 name: const_i16
36 body: |
37 bb.0.entry:
38 ; CHECK-LABEL: name: const_i16
39 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 767
40 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
41 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
42 ; CHECK-NEXT: PseudoRET implicit $x10
43 %0:_(s16) = G_CONSTANT i16 -64769
44 %1:_(s64) = G_ANYEXT %0(s16)
45 $x10 = COPY %1(s64)
46 PseudoRET implicit $x10
47
48 ...
49 ---
50 name: const_i32
51 body: |
52 bb.0.entry:
53 ; CHECK-LABEL: name: const_i32
54 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -64769
55 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[C]](s32)
56 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
57 ; CHECK-NEXT: PseudoRET implicit $x10
58 %0:_(s32) = G_CONSTANT i32 -64769
59 %1:_(s64) = G_ANYEXT %0(s32)
60 $x10 = COPY %1(s64)
61 PseudoRET implicit $x10
62
63 ...
64 ---
65 name: const_i64
66 body: |
67 bb.0.entry:
68 ; CHECK-LABEL: name: const_i64
69 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 2147483649
70 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
71 ; CHECK-NEXT: PseudoRET implicit $x10
72 %0:_(s64) = G_CONSTANT i64 2147483649
73 $x10 = COPY %0(s64)
74 PseudoRET implicit $x10
75
76 ...
77 ---
78 name: const_i72
79 body: |
80 bb.0.entry:
81 ; CHECK-LABEL: name: const_i72
82 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -2147483649312
83 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
84 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
85 ; CHECK-NEXT: $x11 = COPY [[C1]](s64)
86 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
87 %0:_(s72) = G_CONSTANT i72 -2147483649312
88 %1:_(s128) = G_ANYEXT %0(s72)
89 %2:_(s64), %3:_(s64) = G_UNMERGE_VALUES %1(s128)
90 $x10 = COPY %2(s64)
91 $x11 = COPY %3(s64)
92 PseudoRET implicit $x10, implicit $x11
93
94 ...
95 ---
96 name: const_i128
97 body: |
98 bb.0.entry:
99 ; CHECK-LABEL: name: const_i128
100 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 21474831289
101 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
102 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
103 ; CHECK-NEXT: $x11 = COPY [[C1]](s64)
104 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
105 %0:_(s128) = G_CONSTANT i128 21474831289
106 %1:_(s64), %2:_(s64) = G_UNMERGE_VALUES %0(s128)
107 $x10 = COPY %1(s64)
108 $x11 = COPY %2(s64)
109 PseudoRET implicit $x10, implicit $x11
110
111 ...
112 ---
113 name: const_i192
114 body: |
115 bb.0.entry:
116 ; CHECK-LABEL: name: const_i192
117 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -214772364921
118 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
119 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1
120 ; CHECK-NEXT: $x10 = COPY [[C]](s64)
121 ; CHECK-NEXT: $x11 = COPY [[C1]](s64)
122 ; CHECK-NEXT: $x12 = COPY [[C2]](s64)
123 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
124 %0:_(s192) = G_CONSTANT i192 -214772364921
125 %1:_(s64), %2:_(s64), %3:_(s64) = G_UNMERGE_VALUES %0(s192)
126 $x10 = COPY %1(s64)
127 $x11 = COPY %2(s64)
128 $x12 = COPY %3(s64)
129 PseudoRET implicit $x10, implicit $x11, implicit $x12
130
131 ...
132 ---
133 name: const_null
134 body: |
135 bb.0.entry:
136 ; CHECK-LABEL: name: const_null
137 ; CHECK: [[C:%[0-9]+]]:_(p0) = G_CONSTANT i64 0
138 ; CHECK-NEXT: $x10 = COPY [[C]](p0)
139 ; CHECK-NEXT: PseudoRET implicit $x10
140 %0:_(p0) = G_CONSTANT i64 0
141 $x10 = COPY %0(p0)
142 PseudoRET implicit $x10
143
144 ...
145 ---
146 name: const_add_i32
147 body: |
148 bb.0.entry:
149 ; CHECK-LABEL: name: const_add_i32
150 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 -64769
151 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
152 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
153 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[TRUNC]], [[C]]
154 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[ADD]](s32)
155 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
156 ; CHECK-NEXT: PseudoRET implicit $x10
157 %0:_(s32) = G_CONSTANT i32 -64769
158 %1:_(s64) = COPY $x10
159 %2:_(s32) = G_TRUNC %1(s64)
160 %3:_(s32) = G_ADD %2, %0
161 %4:_(s64) = G_ANYEXT %3(s32)
162 $x10 = COPY %4(s64)
163 PseudoRET implicit $x10
164
165 ...
166 ---
167 name: const_add_i8
168 body: |
169 bb.0.entry:
170 ; CHECK-LABEL: name: const_add_i8
171 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
172 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
173 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
174 ; CHECK-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[TRUNC]], [[C]]
175 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[ADD]](s32)
176 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
177 ; CHECK-NEXT: PseudoRET implicit $x10
178 %0:_(s8) = G_CONSTANT i8 1
179 %1:_(s64) = COPY $x10
180 %2:_(s8) = G_TRUNC %1(s64)
181 %3:_(s8) = G_ADD %2, %0
182 %4:_(s64) = G_ANYEXT %3(s8)
183 $x10 = COPY %4(s64)
184 PseudoRET implicit $x10
185
186 ...
187
188 ...
189 ---
190 name: constant_pool_i64
191 body: |
192 bb.0.entry:
193 ; CHECK-LABEL: name: constant_pool_i64
194 ; CHECK: [[CONSTANT_POOL:%[0-9]+]]:_(p0) = G_CONSTANT_POOL %const.0
195 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s64) = G_LOAD [[CONSTANT_POOL]](p0) :: (load (s64) from constant-pool)
196 ; CHECK-NEXT: $x10 = COPY [[LOAD]](s64)
197 ; CHECK-NEXT: PseudoRET implicit $x10
198 %0:_(s64) = G_CONSTANT i64 -1085102592571150096
199 $x10 = COPY %0(s64)
200 PseudoRET implicit $x10
201
202 ...