fix rdar://9289583 - fast isel should handle non-canonical commutative binops
[oota-llvm.git] / test / Transforms / ConstProp / calls.ll
1 ; RUN: opt < %s -constprop -S | FileCheck %s
2
3 declare double @cos(double)
4
5 declare double @sin(double)
6
7 declare double @tan(double)
8
9 declare double @sqrt(double)
10
11 define double @T() {
12 ; CHECK: @T
13 ; CHECK-NOT: call
14 ; CHECK: ret
15   %A = call double @cos(double 0.000000e+00)
16   %B = call double @sin(double 0.000000e+00)
17   %a = fadd double %A, %B
18   %C = call double @tan(double 0.000000e+00)
19   %b = fadd double %a, %C
20   %D = call double @sqrt(double 4.000000e+00)
21   %c = fadd double %b, %D
22   ret double %c
23 }
24
25 define i1 @test_sse_cvt() nounwind readnone {
26 ; CHECK: @test_sse_cvt
27 ; CHECK-NOT: call
28 ; CHECK: ret i1 true
29 entry:
30   %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
31   %i1 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
32   %i2 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
33   %i3 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind
34   %i4 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> <double 1.75, double undef>) nounwind
35   %i5 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> <double 1.75, double undef>) nounwind
36   %i6 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> <double 1.75, double undef>) nounwind
37   %i7 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> <double 1.75, double undef>) nounwind
38   %sum11 = add i32 %i0, %i1
39   %sum12 = add i32 %i4, %i5
40   %sum1 = add i32 %sum11, %sum12
41   %sum21 = add i64 %i2, %i3
42   %sum22 = add i64 %i6, %i7
43   %sum2 = add i64 %sum21, %sum22
44   %sum1.sext = sext i32 %sum1 to i64
45   %b = icmp eq i64 %sum1.sext, %sum2
46   ret i1 %b
47 }
48
49 declare i32 @llvm.x86.sse.cvtss2si(<4 x float>) nounwind readnone
50 declare i32 @llvm.x86.sse.cvttss2si(<4 x float>) nounwind readnone
51 declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>) nounwind readnone
52 declare i64 @llvm.x86.sse.cvttss2si64(<4 x float>) nounwind readnone
53 declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>) nounwind readnone
54 declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>) nounwind readnone
55 declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>) nounwind readnone
56 declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>) nounwind readnone