1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
2 ; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-apple-ios7.0 -O0
4 ; (The O0 test is to make sure FastISel still constrains its operands properly
5 ; and the verifier doesn't trigger).
10 define void @test_fcvtzs(float %flt, double %dbl) {
11 ; CHECK-LABEL: test_fcvtzs:
13 %fix1 = fmul float %flt, 128.0
14 %cvt1 = fptosi float %fix1 to i32
15 ; CHECK: fcvtzs {{w[0-9]+}}, {{s[0-9]+}}, #7
16 store volatile i32 %cvt1, i32* @var32
18 %fix2 = fmul float %flt, 4294967296.0
19 %cvt2 = fptosi float %fix2 to i32
20 ; CHECK: fcvtzs {{w[0-9]+}}, {{s[0-9]+}}, #32
21 store volatile i32 %cvt2, i32* @var32
23 %fix3 = fmul float %flt, 128.0
24 %cvt3 = fptosi float %fix3 to i64
25 ; CHECK: fcvtzs {{x[0-9]+}}, {{s[0-9]+}}, #7
26 store volatile i64 %cvt3, i64* @var64
28 %fix4 = fmul float %flt, 18446744073709551616.0
29 %cvt4 = fptosi float %fix4 to i64
30 ; CHECK: fcvtzs {{x[0-9]+}}, {{s[0-9]+}}, #64
31 store volatile i64 %cvt4, i64* @var64
33 %fix5 = fmul double %dbl, 128.0
34 %cvt5 = fptosi double %fix5 to i32
35 ; CHECK: fcvtzs {{w[0-9]+}}, {{d[0-9]+}}, #7
36 store volatile i32 %cvt5, i32* @var32
38 %fix6 = fmul double %dbl, 4294967296.0
39 %cvt6 = fptosi double %fix6 to i32
40 ; CHECK: fcvtzs {{w[0-9]+}}, {{d[0-9]+}}, #32
41 store volatile i32 %cvt6, i32* @var32
43 %fix7 = fmul double %dbl, 128.0
44 %cvt7 = fptosi double %fix7 to i64
45 ; CHECK: fcvtzs {{x[0-9]+}}, {{d[0-9]+}}, #7
46 store volatile i64 %cvt7, i64* @var64
48 %fix8 = fmul double %dbl, 18446744073709551616.0
49 %cvt8 = fptosi double %fix8 to i64
50 ; CHECK: fcvtzs {{x[0-9]+}}, {{d[0-9]+}}, #64
51 store volatile i64 %cvt8, i64* @var64
56 define void @test_fcvtzu(float %flt, double %dbl) {
57 ; CHECK-LABEL: test_fcvtzu:
59 %fix1 = fmul float %flt, 128.0
60 %cvt1 = fptoui float %fix1 to i32
61 ; CHECK: fcvtzu {{w[0-9]+}}, {{s[0-9]+}}, #7
62 store volatile i32 %cvt1, i32* @var32
64 %fix2 = fmul float %flt, 4294967296.0
65 %cvt2 = fptoui float %fix2 to i32
66 ; CHECK: fcvtzu {{w[0-9]+}}, {{s[0-9]+}}, #32
67 store volatile i32 %cvt2, i32* @var32
69 %fix3 = fmul float %flt, 128.0
70 %cvt3 = fptoui float %fix3 to i64
71 ; CHECK: fcvtzu {{x[0-9]+}}, {{s[0-9]+}}, #7
72 store volatile i64 %cvt3, i64* @var64
74 %fix4 = fmul float %flt, 18446744073709551616.0
75 %cvt4 = fptoui float %fix4 to i64
76 ; CHECK: fcvtzu {{x[0-9]+}}, {{s[0-9]+}}, #64
77 store volatile i64 %cvt4, i64* @var64
79 %fix5 = fmul double %dbl, 128.0
80 %cvt5 = fptoui double %fix5 to i32
81 ; CHECK: fcvtzu {{w[0-9]+}}, {{d[0-9]+}}, #7
82 store volatile i32 %cvt5, i32* @var32
84 %fix6 = fmul double %dbl, 4294967296.0
85 %cvt6 = fptoui double %fix6 to i32
86 ; CHECK: fcvtzu {{w[0-9]+}}, {{d[0-9]+}}, #32
87 store volatile i32 %cvt6, i32* @var32
89 %fix7 = fmul double %dbl, 128.0
90 %cvt7 = fptoui double %fix7 to i64
91 ; CHECK: fcvtzu {{x[0-9]+}}, {{d[0-9]+}}, #7
92 store volatile i64 %cvt7, i64* @var64
94 %fix8 = fmul double %dbl, 18446744073709551616.0
95 %cvt8 = fptoui double %fix8 to i64
96 ; CHECK: fcvtzu {{x[0-9]+}}, {{d[0-9]+}}, #64
97 store volatile i64 %cvt8, i64* @var64
102 @varfloat = global float 0.0
103 @vardouble = global double 0.0
105 define void @test_scvtf(i32 %int, i64 %long) {
106 ; CHECK-LABEL: test_scvtf:
108 %cvt1 = sitofp i32 %int to float
109 %fix1 = fdiv float %cvt1, 128.0
110 ; CHECK: scvtf {{s[0-9]+}}, {{w[0-9]+}}, #7
111 store volatile float %fix1, float* @varfloat
113 %cvt2 = sitofp i32 %int to float
114 %fix2 = fdiv float %cvt2, 4294967296.0
115 ; CHECK: scvtf {{s[0-9]+}}, {{w[0-9]+}}, #32
116 store volatile float %fix2, float* @varfloat
118 %cvt3 = sitofp i64 %long to float
119 %fix3 = fdiv float %cvt3, 128.0
120 ; CHECK: scvtf {{s[0-9]+}}, {{x[0-9]+}}, #7
121 store volatile float %fix3, float* @varfloat
123 %cvt4 = sitofp i64 %long to float
124 %fix4 = fdiv float %cvt4, 18446744073709551616.0
125 ; CHECK: scvtf {{s[0-9]+}}, {{x[0-9]+}}, #64
126 store volatile float %fix4, float* @varfloat
128 %cvt5 = sitofp i32 %int to double
129 %fix5 = fdiv double %cvt5, 128.0
130 ; CHECK: scvtf {{d[0-9]+}}, {{w[0-9]+}}, #7
131 store volatile double %fix5, double* @vardouble
133 %cvt6 = sitofp i32 %int to double
134 %fix6 = fdiv double %cvt6, 4294967296.0
135 ; CHECK: scvtf {{d[0-9]+}}, {{w[0-9]+}}, #32
136 store volatile double %fix6, double* @vardouble
138 %cvt7 = sitofp i64 %long to double
139 %fix7 = fdiv double %cvt7, 128.0
140 ; CHECK: scvtf {{d[0-9]+}}, {{x[0-9]+}}, #7
141 store volatile double %fix7, double* @vardouble
143 %cvt8 = sitofp i64 %long to double
144 %fix8 = fdiv double %cvt8, 18446744073709551616.0
145 ; CHECK: scvtf {{d[0-9]+}}, {{x[0-9]+}}, #64
146 store volatile double %fix8, double* @vardouble
151 define void @test_ucvtf(i32 %int, i64 %long) {
152 ; CHECK-LABEL: test_ucvtf:
154 %cvt1 = uitofp i32 %int to float
155 %fix1 = fdiv float %cvt1, 128.0
156 ; CHECK: ucvtf {{s[0-9]+}}, {{w[0-9]+}}, #7
157 store volatile float %fix1, float* @varfloat
159 %cvt2 = uitofp i32 %int to float
160 %fix2 = fdiv float %cvt2, 4294967296.0
161 ; CHECK: ucvtf {{s[0-9]+}}, {{w[0-9]+}}, #32
162 store volatile float %fix2, float* @varfloat
164 %cvt3 = uitofp i64 %long to float
165 %fix3 = fdiv float %cvt3, 128.0
166 ; CHECK: ucvtf {{s[0-9]+}}, {{x[0-9]+}}, #7
167 store volatile float %fix3, float* @varfloat
169 %cvt4 = uitofp i64 %long to float
170 %fix4 = fdiv float %cvt4, 18446744073709551616.0
171 ; CHECK: ucvtf {{s[0-9]+}}, {{x[0-9]+}}, #64
172 store volatile float %fix4, float* @varfloat
174 %cvt5 = uitofp i32 %int to double
175 %fix5 = fdiv double %cvt5, 128.0
176 ; CHECK: ucvtf {{d[0-9]+}}, {{w[0-9]+}}, #7
177 store volatile double %fix5, double* @vardouble
179 %cvt6 = uitofp i32 %int to double
180 %fix6 = fdiv double %cvt6, 4294967296.0
181 ; CHECK: ucvtf {{d[0-9]+}}, {{w[0-9]+}}, #32
182 store volatile double %fix6, double* @vardouble
184 %cvt7 = uitofp i64 %long to double
185 %fix7 = fdiv double %cvt7, 128.0
186 ; CHECK: ucvtf {{d[0-9]+}}, {{x[0-9]+}}, #7
187 store volatile double %fix7, double* @vardouble
189 %cvt8 = uitofp i64 %long to double
190 %fix8 = fdiv double %cvt8, 18446744073709551616.0
191 ; CHECK: ucvtf {{d[0-9]+}}, {{x[0-9]+}}, #64
192 store volatile double %fix8, double* @vardouble