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