2005-04-02 13:35:00 +08:00
|
|
|
; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
|
2012-08-09 04:31:37 +08: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 13:35:00 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
declare float @fabsf(float)
|
2006-08-30 06:01:39 +08:00
|
|
|
|
2007-09-27 05:12:10 +08:00
|
|
|
declare x86_fp80 @fabsl(x86_fp80)
|
2005-04-02 13:35:00 +08:00
|
|
|
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test1:
|
|
|
|
; UNSAFE-LABEL: test1:
|
|
|
|
; NOOPT-LABEL: test1:
|
2007-09-27 05:12:10 +08:00
|
|
|
define float @test1(float %X) {
|
2012-08-04 07:29:17 +08:00
|
|
|
%Y = call float @fabsf(float %X) readnone
|
2005-04-02 13:35:00 +08:00
|
|
|
ret float %Y
|
|
|
|
}
|
2012-07-03 11:59:15 +08:00
|
|
|
; CHECK: {{^[ \t]+fabs$}}
|
|
|
|
; UNSAFE: {{^[ \t]+fabs$}}
|
2005-04-02 13:35:00 +08:00
|
|
|
|
2012-07-03 11:59:15 +08:00
|
|
|
; CHECK-NOT: fabs
|
|
|
|
; UNSAFE-NOT: fabs
|
2012-08-03 12:06:28 +08:00
|
|
|
; NOOPT-NOT: fabsf
|
2012-07-03 11:59:15 +08:00
|
|
|
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test2:
|
|
|
|
; UNSAFE-LABEL: test2:
|
|
|
|
; NOOPT-LABEL: test2:
|
2007-09-27 05:12:10 +08:00
|
|
|
define double @test2(double %X) {
|
|
|
|
%Y = fcmp oge double %X, -0.0
|
2009-06-05 06:49:04 +08:00
|
|
|
%Z = fsub double -0.0, %X
|
2007-09-27 05:12:10 +08:00
|
|
|
%Q = select i1 %Y, double %X, double %Z
|
2005-04-09 12:55:14 +08:00
|
|
|
ret double %Q
|
|
|
|
}
|
2012-07-03 11:59:15 +08:00
|
|
|
; fabs is not used here.
|
|
|
|
; CHECK-NOT: fabs
|
2012-08-03 12:06:28 +08:00
|
|
|
; NOOPT-NOT: fabs
|
2012-07-03 11:59:15 +08:00
|
|
|
|
|
|
|
; UNSAFE: {{^[ \t]+fabs$}}
|
2005-04-09 12:55:14 +08:00
|
|
|
|
2012-07-03 11:59:15 +08:00
|
|
|
; UNSAFE-NOT: fabs
|
|
|
|
|
2013-07-14 04:38:47 +08:00
|
|
|
; CHECK-LABEL: test3:
|
|
|
|
; UNSAFE-LABEL: test3:
|
|
|
|
; NOOPT-LABEL: test3:
|
2007-09-27 05:12:10 +08:00
|
|
|
define x86_fp80 @test3(x86_fp80 %X) {
|
2012-08-04 07:29:17 +08:00
|
|
|
%Y = call x86_fp80 @fabsl(x86_fp80 %X) readnone
|
2007-09-27 05:12:10 +08:00
|
|
|
ret x86_fp80 %Y
|
|
|
|
}
|
2012-07-03 11:59:15 +08:00
|
|
|
; CHECK: {{^[ \t]+fabs$}}
|
|
|
|
; UNSAFE: {{^[ \t]+fabs$}}
|
2012-08-03 12:06:28 +08:00
|
|
|
; NOOPT: {{^[ \t]+fabs$}}
|
2007-09-27 05:12:10 +08:00
|
|
|
|
2012-07-03 11:59:15 +08:00
|
|
|
; CHECK-NOT: fabs
|
|
|
|
; UNSAFE-NOT: fabs
|
2012-08-03 12:06:28 +08:00
|
|
|
; NOOPT-NOT: fabs
|