• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-sse,-sse2,-sse3                                                | FileCheck %s --check-prefix=X87
3; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s --check-prefix=X87UNSAFE
4; RUN: llc < %s -mtriple=x86_64-unknown-unknown                                                                      | FileCheck %s --check-prefix=X64
5
6declare float @fabsf(float)
7declare x86_fp80 @fabsl(x86_fp80)
8
9define float @test1(float %X) {
10; X87-LABEL: test1:
11; X87:       # %bb.0:
12; X87-NEXT:    flds {{[0-9]+}}(%esp)
13; X87-NEXT:    fabs
14; X87-NEXT:    retl
15;
16; X87UNSAFE-LABEL: test1:
17; X87UNSAFE:       # %bb.0:
18; X87UNSAFE-NEXT:    flds {{[0-9]+}}(%esp)
19; X87UNSAFE-NEXT:    fabs
20; X87UNSAFE-NEXT:    retl
21;
22; X64-LABEL: test1:
23; X64:       # %bb.0:
24; X64-NEXT:    andps {{.*}}(%rip), %xmm0
25; X64-NEXT:    retq
26  %Y = call float @fabsf(float %X) readnone
27  ret float %Y
28}
29
30define x86_fp80 @test2(x86_fp80 %X) {
31; X87-LABEL: test2:
32; X87:       # %bb.0:
33; X87-NEXT:    fldt {{[0-9]+}}(%esp)
34; X87-NEXT:    fabs
35; X87-NEXT:    retl
36;
37; X87UNSAFE-LABEL: test2:
38; X87UNSAFE:       # %bb.0:
39; X87UNSAFE-NEXT:    fldt {{[0-9]+}}(%esp)
40; X87UNSAFE-NEXT:    fabs
41; X87UNSAFE-NEXT:    retl
42;
43; X64-LABEL: test2:
44; X64:       # %bb.0:
45; X64-NEXT:    fldt {{[0-9]+}}(%rsp)
46; X64-NEXT:    fabs
47; X64-NEXT:    retq
48  %Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone
49  ret x86_fp80 %Y
50}
51
52