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