Skip to content

Commit 0fe6481

Browse files
committed
[ARM] VECTOR_REG_CAST undef -> undef
Propagate undef through VECTOR_REG_CAST nodes, allowing extra simplification in some patterns.
1 parent 7fb4001 commit 0fe6481

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14020,6 +14020,10 @@ PerformVECTOR_REG_CASTCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
1402014020
if (ST->isLittle())
1402114021
return DCI.DAG.getNode(ISD::BITCAST, dl, VT, Op);
1402214022

14023+
// VECTOR_REG_CAST undef -> undef
14024+
if (Op.isUndef())
14025+
return DCI.DAG.getUNDEF(VT);
14026+
1402314027
// VECTOR_REG_CAST(VECTOR_REG_CAST(x)) == VECTOR_REG_CAST(x)
1402414028
if (Op->getOpcode() == ARMISD::VECTOR_REG_CAST) {
1402514029
// If the valuetypes are the same, we can remove the cast entirely.

llvm/test/CodeGen/Thumb2/mve-be.ll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,4 +355,13 @@ entry:
355355
ret void
356356
}
357357

358+
define arm_aapcs_vfpcc <8 x half> @undef_one() {
359+
; CHECK-LABEL: undef_one:
360+
; CHECK: @ %bb.0:
361+
; CHECK-NEXT: bx lr
362+
%c = call <8 x half> @llvm.arm.mve.vreinterpretq.v8f16.v4f32(<4 x float> undef)
363+
ret <8 x half> %c
364+
}
365+
366+
declare <8 x half> @llvm.arm.mve.vreinterpretq.v8f16.v4f32(<4 x float>)
358367
declare <8 x i16> @llvm.arm.mve.vreinterpretq.v8i16.v4i32(<4 x i32>)

0 commit comments

Comments
 (0)