diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-09-29 15:01:45 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-09-29 15:01:45 +0000 |
commit | 20c64510cb331cdeedefc1e0bb2f970ad197c912 (patch) | |
tree | 97f2734df08de5e193ccd887be8afe97a542499c | |
parent | a731940c60ac5230a07657cbeae4e5432924260e (diff) | |
download | bcm5719-llvm-20c64510cb331cdeedefc1e0bb2f970ad197c912.tar.gz bcm5719-llvm-20c64510cb331cdeedefc1e0bb2f970ad197c912.zip |
[InstCombine] add test for vector widening of insertelements; NFC
The test shows a potential overreach with the fix from D52548.
llvm-svn: 343378
-rw-r--r-- | llvm/test/Transforms/InstCombine/vec_shuffle.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/vec_shuffle.ll b/llvm/test/Transforms/InstCombine/vec_shuffle.ll index ce323a40eb2..b3f2ca54be9 100644 --- a/llvm/test/Transforms/InstCombine/vec_shuffle.ll +++ b/llvm/test/Transforms/InstCombine/vec_shuffle.ll @@ -218,6 +218,21 @@ define <3 x i32> @div_wider(i32 %y, i32 %z) { ret <3 x i32> %ext } +; TODO: Increasing length of insertelements (no math ops) is a good canonicalization. + +define <3 x i8> @fold_inselts_with_widening_shuffle(i8 %x, i8 %y) { +; CHECK-LABEL: @fold_inselts_with_widening_shuffle( +; CHECK-NEXT: [[INS0:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 0 +; CHECK-NEXT: [[INS1:%.*]] = insertelement <2 x i8> [[INS0]], i8 [[Y:%.*]], i32 1 +; CHECK-NEXT: [[WIDEN:%.*]] = shufflevector <2 x i8> [[INS1]], <2 x i8> undef, <3 x i32> <i32 0, i32 1, i32 undef> +; CHECK-NEXT: ret <3 x i8> [[WIDEN]] +; + %ins0 = insertelement <2 x i8> undef, i8 %x, i32 0 + %ins1 = insertelement <2 x i8> %ins0, i8 %y, i32 1 + %widen = shufflevector <2 x i8> %ins1, <2 x i8> undef, <3 x i32> <i32 0, i32 1, i32 undef> + ret <3 x i8> %widen +} + define <2 x i8> @test13b(i8 %x) { ; CHECK-LABEL: @test13b( ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i8> undef, i8 [[X:%.*]], i32 1 |