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