[PATCH] D13508: [ARM] Only lower to interleaved load/store if the target has NEON

Jeroen Ketema via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 7 06:13:08 PDT 2015


jketema created this revision.
jketema added a reviewer: sbaranga.
jketema added a subscriber: llvm-commits.
Herald added subscribers: rengolin, aemerson.

Without an additional check for NEON, the compiler crashes during legalization of vldN/vstN.

http://reviews.llvm.org/D13508

Files:
  lib/Target/ARM/ARMISelLowering.cpp
  test/CodeGen/ARM/arm-interleaved-accesses-bug.ll

Index: test/CodeGen/ARM/arm-interleaved-accesses-bug.ll
===================================================================
--- test/CodeGen/ARM/arm-interleaved-accesses-bug.ll
+++ test/CodeGen/ARM/arm-interleaved-accesses-bug.ll
@@ -0,0 +1,11 @@
+; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 -mattr=-neon < %s | FileCheck %s
+
+; CHECK-LABEL: no_neon_interleaved:
+; CHECK-NOT: vld2
+define <8 x i8> @no_neon_interleaved(<16 x i8>* %ptr) {
+  %wide.vec = load <16 x i8>, <16 x i8>* %ptr, align 4
+  %strided.v0 = shufflevector <16 x i8> %wide.vec, <16 x i8> undef, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14>
+  %strided.v1 = shufflevector <16 x i8> %wide.vec, <16 x i8> undef, <8 x i32> <i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15>
+  %add = add nsw <8 x i8> %strided.v0, %strided.v1
+  ret <8 x i8> %add
+}
Index: lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- lib/Target/ARM/ARMISelLowering.cpp
+++ lib/Target/ARM/ARMISelLowering.cpp
@@ -11825,9 +11825,9 @@
   unsigned VecSize = DL.getTypeAllocSizeInBits(VecTy);
   bool EltIs64Bits = DL.getTypeAllocSizeInBits(EltTy) == 64;
 
-  // Skip illegal vector types and vector types of i64/f64 element (vldN doesn't
-  // support i64/f64 element).
-  if ((VecSize != 64 && VecSize != 128) || EltIs64Bits)
+  // Skip if we do not have NEON and skip illegal vector types and vector types
+  // with i64/f64 elements (vldN doesn't support i64/f64 elements).
+  if (!Subtarget->hasNEON() || (VecSize != 64 && VecSize != 128) || EltIs64Bits)
     return false;
 
   // A pointer vector can not be the return type of the ldN intrinsics. Need to
@@ -11915,9 +11915,10 @@
   unsigned SubVecSize = DL.getTypeAllocSizeInBits(SubVecTy);
   bool EltIs64Bits = DL.getTypeAllocSizeInBits(EltTy) == 64;
 
-  // Skip illegal sub vector types and vector types of i64/f64 element (vstN
-  // doesn't support i64/f64 element).
-  if ((SubVecSize != 64 && SubVecSize != 128) || EltIs64Bits)
+  // Skip if we do not have NEON and skip illegal vector types and vector types
+  // with i64/f64 elements (vstN doesn't support i64/f64 elements).
+  if (!Subtarget->hasNEON() || (SubVecSize != 64 && SubVecSize != 128) ||
+      EltIs64Bits)
     return false;
 
   Value *Op0 = SVI->getOperand(0);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13508.36731.patch
Type: text/x-patch
Size: 2322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151007/2e23b496/attachment.bin>


More information about the llvm-commits mailing list