Chandler Carruth | f7b0047 | 2011-01-11 01:07:20 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -constprop -S | FileCheck %s |
Chris Lattner | cc713a3 | 2004-04-13 19:28:09 +0000 | [diff] [blame] | 2 | |
Tanya Lattner | ec9a35a | 2008-03-01 09:15:35 +0000 | [diff] [blame] | 3 | declare double @cos(double) |
Chris Lattner | cc713a3 | 2004-04-13 19:28:09 +0000 | [diff] [blame] | 4 | |
Tanya Lattner | ec9a35a | 2008-03-01 09:15:35 +0000 | [diff] [blame] | 5 | declare double @sin(double) |
| 6 | |
| 7 | declare double @tan(double) |
| 8 | |
| 9 | declare double @sqrt(double) |
Chris Lattner | 805fa97 | 2011-05-22 22:22:35 +0000 | [diff] [blame^] | 10 | declare double @exp2(double) |
Tanya Lattner | ec9a35a | 2008-03-01 09:15:35 +0000 | [diff] [blame] | 11 | |
Tanya Lattner | ec9a35a | 2008-03-01 09:15:35 +0000 | [diff] [blame] | 12 | define double @T() { |
Chandler Carruth | f7b0047 | 2011-01-11 01:07:20 +0000 | [diff] [blame] | 13 | ; CHECK: @T |
| 14 | ; CHECK-NOT: call |
| 15 | ; CHECK: ret |
| 16 | %A = call double @cos(double 0.000000e+00) |
| 17 | %B = call double @sin(double 0.000000e+00) |
| 18 | %a = fadd double %A, %B |
| 19 | %C = call double @tan(double 0.000000e+00) |
| 20 | %b = fadd double %a, %C |
| 21 | %D = call double @sqrt(double 4.000000e+00) |
| 22 | %c = fadd double %b, %D |
Chris Lattner | 805fa97 | 2011-05-22 22:22:35 +0000 | [diff] [blame^] | 23 | |
| 24 | ; PR9315 |
| 25 | %E = call double @exp2(double 4.0) |
| 26 | %d = fadd double %c, %E |
| 27 | ret double %d |
Chris Lattner | cc713a3 | 2004-04-13 19:28:09 +0000 | [diff] [blame] | 28 | } |
Chandler Carruth | 15ed90c | 2011-01-11 01:07:24 +0000 | [diff] [blame] | 29 | |
| 30 | define i1 @test_sse_cvt() nounwind readnone { |
| 31 | ; CHECK: @test_sse_cvt |
| 32 | ; CHECK-NOT: call |
| 33 | ; CHECK: ret i1 true |
| 34 | entry: |
| 35 | %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind |
| 36 | %i1 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind |
| 37 | %i2 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind |
| 38 | %i3 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind |
| 39 | %i4 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> <double 1.75, double undef>) nounwind |
| 40 | %i5 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> <double 1.75, double undef>) nounwind |
| 41 | %i6 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> <double 1.75, double undef>) nounwind |
| 42 | %i7 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> <double 1.75, double undef>) nounwind |
| 43 | %sum11 = add i32 %i0, %i1 |
| 44 | %sum12 = add i32 %i4, %i5 |
| 45 | %sum1 = add i32 %sum11, %sum12 |
| 46 | %sum21 = add i64 %i2, %i3 |
| 47 | %sum22 = add i64 %i6, %i7 |
| 48 | %sum2 = add i64 %sum21, %sum22 |
| 49 | %sum1.sext = sext i32 %sum1 to i64 |
| 50 | %b = icmp eq i64 %sum1.sext, %sum2 |
| 51 | ret i1 %b |
| 52 | } |
| 53 | |
| 54 | declare i32 @llvm.x86.sse.cvtss2si(<4 x float>) nounwind readnone |
| 55 | declare i32 @llvm.x86.sse.cvttss2si(<4 x float>) nounwind readnone |
| 56 | declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>) nounwind readnone |
| 57 | declare i64 @llvm.x86.sse.cvttss2si64(<4 x float>) nounwind readnone |
| 58 | declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>) nounwind readnone |
| 59 | declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>) nounwind readnone |
| 60 | declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>) nounwind readnone |
| 61 | declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>) nounwind readnone |