blob: 0646a7963ad30533ed6b1cfd345cb35424ee4e51 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
Dale Johannesen99f8c262007-09-26 21:12:10 +00002; RUN: llvm-as < %s | llc -march=x86 -mattr=-sse2,-sse3,-sse | grep fabs\$ | \
3; RUN: count 2
4; RUN: llvm-as < %s | \
5; RUN: llc -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | \
6; RUN: grep fabs\$ | count 3
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007
Dale Johannesen99f8c262007-09-26 21:12:10 +00008declare float @fabsf(float)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009
Dale Johannesen99f8c262007-09-26 21:12:10 +000010declare x86_fp80 @fabsl(x86_fp80)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011
Dale Johannesen99f8c262007-09-26 21:12:10 +000012define float @test1(float %X) {
13 %Y = call float @fabsf(float %X)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000014 ret float %Y
15}
16
Dale Johannesen99f8c262007-09-26 21:12:10 +000017define double @test2(double %X) {
18 %Y = fcmp oge double %X, -0.0
Dan Gohmanf17a25c2007-07-18 16:29:46 +000019 %Z = sub double -0.0, %X
Dale Johannesen99f8c262007-09-26 21:12:10 +000020 %Q = select i1 %Y, double %X, double %Z
Dan Gohmanf17a25c2007-07-18 16:29:46 +000021 ret double %Q
22}
23
Dale Johannesen99f8c262007-09-26 21:12:10 +000024define x86_fp80 @test3(x86_fp80 %X) {
25 %Y = call x86_fp80 @fabsl(x86_fp80 %X)
26 ret x86_fp80 %Y
27}
28
29