zpu: managed to compile program that writes constant to global variable
[llvm/zpu.git] / test / CodeGen / X86 / fabs.ll
blob9ded7e05dc4654cb3ff90515e958380634686b85
1 ; Make sure this testcase codegens to the fabs instruction, not a call to fabsf
2 ; RUN: llc < %s -march=x86 -mattr=-sse2,-sse3,-sse | grep fabs\$ | \
3 ; RUN:   count 2
4 ; RUN: llc < %s -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math -enable-no-nans-fp-math | \
5 ; RUN:   grep fabs\$ | count 3
7 declare float @fabsf(float)
9 declare x86_fp80 @fabsl(x86_fp80)
11 define float @test1(float %X) {
12         %Y = call float @fabsf(float %X)
13         ret float %Y
16 define double @test2(double %X) {
17         %Y = fcmp oge double %X, -0.0
18         %Z = fsub double -0.0, %X
19         %Q = select i1 %Y, double %X, double %Z
20         ret double %Q
23 define x86_fp80 @test3(x86_fp80 %X) {
24         %Y = call x86_fp80 @fabsl(x86_fp80 %X)
25         ret x86_fp80 %Y