blob: 7ac8e048edbc46f31894474ba401097699203bca [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
Dale Johannesenfe5293d2007-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
Chris Lattner597f22f2005-04-02 05:35:00 +00007
Dale Johannesenfe5293d2007-09-26 21:12:10 +00008declare float @fabsf(float)
Evan Chengbb0a23a2006-08-29 22:01:39 +00009
Dale Johannesenfe5293d2007-09-26 21:12:10 +000010declare x86_fp80 @fabsl(x86_fp80)
Chris Lattner597f22f2005-04-02 05:35:00 +000011
Dale Johannesenfe5293d2007-09-26 21:12:10 +000012define float @test1(float %X) {
13 %Y = call float @fabsf(float %X)
Chris Lattner597f22f2005-04-02 05:35:00 +000014 ret float %Y
15}
16
Dale Johannesenfe5293d2007-09-26 21:12:10 +000017define double @test2(double %X) {
18 %Y = fcmp oge double %X, -0.0
Dan Gohmanae3a0be2009-06-04 22:49:04 +000019 %Z = fsub double -0.0, %X
Dale Johannesenfe5293d2007-09-26 21:12:10 +000020 %Q = select i1 %Y, double %X, double %Z
Chris Lattner2e6027c2005-04-09 04:55:14 +000021 ret double %Q
22}
23
Dale Johannesenfe5293d2007-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