xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/fcvt-fixed.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-apple-ios7.0 -O0
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; (The O0 test is to make sure FastISel still constrains its operands properly
5*9880d681SAndroid Build Coastguard Worker; and the verifier doesn't trigger).
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker@var32 = global i32 0
8*9880d681SAndroid Build Coastguard Worker@var64 = global i64 0
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine void @test_fcvtzs(float %flt, double %dbl) {
11*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_fcvtzs:
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker  %fix1 = fmul float %flt, 128.0
14*9880d681SAndroid Build Coastguard Worker  %cvt1 = fptosi float %fix1 to i32
15*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{w[0-9]+}}, {{s[0-9]+}}, #7
16*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt1, i32* @var32
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker  %fix2 = fmul float %flt, 4294967296.0
19*9880d681SAndroid Build Coastguard Worker  %cvt2 = fptosi float %fix2 to i32
20*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{w[0-9]+}}, {{s[0-9]+}}, #32
21*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt2, i32* @var32
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker  %fix3 = fmul float %flt, 128.0
24*9880d681SAndroid Build Coastguard Worker  %cvt3 = fptosi float %fix3 to i64
25*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{x[0-9]+}}, {{s[0-9]+}}, #7
26*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt3, i64* @var64
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker  %fix4 = fmul float %flt, 18446744073709551616.0
29*9880d681SAndroid Build Coastguard Worker  %cvt4 = fptosi float %fix4 to i64
30*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{x[0-9]+}}, {{s[0-9]+}}, #64
31*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt4, i64* @var64
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker  %fix5 = fmul double %dbl, 128.0
34*9880d681SAndroid Build Coastguard Worker  %cvt5 = fptosi double %fix5 to i32
35*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{w[0-9]+}}, {{d[0-9]+}}, #7
36*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt5, i32* @var32
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker  %fix6 = fmul double %dbl, 4294967296.0
39*9880d681SAndroid Build Coastguard Worker  %cvt6 = fptosi double %fix6 to i32
40*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{w[0-9]+}}, {{d[0-9]+}}, #32
41*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt6, i32* @var32
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Worker  %fix7 = fmul double %dbl, 128.0
44*9880d681SAndroid Build Coastguard Worker  %cvt7 = fptosi double %fix7 to i64
45*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{x[0-9]+}}, {{d[0-9]+}}, #7
46*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt7, i64* @var64
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker  %fix8 = fmul double %dbl, 18446744073709551616.0
49*9880d681SAndroid Build Coastguard Worker  %cvt8 = fptosi double %fix8 to i64
50*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzs {{x[0-9]+}}, {{d[0-9]+}}, #64
51*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt8, i64* @var64
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker  ret void
54*9880d681SAndroid Build Coastguard Worker}
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Workerdefine void @test_fcvtzu(float %flt, double %dbl) {
57*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_fcvtzu:
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker  %fix1 = fmul float %flt, 128.0
60*9880d681SAndroid Build Coastguard Worker  %cvt1 = fptoui float %fix1 to i32
61*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{w[0-9]+}}, {{s[0-9]+}}, #7
62*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt1, i32* @var32
63*9880d681SAndroid Build Coastguard Worker
64*9880d681SAndroid Build Coastguard Worker  %fix2 = fmul float %flt, 4294967296.0
65*9880d681SAndroid Build Coastguard Worker  %cvt2 = fptoui float %fix2 to i32
66*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{w[0-9]+}}, {{s[0-9]+}}, #32
67*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt2, i32* @var32
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Worker  %fix3 = fmul float %flt, 128.0
70*9880d681SAndroid Build Coastguard Worker  %cvt3 = fptoui float %fix3 to i64
71*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{x[0-9]+}}, {{s[0-9]+}}, #7
72*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt3, i64* @var64
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Worker  %fix4 = fmul float %flt, 18446744073709551616.0
75*9880d681SAndroid Build Coastguard Worker  %cvt4 = fptoui float %fix4 to i64
76*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{x[0-9]+}}, {{s[0-9]+}}, #64
77*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt4, i64* @var64
78*9880d681SAndroid Build Coastguard Worker
79*9880d681SAndroid Build Coastguard Worker  %fix5 = fmul double %dbl, 128.0
80*9880d681SAndroid Build Coastguard Worker  %cvt5 = fptoui double %fix5 to i32
81*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{w[0-9]+}}, {{d[0-9]+}}, #7
82*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt5, i32* @var32
83*9880d681SAndroid Build Coastguard Worker
84*9880d681SAndroid Build Coastguard Worker  %fix6 = fmul double %dbl, 4294967296.0
85*9880d681SAndroid Build Coastguard Worker  %cvt6 = fptoui double %fix6 to i32
86*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{w[0-9]+}}, {{d[0-9]+}}, #32
87*9880d681SAndroid Build Coastguard Worker  store volatile i32 %cvt6, i32* @var32
88*9880d681SAndroid Build Coastguard Worker
89*9880d681SAndroid Build Coastguard Worker  %fix7 = fmul double %dbl, 128.0
90*9880d681SAndroid Build Coastguard Worker  %cvt7 = fptoui double %fix7 to i64
91*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{x[0-9]+}}, {{d[0-9]+}}, #7
92*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt7, i64* @var64
93*9880d681SAndroid Build Coastguard Worker
94*9880d681SAndroid Build Coastguard Worker  %fix8 = fmul double %dbl, 18446744073709551616.0
95*9880d681SAndroid Build Coastguard Worker  %cvt8 = fptoui double %fix8 to i64
96*9880d681SAndroid Build Coastguard Worker; CHECK: fcvtzu {{x[0-9]+}}, {{d[0-9]+}}, #64
97*9880d681SAndroid Build Coastguard Worker  store volatile i64 %cvt8, i64* @var64
98*9880d681SAndroid Build Coastguard Worker
99*9880d681SAndroid Build Coastguard Worker  ret void
100*9880d681SAndroid Build Coastguard Worker}
101*9880d681SAndroid Build Coastguard Worker
102*9880d681SAndroid Build Coastguard Worker@varfloat = global float 0.0
103*9880d681SAndroid Build Coastguard Worker@vardouble = global double 0.0
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Workerdefine void @test_scvtf(i32 %int, i64 %long) {
106*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_scvtf:
107*9880d681SAndroid Build Coastguard Worker
108*9880d681SAndroid Build Coastguard Worker  %cvt1 = sitofp i32 %int to float
109*9880d681SAndroid Build Coastguard Worker  %fix1 = fdiv float %cvt1, 128.0
110*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{s[0-9]+}}, {{w[0-9]+}}, #7
111*9880d681SAndroid Build Coastguard Worker  store volatile float %fix1, float* @varfloat
112*9880d681SAndroid Build Coastguard Worker
113*9880d681SAndroid Build Coastguard Worker  %cvt2 = sitofp i32 %int to float
114*9880d681SAndroid Build Coastguard Worker  %fix2 = fdiv float %cvt2, 4294967296.0
115*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{s[0-9]+}}, {{w[0-9]+}}, #32
116*9880d681SAndroid Build Coastguard Worker  store volatile float %fix2, float* @varfloat
117*9880d681SAndroid Build Coastguard Worker
118*9880d681SAndroid Build Coastguard Worker  %cvt3 = sitofp i64 %long to float
119*9880d681SAndroid Build Coastguard Worker  %fix3 = fdiv float %cvt3, 128.0
120*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{s[0-9]+}}, {{x[0-9]+}}, #7
121*9880d681SAndroid Build Coastguard Worker  store volatile float %fix3, float* @varfloat
122*9880d681SAndroid Build Coastguard Worker
123*9880d681SAndroid Build Coastguard Worker  %cvt4 = sitofp i64 %long to float
124*9880d681SAndroid Build Coastguard Worker  %fix4 = fdiv float %cvt4, 18446744073709551616.0
125*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{s[0-9]+}}, {{x[0-9]+}}, #64
126*9880d681SAndroid Build Coastguard Worker  store volatile float %fix4, float* @varfloat
127*9880d681SAndroid Build Coastguard Worker
128*9880d681SAndroid Build Coastguard Worker  %cvt5 = sitofp i32 %int to double
129*9880d681SAndroid Build Coastguard Worker  %fix5 = fdiv double %cvt5, 128.0
130*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{d[0-9]+}}, {{w[0-9]+}}, #7
131*9880d681SAndroid Build Coastguard Worker  store volatile double %fix5, double* @vardouble
132*9880d681SAndroid Build Coastguard Worker
133*9880d681SAndroid Build Coastguard Worker  %cvt6 = sitofp i32 %int to double
134*9880d681SAndroid Build Coastguard Worker  %fix6 = fdiv double %cvt6, 4294967296.0
135*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{d[0-9]+}}, {{w[0-9]+}}, #32
136*9880d681SAndroid Build Coastguard Worker  store volatile double %fix6, double* @vardouble
137*9880d681SAndroid Build Coastguard Worker
138*9880d681SAndroid Build Coastguard Worker  %cvt7 = sitofp i64 %long to double
139*9880d681SAndroid Build Coastguard Worker  %fix7 = fdiv double %cvt7, 128.0
140*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{d[0-9]+}}, {{x[0-9]+}}, #7
141*9880d681SAndroid Build Coastguard Worker  store volatile double %fix7, double* @vardouble
142*9880d681SAndroid Build Coastguard Worker
143*9880d681SAndroid Build Coastguard Worker  %cvt8 = sitofp i64 %long to double
144*9880d681SAndroid Build Coastguard Worker  %fix8 = fdiv double %cvt8, 18446744073709551616.0
145*9880d681SAndroid Build Coastguard Worker; CHECK: scvtf {{d[0-9]+}}, {{x[0-9]+}}, #64
146*9880d681SAndroid Build Coastguard Worker  store volatile double %fix8, double* @vardouble
147*9880d681SAndroid Build Coastguard Worker
148*9880d681SAndroid Build Coastguard Worker  ret void
149*9880d681SAndroid Build Coastguard Worker}
150*9880d681SAndroid Build Coastguard Worker
151*9880d681SAndroid Build Coastguard Workerdefine void @test_ucvtf(i32 %int, i64 %long) {
152*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_ucvtf:
153*9880d681SAndroid Build Coastguard Worker
154*9880d681SAndroid Build Coastguard Worker  %cvt1 = uitofp i32 %int to float
155*9880d681SAndroid Build Coastguard Worker  %fix1 = fdiv float %cvt1, 128.0
156*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{s[0-9]+}}, {{w[0-9]+}}, #7
157*9880d681SAndroid Build Coastguard Worker  store volatile float %fix1, float* @varfloat
158*9880d681SAndroid Build Coastguard Worker
159*9880d681SAndroid Build Coastguard Worker  %cvt2 = uitofp i32 %int to float
160*9880d681SAndroid Build Coastguard Worker  %fix2 = fdiv float %cvt2, 4294967296.0
161*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{s[0-9]+}}, {{w[0-9]+}}, #32
162*9880d681SAndroid Build Coastguard Worker  store volatile float %fix2, float* @varfloat
163*9880d681SAndroid Build Coastguard Worker
164*9880d681SAndroid Build Coastguard Worker  %cvt3 = uitofp i64 %long to float
165*9880d681SAndroid Build Coastguard Worker  %fix3 = fdiv float %cvt3, 128.0
166*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{s[0-9]+}}, {{x[0-9]+}}, #7
167*9880d681SAndroid Build Coastguard Worker  store volatile float %fix3, float* @varfloat
168*9880d681SAndroid Build Coastguard Worker
169*9880d681SAndroid Build Coastguard Worker  %cvt4 = uitofp i64 %long to float
170*9880d681SAndroid Build Coastguard Worker  %fix4 = fdiv float %cvt4, 18446744073709551616.0
171*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{s[0-9]+}}, {{x[0-9]+}}, #64
172*9880d681SAndroid Build Coastguard Worker  store volatile float %fix4, float* @varfloat
173*9880d681SAndroid Build Coastguard Worker
174*9880d681SAndroid Build Coastguard Worker  %cvt5 = uitofp i32 %int to double
175*9880d681SAndroid Build Coastguard Worker  %fix5 = fdiv double %cvt5, 128.0
176*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{d[0-9]+}}, {{w[0-9]+}}, #7
177*9880d681SAndroid Build Coastguard Worker  store volatile double %fix5, double* @vardouble
178*9880d681SAndroid Build Coastguard Worker
179*9880d681SAndroid Build Coastguard Worker  %cvt6 = uitofp i32 %int to double
180*9880d681SAndroid Build Coastguard Worker  %fix6 = fdiv double %cvt6, 4294967296.0
181*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{d[0-9]+}}, {{w[0-9]+}}, #32
182*9880d681SAndroid Build Coastguard Worker  store volatile double %fix6, double* @vardouble
183*9880d681SAndroid Build Coastguard Worker
184*9880d681SAndroid Build Coastguard Worker  %cvt7 = uitofp i64 %long to double
185*9880d681SAndroid Build Coastguard Worker  %fix7 = fdiv double %cvt7, 128.0
186*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{d[0-9]+}}, {{x[0-9]+}}, #7
187*9880d681SAndroid Build Coastguard Worker  store volatile double %fix7, double* @vardouble
188*9880d681SAndroid Build Coastguard Worker
189*9880d681SAndroid Build Coastguard Worker  %cvt8 = uitofp i64 %long to double
190*9880d681SAndroid Build Coastguard Worker  %fix8 = fdiv double %cvt8, 18446744073709551616.0
191*9880d681SAndroid Build Coastguard Worker; CHECK: ucvtf {{d[0-9]+}}, {{x[0-9]+}}, #64
192*9880d681SAndroid Build Coastguard Worker  store volatile double %fix8, double* @vardouble
193*9880d681SAndroid Build Coastguard Worker
194*9880d681SAndroid Build Coastguard Worker  ret void
195*9880d681SAndroid Build Coastguard Worker}
196