diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2011-01-11 01:07:24 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2011-01-11 01:07:24 +0000 |
| commit | b1e7f557b7a18e2fe31623077aa88429a60f5746 (patch) | |
| tree | 5b97e9159bb1658fba6e7f4251caeb6eaafa24f5 /llvm/test | |
| parent | fdf4969149e445003724d0fc16b366d245572fcd (diff) | |
| download | bcm5719-llvm-b1e7f557b7a18e2fe31623077aa88429a60f5746.tar.gz bcm5719-llvm-b1e7f557b7a18e2fe31623077aa88429a60f5746.zip | |
Teach constant folding to perform conversions from constant floating
point values to their integer representation through the SSE intrinsic
calls. This is the last part of a README.txt entry for which I have real
world examples.
llvm-svn: 123206
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Transforms/ConstProp/calls.ll | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ConstProp/calls.ll b/llvm/test/Transforms/ConstProp/calls.ll index a12fc82d646..82d73245ad1 100644 --- a/llvm/test/Transforms/ConstProp/calls.ll +++ b/llvm/test/Transforms/ConstProp/calls.ll @@ -21,3 +21,36 @@ define double @T() { %c = fadd double %b, %D ret double %c } + +define i1 @test_sse_cvt() nounwind readnone { +; CHECK: @test_sse_cvt +; CHECK-NOT: call +; CHECK: ret i1 true +entry: + %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind + %i1 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind + %i2 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind + %i3 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind + %i4 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> <double 1.75, double undef>) nounwind + %i5 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> <double 1.75, double undef>) nounwind + %i6 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> <double 1.75, double undef>) nounwind + %i7 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> <double 1.75, double undef>) nounwind + %sum11 = add i32 %i0, %i1 + %sum12 = add i32 %i4, %i5 + %sum1 = add i32 %sum11, %sum12 + %sum21 = add i64 %i2, %i3 + %sum22 = add i64 %i6, %i7 + %sum2 = add i64 %sum21, %sum22 + %sum1.sext = sext i32 %sum1 to i64 + %b = icmp eq i64 %sum1.sext, %sum2 + ret i1 %b +} + +declare i32 @llvm.x86.sse.cvtss2si(<4 x float>) nounwind readnone +declare i32 @llvm.x86.sse.cvttss2si(<4 x float>) nounwind readnone +declare i64 @llvm.x86.sse.cvtss2si64(<4 x float>) nounwind readnone +declare i64 @llvm.x86.sse.cvttss2si64(<4 x float>) nounwind readnone +declare i32 @llvm.x86.sse2.cvtsd2si(<2 x double>) nounwind readnone +declare i32 @llvm.x86.sse2.cvttsd2si(<2 x double>) nounwind readnone +declare i64 @llvm.x86.sse2.cvtsd2si64(<2 x double>) nounwind readnone +declare i64 @llvm.x86.sse2.cvttsd2si64(<2 x double>) nounwind readnone |

