OSDN Git Service

[Hexagon] Handle ANY_EXTEND_VECTOR_INREG in lowering
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 31 Jan 2018 20:48:11 +0000 (20:48 +0000)
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>
Wed, 31 Jan 2018 20:48:11 +0000 (20:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323912 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonISelLowering.cpp
test/CodeGen/Hexagon/autohvx/isel-anyext-inreg.ll [new file with mode: 0644]

index bcef8b7..9535d0f 100644 (file)
@@ -3261,6 +3261,10 @@ HexagonTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
       if (Subtarget.useHVXOps())
         return LowerHvxMulh(Op, DAG);
       break;
+    case ISD::ANY_EXTEND_VECTOR_INREG:
+      if (Subtarget.useHVXOps())
+        return LowerHvxExtend(Op, DAG);
+      break;
   }
   return SDValue();
 }
diff --git a/test/CodeGen/Hexagon/autohvx/isel-anyext-inreg.ll b/test/CodeGen/Hexagon/autohvx/isel-anyext-inreg.ll
new file mode 100644 (file)
index 0000000..bc859ae
--- /dev/null
@@ -0,0 +1,20 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+
+; This code causes any_extend_vector_inreg to appear in the selection DAG.
+; Make sure that it is handled instead of crashing.
+; CHECK: vmem
+
+target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
+target triple = "hexagon"
+
+define hidden fastcc void @fred() #0 {
+b0:
+  %v1 = load i16, i16* undef, align 2
+  %v2 = insertelement <16 x i16> undef, i16 %v1, i32 15
+  %v3 = zext <16 x i16> %v2 to <16 x i32>
+  %v4 = shl nuw <16 x i32> %v3, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
+  store <16 x i32> %v4, <16 x i32>* undef, align 4
+  unreachable
+}
+
+attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length64b" }