2005-04-02 05:35:00 +00:00
|
|
|
; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
|
2012-08-08 20:31:37 +00:00
|
|
|
; RUN: llc < %s -mtriple=i686-apple-macosx -mattr=-sse2,-sse3,-sse | FileCheck %s
|
|
|
|
; 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
|
|
|
|
; RUN: llc < %s -mtriple=x86_64-apple-macosx -O0 | FileCheck %s --check-prefix=NOOPT
|
2005-04-02 05:35:00 +00:00
|
|
|
|
2007-09-26 21:12:10 +00:00
|
|
|
declare float @fabsf(float)
|
2006-08-29 22:01:39 +00:00
|
|
|
|
2007-09-26 21:12:10 +00:00
|
|
|
declare x86_fp80 @fabsl(x86_fp80)
|
2005-04-02 05:35:00 +00:00
|
|
|
|
2012-07-03 03:59:15 +00:00
|
|
|
; CHECK: test1:
|
|
|
|
; UNSAFE: test1:
|
2012-08-03 04:06:28 +00:00
|
|
|
; NOOPT: test1:
|
2007-09-26 21:12:10 +00:00
|
|
|
define float @test1(float %X) {
|
2012-08-03 23:29:17 +00:00
|
|
|
%Y = call float @fabsf(float %X) readnone
|
2005-04-02 05:35:00 +00:00
|
|
|
ret float %Y
|
|
|
|
}
|
2012-07-03 03:59:15 +00:00
|
|
|
; CHECK: {{^[ \t]+fabs$}}
|
|
|
|
; UNSAFE: {{^[ \t]+fabs$}}
|
2005-04-02 05:35:00 +00:00
|
|
|
|
2012-07-03 03:59:15 +00:00
|
|
|
; CHECK-NOT: fabs
|
|
|
|
; UNSAFE-NOT: fabs
|
2012-08-03 04:06:28 +00:00
|
|
|
; NOOPT-NOT: fabsf
|
2012-07-03 03:59:15 +00:00
|
|
|
|
|
|
|
; CHECK: test2:
|
|
|
|
; UNSAFE: test2:
|
2012-08-03 04:06:28 +00:00
|
|
|
; NOOPT: test2:
|
2007-09-26 21:12:10 +00:00
|
|
|
define double @test2(double %X) {
|
|
|
|
%Y = fcmp oge double %X, -0.0
|
2009-06-04 22:49:04 +00:00
|
|
|
%Z = fsub double -0.0, %X
|
2007-09-26 21:12:10 +00:00
|
|
|
%Q = select i1 %Y, double %X, double %Z
|
2005-04-09 04:55:14 +00:00
|
|
|
ret double %Q
|
|
|
|
}
|
2012-07-03 03:59:15 +00:00
|
|
|
; fabs is not used here.
|
|
|
|
; CHECK-NOT: fabs
|
2012-08-03 04:06:28 +00:00
|
|
|
; NOOPT-NOT: fabs
|
2012-07-03 03:59:15 +00:00
|
|
|
|
|
|
|
; UNSAFE: {{^[ \t]+fabs$}}
|
2005-04-09 04:55:14 +00:00
|
|
|
|
2012-07-03 03:59:15 +00:00
|
|
|
; UNSAFE-NOT: fabs
|
|
|
|
|
|
|
|
; CHECK: test3:
|
|
|
|
; UNSAFE: test3:
|
2012-08-03 04:06:28 +00:00
|
|
|
; NOOPT: test3:
|
2007-09-26 21:12:10 +00:00
|
|
|
define x86_fp80 @test3(x86_fp80 %X) {
|
2012-08-03 23:29:17 +00:00
|
|
|
%Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone
|
2007-09-26 21:12:10 +00:00
|
|
|
ret x86_fp80 %Y
|
|
|
|
}
|
2012-07-03 03:59:15 +00:00
|
|
|
; CHECK: {{^[ \t]+fabs$}}
|
|
|
|
; UNSAFE: {{^[ \t]+fabs$}}
|
2012-08-03 04:06:28 +00:00
|
|
|
; NOOPT: {{^[ \t]+fabs$}}
|
2007-09-26 21:12:10 +00:00
|
|
|
|
2012-07-03 03:59:15 +00:00
|
|
|
; CHECK-NOT: fabs
|
|
|
|
; UNSAFE-NOT: fabs
|
2012-08-03 04:06:28 +00:00
|
|
|
; NOOPT-NOT: fabs
|