[llvm] 0fe6481 - [ARM] VECTOR_REG_CAST undef -> undef

David Green via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 28 03:14:08 PST 2021


Author: David Green
Date: 2021-02-28T11:13:49Z
New Revision: 0fe64812d86ca387115d5b25eb24bfb2287c3b8a

URL: https://github.com/llvm/llvm-project/commit/0fe64812d86ca387115d5b25eb24bfb2287c3b8a
DIFF: https://github.com/llvm/llvm-project/commit/0fe64812d86ca387115d5b25eb24bfb2287c3b8a.diff

LOG: [ARM] VECTOR_REG_CAST undef -> undef

Propagate undef through VECTOR_REG_CAST nodes, allowing extra
simplification in some patterns.

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMISelLowering.cpp
    llvm/test/CodeGen/Thumb2/mve-be.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index cc326b960a0c..4fca4f512bc9 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -14020,6 +14020,10 @@ PerformVECTOR_REG_CASTCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
   if (ST->isLittle())
     return DCI.DAG.getNode(ISD::BITCAST, dl, VT, Op);
 
+  // VECTOR_REG_CAST undef -> undef
+  if (Op.isUndef())
+    return DCI.DAG.getUNDEF(VT);
+
   // VECTOR_REG_CAST(VECTOR_REG_CAST(x)) == VECTOR_REG_CAST(x)
   if (Op->getOpcode() == ARMISD::VECTOR_REG_CAST) {
     // If the valuetypes are the same, we can remove the cast entirely.

diff  --git a/llvm/test/CodeGen/Thumb2/mve-be.ll b/llvm/test/CodeGen/Thumb2/mve-be.ll
index 049f77ee1426..d941036488ba 100644
--- a/llvm/test/CodeGen/Thumb2/mve-be.ll
+++ b/llvm/test/CodeGen/Thumb2/mve-be.ll
@@ -355,4 +355,13 @@ entry:
   ret void
 }
 
+define arm_aapcs_vfpcc <8 x half> @undef_one() {
+; CHECK-LABEL: undef_one:
+; CHECK:       @ %bb.0:
+; CHECK-NEXT:    bx lr
+    %c = call <8 x half> @llvm.arm.mve.vreinterpretq.v8f16.v4f32(<4 x float> undef)
+    ret <8 x half> %c
+}
+
+declare <8 x half> @llvm.arm.mve.vreinterpretq.v8f16.v4f32(<4 x float>)
 declare <8 x i16> @llvm.arm.mve.vreinterpretq.v8i16.v4i32(<4 x i32>)


        


More information about the llvm-commits mailing list