blob: 54947c394b5e86b7f3df60d43db1133cafaceb85 [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
Dan Gohman0a063102009-09-08 23:54:48 +00002; RUN: llc < %s -march=x86 -mattr=-sse2,-sse3,-sse | grep fabs\$ | \
Dale Johannesen99f8c262007-09-26 21:12:10 +00003; RUN: count 2
Dan Gohman0cb2f672009-09-11 18:36:27 +00004; RUN: llc < %s -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | \
Dale Johannesen99f8c262007-09-26 21:12:10 +00005; RUN: grep fabs\$ | count 3
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
Dale Johannesen99f8c262007-09-26 21:12:10 +00007declare float @fabsf(float)
Dan Gohmanf17a25c2007-07-18 16:29:46 +00008
Dale Johannesen99f8c262007-09-26 21:12:10 +00009declare x86_fp80 @fabsl(x86_fp80)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000010
Dale Johannesen99f8c262007-09-26 21:12:10 +000011define float @test1(float %X) {
12 %Y = call float @fabsf(float %X)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000013 ret float %Y
14}
15
Dale Johannesen99f8c262007-09-26 21:12:10 +000016define double @test2(double %X) {
17 %Y = fcmp oge double %X, -0.0
Dan Gohman7ce405e2009-06-04 22:49:04 +000018 %Z = fsub double -0.0, %X
Dale Johannesen99f8c262007-09-26 21:12:10 +000019 %Q = select i1 %Y, double %X, double %Z
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020 ret double %Q
21}
22
Dale Johannesen99f8c262007-09-26 21:12:10 +000023define x86_fp80 @test3(x86_fp80 %X) {
24 %Y = call x86_fp80 @fabsl(x86_fp80 %X)
25 ret x86_fp80 %Y
26}
27
28