blob: dd94613e7cb6026d2d72de82dcb2a1feb6637c89 [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
2; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=-sse2,-sse3 | \
3; RUN: grep fabs\$ | wc -l | grep 1
4; RUN: llvm-upgrade < %s | llvm-as | \
5; RUN: llc -march=x86 -mattr=-sse2,-sse3 -enable-unsafe-fp-math | \
6; RUN: grep fabs\$ | wc -l | grep 2
7
8target endian = little
9target pointersize = 32
10
11declare float %fabsf(float)
12
13float %test1(float %X) {
14 %Y = call float %fabsf(float %X)
15 ret float %Y
16}
17
18double %test2(double %X) {
19 %Y = setge double %X, -0.0
20 %Z = sub double -0.0, %X
21 %Q = select bool %Y, double %X, double %Z
22 ret double %Q
23}
24