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 5 6 declare float @fabsf(float) 7 8 declare x86_fp80 @fabsl(x86_fp80) 9 10 ; CHECK-LABEL: test1: 11 ; UNSAFE-LABEL: test1: 12 ; NOOPT-LABEL: test1: 13 define float @test1(float %X) { 14 %Y = call float @fabsf(float %X) readnone 15 ret float %Y 16 } 17 ; CHECK: {{^[ \t]+fabs$}} 18 ; UNSAFE: {{^[ \t]+fabs$}} 19 20 ; CHECK-NOT: fabs 21 ; UNSAFE-NOT: fabs 22 ; NOOPT-NOT: fabsf 23 24 ; CHECK-LABEL: test2: 25 ; UNSAFE-LABEL: test2: 26 ; NOOPT-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 31 ret double %Q 32 } 33 ; fabs is not used here. 34 ; CHECK-NOT: fabs 35 ; NOOPT-NOT: fabs 36 37 ; UNSAFE: {{^[ \t]+fabs$}} 38 39 ; UNSAFE-NOT: fabs 40 41 ; CHECK-LABEL: test3: 42 ; UNSAFE-LABEL: test3: 43 ; NOOPT-LABEL: test3: 44 define x86_fp80 @test3(x86_fp80 %X) { 45 %Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone 46 ret x86_fp80 %Y 47 } 48 ; CHECK: {{^[ \t]+fabs$}} 49 ; UNSAFE: {{^[ \t]+fabs$}} 50 ; NOOPT: {{^[ \t]+fabs$}} 51 52 ; CHECK-NOT: fabs 53 ; UNSAFE-NOT: fabs 54 ; NOOPT-NOT: fabs 55