blob: 9ded7e05dc4654cb3ff90515e958380634686b85 [file] [log] [blame]
Chris Lattner597f22f2005-04-02 05:35:00 +00001; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
Dan Gohman36a09472009-09-08 23:54:48 +00002; RUN: llc < %s -march=x86 -mattr=-sse2,-sse3,-sse | grep fabs\$ | \
Dale Johannesenfe5293d2007-09-26 21:12:10 +00003; RUN: count 2
Evan Cheng60108e92010-07-15 22:07:12 +00004; RUN: llc < %s -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math -enable-no-nans-fp-math | \
Dale Johannesenfe5293d2007-09-26 21:12:10 +00005; RUN: grep fabs\$ | count 3
Chris Lattner597f22f2005-04-02 05:35:00 +00006
Dale Johannesenfe5293d2007-09-26 21:12:10 +00007declare float @fabsf(float)
Evan Chengbb0a23a2006-08-29 22:01:39 +00008
Dale Johannesenfe5293d2007-09-26 21:12:10 +00009declare x86_fp80 @fabsl(x86_fp80)
Chris Lattner597f22f2005-04-02 05:35:00 +000010
Dale Johannesenfe5293d2007-09-26 21:12:10 +000011define float @test1(float %X) {
12 %Y = call float @fabsf(float %X)
Chris Lattner597f22f2005-04-02 05:35:00 +000013 ret float %Y
14}
15
Dale Johannesenfe5293d2007-09-26 21:12:10 +000016define double @test2(double %X) {
17 %Y = fcmp oge double %X, -0.0
Dan Gohmanae3a0be2009-06-04 22:49:04 +000018 %Z = fsub double -0.0, %X
Dale Johannesenfe5293d2007-09-26 21:12:10 +000019 %Q = select i1 %Y, double %X, double %Z
Chris Lattner2e6027c2005-04-09 04:55:14 +000020 ret double %Q
21}
22
Dale Johannesenfe5293d2007-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