summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AArch64
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-01-21 17:30:14 +0000
committerSanjay Patel <spatel@rotateright.com>2019-01-21 17:30:14 +0000
commite713c47d491365b53c4b2e3c9fe6f2e61aa25f2c (patch)
treeb1d17e9849b346efddc64c6d1d442f72e5e4060b /llvm/test/CodeGen/AArch64
parent4d54038279cd0f667d6acf6a85de19a2bb9b72ce (diff)
downloadbcm5719-llvm-e713c47d491365b53c4b2e3c9fe6f2e61aa25f2c.tar.gz
bcm5719-llvm-e713c47d491365b53c4b2e3c9fe6f2e61aa25f2c.zip
[DAGCombiner] fix crash when converting build vector to shuffle
The regression test is reduced from the example shown in D56281. This does raise a question as noted in the test file: do we want to handle this pattern? I don't have a motivating example for that on x86 yet, but it seems like we could have that pattern there too, so we could avoid the back-and-forth using a shuffle. llvm-svn: 351753
Diffstat (limited to 'llvm/test/CodeGen/AArch64')
-rw-r--r--llvm/test/CodeGen/AArch64/build-vector-extract.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/build-vector-extract.ll b/llvm/test/CodeGen/AArch64/build-vector-extract.ll
new file mode 100644
index 00000000000..bba3a22cf33
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/build-vector-extract.ll
@@ -0,0 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
+
+; This would crash because we did not expect to create
+; a shuffle for a vector where the source operand is
+; not the same size as the result.
+; TODO: Should we handle this pattern? Ie, is moving to/from
+; registers the optimal code?
+
+define <4 x i32> @larger_bv_than_source(<4 x i16> %t0) {
+; CHECK-LABEL: larger_bv_than_source:
+; CHECK: // %bb.0:
+; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
+; CHECK-NEXT: umov w8, v0.h[2]
+; CHECK-NEXT: fmov s0, w8
+; CHECK-NEXT: ret
+ %t1 = extractelement <4 x i16> %t0, i32 2
+ %vgetq_lane = zext i16 %t1 to i32
+ %t2 = insertelement <4 x i32> undef, i32 %vgetq_lane, i64 0
+ ret <4 x i32> %t2
+}
+
OpenPOWER on IntegriCloud