1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
6 define signext i8 @float_to_int8(float %val) {
8 %conv = fptosi float %val to i8
12 define signext i16 @float_to_int16(float %val) {
14 %conv = fptosi float %val to i16
18 define i32 @float_to_int32(float %val) {
20 %conv = fptosi float %val to i32
24 define i64 @float_to_int64(float %val) {
26 %conv = fptosi float %val to i64
30 define signext i8 @double_to_int8(double %val) {
32 %conv = fptosi double %val to i8
36 define signext i16 @double_to_int16(double %val) {
38 %conv = fptosi double %val to i16
42 define i32 @double_to_int32(double %val) {
44 %conv = fptosi double %val to i32
48 define i64 @double_to_int64(double %val) {
50 %conv = fptosi double %val to i64
60 tracksRegLiveness: true
62 - { id: 0, class: vecr }
63 - { id: 1, class: vecr }
64 - { id: 2, class: gpr }
65 - { id: 3, class: gpr }
70 ; CHECK-LABEL: name: float_to_int8
71 ; CHECK: liveins: $xmm0
72 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
73 ; CHECK: [[COPY1:%[0-9]+]]:fr32 = COPY [[COPY]]
74 ; CHECK: [[CVTTSS2SIrr:%[0-9]+]]:gr32 = CVTTSS2SIrr [[COPY1]]
75 ; CHECK: [[COPY2:%[0-9]+]]:gr8 = COPY [[CVTTSS2SIrr]].sub_8bit
76 ; CHECK: $al = COPY [[COPY2]]
77 ; CHECK: RET 0, implicit $al
78 %1:vecr(s128) = COPY $xmm0
79 %0:vecr(s32) = G_TRUNC %1(s128)
80 %3:gpr(s32) = G_FPTOSI %0(s32)
81 %2:gpr(s8) = G_TRUNC %3(s32)
91 tracksRegLiveness: true
93 - { id: 0, class: vecr }
94 - { id: 1, class: vecr }
95 - { id: 2, class: gpr }
96 - { id: 3, class: gpr }
101 ; CHECK-LABEL: name: float_to_int16
102 ; CHECK: liveins: $xmm0
103 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
104 ; CHECK: [[COPY1:%[0-9]+]]:fr32 = COPY [[COPY]]
105 ; CHECK: [[CVTTSS2SIrr:%[0-9]+]]:gr32 = CVTTSS2SIrr [[COPY1]]
106 ; CHECK: [[COPY2:%[0-9]+]]:gr16 = COPY [[CVTTSS2SIrr]].sub_16bit
107 ; CHECK: $ax = COPY [[COPY2]]
108 ; CHECK: RET 0, implicit $ax
109 %1:vecr(s128) = COPY $xmm0
110 %0:vecr(s32) = G_TRUNC %1(s128)
111 %3:gpr(s32) = G_FPTOSI %0(s32)
112 %2:gpr(s16) = G_TRUNC %3(s32)
121 regBankSelected: true
122 tracksRegLiveness: true
124 - { id: 0, class: vecr }
125 - { id: 1, class: vecr }
126 - { id: 2, class: gpr }
131 ; CHECK-LABEL: name: float_to_int32
132 ; CHECK: liveins: $xmm0
133 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
134 ; CHECK: [[COPY1:%[0-9]+]]:fr32 = COPY [[COPY]]
135 ; CHECK: [[CVTTSS2SIrr:%[0-9]+]]:gr32 = CVTTSS2SIrr [[COPY1]]
136 ; CHECK: $eax = COPY [[CVTTSS2SIrr]]
137 ; CHECK: RET 0, implicit $eax
138 %1:vecr(s128) = COPY $xmm0
139 %0:vecr(s32) = G_TRUNC %1(s128)
140 %2:gpr(s32) = G_FPTOSI %0(s32)
149 regBankSelected: true
150 tracksRegLiveness: true
152 - { id: 0, class: vecr }
153 - { id: 1, class: vecr }
154 - { id: 2, class: gpr }
159 ; CHECK-LABEL: name: float_to_int64
160 ; CHECK: liveins: $xmm0
161 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
162 ; CHECK: [[COPY1:%[0-9]+]]:fr32 = COPY [[COPY]]
163 ; CHECK: [[CVTTSS2SI64rr:%[0-9]+]]:gr64 = CVTTSS2SI64rr [[COPY1]]
164 ; CHECK: $rax = COPY [[CVTTSS2SI64rr]]
165 ; CHECK: RET 0, implicit $rax
166 %1:vecr(s128) = COPY $xmm0
167 %0:vecr(s32) = G_TRUNC %1(s128)
168 %2:gpr(s64) = G_FPTOSI %0(s32)
177 regBankSelected: true
178 tracksRegLiveness: true
180 - { id: 0, class: vecr }
181 - { id: 1, class: vecr }
182 - { id: 2, class: gpr }
183 - { id: 3, class: gpr }
188 ; CHECK-LABEL: name: double_to_int8
189 ; CHECK: liveins: $xmm0
190 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
191 ; CHECK: [[COPY1:%[0-9]+]]:fr64 = COPY [[COPY]]
192 ; CHECK: [[CVTTSD2SIrr:%[0-9]+]]:gr32 = CVTTSD2SIrr [[COPY1]]
193 ; CHECK: [[COPY2:%[0-9]+]]:gr8 = COPY [[CVTTSD2SIrr]].sub_8bit
194 ; CHECK: $al = COPY [[COPY2]]
195 ; CHECK: RET 0, implicit $al
196 %1:vecr(s128) = COPY $xmm0
197 %0:vecr(s64) = G_TRUNC %1(s128)
198 %3:gpr(s32) = G_FPTOSI %0(s64)
199 %2:gpr(s8) = G_TRUNC %3(s32)
205 name: double_to_int16
208 regBankSelected: true
209 tracksRegLiveness: true
211 - { id: 0, class: vecr }
212 - { id: 1, class: vecr }
213 - { id: 2, class: gpr }
214 - { id: 3, class: gpr }
219 ; CHECK-LABEL: name: double_to_int16
220 ; CHECK: liveins: $xmm0
221 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
222 ; CHECK: [[COPY1:%[0-9]+]]:fr64 = COPY [[COPY]]
223 ; CHECK: [[CVTTSD2SIrr:%[0-9]+]]:gr32 = CVTTSD2SIrr [[COPY1]]
224 ; CHECK: [[COPY2:%[0-9]+]]:gr16 = COPY [[CVTTSD2SIrr]].sub_16bit
225 ; CHECK: $ax = COPY [[COPY2]]
226 ; CHECK: RET 0, implicit $ax
227 %1:vecr(s128) = COPY $xmm0
228 %0:vecr(s64) = G_TRUNC %1(s128)
229 %3:gpr(s32) = G_FPTOSI %0(s64)
230 %2:gpr(s16) = G_TRUNC %3(s32)
236 name: double_to_int32
239 regBankSelected: true
240 tracksRegLiveness: true
242 - { id: 0, class: vecr }
243 - { id: 1, class: vecr }
244 - { id: 2, class: gpr }
249 ; CHECK-LABEL: name: double_to_int32
250 ; CHECK: liveins: $xmm0
251 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
252 ; CHECK: [[COPY1:%[0-9]+]]:fr64 = COPY [[COPY]]
253 ; CHECK: [[CVTTSD2SIrr:%[0-9]+]]:gr32 = CVTTSD2SIrr [[COPY1]]
254 ; CHECK: $eax = COPY [[CVTTSD2SIrr]]
255 ; CHECK: RET 0, implicit $eax
256 %1:vecr(s128) = COPY $xmm0
257 %0:vecr(s64) = G_TRUNC %1(s128)
258 %2:gpr(s32) = G_FPTOSI %0(s64)
264 name: double_to_int64
267 regBankSelected: true
268 tracksRegLiveness: true
270 - { id: 0, class: vecr }
271 - { id: 1, class: vecr }
272 - { id: 2, class: gpr }
277 ; CHECK-LABEL: name: double_to_int64
278 ; CHECK: liveins: $xmm0
279 ; CHECK: [[COPY:%[0-9]+]]:vr128 = COPY $xmm0
280 ; CHECK: [[COPY1:%[0-9]+]]:fr64 = COPY [[COPY]]
281 ; CHECK: [[CVTTSD2SI64rr:%[0-9]+]]:gr64 = CVTTSD2SI64rr [[COPY1]]
282 ; CHECK: $rax = COPY [[CVTTSD2SI64rr]]
283 ; CHECK: RET 0, implicit $rax
284 %1:vecr(s128) = COPY $xmm0
285 %0:vecr(s64) = G_TRUNC %1(s128)
286 %2:gpr(s64) = G_FPTOSI %0(s64)