From: Krzysztof Parzyszek Date: Thu, 2 Mar 2017 17:50:24 +0000 (+0000) Subject: [Hexagon] Properly handle 'q' constraint in 128-byte vector mode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f339ad775f8f37ece6d2042a6618b16edd1ba77;p=llvm [Hexagon] Properly handle 'q' constraint in 128-byte vector mode git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296772 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Hexagon/HexagonISelLowering.cpp b/lib/Target/Hexagon/HexagonISelLowering.cpp index c38de2b7d46..0a5e9aed4f1 100644 --- a/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -3057,37 +3057,25 @@ HexagonTargetLowering::getRegForInlineAsmConstraint( return std::make_pair(0U, &Hexagon::DoubleRegsRegClass); } case 'q': // q0-q3 - switch (VT.SimpleTy) { + switch (VT.getSizeInBits()) { default: - llvm_unreachable("getRegForInlineAsmConstraint Unhandled data type"); - case MVT::v1024i1: - case MVT::v512i1: - case MVT::v32i16: - case MVT::v16i32: - case MVT::v64i8: - case MVT::v8i64: + llvm_unreachable("getRegForInlineAsmConstraint Unhandled vector size"); + case 512: return std::make_pair(0U, &Hexagon::VecPredRegsRegClass); + case 1024: + return std::make_pair(0U, &Hexagon::VecPredRegs128BRegClass); } case 'v': // V0-V31 - switch (VT.SimpleTy) { + switch (VT.getSizeInBits()) { default: - llvm_unreachable("getRegForInlineAsmConstraint Unhandled data type"); - case MVT::v16i32: - case MVT::v32i16: - case MVT::v64i8: - case MVT::v8i64: + llvm_unreachable("getRegForInlineAsmConstraint Unhandled vector size"); + case 512: return std::make_pair(0U, &Hexagon::VectorRegsRegClass); - case MVT::v32i32: - case MVT::v64i16: - case MVT::v16i64: - case MVT::v128i8: + case 1024: if (Subtarget.hasV60TOps() && UseHVX && UseHVXDbl) return std::make_pair(0U, &Hexagon::VectorRegs128BRegClass); return std::make_pair(0U, &Hexagon::VecDblRegsRegClass); - case MVT::v256i8: - case MVT::v128i16: - case MVT::v64i32: - case MVT::v32i64: + case 2048: return std::make_pair(0U, &Hexagon::VecDblRegs128BRegClass); } diff --git a/test/CodeGen/Hexagon/inline-asm-vecpred128.ll b/test/CodeGen/Hexagon/inline-asm-vecpred128.ll new file mode 100644 index 00000000000..234f5a0b792 --- /dev/null +++ b/test/CodeGen/Hexagon/inline-asm-vecpred128.ll @@ -0,0 +1,15 @@ +; RUN: llc -march=hexagon < %s | FileCheck %s +; REQUIRES: asserts + +; Make sure we can handle the 'q' constraint in the 128-byte mode. + +target triple = "hexagon" + +; CHECK-LABEL: fred +; CHECK: if (q{{[0-3]}}) vmem +define void @fred() #0 { + tail call void asm sideeffect "if ($0) vmem($1) = $2;", "q,r,v,~{memory}"(<32 x i32> undef, <32 x i32>* undef, <32 x i32> undef) #0 + ret void +} + +attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-double" }