diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-01-18 14:23:06 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-01-18 14:23:06 +0000 |
| commit | 970d67c6538410f423d6329a1f7a136e143b6eed (patch) | |
| tree | d5a91525e2c79aadb35d176336c6dc4954b3da81 | |
| parent | 517b61cb69d6cf19841c07242dc1c7dc901736c4 (diff) | |
| download | bcm5719-llvm-970d67c6538410f423d6329a1f7a136e143b6eed.tar.gz bcm5719-llvm-970d67c6538410f423d6329a1f7a136e143b6eed.zip | |
[InstCombine][AVX2] Tests showing missed opportunities to pass demanded elts through a vpermd/vpermps shuffle
llvm-svn: 292368
| -rw-r--r-- | llvm/test/Transforms/InstCombine/x86-avx2.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/x86-avx2.ll b/llvm/test/Transforms/InstCombine/x86-avx2.ll index 4c13b4c6ae7..aafe473d544 100644 --- a/llvm/test/Transforms/InstCombine/x86-avx2.ll +++ b/llvm/test/Transforms/InstCombine/x86-avx2.ll @@ -81,5 +81,32 @@ define <8 x float> @undef_test_vpermps(<8 x float> %a0) { ret <8 x float> %a } +; Verify simplify demanded elts. + +define <8 x i32> @elts_test_vpermd(<8 x i32> %a0, i32 %a1) { +; CHECK-LABEL: @elts_test_vpermd( +; CHECK-NEXT: [[TMP1:%.*]] = insertelement <8 x i32> <i32 undef, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i32 %a1, i32 0 +; CHECK-NEXT: [[TMP2:%.*]] = tail call <8 x i32> @llvm.x86.avx2.permd(<8 x i32> %a0, <8 x i32> [[TMP1]]) +; CHECK-NEXT: ret <8 x i32> [[TMP2]] +; + %1 = insertelement <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i32 %a1, i32 0 + %2 = tail call <8 x i32> @llvm.x86.avx2.permd(<8 x i32> %a0, <8 x i32> %1) + %3 = shufflevector <8 x i32> %2, <8 x i32> undef, <8 x i32> <i32 undef, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> + ret <8 x i32> %3 +} + +define <8 x float> @elts_test_vpermps(<8 x float> %a0, <8 x i32> %a1) { +; CHECK-LABEL: @elts_test_vpermps( +; CHECK-NEXT: [[TMP1:%.*]] = insertelement <8 x i32> %a1, i32 0, i32 7 +; CHECK-NEXT: [[TMP2:%.*]] = tail call <8 x float> @llvm.x86.avx2.permps(<8 x float> %a0, <8 x i32> [[TMP1]]) +; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <8 x float> [[TMP2]], <8 x float> undef, <8 x i32> zeroinitializer +; CHECK-NEXT: ret <8 x float> [[TMP3]] +; + %1 = insertelement <8 x i32> %a1, i32 0, i32 7 + %2 = tail call <8 x float> @llvm.x86.avx2.permps(<8 x float> %a0, <8 x i32> %1) + %3 = shufflevector <8 x float> %2, <8 x float> undef, <8 x i32> zeroinitializer + ret <8 x float> %3 +} + declare <8 x i32> @llvm.x86.avx2.permd(<8 x i32>, <8 x i32>) declare <8 x float> @llvm.x86.avx2.permps(<8 x float>, <8 x i32>) |

