1 ; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
2 ; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse2,-sse3,-sse | FileCheck %s
3 ; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s --check-prefix=UNSAFE
4 ; RUN: llc < %s -mtriple=x86_64-apple-macosx -O0 | FileCheck %s --check-prefix=NOOPT
6 declare float @fabsf(float)
8 declare x86_fp80 @fabsl(x86_fp80)
11 ; UNSAFE-LABEL: test1:
13 define float @test1(float %X) {
14 %Y = call float @fabsf(float %X) readnone
17 ; CHECK: {{^[ \t]+fabs$}}
18 ; UNSAFE: {{^[ \t]+fabs$}}
25 ; UNSAFE-LABEL: test2:
27 define double @test2(double %X) {
28 %Y = fcmp oge double %X, -0.0
29 %Z = fsub double -0.0, %X
30 %Q = select i1 %Y, double %X, double %Z
33 ; fabs is not used here.
37 ; UNSAFE: {{^[ \t]+fabs$}}
42 ; UNSAFE-LABEL: test3:
44 define x86_fp80 @test3(x86_fp80 %X) {
45 %Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone
48 ; CHECK: {{^[ \t]+fabs$}}
49 ; UNSAFE: {{^[ \t]+fabs$}}
50 ; NOOPT: {{^[ \t]+fabs$}}