1
1
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2
2
; RUN: llc < %s -mtriple=sparc | FileCheck %s
3
3
; RUN: llc < %s -mtriple=sparcel | FileCheck %s --check-prefix=CHECK-LE
4
+ ; RUN: llc < %s -mtriple=sparcv9 -mattr=+vis | FileCheck %s --check-prefix=CHECK-VIS
4
5
5
6
;; Bitcast should not do a runtime conversion, but rather emit a
6
7
;; constant into integer registers directly.
@@ -17,6 +18,12 @@ define <2 x i32> @bitcast() nounwind {
17
18
; CHECK-LE-NEXT: sethi 1049856, %o1
18
19
; CHECK-LE-NEXT: retl
19
20
; CHECK-LE-NEXT: mov %g0, %o0
21
+ ;
22
+ ; CHECK-VIS-LABEL: bitcast:
23
+ ; CHECK-VIS: ! %bb.0:
24
+ ; CHECK-VIS-NEXT: sethi 1049856, %o0
25
+ ; CHECK-VIS-NEXT: retl
26
+ ; CHECK-VIS-NEXT: mov %g0, %o1
20
27
%1 = bitcast double 5 .0 to <2 x i32 >
21
28
ret <2 x i32 > %1
22
29
}
@@ -43,6 +50,17 @@ define void @test_call() nounwind {
43
50
; CHECK-LE-NEXT: mov %g0, %o0
44
51
; CHECK-LE-NEXT: ret
45
52
; CHECK-LE-NEXT: restore
53
+ ;
54
+ ; CHECK-VIS-LABEL: test_call:
55
+ ; CHECK-VIS: ! %bb.0:
56
+ ; CHECK-VIS-NEXT: save %sp, -176, %sp
57
+ ; CHECK-VIS-NEXT: sethi %h44(.LCPI1_0), %i0
58
+ ; CHECK-VIS-NEXT: add %i0, %m44(.LCPI1_0), %i0
59
+ ; CHECK-VIS-NEXT: sllx %i0, 12, %i0
60
+ ; CHECK-VIS-NEXT: call a
61
+ ; CHECK-VIS-NEXT: ldd [%i0+%l44(.LCPI1_0)], %f0
62
+ ; CHECK-VIS-NEXT: ret
63
+ ; CHECK-VIS-NEXT: restore
46
64
call void @a (double 5 .0 )
47
65
ret void
48
66
}
@@ -75,6 +93,103 @@ define double @test_intrins_call() nounwind {
75
93
; CHECK-LE-NEXT: mov %o1, %o3
76
94
; CHECK-LE-NEXT: ret
77
95
; CHECK-LE-NEXT: restore
96
+ ;
97
+ ; CHECK-VIS-LABEL: test_intrins_call:
98
+ ; CHECK-VIS: ! %bb.0:
99
+ ; CHECK-VIS-NEXT: save %sp, -176, %sp
100
+ ; CHECK-VIS-NEXT: sethi %h44(.LCPI2_0), %i0
101
+ ; CHECK-VIS-NEXT: add %i0, %m44(.LCPI2_0), %i0
102
+ ; CHECK-VIS-NEXT: sllx %i0, 12, %i0
103
+ ; CHECK-VIS-NEXT: ldd [%i0+%l44(.LCPI2_0)], %f0
104
+ ; CHECK-VIS-NEXT: fmovd %f0, %f2
105
+ ; CHECK-VIS-NEXT: call pow
106
+ ; CHECK-VIS-NEXT: nop
107
+ ; CHECK-VIS-NEXT: ret
108
+ ; CHECK-VIS-NEXT: restore
78
109
%1 = call double @llvm.pow.f64 (double 2 .0 , double 2 .0 )
79
110
ret double %1
80
111
}
112
+
113
+ ;; When we have VIS, f32/f64 zero constant should be materialized from fzero/fzeros.
114
+
115
+ define double @pos_zero_double () nounwind {
116
+ ; CHECK-LABEL: pos_zero_double:
117
+ ; CHECK: ! %bb.0:
118
+ ; CHECK-NEXT: sethi %hi(.LCPI3_0), %o0
119
+ ; CHECK-NEXT: retl
120
+ ; CHECK-NEXT: ldd [%o0+%lo(.LCPI3_0)], %f0
121
+ ;
122
+ ; CHECK-LE-LABEL: pos_zero_double:
123
+ ; CHECK-LE: ! %bb.0:
124
+ ; CHECK-LE-NEXT: sethi %hi(.LCPI3_0), %o0
125
+ ; CHECK-LE-NEXT: retl
126
+ ; CHECK-LE-NEXT: ldd [%o0+%lo(.LCPI3_0)], %f0
127
+ ;
128
+ ; CHECK-VIS-LABEL: pos_zero_double:
129
+ ; CHECK-VIS: ! %bb.0:
130
+ ; CHECK-VIS-NEXT: retl
131
+ ; CHECK-VIS-NEXT: fzero %f0
132
+ ret double +0 .0
133
+ }
134
+
135
+ define double @neg_zero_double () nounwind {
136
+ ; CHECK-LABEL: neg_zero_double:
137
+ ; CHECK: ! %bb.0:
138
+ ; CHECK-NEXT: sethi %hi(.LCPI4_0), %o0
139
+ ; CHECK-NEXT: retl
140
+ ; CHECK-NEXT: ldd [%o0+%lo(.LCPI4_0)], %f0
141
+ ;
142
+ ; CHECK-LE-LABEL: neg_zero_double:
143
+ ; CHECK-LE: ! %bb.0:
144
+ ; CHECK-LE-NEXT: sethi %hi(.LCPI4_0), %o0
145
+ ; CHECK-LE-NEXT: retl
146
+ ; CHECK-LE-NEXT: ldd [%o0+%lo(.LCPI4_0)], %f0
147
+ ;
148
+ ; CHECK-VIS-LABEL: neg_zero_double:
149
+ ; CHECK-VIS: ! %bb.0:
150
+ ; CHECK-VIS-NEXT: fzero %f0
151
+ ; CHECK-VIS-NEXT: retl
152
+ ; CHECK-VIS-NEXT: fnegd %f0, %f0
153
+ ret double -0 .0
154
+ }
155
+
156
+ define float @pos_zero_float () nounwind {
157
+ ; CHECK-LABEL: pos_zero_float:
158
+ ; CHECK: ! %bb.0:
159
+ ; CHECK-NEXT: sethi %hi(.LCPI5_0), %o0
160
+ ; CHECK-NEXT: retl
161
+ ; CHECK-NEXT: ld [%o0+%lo(.LCPI5_0)], %f0
162
+ ;
163
+ ; CHECK-LE-LABEL: pos_zero_float:
164
+ ; CHECK-LE: ! %bb.0:
165
+ ; CHECK-LE-NEXT: sethi %hi(.LCPI5_0), %o0
166
+ ; CHECK-LE-NEXT: retl
167
+ ; CHECK-LE-NEXT: ld [%o0+%lo(.LCPI5_0)], %f0
168
+ ;
169
+ ; CHECK-VIS-LABEL: pos_zero_float:
170
+ ; CHECK-VIS: ! %bb.0:
171
+ ; CHECK-VIS-NEXT: retl
172
+ ; CHECK-VIS-NEXT: fzeros %f0
173
+ ret float +0 .0
174
+ }
175
+
176
+ define float @neg_zero_float () nounwind {
177
+ ; CHECK-LABEL: neg_zero_float:
178
+ ; CHECK: ! %bb.0:
179
+ ; CHECK-NEXT: sethi %hi(.LCPI6_0), %o0
180
+ ; CHECK-NEXT: retl
181
+ ; CHECK-NEXT: ld [%o0+%lo(.LCPI6_0)], %f0
182
+ ;
183
+ ; CHECK-LE-LABEL: neg_zero_float:
184
+ ; CHECK-LE: ! %bb.0:
185
+ ; CHECK-LE-NEXT: sethi %hi(.LCPI6_0), %o0
186
+ ; CHECK-LE-NEXT: retl
187
+ ; CHECK-LE-NEXT: ld [%o0+%lo(.LCPI6_0)], %f0
188
+ ;
189
+ ; CHECK-VIS-LABEL: neg_zero_float:
190
+ ; CHECK-VIS: ! %bb.0:
191
+ ; CHECK-VIS-NEXT: fzeros %f0
192
+ ; CHECK-VIS-NEXT: retl
193
+ ; CHECK-VIS-NEXT: fnegs %f0, %f0
194
+ ret float -0 .0
195
+ }
0 commit comments