diff options
author | Eric Christopher <echristo@gmail.com> | 2019-04-17 02:12:23 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2019-04-17 02:12:23 +0000 |
commit | a86343512845c9c1fdbac865fea88aa5fce7142a (patch) | |
tree | 666fc6353de19ad8b00e56b67edd33f24104e4a7 /llvm/test/Transforms/ConstProp | |
parent | 7f8ca6e3679b3af951cb7a4b1377edfaa3244b93 (diff) | |
download | bcm5719-llvm-a86343512845c9c1fdbac865fea88aa5fce7142a.tar.gz bcm5719-llvm-a86343512845c9c1fdbac865fea88aa5fce7142a.zip |
Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).
This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda.
llvm-svn: 358546
Diffstat (limited to 'llvm/test/Transforms/ConstProp')
35 files changed, 0 insertions, 2580 deletions
diff --git a/llvm/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll b/llvm/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll deleted file mode 100644 index 15a62118938..00000000000 --- a/llvm/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll +++ /dev/null @@ -1,15 +0,0 @@ -; Make sure that the constant propogator doesn't divide by zero! -; -; RUN: opt < %s -constprop -; - -define i32 @test() { - %R = sdiv i32 12, 0 ; <i32> [#uses=1] - ret i32 %R -} - -define i32 @test2() { - %R = srem i32 12, 0 ; <i32> [#uses=1] - ret i32 %R -} - diff --git a/llvm/test/Transforms/ConstProp/2002-05-03-NotOperator.ll b/llvm/test/Transforms/ConstProp/2002-05-03-NotOperator.ll deleted file mode 100644 index ca1d6180c75..00000000000 --- a/llvm/test/Transforms/ConstProp/2002-05-03-NotOperator.ll +++ /dev/null @@ -1,19 +0,0 @@ -; This bug has to do with the fact that constant propagation was implemented in -; terms of _logical_ not (! in C) instead of _bitwise_ not (~ in C). This was -; due to a spec change. - -; Fix #2: The unary not instruction now no longer exists. Change to xor. - -; RUN: opt < %s -constprop -S | \ -; RUN: not grep "i32 0" - -define i32 @test1() { - %R = xor i32 123, -1 ; <i32> [#uses=1] - ret i32 %R -} - -define i32 @test2() { - %R = xor i32 -123, -1 ; <i32> [#uses=1] - ret i32 %R -} - diff --git a/llvm/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll b/llvm/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll deleted file mode 100644 index dd24d965620..00000000000 --- a/llvm/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll +++ /dev/null @@ -1,20 +0,0 @@ -; SetCC on boolean values was not implemented! - -; RUN: opt < %s -constprop -die -S | \ -; RUN: not grep set - -define i1 @test1() { - %A = icmp ule i1 true, false ; <i1> [#uses=1] - %B = icmp uge i1 true, false ; <i1> [#uses=1] - %C = icmp ult i1 false, true ; <i1> [#uses=1] - %D = icmp ugt i1 true, false ; <i1> [#uses=1] - %E = icmp eq i1 false, false ; <i1> [#uses=1] - %F = icmp ne i1 false, true ; <i1> [#uses=1] - %G = and i1 %A, %B ; <i1> [#uses=1] - %H = and i1 %C, %D ; <i1> [#uses=1] - %I = and i1 %E, %F ; <i1> [#uses=1] - %J = and i1 %G, %H ; <i1> [#uses=1] - %K = and i1 %I, %J ; <i1> [#uses=1] - ret i1 %K -} - diff --git a/llvm/test/Transforms/ConstProp/2003-05-12-DivideError.ll b/llvm/test/Transforms/ConstProp/2003-05-12-DivideError.ll deleted file mode 100644 index 2708dce9852..00000000000 --- a/llvm/test/Transforms/ConstProp/2003-05-12-DivideError.ll +++ /dev/null @@ -1,15 +0,0 @@ -; Make sure that the constant propagator doesn't cause a sigfpe -; -; RUN: opt < %s -constprop -; - -define i32 @test() { - %R = sdiv i32 -2147483648, -1 ; <i32> [#uses=1] - ret i32 %R -} - -define i32 @test2() { - %R = srem i32 -2147483648, -1 ; <i32> [#uses=1] - ret i32 %R -} - diff --git a/llvm/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll b/llvm/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll deleted file mode 100644 index af7e8be4fcd..00000000000 --- a/llvm/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: opt < %s -constprop -S | \ -; RUN: not grep "ret i1 false" - -@b = external global [2 x { }] ; <[2 x { }]*> [#uses=2] - -define i1 @f() { - %tmp.2 = icmp eq { }* getelementptr ([2 x { }], [2 x { }]* @b, i32 0, i32 0), getelementptr ([2 x { }], [2 x { }]* @b, i32 0, i32 1) ; <i1> [#uses=1] - ret i1 %tmp.2 -} - diff --git a/llvm/test/Transforms/ConstProp/2006-11-30-vector-cast.ll b/llvm/test/Transforms/ConstProp/2006-11-30-vector-cast.ll deleted file mode 100644 index 4a93144d2d5..00000000000 --- a/llvm/test/Transforms/ConstProp/2006-11-30-vector-cast.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: opt < %s -constprop -S | \ -; RUN: grep "i32 -1" -; RUN: opt < %s -constprop -S | \ -; RUN: not grep zeroinitializer - -define <4 x i32> @test() { - %tmp40 = bitcast <2 x i64> bitcast (<4 x i32> < i32 0, i32 0, i32 -1, i32 0 > to <2 x i64>) to <4 x i32>; <<4 x i32>> [#uses=1] - ret <4 x i32> %tmp40 -} - diff --git a/llvm/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll b/llvm/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll deleted file mode 100644 index ce66c706488..00000000000 --- a/llvm/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: opt < %s -instcombine -S | \ -; RUN: grep "ret i1 false" -define i1 @test() { - %X = trunc i32 320 to i1 ; <i1> [#uses=1] - ret i1 %X -} - diff --git a/llvm/test/Transforms/ConstProp/2006-12-01-bool-casts.ll b/llvm/test/Transforms/ConstProp/2006-12-01-bool-casts.ll deleted file mode 100644 index 71db4211c5d..00000000000 --- a/llvm/test/Transforms/ConstProp/2006-12-01-bool-casts.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: opt < %s -constprop -S | \ -; RUN: grep "ret i32 -1" -; RUN: opt < %s -constprop -S | \ -; RUN: grep "ret i32 1" - -define i32 @test1() { - %A = sext i1 true to i32 ; <i32> [#uses=1] - ret i32 %A -} - -define i32 @test2() { - %A = zext i1 true to i32 ; <i32> [#uses=1] - ret i32 %A -} - diff --git a/llvm/test/Transforms/ConstProp/2007-02-05-BitCast.ll b/llvm/test/Transforms/ConstProp/2007-02-05-BitCast.ll deleted file mode 100644 index ebe3d21806b..00000000000 --- a/llvm/test/Transforms/ConstProp/2007-02-05-BitCast.ll +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: opt < %s -constprop -S | grep 1065353216 - -define i32 @test() { - %A = bitcast float 1.000000e+00 to i32 ; <i32> [#uses=1] - ret i32 %A -} - diff --git a/llvm/test/Transforms/ConstProp/2007-02-23-sdiv.ll b/llvm/test/Transforms/ConstProp/2007-02-23-sdiv.ll deleted file mode 100644 index 75f58b573ff..00000000000 --- a/llvm/test/Transforms/ConstProp/2007-02-23-sdiv.ll +++ /dev/null @@ -1,5 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis | grep "global i32 0" -; PR1215 - -@G = global i32 sdiv (i32 0, i32 -1) - diff --git a/llvm/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll b/llvm/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll deleted file mode 100644 index fd5495445b7..00000000000 --- a/llvm/test/Transforms/ConstProp/2008-07-07-VectorCompare.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: opt < %s -constprop -disable-output -; PR2529 -define <4 x i1> @test1(i32 %argc, i8** %argv) { -entry: - %foo = icmp slt <4 x i32> undef, <i32 14, i32 undef, i32 undef, i32 undef> - ret <4 x i1> %foo -} - -define <4 x i1> @test2(i32 %argc, i8** %argv) { -entry: - %foo = icmp slt <4 x i32> <i32 undef, i32 undef, i32 undef, i32 -undef>, <i32 undef, i32 undef, i32 undef, i32 undef> - ret <4 x i1> %foo -} - - -define <4 x i1> @test3() { - %foo = fcmp ueq <4 x float> <float 0.0, float 0.0, float 0.0, float -undef>, <float 1.0, float 1.0, float 1.0, float undef> - ret <4 x i1> %foo -} - -define <4 x i1> @test4() { - %foo = fcmp ueq <4 x float> <float 0.0, float 0.0, float 0.0, float 0.0>, <float 1.0, float 1.0, float 1.0, float 0.0> - - ret <4 x i1> %foo -} - diff --git a/llvm/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll b/llvm/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll deleted file mode 100644 index 332260590ae..00000000000 --- a/llvm/test/Transforms/ConstProp/2009-06-20-constexpr-zero-lhs.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis | not grep ptrtoint -; PR4424 -@G = external global i32 -@test1 = constant i32 sdiv (i32 0, i32 ptrtoint (i32* @G to i32)) -@test2 = constant i32 udiv (i32 0, i32 ptrtoint (i32* @G to i32)) -@test3 = constant i32 srem (i32 0, i32 ptrtoint (i32* @G to i32)) -@test4 = constant i32 urem (i32 0, i32 ptrtoint (i32* @G to i32)) -@test5 = constant i32 lshr (i32 0, i32 ptrtoint (i32* @G to i32)) -@test6 = constant i32 ashr (i32 0, i32 ptrtoint (i32* @G to i32)) -@test7 = constant i32 shl (i32 0, i32 ptrtoint (i32* @G to i32)) - diff --git a/llvm/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll b/llvm/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll deleted file mode 100644 index e93a2c066bd..00000000000 --- a/llvm/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: opt < %s -constprop | llvm-dis -; PR4848 -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-unknown-linux-gnu" - -%0 = type { %struct.anon } -%1 = type { %0, %2, [24 x i8] } -%2 = type <{ %3, %3 }> -%3 = type { %struct.hrtimer_cpu_base*, i32, %struct.rb_root, %struct.rb_node*, %struct.pgprot, i64 ()*, [16 x i8] } -%struct.anon = type { } -%struct.hrtimer_clock_base = type { %struct.hrtimer_cpu_base*, i32, %struct.rb_root, %struct.rb_node*, %struct.pgprot, i64 ()*, %struct.pgprot, %struct.pgprot } -%struct.hrtimer_cpu_base = type { %0, [2 x %struct.hrtimer_clock_base], %struct.pgprot, i32, i64 } -%struct.pgprot = type { i64 } -%struct.rb_node = type { i64, %struct.rb_node*, %struct.rb_node* } -%struct.rb_root = type { %struct.rb_node* } - -@per_cpu__hrtimer_bases = external global %1, align 8 ; <%1*> [#uses=1] - -define void @init_hrtimers_cpu(i32 %cpu) nounwind noredzone section ".cpuinit.text" { -entry: - %tmp3 = getelementptr %struct.hrtimer_cpu_base, %struct.hrtimer_cpu_base* bitcast (%1* @per_cpu__hrtimer_bases to %struct.hrtimer_cpu_base*), i32 0, i32 0 ; <%0*> [#uses=1] - %tmp5 = bitcast %0* %tmp3 to i8* ; <i8*> [#uses=0] - unreachable -} diff --git a/llvm/test/Transforms/ConstProp/InsertElement.ll b/llvm/test/Transforms/ConstProp/InsertElement.ll deleted file mode 100644 index 011ad3f57f4..00000000000 --- a/llvm/test/Transforms/ConstProp/InsertElement.ll +++ /dev/null @@ -1,32 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s - -; CHECK-LABEL: @test1 -define i32 @test1() { - %A = bitcast i32 2139171423 to float - %B = insertelement <1 x float> undef, float %A, i32 0 - %C = extractelement <1 x float> %B, i32 0 - %D = bitcast float %C to i32 - ret i32 %D -; CHECK: ret i32 2139171423 -} - -; CHECK-LABEL: @insertelement -define <4 x i64> @insertelement() { - %vec1 = insertelement <4 x i64> undef, i64 -1, i32 0 - %vec2 = insertelement <4 x i64> %vec1, i64 -2, i32 1 - %vec3 = insertelement <4 x i64> %vec2, i64 -3, i32 2 - %vec4 = insertelement <4 x i64> %vec3, i64 -4, i32 3 - ; CHECK: ret <4 x i64> <i64 -1, i64 -2, i64 -3, i64 -4> - ret <4 x i64> %vec4 -} - -; CHECK-LABEL: @insertelement_undef -define <4 x i64> @insertelement_undef() { - %vec1 = insertelement <4 x i64> undef, i64 -1, i32 0 - %vec2 = insertelement <4 x i64> %vec1, i64 -2, i32 1 - %vec3 = insertelement <4 x i64> %vec2, i64 -3, i32 2 - %vec4 = insertelement <4 x i64> %vec3, i64 -4, i32 3 - %vec5 = insertelement <4 x i64> %vec3, i64 -5, i32 4 - ; CHECK: ret <4 x i64> undef - ret <4 x i64> %vec5 -} diff --git a/llvm/test/Transforms/ConstProp/avx512.ll b/llvm/test/Transforms/ConstProp/avx512.ll deleted file mode 100644 index 7043c23315c..00000000000 --- a/llvm/test/Transforms/ConstProp/avx512.ll +++ /dev/null @@ -1,490 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s -; REQUIRES: x86-registered-target - -define i1 @test_avx512_cvts_exact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_exact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2si32(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 10 - %cmp13 = icmp eq i64 %sum13, 10 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -define i1 @test_avx512_cvts_exact_max() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_exact_max( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> <double 2147483647.0, double undef>, i32 4) nounwind - %b = icmp eq i32 %i0, 2147483647 - ret i1 %b -} - -define i1 @test_avx512_cvts_exact_max_p1() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_exact_max_p1( -; CHECK: call -entry: - %i0 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> <double 2147483648.0, double undef>, i32 4) nounwind - %b = icmp eq i32 %i0, 2147483648 - ret i1 %b -} - -define i1 @test_avx512_cvts_exact_neg_max() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_exact_neg_max( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> <double -2147483648.0, double undef>, i32 4) nounwind - %b = icmp eq i32 %i0, -2147483648 - ret i1 %b -} - -define i1 @test_avx512_cvts_exact_neg_max_p1() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_exact_neg_max_p1( -; CHECK: call -entry: - %i0 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> <double -2147483649.0, double undef>, i32 4) nounwind - %b = icmp eq i32 %i0, -2147483649 - ret i1 %b -} - -; Inexact values should not fold as they are dependent on rounding mode -define i1 @test_avx512_cvts_inexact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_inexact( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2si32(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 4 - %cmp13 = icmp eq i64 %sum13, 4 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; FLT_MAX/DBL_MAX should not fold -define i1 @test_avx512_cvts_max() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_max( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095039, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405311, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2si32(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; INF should not fold -define i1 @test_avx512_cvts_inf() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_inf( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095040, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405312, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2si32(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; NAN should not fold -define i1 @test_avx512_cvts_nan() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvts_nan( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2143289344, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9221120237041090560, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2si32(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2si64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -define i1 @test_avx512_cvtts_exact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtts_exact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.avx512.cvttss2si(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2si64(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2si(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2si64(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 10 - %cmp13 = icmp eq i64 %sum13, 10 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -define i1 @test_avx512_cvtts_inexact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtts_inexact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.avx512.cvttss2si(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2si(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2si64(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 2 - %cmp13 = icmp eq i64 %sum13, 2 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; FLT_MAX/DBL_MAX should not fold -define i1 @test_avx512_cvtts_max() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtts_max( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095039, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405311, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.cvttss2si(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2si64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2si(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2si64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; INF should not fold -define i1 @test_avx512_cvtts_inf() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtts_inf( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095040, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405312, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.cvttss2si(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2si64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2si(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2si64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; NAN should not fold -define i1 @test_avx512_cvtts_nan() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtts_nan( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2143289344, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9221120237041090560, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.cvttss2si(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2si64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2si(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2si64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -define i1 @test_avx512_cvtu_exact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_exact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 10 - %cmp13 = icmp eq i64 %sum13, 10 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; Negative values should not fold as they can't be represented in an unsigned int. -define i1 @test_avx512_cvtu_neg() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_neg( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> <float -3.0, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> <float -3.0, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> <double -7.0, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> <double -7.0, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, -10 - %cmp13 = icmp eq i64 %sum13, -10 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -define i1 @test_avx512_cvtu_exact_max() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_exact_max( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> <double 4294967295.0, double undef>, i32 4) nounwind - %b = icmp eq i32 %i0, 4294967295 - ret i1 %b -} - -define i1 @test_avx512_cvtu_exact_max_p1() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_exact_max_p1( -; CHECK: call -entry: - %i0 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> <double 4294967296.0, double undef>, i32 4) nounwind - %b = icmp eq i32 %i0, 4294967296 - ret i1 %b -} - -; Inexact values should not fold as they are dependent on rounding mode -define i1 @test_avx512_cvtu_inexact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_inexact( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 4 - %cmp13 = icmp eq i64 %sum13, 4 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; FLT_MAX/DBL_MAX should not fold -define i1 @test_avx512_cvtu_max() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_max( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095039, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405311, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; INF should not fold -define i1 @test_avx512_cvtu_inf() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_inf( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095040, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405312, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; NAN should not fold -define i1 @test_avx512_cvtu_nan() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvtu_nan( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2143289344, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9221120237041090560, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -define i1 @test_avx512_cvttu_exact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvttu_exact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.avx512.cvttss2usi(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2usi64(<4 x float> <float 3.0, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2usi(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double> <double 7.0, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 10 - %cmp13 = icmp eq i64 %sum13, 10 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -define i1 @test_avx512_cvttu_inexact() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvttu_inexact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.avx512.cvttss2usi(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2usi64(<4 x float> <float 1.75, float undef, float undef, float undef>, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2usi(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double> <double 1.75, double undef>, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 2 - %cmp13 = icmp eq i64 %sum13, 2 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; FLT_MAX/DBL_MAX should not fold -define i1 @test_avx512_cvttu_max() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvttu_max( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095039, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405311, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.cvttss2usi(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2usi64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2usi(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; INF should not fold -define i1 @test_avx512_cvttu_inf() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvttu_inf( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095040, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405312, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.cvttss2usi(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2usi64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2usi(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; NAN should not fold -define i1 @test_avx512_cvttu_nan() nounwind readnone { -; CHECK-LABEL: @test_avx512_cvttu_nan( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2143289344, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9221120237041090560, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.avx512.cvttss2usi(<4 x float> %fm, i32 4) nounwind - %i1 = tail call i64 @llvm.x86.avx512.cvttss2usi64(<4 x float> %fm, i32 4) nounwind - %i2 = call i32 @llvm.x86.avx512.cvttsd2usi(<2 x double> %dm, i32 4) nounwind - %i3 = call i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double> %dm, i32 4) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -declare i32 @llvm.x86.avx512.vcvtss2si32(<4 x float>, i32) nounwind readnone -declare i32 @llvm.x86.avx512.cvttss2si(<4 x float>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.vcvtss2si64(<4 x float>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.cvttss2si64(<4 x float>, i32) nounwind readnone -declare i32 @llvm.x86.avx512.vcvtsd2si32(<2 x double>, i32) nounwind readnone -declare i32 @llvm.x86.avx512.cvttsd2si(<2 x double>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.vcvtsd2si64(<2 x double>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.cvttsd2si64(<2 x double>, i32) nounwind readnone -declare i32 @llvm.x86.avx512.vcvtss2usi32(<4 x float>, i32) nounwind readnone -declare i32 @llvm.x86.avx512.cvttss2usi(<4 x float>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.vcvtss2usi64(<4 x float>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.cvttss2usi64(<4 x float>, i32) nounwind readnone -declare i32 @llvm.x86.avx512.vcvtsd2usi32(<2 x double>, i32) nounwind readnone -declare i32 @llvm.x86.avx512.cvttsd2usi(<2 x double>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.vcvtsd2usi64(<2 x double>, i32) nounwind readnone -declare i64 @llvm.x86.avx512.cvttsd2usi64(<2 x double>, i32) nounwind readnone diff --git a/llvm/test/Transforms/ConstProp/basictest.ll b/llvm/test/Transforms/ConstProp/basictest.ll deleted file mode 100644 index afe6ef91240..00000000000 --- a/llvm/test/Transforms/ConstProp/basictest.ll +++ /dev/null @@ -1,53 +0,0 @@ -; RUN: opt < %s -constprop -die -S | FileCheck %s - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.7.2" - -; This is a basic sanity check for constant propagation. The add instruction -; should be eliminated. -define i32 @test1(i1 %B) { - br i1 %B, label %BB1, label %BB2 - -BB1: - %Val = add i32 0, 0 - br label %BB3 - -BB2: - br label %BB3 - -BB3: -; CHECK-LABEL: @test1( -; CHECK: %Ret = phi i32 [ 0, %BB1 ], [ 1, %BB2 ] - %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] - ret i32 %Ret -} - - -; PR6197 -define i1 @test2(i8* %f) nounwind { -entry: - %V = icmp ne i8* blockaddress(@test2, %bb), null - br label %bb -bb: - ret i1 %V - -; CHECK-LABEL: @test2( -; CHECK: ret i1 true -} - -define i1 @TNAN() { -; CHECK-LABEL: @TNAN( -; CHECK: ret i1 true - %A = fcmp uno double 0x7FF8000000000000, 1.000000e+00 - %B = fcmp uno double 1.230000e+02, 1.000000e+00 - %C = or i1 %A, %B - ret i1 %C -} - -define i128 @vector_to_int_cast() { - %A = bitcast <4 x i32> <i32 1073741824, i32 1073741824, i32 1073741824, i32 1073741824> to i128 - ret i128 %A -; CHECK-LABEL: @vector_to_int_cast( -; CHECK: ret i128 85070591750041656499021422275829170176 -} - diff --git a/llvm/test/Transforms/ConstProp/bitcast.ll b/llvm/test/Transforms/ConstProp/bitcast.ll deleted file mode 100644 index 7b1908bd7ac..00000000000 --- a/llvm/test/Transforms/ConstProp/bitcast.ll +++ /dev/null @@ -1,73 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s -; PR2165 - -define <1 x i64> @test1() { -; CHECK-LABEL: @test1( -; CHECK-NEXT: ret <1 x i64> <i64 63> -; - %A = bitcast i64 63 to <1 x i64> - ret <1 x i64> %A -} - -; Ensure that a FP source operand isn't propagated to an icmp. - -@a = external global i16, align 1 -@b = external global i16, align 1 - -define i1 @bad_icmp_constexpr_bitcast() { -; CHECK-LABEL: @bad_icmp_constexpr_bitcast( -; CHECK-NEXT: ret i1 icmp eq (i32 ptrtoint (i16* @a to i32), i32 bitcast (float fadd (float bitcast (i32 ptrtoint (i16* @b to i32) to float), float 2.000000e+00) to i32)) -; - %cmp = icmp eq i32 ptrtoint (i16* @a to i32), bitcast (float fadd (float bitcast (i32 ptrtoint (i16* @b to i32) to float), float 2.0) to i32) - ret i1 %cmp -} - -; Ensure that an integer source operand isn't propagated to a fcmp. - -@c = external global i16, align 1 -@d = external global i16, align 1 - -define i1 @bad_fcmp_constexpr_bitcast() { -; CHECK-LABEL: @bad_fcmp_constexpr_bitcast( -; CHECK-NEXT: ret i1 fcmp oeq (float bitcast (i32 ptrtoint (i16* @c to i32) to float), float bitcast (i32 add (i32 ptrtoint (i16* @d to i32), i32 2) to float)) -; - %cmp = fcmp oeq float bitcast (i32 ptrtoint (i16* @c to i32) to float), bitcast (i32 add (i32 ptrtoint (i16* @d to i32), i32 2) to float) - ret i1 %cmp -} - -; Ensure that an "ordered and equal" fcmp of a ConstantExpr to itself is not folded, since the ConstantExpr may be a NaN. - -define i1 @fcmp_constexpr_oeq(float %conv) { -; CHECK-LABEL: @fcmp_constexpr_oeq( -; CHECK-NEXT: ret i1 fcmp oeq (float bitcast (i32 ptrtoint (i16* @a to i32) to float), float bitcast (i32 ptrtoint (i16* @a to i32) to float)) -; - %cmp = fcmp oeq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) - ret i1 %cmp -} - -; Ensure that an "unordered or not equal" fcmp of a ConstantExpr to itself is not folded, since the ConstantExpr may be a NaN. - -define i1 @fcmp_constexpr_une(float %conv) { -; CHECK-LABEL: @fcmp_constexpr_une( -; CHECK-NEXT: ret i1 fcmp une (float bitcast (i32 ptrtoint (i16* @a to i32) to float), float bitcast (i32 ptrtoint (i16* @a to i32) to float)) -; - %cmp = fcmp une float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) - ret i1 %cmp -} - -define i1 @fcmp_constexpr_ueq(float %conv) { -; CHECK-LABEL: @fcmp_constexpr_ueq( -; CHECK-NEXT: ret i1 true -; - %cmp = fcmp ueq float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) - ret i1 %cmp -} - -define i1 @fcmp_constexpr_one(float %conv) { -; CHECK-LABEL: @fcmp_constexpr_one( -; CHECK-NEXT: ret i1 false -; - %cmp = fcmp one float bitcast (i32 ptrtoint (i16* @a to i32) to float), bitcast (i32 ptrtoint (i16* @a to i32) to float) - ret i1 %cmp -} diff --git a/llvm/test/Transforms/ConstProp/bswap.ll b/llvm/test/Transforms/ConstProp/bswap.ll deleted file mode 100644 index f601deb73db..00000000000 --- a/llvm/test/Transforms/ConstProp/bswap.ll +++ /dev/null @@ -1,41 +0,0 @@ -; bswap should be constant folded when it is passed a constant argument - -; RUN: opt < %s -constprop -S | FileCheck %s - -declare i16 @llvm.bswap.i16(i16) - -declare i32 @llvm.bswap.i32(i32) - -declare i64 @llvm.bswap.i64(i64) - -declare i80 @llvm.bswap.i80(i80) - -; CHECK-LABEL: define i16 @W( -define i16 @W() { - ; CHECK: ret i16 256 - %Z = call i16 @llvm.bswap.i16( i16 1 ) ; <i16> [#uses=1] - ret i16 %Z -} - -; CHECK-LABEL: define i32 @X( -define i32 @X() { - ; CHECK: ret i32 16777216 - %Z = call i32 @llvm.bswap.i32( i32 1 ) ; <i32> [#uses=1] - ret i32 %Z -} - -; CHECK-LABEL: define i64 @Y( -define i64 @Y() { - ; CHECK: ret i64 72057594037927936 - %Z = call i64 @llvm.bswap.i64( i64 1 ) ; <i64> [#uses=1] - ret i64 %Z -} - -; CHECK-LABEL: define i80 @Z( -define i80 @Z() { - ; CHECK: ret i80 -450681596205739728166896 - ; 0xA0908070605040302010 - %Z = call i80 @llvm.bswap.i80( i80 76151636403560493650080 ) - ; 0x102030405060708090A0 - ret i80 %Z -} diff --git a/llvm/test/Transforms/ConstProp/calls-math-finite.ll b/llvm/test/Transforms/ConstProp/calls-math-finite.ll deleted file mode 100644 index d13b798bde2..00000000000 --- a/llvm/test/Transforms/ConstProp/calls-math-finite.ll +++ /dev/null @@ -1,149 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s -; RUN: opt < %s -constprop -S -mtriple=unknown-unknown-linux-musl | FileCheck -check-prefix=MUSL %s - -; Test to verify constant folding can occur when math routines are mapped -; to the __<func>_finite versions of functions due to __FINITE_MATH_ONLY__ -; being enabled on headers on Linux. All calls should constant fold away -; in this test. - -target triple = "unknown-unknown-linux-gnu" - -declare double @__acos_finite(double) #0 -declare float @__acosf_finite(float) #0 -declare double @__asin_finite(double) #0 -declare float @__asinf_finite(float) #0 -declare double @__atan2_finite(double, double) #0 -declare float @__atan2f_finite(float, float) #0 -declare double @__cosh_finite(double) #0 -declare float @__coshf_finite(float) #0 -declare double @__exp2_finite(double) #0 -declare float @__exp2f_finite(float) #0 -declare double @__exp_finite(double) #0 -declare float @__expf_finite(float) #0 -declare double @__log10_finite(double) #0 -declare float @__log10f_finite(float) #0 -declare double @__log_finite(double) #0 -declare float @__logf_finite(float) #0 -declare double @__pow_finite(double, double) #0 -declare float @__powf_finite(float, float) #0 -declare double @__sinh_finite(double) #0 -declare float @__sinhf_finite(float) #0 - -attributes #0 = { nounwind readnone } - -define void @T() { -; CHECK-LABEL: @T( -; CHECK-NEXT: [[SLOT:%.*]] = alloca double -; CHECK-NEXT: [[SLOTF:%.*]] = alloca float -; CHECK-NEXT: store double 0.000000e+00, double* [[SLOT]] -; CHECK-NEXT: store double 0x3FF921FB54442D18, double* [[SLOT]] -; CHECK-NEXT: store double 0x3FE4978FA3269EE1, double* [[SLOT]] -; CHECK-NEXT: store double 0x402422A497D6185E, double* [[SLOT]] -; CHECK-NEXT: store double 0x403415E5BF6FB106, double* [[SLOT]] -; CHECK-NEXT: store double 8.000000e+00, double* [[SLOT]] -; CHECK-NEXT: store double 0x3FF193EA7AAD030{{[AB]}}, double* [[SLOT]] -; CHECK-NEXT: store double 0x3FDE8927964FD5FD, double* [[SLOT]] -; CHECK-NEXT: store double 1.000000e+00, double* [[SLOT]] -; CHECK-NEXT: store double 0x40240926E70949AE, double* [[SLOT]] -; CHECK-NEXT: store float 0.000000e+00, float* [[SLOTF]] -; CHECK-NEXT: store float 0x3FF921FB60000000, float* [[SLOTF]] -; CHECK-NEXT: store float 0x3FE4978FA0000000, float* [[SLOTF]] -; CHECK-NEXT: store float 0x402422A4A0000000, float* [[SLOTF]] -; CHECK-NEXT: store float 0x403415E5C0000000, float* [[SLOTF]] -; CHECK-NEXT: store float 8.000000e+00, float* [[SLOTF]] -; CHECK-NEXT: store float 0x3FF193EA80000000, float* [[SLOTF]] -; CHECK-NEXT: store float 0x3FDE8927A0000000, float* [[SLOTF]] -; CHECK-NEXT: store float 8.100000e+01, float* [[SLOTF]] -; CHECK-NEXT: store float 0x40240926E0000000, float* [[SLOTF]] -; CHECK-NEXT: ret void -; -; MUSL-LABEL: @T( -; MUSL-NEXT: [[SLOT:%.*]] = alloca double -; MUSL-NEXT: [[SLOTF:%.*]] = alloca float -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store -; MUSL-NEXT: call -; MUSL-NEXT: store - - %slot = alloca double - %slotf = alloca float - - %ACOS = call fast double @__acos_finite(double 1.000000e+00) - store double %ACOS, double* %slot - %ASIN = call fast double @__asin_finite(double 1.000000e+00) - store double %ASIN, double* %slot - %ATAN2 = call fast double @__atan2_finite(double 3.000000e+00, double 4.000000e+00) - store double %ATAN2, double* %slot - %COSH = call fast double @__cosh_finite(double 3.000000e+00) - store double %COSH, double* %slot - %EXP = call fast double @__exp_finite(double 3.000000e+00) - store double %EXP, double* %slot - %EXP2 = call fast double @__exp2_finite(double 3.000000e+00) - store double %EXP2, double* %slot - %LOG = call fast double @__log_finite(double 3.000000e+00) - store double %LOG, double* %slot - %LOG10 = call fast double @__log10_finite(double 3.000000e+00) - store double %LOG10, double* %slot - %POW = call fast double @__pow_finite(double 1.000000e+00, double 4.000000e+00) - store double %POW, double* %slot - %SINH = call fast double @__sinh_finite(double 3.000000e+00) - store double %SINH, double* %slot - - %ACOSF = call fast float @__acosf_finite(float 1.000000e+00) - store float %ACOSF, float* %slotf - %ASINF = call fast float @__asinf_finite(float 1.000000e+00) - store float %ASINF, float* %slotf - %ATAN2F = call fast float @__atan2f_finite(float 3.000000e+00, float 4.000000e+00) - store float %ATAN2F, float* %slotf - %COSHF = call fast float @__coshf_finite(float 3.000000e+00) - store float %COSHF, float* %slotf - %EXPF = call fast float @__expf_finite(float 3.000000e+00) - store float %EXPF, float* %slotf - %EXP2F = call fast float @__exp2f_finite(float 3.000000e+00) - store float %EXP2F, float* %slotf - %LOGF = call fast float @__logf_finite(float 3.000000e+00) - store float %LOGF, float* %slotf - %LOG10F = call fast float @__log10f_finite(float 3.000000e+00) - store float %LOG10F, float* %slotf - %POWF = call fast float @__powf_finite(float 3.000000e+00, float 4.000000e+00) - store float %POWF, float* %slotf - %SINHF = call fast float @__sinhf_finite(float 3.000000e+00) - store float %SINHF, float* %slotf - ret void -} - diff --git a/llvm/test/Transforms/ConstProp/calls.ll b/llvm/test/Transforms/ConstProp/calls.ll deleted file mode 100644 index 12ee1cb1139..00000000000 --- a/llvm/test/Transforms/ConstProp/calls.ll +++ /dev/null @@ -1,206 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s -; RUN: opt < %s -constprop -disable-simplify-libcalls -S | FileCheck %s --check-prefix=FNOBUILTIN - -declare double @acos(double) readnone nounwind -declare double @asin(double) readnone nounwind -declare double @atan(double) readnone nounwind -declare double @atan2(double, double) readnone nounwind -declare double @ceil(double) readnone nounwind -declare double @cos(double) readnone nounwind -declare double @cosh(double) readnone nounwind -declare double @exp(double) readnone nounwind -declare double @exp2(double) readnone nounwind -declare double @fabs(double) readnone nounwind -declare double @floor(double) readnone nounwind -declare double @fmod(double, double) readnone nounwind -declare double @log(double) readnone nounwind -declare double @log10(double) readnone nounwind -declare double @pow(double, double) readnone nounwind -declare double @round(double) readnone nounwind -declare double @sin(double) readnone nounwind -declare double @sinh(double) readnone nounwind -declare double @sqrt(double) readnone nounwind -declare double @tan(double) readnone nounwind -declare double @tanh(double) readnone nounwind - -declare float @acosf(float) readnone nounwind -declare float @asinf(float) readnone nounwind -declare float @atanf(float) readnone nounwind -declare float @atan2f(float, float) readnone nounwind -declare float @ceilf(float) readnone nounwind -declare float @cosf(float) readnone nounwind -declare float @coshf(float) readnone nounwind -declare float @expf(float) readnone nounwind -declare float @exp2f(float) readnone nounwind -declare float @fabsf(float) readnone nounwind -declare float @floorf(float) readnone nounwind -declare float @fmodf(float, float) readnone nounwind -declare float @logf(float) readnone nounwind -declare float @log10f(float) readnone nounwind -declare float @powf(float, float) readnone nounwind -declare float @roundf(float) readnone nounwind -declare float @sinf(float) readnone nounwind -declare float @sinhf(float) readnone nounwind -declare float @sqrtf(float) readnone nounwind -declare float @tanf(float) readnone nounwind -declare float @tanhf(float) readnone nounwind - -define double @T() { -; CHECK-LABEL: @T( -; FNOBUILTIN-LABEL: @T( - -; CHECK-NOT: call -; CHECK: ret - %A = call double @cos(double 0.000000e+00) - %B = call double @sin(double 0.000000e+00) - %a = fadd double %A, %B - %C = call double @tan(double 0.000000e+00) - %b = fadd double %a, %C - %D = call double @sqrt(double 4.000000e+00) - %c = fadd double %b, %D - - %slot = alloca double - %slotf = alloca float -; FNOBUILTIN: call - %1 = call double @acos(double 1.000000e+00) - store double %1, double* %slot -; FNOBUILTIN: call - %2 = call double @asin(double 1.000000e+00) - store double %2, double* %slot -; FNOBUILTIN: call - %3 = call double @atan(double 3.000000e+00) - store double %3, double* %slot -; FNOBUILTIN: call - %4 = call double @atan2(double 3.000000e+00, double 4.000000e+00) - store double %4, double* %slot -; FNOBUILTIN: call - %5 = call double @ceil(double 3.000000e+00) - store double %5, double* %slot -; FNOBUILTIN: call - %6 = call double @cosh(double 3.000000e+00) - store double %6, double* %slot -; FNOBUILTIN: call - %7 = call double @exp(double 3.000000e+00) - store double %7, double* %slot -; FNOBUILTIN: call - %8 = call double @exp2(double 3.000000e+00) - store double %8, double* %slot -; FNOBUILTIN: call - %9 = call double @fabs(double 3.000000e+00) - store double %9, double* %slot -; FNOBUILTIN: call - %10 = call double @floor(double 3.000000e+00) - store double %10, double* %slot -; FNOBUILTIN: call - %11 = call double @fmod(double 3.000000e+00, double 4.000000e+00) - store double %11, double* %slot -; FNOBUILTIN: call - %12 = call double @log(double 3.000000e+00) - store double %12, double* %slot -; FNOBUILTIN: call - %13 = call double @log10(double 3.000000e+00) - store double %13, double* %slot -; FNOBUILTIN: call - %14 = call double @pow(double 3.000000e+00, double 4.000000e+00) - store double %14, double* %slot -; FNOBUILTIN: call - %round_val = call double @round(double 3.000000e+00) - store double %round_val, double* %slot -; FNOBUILTIN: call - %15 = call double @sinh(double 3.000000e+00) - store double %15, double* %slot -; FNOBUILTIN: call - %16 = call double @tanh(double 3.000000e+00) - store double %16, double* %slot -; FNOBUILTIN: call - %17 = call float @acosf(float 1.000000e+00) - store float %17, float* %slotf -; FNOBUILTIN: call - %18 = call float @asinf(float 1.000000e+00) - store float %18, float* %slotf -; FNOBUILTIN: call - %19 = call float @atanf(float 3.000000e+00) - store float %19, float* %slotf -; FNOBUILTIN: call - %20 = call float @atan2f(float 3.000000e+00, float 4.000000e+00) - store float %20, float* %slotf -; FNOBUILTIN: call - %21 = call float @ceilf(float 3.000000e+00) - store float %21, float* %slotf -; FNOBUILTIN: call - %22 = call float @cosf(float 3.000000e+00) - store float %22, float* %slotf -; FNOBUILTIN: call - %23 = call float @coshf(float 3.000000e+00) - store float %23, float* %slotf -; FNOBUILTIN: call - %24 = call float @expf(float 3.000000e+00) - store float %24, float* %slotf -; FNOBUILTIN: call - %25 = call float @exp2f(float 3.000000e+00) - store float %25, float* %slotf -; FNOBUILTIN: call - %26 = call float @fabsf(float 3.000000e+00) - store float %26, float* %slotf -; FNOBUILTIN: call - %27 = call float @floorf(float 3.000000e+00) - store float %27, float* %slotf -; FNOBUILTIN: call - %28 = call float @fmodf(float 3.000000e+00, float 4.000000e+00) - store float %28, float* %slotf -; FNOBUILTIN: call - %29 = call float @logf(float 3.000000e+00) - store float %29, float* %slotf -; FNOBUILTIN: call - %30 = call float @log10f(float 3.000000e+00) - store float %30, float* %slotf -; FNOBUILTIN: call - %31 = call float @powf(float 3.000000e+00, float 4.000000e+00) - store float %31, float* %slotf -; FNOBUILTIN: call - %roundf_val = call float @roundf(float 3.000000e+00) - store float %roundf_val, float* %slotf -; FNOBUILTIN: call - %32 = call float @sinf(float 3.000000e+00) - store float %32, float* %slotf -; FNOBUILTIN: call - %33 = call float @sinhf(float 3.000000e+00) - store float %33, float* %slotf -; FNOBUILTIN: call - %34 = call float @sqrtf(float 3.000000e+00) - store float %34, float* %slotf -; FNOBUILTIN: call - %35 = call float @tanf(float 3.000000e+00) - store float %35, float* %slotf -; FNOBUILTIN: call - %36 = call float @tanhf(float 3.000000e+00) - store float %36, float* %slotf - -; FNOBUILTIN: ret - - ; PR9315 - %E = call double @exp2(double 4.0) - %d = fadd double %c, %E - ret double %d -} - -define double @test_intrinsic_pow() nounwind uwtable ssp { -entry: -; CHECK-LABEL: @test_intrinsic_pow( -; CHECK-NOT: call -; CHECK: ret - %0 = call double @llvm.pow.f64(double 1.500000e+00, double 3.000000e+00) - ret double %0 -} - -define float @test_intrinsic_pow_f32_overflow() nounwind uwtable ssp { -entry: -; CHECK-LABEL: @test_intrinsic_pow_f32_overflow( -; CHECK-NOT: call -; CHECK: ret float 0x7FF0000000000000 - %0 = call float @llvm.pow.f32(float 40.0, float 50.0) - ret float %0 -} - -declare double @llvm.pow.f64(double, double) nounwind readonly -declare float @llvm.pow.f32(float, float) nounwind readonly diff --git a/llvm/test/Transforms/ConstProp/cast.ll b/llvm/test/Transforms/ConstProp/cast.ll deleted file mode 100644 index 8377df17b3a..00000000000 --- a/llvm/test/Transforms/ConstProp/cast.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s - -; Overflow on a float to int or int to float conversion is undefined (PR21130). - -define i8 @overflow_fptosi() { -; CHECK-LABEL: @overflow_fptosi( -; CHECK-NEXT: ret i8 undef -; - %i = fptosi double 1.56e+02 to i8 - ret i8 %i -} - -define i8 @overflow_fptoui() { -; CHECK-LABEL: @overflow_fptoui( -; CHECK-NEXT: ret i8 undef -; - %i = fptoui double 2.56e+02 to i8 - ret i8 %i -} - -; The maximum float is approximately 2 ** 128 which is 3.4E38. -; The constant below is 4E38. Use a 130 bit integer to hold that -; number; 129-bits for the value + 1 bit for the sign. - -define float @overflow_uitofp() { -; CHECK-LABEL: @overflow_uitofp( -; CHECK-NEXT: ret float 0x7FF0000000000000 -; - %i = uitofp i130 400000000000000000000000000000000000000 to float - ret float %i -} - -define float @overflow_sitofp() { -; CHECK-LABEL: @overflow_sitofp( -; CHECK-NEXT: ret float 0x7FF0000000000000 -; - %i = sitofp i130 400000000000000000000000000000000000000 to float - ret float %i -} - diff --git a/llvm/test/Transforms/ConstProp/constant-expr.ll b/llvm/test/Transforms/ConstProp/constant-expr.ll deleted file mode 100644 index 1088fa6959a..00000000000 --- a/llvm/test/Transforms/ConstProp/constant-expr.ll +++ /dev/null @@ -1,111 +0,0 @@ -; RUN: llvm-as < %s | llvm-dis | FileCheck %s - -@X = external global i8 -@Y = external global i8 -@Z = external global i8 - -@A = global i1 add (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @A = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -@B = global i1 sub (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)), align 2 -; CHECK: @B = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -@C = global i1 mul (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @C = global i1 and (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) - -@D = global i1 sdiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @D = global i1 icmp ult (i8* @X, i8* @Y) -@E = global i1 udiv (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @E = global i1 icmp ult (i8* @X, i8* @Y) -@F = global i1 srem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @F = global i1 false -@G = global i1 urem (i1 icmp ult (i8* @X, i8* @Y), i1 icmp ult (i8* @X, i8* @Z)) -; CHECK: @G = global i1 false - -@H = global i1 icmp ule (i32* bitcast (i8* @X to i32*), i32* bitcast (i8* @Y to i32*)) -; CHECK: @H = global i1 icmp ule (i8* @X, i8* @Y) - -@I = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 false) -; CHECK: @I = global i1 icmp ult (i8* @X, i8* @Y) -@J = global i1 xor (i1 icmp ult (i8* @X, i8* @Y), i1 true) -; CHECK: @J = global i1 icmp uge (i8* @X, i8* @Y) - -@K = global i1 icmp eq (i1 icmp ult (i8* @X, i8* @Y), i1 false) -; CHECK: @K = global i1 icmp uge (i8* @X, i8* @Y) -@L = global i1 icmp eq (i1 icmp ult (i8* @X, i8* @Y), i1 true) -; CHECK: @L = global i1 icmp ult (i8* @X, i8* @Y) -@M = global i1 icmp ne (i1 icmp ult (i8* @X, i8* @Y), i1 true) -; CHECK: @M = global i1 icmp uge (i8* @X, i8* @Y) -@N = global i1 icmp ne (i1 icmp ult (i8* @X, i8* @Y), i1 false) -; CHECK: @N = global i1 icmp ult (i8* @X, i8* @Y) - -@O = global i1 icmp eq (i32 zext (i1 icmp ult (i8* @X, i8* @Y) to i32), i32 0) -; CHECK: @O = global i1 icmp uge (i8* @X, i8* @Y) - - - -; PR5176 - -; CHECK: @T1 = global i1 true -@T1 = global i1 icmp eq (i64 and (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 64) to i64), i64 1), i64 0) - -; CHECK: @T2 = global i1* @B -@T2 = global i1* inttoptr (i64 add (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 192)), i256 192) to i64), i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 192)), i256 128) to i64)) to i1*) - -; CHECK: @T3 = global i64 add (i64 ptrtoint (i1* @B to i64), i64 -1) -@T3 = global i64 add (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 64) to i64), i64 -1) - -; CHECK: @T4 = global i1* @B -@T4 = global i1* inttoptr (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 64) to i64) to i1*) - -; CHECK: @T5 = global i1* @A -@T5 = global i1* inttoptr (i64 add (i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 192) to i64), i64 trunc (i256 lshr (i256 or (i256 and (i256 and (i256 shl (i256 zext (i64 ptrtoint (i1* @B to i64) to i256), i256 64), i256 -6277101735386680763495507056286727952638980837032266301441), i256 6277101735386680763835789423207666416102355444464034512895), i256 shl (i256 zext (i64 ptrtoint (i1* @A to i64) to i256), i256 192)), i256 128) to i64)) to i1*) - - - -; PR6096 - -; No check line. This used to crash llvm-as. -@T6 = global <2 x i1> fcmp ole (<2 x float> fdiv (<2 x float> undef, <2 x float> <float 1.000000e+00, float 1.000000e+00>), <2 x float> zeroinitializer) - - -; PR9011 - -@pr9011_1 = constant <4 x i32> zext (<4 x i8> zeroinitializer to <4 x i32>) -; CHECK: pr9011_1 = constant <4 x i32> zeroinitializer -@pr9011_2 = constant <4 x i32> sext (<4 x i8> zeroinitializer to <4 x i32>) -; CHECK: pr9011_2 = constant <4 x i32> zeroinitializer -@pr9011_3 = constant <4 x i32> bitcast (<16 x i8> zeroinitializer to <4 x i32>) -; CHECK: pr9011_3 = constant <4 x i32> zeroinitializer -@pr9011_4 = constant <4 x float> uitofp (<4 x i8> zeroinitializer to <4 x float>) -; CHECK: pr9011_4 = constant <4 x float> zeroinitializer -@pr9011_5 = constant <4 x float> sitofp (<4 x i8> zeroinitializer to <4 x float>) -; CHECK: pr9011_5 = constant <4 x float> zeroinitializer -@pr9011_6 = constant <4 x i32> fptosi (<4 x float> zeroinitializer to <4 x i32>) -; CHECK: pr9011_6 = constant <4 x i32> zeroinitializer -@pr9011_7 = constant <4 x i32> fptoui (<4 x float> zeroinitializer to <4 x i32>) -; CHECK: pr9011_7 = constant <4 x i32> zeroinitializer -@pr9011_8 = constant <4 x float> fptrunc (<4 x double> zeroinitializer to <4 x float>) -; CHECK: pr9011_8 = constant <4 x float> zeroinitializer -@pr9011_9 = constant <4 x double> fpext (<4 x float> zeroinitializer to <4 x double>) -; CHECK: pr9011_9 = constant <4 x double> zeroinitializer - -@pr9011_10 = constant <4 x double> bitcast (i256 0 to <4 x double>) -; CHECK: pr9011_10 = constant <4 x double> zeroinitializer -@pr9011_11 = constant <4 x float> bitcast (i128 0 to <4 x float>) -; CHECK: pr9011_11 = constant <4 x float> zeroinitializer -@pr9011_12 = constant <4 x i32> bitcast (i128 0 to <4 x i32>) -; CHECK: pr9011_12 = constant <4 x i32> zeroinitializer -@pr9011_13 = constant i256 bitcast (<4 x double> zeroinitializer to i256) -; CHECK: pr9011_13 = constant i256 0 -@pr9011_14 = constant i128 bitcast (<4 x float> zeroinitializer to i128) -; CHECK: pr9011_14 = constant i128 0 -@pr9011_15 = constant i128 bitcast (<4 x i32> zeroinitializer to i128) -; CHECK: pr9011_15 = constant i128 0 - -@select = internal constant - i32 select (i1 icmp ult (i32 ptrtoint (i8* @X to i32), - i32 ptrtoint (i8* @Y to i32)), - i32 select (i1 icmp ult (i32 ptrtoint (i8* @X to i32), - i32 ptrtoint (i8* @Y to i32)), - i32 10, i32 20), - i32 30) -; CHECK: select = internal constant i32 select {{.*}} i32 10, i32 30 diff --git a/llvm/test/Transforms/ConstProp/convert-from-fp16.ll b/llvm/test/Transforms/ConstProp/convert-from-fp16.ll deleted file mode 100644 index bb903231317..00000000000 --- a/llvm/test/Transforms/ConstProp/convert-from-fp16.ll +++ /dev/null @@ -1,97 +0,0 @@ -; RUN: opt -constprop -S < %s | FileCheck %s - -; Verify that we don't crash with an assertion failure when constant folding -; a call to intrinsic 'convert.from.fp16' if the return type is not 'float'. - -define float @fold_from_fp16_to_fp32() { -; CHECK-LABEL: @fold_from_fp16_to_fp32 -; CHECK: ret float 0.000000e+00 -entry: - %0 = call float @llvm.convert.from.fp16.f32(i16 0) - ret float %0 -} - -define double @fold_from_fp16_to_fp64() { -; CHECK-LABEL: @fold_from_fp16_to_fp64 -; CHECK: ret double 0.000000e+00 -entry: - %0 = call double @llvm.convert.from.fp16.f64(i16 0) - ret double %0 -} - -define x86_fp80 @fold_from_fp16_to_fp80() { -; CHECK-LABEL: @fold_from_fp16_to_fp80 -; CHECK: ret x86_fp80 0xK00000000000000000000 -entry: - %0 = call x86_fp80 @llvm.convert.from.fp16.f80(i16 0) - ret x86_fp80 %0 -} - -define fp128 @fold_from_fp16_to_fp128() { -; CHECK-LABEL: @fold_from_fp16_to_fp128 -; CHECK: ret fp128 0xL00000000000000000000000000000000 -entry: - %0 = call fp128 @llvm.convert.from.fp16.f128(i16 0) - ret fp128 %0 -} - -define ppc_fp128 @fold_from_fp16_to_ppcfp128() { -; CHECK-LABEL: @fold_from_fp16_to_ppcfp128 -; CHECK: ret ppc_fp128 0xM00000000000000000000000000000000 -entry: - %0 = call ppc_fp128 @llvm.convert.from.fp16.ppcf128(i16 0) - ret ppc_fp128 %0 -} - -define float @fold_from_fp16_to_fp32_b() { -; CHECK-LABEL: @fold_from_fp16_to_fp32_b -; CHECK: ret float 4.000000e+00 -entry: - %0 = call i16 @llvm.convert.to.fp16.f64(double 4.0) - %1 = call float @llvm.convert.from.fp16.f32(i16 %0) - ret float %1 -} - -define double @fold_from_fp16_to_fp64_b() { -; CHECK-LABEL: @fold_from_fp16_to_fp64_b -; CHECK: ret double 4.000000e+00 -entry: - %0 = call i16 @llvm.convert.to.fp16.f64(double 4.0) - %1 = call double @llvm.convert.from.fp16.f64(i16 %0) - ret double %1 -} - -define x86_fp80 @fold_from_fp16_to_fp80_b() { -; CHECK-LABEL: @fold_from_fp16_to_fp80_b -; CHECK: ret x86_fp80 0xK40018000000000000000 -entry: - %0 = call i16 @llvm.convert.to.fp16.f64(double 4.0) - %1 = call x86_fp80 @llvm.convert.from.fp16.f80(i16 %0) - ret x86_fp80 %1 -} - -define fp128 @fold_from_fp16_to_fp128_b() { -; CHECK-LABEL: @fold_from_fp16_to_fp128_b -; CHECK: ret fp128 0xL00000000000000004001000000000000 -entry: - %0 = call i16 @llvm.convert.to.fp16.f64(double 4.0) - %1 = call fp128 @llvm.convert.from.fp16.f128(i16 %0) - ret fp128 %1 -} - -define ppc_fp128 @fold_from_fp16_to_ppcfp128_b() { -; CHECK-LABEL: @fold_from_fp16_to_ppcfp128_b -; CHECK: ret ppc_fp128 0xM40100000000000000000000000000000 -entry: - %0 = call i16 @llvm.convert.to.fp16.f64(double 4.0) - %1 = call ppc_fp128 @llvm.convert.from.fp16.ppcf128(i16 %0) - ret ppc_fp128 %1 -} - - -declare i16 @llvm.convert.to.fp16.f64(double) -declare float @llvm.convert.from.fp16.f32(i16) -declare double @llvm.convert.from.fp16.f64(i16) -declare x86_fp80 @llvm.convert.from.fp16.f80(i16) -declare fp128 @llvm.convert.from.fp16.f128(i16) -declare ppc_fp128 @llvm.convert.from.fp16.ppcf128(i16) diff --git a/llvm/test/Transforms/ConstProp/div-zero.ll b/llvm/test/Transforms/ConstProp/div-zero.ll deleted file mode 100644 index f4049a9615a..00000000000 --- a/llvm/test/Transforms/ConstProp/div-zero.ll +++ /dev/null @@ -1,12 +0,0 @@ -; RUN: opt < %s -instcombine -S | grep "ret i32 0" -; PR4424 -declare void @ext() - -define i32 @foo(i32 %ptr) { -entry: - %zero = sub i32 %ptr, %ptr ; <i32> [#uses=1] - %div_zero = sdiv i32 %zero, ptrtoint (i32* getelementptr (i32, i32* null, -i32 1) to i32) ; <i32> [#uses=1] - ret i32 %div_zero -} - diff --git a/llvm/test/Transforms/ConstProp/extractvalue.ll b/llvm/test/Transforms/ConstProp/extractvalue.ll deleted file mode 100644 index 72d6cb714a5..00000000000 --- a/llvm/test/Transforms/ConstProp/extractvalue.ll +++ /dev/null @@ -1,67 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s - -%struct = type { i32, [4 x i8] } - -define i32 @test1() { - %A = extractvalue %struct { i32 2, [4 x i8] c"foo\00" }, 0 - ret i32 %A -; CHECK-LABEL: @test1( -; CHECK: ret i32 2 -} - -define i8 @test2() { - %A = extractvalue %struct { i32 2, [4 x i8] c"foo\00" }, 1, 2 - ret i8 %A -; CHECK-LABEL: @test2( -; CHECK: ret i8 111 -} - -define i32 @test3() { - %A = extractvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], 1, 0 - ret i32 %A -; CHECK-LABEL: @test3( -; CHECK: ret i32 1 -} - -define i32 @zeroinitializer-test1() { - %A = extractvalue %struct zeroinitializer, 0 - ret i32 %A -; CHECK: @zeroinitializer-test1 -; CHECK: ret i32 0 -} - -define i8 @zeroinitializer-test2() { - %A = extractvalue %struct zeroinitializer, 1, 2 - ret i8 %A -; CHECK: @zeroinitializer-test2 -; CHECK: ret i8 0 -} - -define i32 @zeroinitializer-test3() { - %A = extractvalue [3 x %struct] zeroinitializer, 1, 0 - ret i32 %A -; CHECK: @zeroinitializer-test3 -; CHECK: ret i32 0 -} - -define i32 @undef-test1() { - %A = extractvalue %struct undef, 0 - ret i32 %A -; CHECK: @undef-test1 -; CHECK: ret i32 undef -} - -define i8 @undef-test2() { - %A = extractvalue %struct undef, 1, 2 - ret i8 %A -; CHECK: @undef-test2 -; CHECK: ret i8 undef -} - -define i32 @undef-test3() { - %A = extractvalue [3 x %struct] undef, 1, 0 - ret i32 %A -; CHECK: @undef-test3 -; CHECK: ret i32 undef -} - diff --git a/llvm/test/Transforms/ConstProp/float-to-ptr-cast.ll b/llvm/test/Transforms/ConstProp/float-to-ptr-cast.ll deleted file mode 100644 index 937f606bf13..00000000000 --- a/llvm/test/Transforms/ConstProp/float-to-ptr-cast.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s - -define i32* @test1() { - %X = inttoptr i64 0 to i32* ; <i32*> [#uses=1] - ret i32* %X -} - -; CHECK: ret i32* null - -define i32* @test2() { - ret i32* null -} - -; CHECK: ret i32* null - diff --git a/llvm/test/Transforms/ConstProp/insertvalue.ll b/llvm/test/Transforms/ConstProp/insertvalue.ll deleted file mode 100644 index 606f7ddc679..00000000000 --- a/llvm/test/Transforms/ConstProp/insertvalue.ll +++ /dev/null @@ -1,86 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s - -%struct = type { i32, [4 x i8] } - -define %struct @test1() { - %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i32 1, 0 - ret %struct %A -; CHECK-LABEL: @test1( -; CHECK: ret %struct { i32 1, [4 x i8] c"foo\00" } -} - -define %struct @test2() { - %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i8 1, 1, 2 - ret %struct %A -; CHECK-LABEL: @test2( -; CHECK: ret %struct { i32 2, [4 x i8] c"fo\01\00" } -} - -define [3 x %struct] @test3() { - %A = insertvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], i32 -1, 1, 0 - ret [3 x %struct] %A -; CHECK-LABEL: @test3( -; CHECK:ret [3 x %struct] [%struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 -1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" }] -} - -define %struct @zeroinitializer-test1() { - %A = insertvalue %struct zeroinitializer, i32 1, 0 - ret %struct %A -; CHECK: @zeroinitializer-test1 -; CHECK: ret %struct { i32 1, [4 x i8] zeroinitializer } -} - -define %struct @zeroinitializer-test2() { - %A = insertvalue %struct zeroinitializer, i8 1, 1, 2 - ret %struct %A -; CHECK: @zeroinitializer-test2 -; CHECK: ret %struct { i32 0, [4 x i8] c"\00\00\01\00" } -} - -define [3 x %struct] @zeroinitializer-test3() { - %A = insertvalue [3 x %struct] zeroinitializer, i32 1, 1, 0 - ret [3 x %struct] %A -; CHECK: @zeroinitializer-test3 -; CHECK: ret [3 x %struct] [%struct zeroinitializer, %struct { i32 1, [4 x i8] zeroinitializer }, %struct zeroinitializer] -} - -define %struct @undef-test1() { - %A = insertvalue %struct undef, i32 1, 0 - ret %struct %A -; CHECK: @undef-test1 -; CHECK: ret %struct { i32 1, [4 x i8] undef } -} - -define %struct @undef-test2() { - %A = insertvalue %struct undef, i8 0, 1, 2 - ret %struct %A -; CHECK: @undef-test2 -; CHECK: ret %struct { i32 undef, [4 x i8] [i8 undef, i8 undef, i8 0, i8 undef] } -} - -define [3 x %struct] @undef-test3() { - %A = insertvalue [3 x %struct] undef, i32 0, 1, 0 - ret [3 x %struct] %A -; CHECK: @undef-test3 -; CHECK: ret [3 x %struct] [%struct undef, %struct { i32 0, [4 x i8] undef }, %struct undef] -} - -define i32 @test-float-Nan() { - %A = bitcast i32 2139171423 to float - %B = insertvalue [1 x float] undef, float %A, 0 - %C = extractvalue [1 x float] %B, 0 - %D = bitcast float %C to i32 - ret i32 %D -; CHECK: @test-float-Nan -; CHECK: ret i32 2139171423 -} - -define i16 @test-half-Nan() { - %A = bitcast i16 32256 to half - %B = insertvalue [1 x half] undef, half %A, 0 - %C = extractvalue [1 x half] %B, 0 - %D = bitcast half %C to i16 - ret i16 %D -; CHECK: @test-half-Nan -; CHECK: ret i16 32256 -} diff --git a/llvm/test/Transforms/ConstProp/loads.ll b/llvm/test/Transforms/ConstProp/loads.ll deleted file mode 100644 index 68d7390b0e6..00000000000 --- a/llvm/test/Transforms/ConstProp/loads.ll +++ /dev/null @@ -1,310 +0,0 @@ -; RUN: opt < %s -data-layout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64" -instcombine -S | FileCheck %s --check-prefix=LE -; RUN: opt < %s -data-layout="E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64" -instcombine -S | FileCheck %s --check-prefix=BE - -; {{ 0xDEADBEEF, 0xBA }, 0xCAFEBABE} -@g1 = constant {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 } -@g2 = constant double 1.0 -; { 0x7B, 0x06B1BFF8 } -@g3 = constant {i64, i64} { i64 123, i64 112312312 } - -; Simple load -define i32 @test1() { - %r = load i32, i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) - ret i32 %r - -; 0xDEADBEEF -; LE-LABEL: @test1( -; LE: ret i32 -559038737 - -; 0xDEADBEEF -; BE-LABEL: @test1( -; BE: ret i32 -559038737 -} - -; PR3152 -; Load of first 16 bits of 32-bit value. -define i16 @test2() { - %r = load i16, i16* bitcast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*) - ret i16 %r - -; 0xBEEF -; LE-LABEL: @test2( -; LE: ret i16 -16657 - -; 0xDEAD -; BE-LABEL: @test2( -; BE: ret i16 -8531 -} - -define i16 @test2_addrspacecast() { - %r = load i16, i16 addrspace(1)* addrspacecast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16 addrspace(1)*) - ret i16 %r - -; FIXME: Should be able to load through a constant addrspacecast. -; 0xBEEF -; LE-LABEL: @test2_addrspacecast( -; XLE: ret i16 -16657 -; LE: load i16, i16 addrspace(1)* addrspacecast - -; 0xDEAD -; BE-LABEL: @test2_addrspacecast( -; XBE: ret i16 -8531 -; BE: load i16, i16 addrspace(1)* addrspacecast -} - -; Load of second 16 bits of 32-bit value. -define i16 @test3() { - %r = load i16, i16* getelementptr(i16, i16* bitcast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*), i32 1) - ret i16 %r - -; 0xDEAD -; LE-LABEL: @test3( -; LE: ret i16 -8531 - -; 0xBEEF -; BE-LABEL: @test3( -; BE: ret i16 -16657 -} - -; Load of 8 bit field + tail padding. -define i16 @test4() { - %r = load i16, i16* getelementptr(i16, i16* bitcast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*), i32 2) - ret i16 %r - -; 0x00BA -; LE-LABEL: @test4( -; LE: ret i16 186 - -; 0xBA00 -; BE-LABEL: @test4( -; BE: ret i16 -17920 -} - -; Load of double bits. -define i64 @test6() { - %r = load i64, i64* bitcast(double* @g2 to i64*) - ret i64 %r - -; 0x3FF_0000000000000 -; LE-LABEL: @test6( -; LE: ret i64 4607182418800017408 - -; 0x3FF_0000000000000 -; BE-LABEL: @test6( -; BE: ret i64 4607182418800017408 -} - -; Load of double bits. -define i16 @test7() { - %r = load i16, i16* bitcast(double* @g2 to i16*) - ret i16 %r - -; 0x0000 -; LE-LABEL: @test7( -; LE: ret i16 0 - -; 0x3FF0 -; BE-LABEL: @test7( -; BE: ret i16 16368 -} - -; Double load. -define double @test8() { - %r = load double, double* bitcast({{i32,i8},i32}* @g1 to double*) - ret double %r - -; LE-LABEL: @test8( -; LE: ret double 0xBADEADBEEF - -; BE-LABEL: @test8( -; BE: ret double 0xDEADBEEFBA000000 -} - - -; i128 load. -define i128 @test9() { - %r = load i128, i128* bitcast({i64, i64}* @g3 to i128*) - ret i128 %r - -; 0x00000000_06B1BFF8_00000000_0000007B -; LE-LABEL: @test9( -; LE: ret i128 2071796475790618158476296315 - -; 0x00000000_0000007B_00000000_06B1BFF8 -; BE-LABEL: @test9( -; BE: ret i128 2268949521066387161080 -} - -; vector load. -define <2 x i64> @test10() { - %r = load <2 x i64>, <2 x i64>* bitcast({i64, i64}* @g3 to <2 x i64>*) - ret <2 x i64> %r - -; LE-LABEL: @test10( -; LE: ret <2 x i64> <i64 123, i64 112312312> - -; BE-LABEL: @test10( -; BE: ret <2 x i64> <i64 123, i64 112312312> -} - - -; PR5287 -; { 0xA1, 0x08 } -@g4 = internal constant { i8, i8 } { i8 -95, i8 8 } - -define i16 @test11() nounwind { -entry: - %a = load i16, i16* bitcast ({ i8, i8 }* @g4 to i16*) - ret i16 %a - -; 0x08A1 -; LE-LABEL: @test11( -; LE: ret i16 2209 - -; 0xA108 -; BE-LABEL: @test11( -; BE: ret i16 -24312 -} - - -; PR5551 -@test12g = private constant [6 x i8] c"a\00b\00\00\00" - -define i16 @test12() { - %a = load i16, i16* getelementptr inbounds ([3 x i16], [3 x i16]* bitcast ([6 x i8]* @test12g to [3 x i16]*), i32 0, i64 1) - ret i16 %a - -; 0x0062 -; LE-LABEL: @test12( -; LE: ret i16 98 - -; 0x6200 -; BE-LABEL: @test12( -; BE: ret i16 25088 -} - - -; PR5978 -@g5 = constant i8 4 -define i1 @test13() { - %A = load i1, i1* bitcast (i8* @g5 to i1*) - ret i1 %A - -; LE-LABEL: @test13( -; LE: ret i1 false - -; BE-LABEL: @test13( -; BE: ret i1 false -} - -@g6 = constant [2 x i8*] [i8* inttoptr (i64 1 to i8*), i8* inttoptr (i64 2 to i8*)] -define i64 @test14() nounwind { -entry: - %tmp = load i64, i64* bitcast ([2 x i8*]* @g6 to i64*) - ret i64 %tmp - -; LE-LABEL: @test14( -; LE: ret i64 1 - -; BE-LABEL: @test14( -; BE: ret i64 1 -} - -; Check with address space pointers -@g6_as1 = constant [2 x i8 addrspace(1)*] [i8 addrspace(1)* inttoptr (i16 1 to i8 addrspace(1)*), i8 addrspace(1)* inttoptr (i16 2 to i8 addrspace(1)*)] -define i16 @test14_as1() nounwind { -entry: - %tmp = load i16, i16* bitcast ([2 x i8 addrspace(1)*]* @g6_as1 to i16*) - ret i16 %tmp - -; LE: @test14_as1 -; LE: ret i16 1 - -; BE: @test14_as1 -; BE: ret i16 1 -} - -define i64 @test15() nounwind { -entry: - %tmp = load i64, i64* bitcast (i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @g6, i32 0, i64 1) to i64*) - ret i64 %tmp - -; LE-LABEL: @test15( -; LE: ret i64 2 - -; BE-LABEL: @test15( -; BE: ret i64 2 -} - -@gv7 = constant [4 x i8*] [i8* null, i8* inttoptr (i64 -14 to i8*), i8* null, i8* null] -define i64 @test16.1() { - %v = load i64, i64* bitcast ([4 x i8*]* @gv7 to i64*), align 8 - ret i64 %v - -; LE-LABEL: @test16.1( -; LE: ret i64 0 - -; BE-LABEL: @test16.1( -; BE: ret i64 0 -} - -define i64 @test16.2() { - %v = load i64, i64* bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @gv7, i64 0, i64 1) to i64*), align 8 - ret i64 %v - -; LE-LABEL: @test16.2( -; LE: ret i64 -14 - -; BE-LABEL: @test16.2( -; BE: ret i64 -14 -} - -define i64 @test16.3() { - %v = load i64, i64* bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @gv7, i64 0, i64 2) to i64*), align 8 - ret i64 %v - -; LE-LABEL: @test16.3( -; LE: ret i64 0 - -; BE-LABEL: @test16.3( -; BE: ret i64 0 -} - -@g7 = constant {[0 x i32], [0 x i8], {}*} { [0 x i32] undef, [0 x i8] undef, {}* null } - -define i64* @test_leading_zero_size_elems() { - %v = load i64*, i64** bitcast ({[0 x i32], [0 x i8], {}*}* @g7 to i64**) - ret i64* %v - -; LE-LABEL: @test_leading_zero_size_elems( -; LE: ret i64* null - -; BE-LABEL: @test_leading_zero_size_elems( -; BE: ret i64* null -} - -@g8 = constant {[4294967295 x [0 x i32]], i64} { [4294967295 x [0 x i32]] undef, i64 123 } - -define i64 @test_leading_zero_size_elems_big() { - %v = load i64, i64* bitcast ({[4294967295 x [0 x i32]], i64}* @g8 to i64*) - ret i64 %v - -; LE-LABEL: @test_leading_zero_size_elems_big( -; LE: ret i64 123 - -; BE-LABEL: @test_leading_zero_size_elems_big( -; BE: ret i64 123 -} - -@g9 = constant [4294967295 x [0 x i32]] zeroinitializer - -define i64 @test_array_of_zero_size_array() { - %v = load i64, i64* bitcast ([4294967295 x [0 x i32]]* @g9 to i64*) - ret i64 %v - -; LE-LABEL: @test_array_of_zero_size_array( -; LE: ret i64 0 - -; BE-LABEL: @test_array_of_zero_size_array( -; BE: ret i64 0 -} diff --git a/llvm/test/Transforms/ConstProp/logicaltest.ll b/llvm/test/Transforms/ConstProp/logicaltest.ll deleted file mode 100644 index abd3275a4f7..00000000000 --- a/llvm/test/Transforms/ConstProp/logicaltest.ll +++ /dev/null @@ -1,35 +0,0 @@ -; Ensure constant propagation of logical instructions is working correctly. - -; RUN: opt < %s -constprop -die -S | FileCheck %s -; CHECK-NOT: {{and|or|xor}} - -define i32 @test1() { - %R = and i32 4, 1234 ; <i32> [#uses=1] - ret i32 %R -} - -define i1 @test1.upgrd.1() { - %R = and i1 true, false ; <i1> [#uses=1] - ret i1 %R -} - -define i32 @test2() { - %R = or i32 4, 1234 ; <i32> [#uses=1] - ret i32 %R -} - -define i1 @test2.upgrd.2() { - %R = or i1 true, false ; <i1> [#uses=1] - ret i1 %R -} - -define i32 @test3() { - %R = xor i32 4, 1234 ; <i32> [#uses=1] - ret i32 %R -} - -define i1 @test3.upgrd.3() { - %R = xor i1 true, false ; <i1> [#uses=1] - ret i1 %R -} - diff --git a/llvm/test/Transforms/ConstProp/overflow-ops.ll b/llvm/test/Transforms/ConstProp/overflow-ops.ll deleted file mode 100644 index 303b3b90ab3..00000000000 --- a/llvm/test/Transforms/ConstProp/overflow-ops.ll +++ /dev/null @@ -1,250 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -constprop -S | FileCheck %s - -declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8) -declare {i8, i1} @llvm.usub.with.overflow.i8(i8, i8) -declare {i8, i1} @llvm.umul.with.overflow.i8(i8, i8) - -declare {i8, i1} @llvm.sadd.with.overflow.i8(i8, i8) -declare {i8, i1} @llvm.ssub.with.overflow.i8(i8, i8) -declare {i8, i1} @llvm.smul.with.overflow.i8(i8, i8) - -;;----------------------------- -;; uadd -;;----------------------------- - -define {i8, i1} @uadd_1() nounwind { -; CHECK-LABEL: @uadd_1( -; CHECK-NEXT: ret { i8, i1 } { i8 -114, i1 false } -; - %t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 42, i8 100) - ret {i8, i1} %t -} - -define {i8, i1} @uadd_2() nounwind { -; CHECK-LABEL: @uadd_2( -; CHECK-NEXT: ret { i8, i1 } { i8 6, i1 true } -; - %t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 142, i8 120) - ret {i8, i1} %t -} - -define {i8, i1} @uadd_undef() nounwind { -; CHECK-LABEL: @uadd_undef( -; CHECK-NEXT: ret { i8, i1 } undef -; - %t = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 142, i8 undef) - ret {i8, i1} %t -} - -;;----------------------------- -;; usub -;;----------------------------- - -define {i8, i1} @usub_1() nounwind { -; CHECK-LABEL: @usub_1( -; CHECK-NEXT: ret { i8, i1 } { i8 2, i1 false } -; - %t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 2) - ret {i8, i1} %t -} - -define {i8, i1} @usub_2() nounwind { -; CHECK-LABEL: @usub_2( -; CHECK-NEXT: ret { i8, i1 } { i8 -2, i1 true } -; - %t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 6) - ret {i8, i1} %t -} - -define {i8, i1} @usub_undef() nounwind { -; CHECK-LABEL: @usub_undef( -; CHECK-NEXT: ret { i8, i1 } undef -; - %t = call {i8, i1} @llvm.usub.with.overflow.i8(i8 4, i8 undef) - ret {i8, i1} %t -} - -;;----------------------------- -;; umul -;;----------------------------- - -define {i8, i1} @umul_1() nounwind { -; CHECK-LABEL: @umul_1( -; CHECK-NEXT: ret { i8, i1 } { i8 44, i1 true } -; - %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 100, i8 3) - ret {i8, i1} %t -} - -define {i8, i1} @umul_2() nounwind { -; CHECK-LABEL: @umul_2( -; CHECK-NEXT: ret { i8, i1 } { i8 -56, i1 false } -; - %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 100, i8 2) - ret {i8, i1} %t -} - -define {i8, i1} @umul_undef() nounwind { -; CHECK-LABEL: @umul_undef( -; CHECK-NEXT: ret { i8, i1 } zeroinitializer -; - %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 undef, i8 2) - ret {i8, i1} %t -} - -define {i8, i1} @umul_both_undef() nounwind { -; CHECK-LABEL: @umul_both_undef( -; CHECK-NEXT: ret { i8, i1 } zeroinitializer -; - %t = call {i8, i1} @llvm.umul.with.overflow.i8(i8 undef, i8 undef) - ret {i8, i1} %t -} - -;;----------------------------- -;; sadd -;;----------------------------- - -define {i8, i1} @sadd_1() nounwind { -; CHECK-LABEL: @sadd_1( -; CHECK-NEXT: ret { i8, i1 } { i8 44, i1 false } -; - %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 42, i8 2) - ret {i8, i1} %t -} - -define {i8, i1} @sadd_2() nounwind { -; CHECK-LABEL: @sadd_2( -; CHECK-NEXT: ret { i8, i1 } { i8 -126, i1 true } -; - %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 120, i8 10) - ret {i8, i1} %t -} - -define {i8, i1} @sadd_3() nounwind { -; CHECK-LABEL: @sadd_3( -; CHECK-NEXT: ret { i8, i1 } { i8 -110, i1 false } -; - %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 -120, i8 10) - ret {i8, i1} %t -} - -define {i8, i1} @sadd_4() nounwind { -; CHECK-LABEL: @sadd_4( -; CHECK-NEXT: ret { i8, i1 } { i8 126, i1 true } -; - %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 -120, i8 -10) - ret {i8, i1} %t -} - -define {i8, i1} @sadd_5() nounwind { -; CHECK-LABEL: @sadd_5( -; CHECK-NEXT: ret { i8, i1 } { i8 -8, i1 false } -; - %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 2, i8 -10) - ret {i8, i1} %t -} - -define {i8, i1} @sadd_undef() nounwind { -; CHECK-LABEL: @sadd_undef( -; CHECK-NEXT: ret { i8, i1 } undef -; - %t = call {i8, i1} @llvm.sadd.with.overflow.i8(i8 undef, i8 -10) - ret {i8, i1} %t -} - -;;----------------------------- -;; ssub -;;----------------------------- - -define {i8, i1} @ssub_1() nounwind { -; CHECK-LABEL: @ssub_1( -; CHECK-NEXT: ret { i8, i1 } { i8 2, i1 false } -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 4, i8 2) - ret {i8, i1} %t -} - -define {i8, i1} @ssub_2() nounwind { -; CHECK-LABEL: @ssub_2( -; CHECK-NEXT: ret { i8, i1 } { i8 -2, i1 false } -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 4, i8 6) - ret {i8, i1} %t -} - -define {i8, i1} @ssub_3() nounwind { -; CHECK-LABEL: @ssub_3( -; CHECK-NEXT: ret { i8, i1 } { i8 126, i1 true } -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -10, i8 120) - ret {i8, i1} %t -} - -define {i8, i1} @ssub_3b() nounwind { -; CHECK-LABEL: @ssub_3b( -; CHECK-NEXT: ret { i8, i1 } { i8 -20, i1 false } -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -10, i8 10) - ret {i8, i1} %t -} - -define {i8, i1} @ssub_4() nounwind { -; CHECK-LABEL: @ssub_4( -; CHECK-NEXT: ret { i8, i1 } { i8 -126, i1 true } -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 120, i8 -10) - ret {i8, i1} %t -} - -define {i8, i1} @ssub_4b() nounwind { -; CHECK-LABEL: @ssub_4b( -; CHECK-NEXT: ret { i8, i1 } { i8 30, i1 false } -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 20, i8 -10) - ret {i8, i1} %t -} - -define {i8, i1} @ssub_5() nounwind { -; CHECK-LABEL: @ssub_5( -; CHECK-NEXT: ret { i8, i1 } { i8 -10, i1 false } -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 -20, i8 -10) - ret {i8, i1} %t -} - -define {i8, i1} @ssub_undef() nounwind { -; CHECK-LABEL: @ssub_undef( -; CHECK-NEXT: ret { i8, i1 } undef -; - %t = call {i8, i1} @llvm.ssub.with.overflow.i8(i8 undef, i8 -10) - ret {i8, i1} %t -} - -;;----------------------------- -;; smul -;;----------------------------- - -define {i8, i1} @smul_1() nounwind { -; CHECK-LABEL: @smul_1( -; CHECK-NEXT: ret { i8, i1 } { i8 -56, i1 true } -; - %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 -10) - ret {i8, i1} %t -} - -define {i8, i1} @smul_undef() nounwind { -; CHECK-LABEL: @smul_undef( -; CHECK-NEXT: ret { i8, i1 } zeroinitializer -; - %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 -20, i8 undef) - ret {i8, i1} %t -} - -define {i8, i1} @smul_both_undef() nounwind { -; CHECK-LABEL: @smul_both_undef( -; CHECK-NEXT: ret { i8, i1 } zeroinitializer -; - %t = call {i8, i1} @llvm.smul.with.overflow.i8(i8 undef, i8 undef) - ret {i8, i1} %t -} diff --git a/llvm/test/Transforms/ConstProp/phi.ll b/llvm/test/Transforms/ConstProp/phi.ll deleted file mode 100644 index c65d34cc933..00000000000 --- a/llvm/test/Transforms/ConstProp/phi.ll +++ /dev/null @@ -1,17 +0,0 @@ -; This is a basic sanity check for constant propagation. The add instruction -; should be eliminated. - -; RUN: opt < %s -constprop -die -S | not grep phi - -define i32 @test(i1 %B) { -BB0: - br i1 %B, label %BB1, label %BB3 - -BB1: ; preds = %BB0 - br label %BB3 - -BB3: ; preds = %BB1, %BB0 - %Ret = phi i32 [ 1, %BB0 ], [ 1, %BB1 ] ; <i32> [#uses=1] - ret i32 %Ret -} - diff --git a/llvm/test/Transforms/ConstProp/remtest.ll b/llvm/test/Transforms/ConstProp/remtest.ll deleted file mode 100644 index efd2d48332a..00000000000 --- a/llvm/test/Transforms/ConstProp/remtest.ll +++ /dev/null @@ -1,24 +0,0 @@ -; Ensure constant propagation of remainder instructions is working correctly. - -; RUN: opt < %s -constprop -die -S | not grep rem - -define i32 @test1() { - %R = srem i32 4, 3 ; <i32> [#uses=1] - ret i32 %R -} - -define i32 @test2() { - %R = srem i32 123, -23 ; <i32> [#uses=1] - ret i32 %R -} - -define float @test3() { - %R = frem float 0x4028E66660000000, 0x405ECDA1C0000000 ; <float> [#uses=1] - ret float %R -} - -define double @test4() { - %R = frem double 0x4073833BEE07AFF8, 0x4028AAABB2A0D19C ; <double> [#uses=1] - ret double %R -} - diff --git a/llvm/test/Transforms/ConstProp/shift.ll b/llvm/test/Transforms/ConstProp/shift.ll deleted file mode 100644 index de23fe98ad8..00000000000 --- a/llvm/test/Transforms/ConstProp/shift.ll +++ /dev/null @@ -1,69 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s - -; CHECK-LABEL: shift_undef_64 -define void @shift_undef_64(i64* %p) { - %r1 = lshr i64 -1, 4294967296 ; 2^32 - ; CHECK: store i64 undef - store i64 %r1, i64* %p - - %r2 = ashr i64 -1, 4294967297 ; 2^32 + 1 - ; CHECK: store i64 undef - store i64 %r2, i64* %p - - %r3 = shl i64 -1, 4294967298 ; 2^32 + 2 - ; CHECK: store i64 undef - store i64 %r3, i64* %p - - ret void -} - -; CHECK-LABEL: shift_undef_65 -define void @shift_undef_65(i65* %p) { - %r1 = lshr i65 2, 18446744073709551617 - ; CHECK: store i65 undef - store i65 %r1, i65* %p - - %r2 = ashr i65 4, 18446744073709551617 - ; CHECK: store i65 undef - store i65 %r2, i65* %p - - %r3 = shl i65 1, 18446744073709551617 - ; CHECK: store i65 undef - store i65 %r3, i65* %p - - ret void -} - -; CHECK-LABEL: shift_undef_256 -define void @shift_undef_256(i256* %p) { - %r1 = lshr i256 2, 18446744073709551617 - ; CHECK: store i256 undef - store i256 %r1, i256* %p - - %r2 = ashr i256 4, 18446744073709551618 - ; CHECK: store i256 undef - store i256 %r2, i256* %p - - %r3 = shl i256 1, 18446744073709551619 - ; CHECK: store i256 undef - store i256 %r3, i256* %p - - ret void -} - -; CHECK-LABEL: shift_undef_511 -define void @shift_undef_511(i511* %p) { - %r1 = lshr i511 -1, 1208925819614629174706276 ; 2^80 + 100 - ; CHECK: store i511 undef - store i511 %r1, i511* %p - - %r2 = ashr i511 -2, 1208925819614629174706200 - ; CHECK: store i511 undef - store i511 %r2, i511* %p - - %r3 = shl i511 -3, 1208925819614629174706180 - ; CHECK: store i511 undef - store i511 %r3, i511* %p - - ret void -} diff --git a/llvm/test/Transforms/ConstProp/sse.ll b/llvm/test/Transforms/ConstProp/sse.ll deleted file mode 100644 index ad0a62e4206..00000000000 --- a/llvm/test/Transforms/ConstProp/sse.ll +++ /dev/null @@ -1,208 +0,0 @@ -; RUN: opt < %s -constprop -S | FileCheck %s -; REQUIRES: x86-registered-target - -define i1 @test_sse_cvts_exact() nounwind readnone { -; CHECK-LABEL: @test_sse_cvts_exact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> <float 3.0, float undef, float undef, float undef>) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> <float 3.0, float undef, float undef, float undef>) nounwind - %i2 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> <double 7.0, double undef>) nounwind - %i3 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> <double 7.0, double undef>) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 10 - %cmp13 = icmp eq i64 %sum13, 10 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; Inexact values should not fold as they are dependent on rounding mode -define i1 @test_sse_cvts_inexact() nounwind readnone { -; CHECK-LABEL: @test_sse_cvts_inexact( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -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 i64 @llvm.x86.sse.cvtss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind - %i2 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> <double 1.75, double undef>) nounwind - %i3 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> <double 1.75, double undef>) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 4 - %cmp13 = icmp eq i64 %sum13, 4 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; FLT_MAX/DBL_MAX should not fold -define i1 @test_sse_cvts_max() nounwind readnone { -; CHECK-LABEL: @test_sse_cvts_max( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095039, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405311, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> %fm) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %fm) nounwind - %i2 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %dm) nounwind - %i3 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %dm) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; INF should not fold -define i1 @test_sse_cvts_inf() nounwind readnone { -; CHECK-LABEL: @test_sse_cvts_inf( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095040, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405312, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> %fm) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %fm) nounwind - %i2 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %dm) nounwind - %i3 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %dm) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; NAN should not fold -define i1 @test_sse_cvts_nan() nounwind readnone { -; CHECK-LABEL: @test_sse_cvts_nan( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2143289344, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9221120237041090560, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.sse.cvtss2si(<4 x float> %fm) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvtss2si64(<4 x float> %fm) nounwind - %i2 = call i32 @llvm.x86.sse2.cvtsd2si(<2 x double> %dm) nounwind - %i3 = call i64 @llvm.x86.sse2.cvtsd2si64(<2 x double> %dm) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -define i1 @test_sse_cvtts_exact() nounwind readnone { -; CHECK-LABEL: @test_sse_cvtts_exact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> <float 3.0, float undef, float undef, float undef>) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> <float 3.0, float undef, float undef, float undef>) nounwind - %i2 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> <double 7.0, double undef>) nounwind - %i3 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> <double 7.0, double undef>) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 10 - %cmp13 = icmp eq i64 %sum13, 10 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -define i1 @test_sse_cvtts_inexact() nounwind readnone { -; CHECK-LABEL: @test_sse_cvtts_inexact( -; CHECK-NOT: call -; CHECK: ret i1 true -entry: - %i0 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> <float 1.75, float undef, float undef, float undef>) nounwind - %i2 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> <double 1.75, double undef>) nounwind - %i3 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> <double 1.75, double undef>) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %cmp02 = icmp eq i32 %sum02, 2 - %cmp13 = icmp eq i64 %sum13, 2 - %b = and i1 %cmp02, %cmp13 - ret i1 %b -} - -; FLT_MAX/DBL_MAX should not fold -define i1 @test_sse_cvtts_max() nounwind readnone { -; CHECK-LABEL: @test_sse_cvtts_max( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095039, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405311, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> %fm) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> %fm) nounwind - %i2 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> %dm) nounwind - %i3 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> %dm) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; INF should not fold -define i1 @test_sse_cvtts_inf() nounwind readnone { -; CHECK-LABEL: @test_sse_cvtts_inf( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2139095040, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9218868437227405312, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> %fm) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> %fm) nounwind - %i2 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> %dm) nounwind - %i3 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> %dm) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - ret i1 %b -} - -; NAN should not fold -define i1 @test_sse_cvtts_nan() nounwind readnone { -; CHECK-LABEL: @test_sse_cvtts_nan( -; CHECK: call -; CHECK: call -; CHECK: call -; CHECK: call -entry: - %fm = bitcast <4 x i32> <i32 2143289344, i32 undef, i32 undef, i32 undef> to <4 x float> - %dm = bitcast <2 x i64> <i64 9221120237041090560, i64 undef> to <2 x double> - %i0 = tail call i32 @llvm.x86.sse.cvttss2si(<4 x float> %fm) nounwind - %i1 = tail call i64 @llvm.x86.sse.cvttss2si64(<4 x float> %fm) nounwind - %i2 = call i32 @llvm.x86.sse2.cvttsd2si(<2 x double> %dm) nounwind - %i3 = call i64 @llvm.x86.sse2.cvttsd2si64(<2 x double> %dm) nounwind - %sum02 = add i32 %i0, %i2 - %sum13 = add i64 %i1, %i3 - %sum02.sext = sext i32 %sum02 to i64 - %b = icmp eq i64 %sum02.sext, %sum13 - 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 diff --git a/llvm/test/Transforms/ConstProp/trunc_vec.ll b/llvm/test/Transforms/ConstProp/trunc_vec.ll deleted file mode 100644 index 99db329cdd2..00000000000 --- a/llvm/test/Transforms/ConstProp/trunc_vec.ll +++ /dev/null @@ -1,9 +0,0 @@ -; RUN: opt -constprop < %s - -; Make sure we don't crash on this one - -define <8 x i8> @test_truc_vec() { - %x = bitcast <2 x i64> <i64 1, i64 2> to <8 x i16> - %y = trunc <8 x i16> %x to <8 x i8> - ret <8 x i8> %y -} |