11//@ assembly-output: emit-asm
2- //@ only-x86
32// FIXME(#114479): LLVM miscompiles loading and storing `f32` and `f64` when SSE is disabled.
43// There's no compiletest directive to ignore a test on i586 only, so just always explicitly enable
54// SSE2.
65// Use the same target CPU as `i686` so that LLVM orders the instructions in the same order.
76//@ compile-flags: -Ctarget-feature=+sse2 -Ctarget-cpu=pentium4
87// Force frame pointers to make ASM more consistent between targets
9- //@ compile-flags: -O -C force-frame-pointers
8+ //@ compile-flags: -C force-frame-pointers
9+ // At opt-level=3, LLVM can merge two movss into one movsd, and we aren't testing for that.
10+ //@ compile-flags: -Copt-level=2
1011//@ filecheck-flags: --implicit-check-not fld --implicit-check-not fst
11- //@ revisions: normal win
12- //@[normal] ignore-windows
13- //@[win] only-windows
12+ //@ revisions: linux win
13+ //@ add-core-stubs
14+ //@[linux] needs-llvm-components: x86
15+ //@[win] needs-llvm-components: x86
16+ //@[linux] compile-flags: --target i686-unknown-linux-gnu
17+ //@[win] compile-flags: --target i686-pc-windows-msvc
1418
1519#![ crate_type = "lib" ]
1620#![ feature( f16, f128) ]
21+ #![ feature( no_core) ]
22+ #![ no_core]
23+
24+ extern crate minicore;
25+ use minicore:: * ;
1726
1827// Tests that returning `f32` and `f64` with the "Rust" ABI on 32-bit x86 doesn't use the x87
1928// floating point stack, as loading and storing `f32`s and `f64`s to and from the x87 stack quietens
@@ -190,8 +199,8 @@ pub unsafe fn call_f64_f64(x: &mut (f64, f64)) {
190199 }
191200 // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
192201 // CHECK: calll {{()|_}}get_f64_f64
193- // normal : movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
194- // normal -NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
202+ // linux : movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
203+ // linux -NEXT: movsd [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
195204 // win: movsd (%esp), %[[VAL1:.*]]
196205 // win-NEXT: movsd 8(%esp), %[[VAL2:.*]]
197206 // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]])
@@ -207,12 +216,12 @@ pub unsafe fn call_f32_f64(x: &mut (f32, f64)) {
207216 }
208217 // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
209218 // CHECK: calll {{()|_}}get_f32_f64
210- // normal : movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
211- // normal -NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
219+ // linux : movss [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
220+ // linux -NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
212221 // win: movss (%esp), %[[VAL1:.*]]
213222 // win-NEXT: movsd 8(%esp), %[[VAL2:.*]]
214223 // CHECK-NEXT: movss %[[VAL1]], (%[[PTR]])
215- // normal -NEXT: movsd %[[VAL2]], 4(%[[PTR]])
224+ // linux -NEXT: movsd %[[VAL2]], 4(%[[PTR]])
216225 // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]])
217226 * x = get_f32_f64 ( ) ;
218227}
@@ -225,8 +234,8 @@ pub unsafe fn call_f64_f32(x: &mut (f64, f32)) {
225234 }
226235 // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
227236 // CHECK: calll {{()|_}}get_f64_f32
228- // normal : movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
229- // normal -NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
237+ // linux : movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
238+ // linux -NEXT: movss [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
230239 // win: movsd (%esp), %[[VAL1:.*]]
231240 // win-NEXT: movss 8(%esp), %[[VAL2:.*]]
232241 // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]])
@@ -257,8 +266,8 @@ pub unsafe fn call_f64_other(x: &mut (f64, usize)) {
257266 }
258267 // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
259268 // CHECK: calll {{()|_}}get_f64_other
260- // normal : movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
261- // normal -NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
269+ // linux : movsd [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
270+ // linux -NEXT: movl [[#%d,OFFSET+8]](%ebp), %[[VAL2:.*]]
262271 // win: movsd (%esp), %[[VAL1:.*]]
263272 // win-NEXT: movl 8(%esp), %[[VAL2:.*]]
264273 // CHECK-NEXT: movsd %[[VAL1]], (%[[PTR]])
@@ -289,12 +298,12 @@ pub unsafe fn call_other_f64(x: &mut (usize, f64)) {
289298 }
290299 // CHECK: movl {{.*}}(%ebp), %[[PTR:.*]]
291300 // CHECK: calll {{()|_}}get_other_f64
292- // normal : movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
293- // normal -NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
301+ // linux : movl [[#%d,OFFSET:]](%ebp), %[[VAL1:.*]]
302+ // linux -NEXT: movsd [[#%d,OFFSET+4]](%ebp), %[[VAL2:.*]]
294303 // win: movl (%esp), %[[VAL1:.*]]
295304 // win-NEXT: movsd 8(%esp), %[[VAL2:.*]]
296305 // CHECK-NEXT: movl %[[VAL1]], (%[[PTR]])
297- // normal -NEXT: movsd %[[VAL2]], 4(%[[PTR]])
306+ // linux -NEXT: movsd %[[VAL2]], 4(%[[PTR]])
298307 // win-NEXT: movsd %[[VAL2]], 8(%[[PTR]])
299308 * x = get_other_f64 ( ) ;
300309}
0 commit comments