1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer -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
58 tracksRegLiveness: true
67 ; CHECK-LABEL: name: float_to_int8
68 ; CHECK: liveins: $xmm0
69 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
70 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s128)
71 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[TRUNC]](s32)
72 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[FPTOSI]](s32)
73 ; CHECK: $al = COPY [[TRUNC1]](s8)
74 ; CHECK: RET 0, implicit $al
75 %1:_(s128) = COPY $xmm0
76 %0:_(s32) = G_TRUNC %1(s128)
77 %2:_(s8) = G_FPTOSI %0(s32)
85 tracksRegLiveness: true
94 ; CHECK-LABEL: name: float_to_int16
95 ; CHECK: liveins: $xmm0
96 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
97 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s128)
98 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[TRUNC]](s32)
99 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[FPTOSI]](s32)
100 ; CHECK: $ax = COPY [[TRUNC1]](s16)
101 ; CHECK: RET 0, implicit $ax
102 %1:_(s128) = COPY $xmm0
103 %0:_(s32) = G_TRUNC %1(s128)
104 %2:_(s16) = G_FPTOSI %0(s32)
112 tracksRegLiveness: true
114 - { id: 0, class: _ }
115 - { id: 1, class: _ }
116 - { id: 2, class: _ }
121 ; CHECK-LABEL: name: float_to_int32
122 ; CHECK: liveins: $xmm0
123 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
124 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s128)
125 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[TRUNC]](s32)
126 ; CHECK: $eax = COPY [[FPTOSI]](s32)
127 ; CHECK: RET 0, implicit $eax
128 %1:_(s128) = COPY $xmm0
129 %0:_(s32) = G_TRUNC %1(s128)
130 %2:_(s32) = G_FPTOSI %0(s32)
138 tracksRegLiveness: true
140 - { id: 0, class: _ }
141 - { id: 1, class: _ }
142 - { id: 2, class: _ }
147 ; CHECK-LABEL: name: float_to_int64
148 ; CHECK: liveins: $xmm0
149 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
150 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s128)
151 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s64) = G_FPTOSI [[TRUNC]](s32)
152 ; CHECK: $rax = COPY [[FPTOSI]](s64)
153 ; CHECK: RET 0, implicit $rax
154 %1:_(s128) = COPY $xmm0
155 %0:_(s32) = G_TRUNC %1(s128)
156 %2:_(s64) = G_FPTOSI %0(s32)
164 tracksRegLiveness: true
166 - { id: 0, class: _ }
167 - { id: 1, class: _ }
168 - { id: 2, class: _ }
173 ; CHECK-LABEL: name: double_to_int8
174 ; CHECK: liveins: $xmm0
175 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
176 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY]](s128)
177 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[TRUNC]](s64)
178 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[FPTOSI]](s32)
179 ; CHECK: $al = COPY [[TRUNC1]](s8)
180 ; CHECK: RET 0, implicit $al
181 %1:_(s128) = COPY $xmm0
182 %0:_(s64) = G_TRUNC %1(s128)
183 %2:_(s8) = G_FPTOSI %0(s64)
189 name: double_to_int16
191 tracksRegLiveness: true
193 - { id: 0, class: _ }
194 - { id: 1, class: _ }
195 - { id: 2, class: _ }
200 ; CHECK-LABEL: name: double_to_int16
201 ; CHECK: liveins: $xmm0
202 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
203 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY]](s128)
204 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[TRUNC]](s64)
205 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[FPTOSI]](s32)
206 ; CHECK: $ax = COPY [[TRUNC1]](s16)
207 ; CHECK: RET 0, implicit $ax
208 %1:_(s128) = COPY $xmm0
209 %0:_(s64) = G_TRUNC %1(s128)
210 %2:_(s16) = G_FPTOSI %0(s64)
216 name: double_to_int32
218 tracksRegLiveness: true
220 - { id: 0, class: _ }
221 - { id: 1, class: _ }
222 - { id: 2, class: _ }
227 ; CHECK-LABEL: name: double_to_int32
228 ; CHECK: liveins: $xmm0
229 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
230 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY]](s128)
231 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[TRUNC]](s64)
232 ; CHECK: $eax = COPY [[FPTOSI]](s32)
233 ; CHECK: RET 0, implicit $eax
234 %1:_(s128) = COPY $xmm0
235 %0:_(s64) = G_TRUNC %1(s128)
236 %2:_(s32) = G_FPTOSI %0(s64)
242 name: double_to_int64
244 tracksRegLiveness: true
246 - { id: 0, class: _ }
247 - { id: 1, class: _ }
248 - { id: 2, class: _ }
253 ; CHECK-LABEL: name: double_to_int64
254 ; CHECK: liveins: $xmm0
255 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $xmm0
256 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY]](s128)
257 ; CHECK: [[FPTOSI:%[0-9]+]]:_(s64) = G_FPTOSI [[TRUNC]](s64)
258 ; CHECK: $rax = COPY [[FPTOSI]](s64)
259 ; CHECK: RET 0, implicit $rax
260 %1:_(s128) = COPY $xmm0
261 %0:_(s64) = G_TRUNC %1(s128)
262 %2:_(s64) = G_FPTOSI %0(s64)