[llvm] 6cb9529 - [ARM] Remove VBICimm if no cleared bits are demanded
David Green via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 03:53:55 PDT 2022
Author: David Green
Date: 2022-07-19T11:53:47+01:00
New Revision: 6cb9529001ba8677751862a9e969315182b7094d
URL: https://github.com/llvm/llvm-project/commit/6cb9529001ba8677751862a9e969315182b7094d
DIFF: https://github.com/llvm/llvm-project/commit/6cb9529001ba8677751862a9e969315182b7094d.diff
LOG: [ARM] Remove VBICimm if no cleared bits are demanded
If none of the bits of a VBICimm are demanded, we can remove the node
entirely using the input operand instead.
Differential Revision: https://reviews.llvm.org/D129966
Added:
Modified:
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/test/CodeGen/Thumb2/mve-satmul-loops.ll
llvm/test/CodeGen/Thumb2/mve-vqmovn-combine.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index f34fc70f55729..743cca9ff71f2 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -19996,6 +19996,14 @@ bool ARMTargetLowering::SimplifyDemandedBitsForTargetNode(
}
break;
}
+ case ARMISD::VBICIMM: {
+ SDValue Op0 = Op.getOperand(0);
+ unsigned ModImm = Op.getConstantOperandVal(1);
+ unsigned EltBits = 0;
+ uint64_t Mask = ARM_AM::decodeVMOVModImm(ModImm, EltBits);
+ if ((OriginalDemandedBits & Mask) == 0)
+ return TLO.CombineTo(Op, Op0);
+ }
}
return TargetLowering::SimplifyDemandedBitsForTargetNode(
diff --git a/llvm/test/CodeGen/Thumb2/mve-satmul-loops.ll b/llvm/test/CodeGen/Thumb2/mve-satmul-loops.ll
index ea351a3518ed8..09d1204d421eb 100644
--- a/llvm/test/CodeGen/Thumb2/mve-satmul-loops.ll
+++ b/llvm/test/CodeGen/Thumb2/mve-satmul-loops.ll
@@ -3099,11 +3099,8 @@ define arm_aapcs_vfpcc void @usatmul_16_q7(i8* nocapture readonly %pSrcA, i8* no
; CHECK-NEXT: vldrb.u8 q1, [r1], #16
; CHECK-NEXT: vmullt.u8 q2, q1, q0
; CHECK-NEXT: vmullb.u8 q0, q1, q0
-; CHECK-NEXT: vqshrnb.u16 q2, q2, #7
; CHECK-NEXT: vqshrnb.u16 q0, q0, #7
-; CHECK-NEXT: vmovlb.u8 q2, q2
-; CHECK-NEXT: vmovlb.u8 q0, q0
-; CHECK-NEXT: vmovnt.i16 q0, q2
+; CHECK-NEXT: vqshrnt.u16 q0, q2, #7
; CHECK-NEXT: vstrb.8 q0, [r2], #16
; CHECK-NEXT: le lr, .LBB21_4
; CHECK-NEXT: @ %bb.5: @ %middle.block
diff --git a/llvm/test/CodeGen/Thumb2/mve-vqmovn-combine.ll b/llvm/test/CodeGen/Thumb2/mve-vqmovn-combine.ll
index 6b145b55fc7d2..0e994b4228351 100644
--- a/llvm/test/CodeGen/Thumb2/mve-vqmovn-combine.ll
+++ b/llvm/test/CodeGen/Thumb2/mve-vqmovn-combine.ll
@@ -198,9 +198,7 @@ entry:
define arm_aapcs_vfpcc <16 x i8> @vqmovni16_uminmax_t1(<8 x i16> %s0, <16 x i8> %src1) {
; CHECK-LABEL: vqmovni16_uminmax_t1:
; CHECK: @ %bb.0: @ %entry
-; CHECK-NEXT: vqmovnb.u16 q0, q0
-; CHECK-NEXT: vmovlb.u8 q0, q0
-; CHECK-NEXT: vmovnt.i16 q1, q0
+; CHECK-NEXT: vqmovnt.u16 q1, q0
; CHECK-NEXT: vmov q0, q1
; CHECK-NEXT: bx lr
entry:
@@ -215,7 +213,6 @@ define arm_aapcs_vfpcc <16 x i8> @vqmovni16_uminmax_t2(<8 x i16> %s0, <16 x i8>
; CHECK-LABEL: vqmovni16_uminmax_t2:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: vqmovnb.u16 q0, q0
-; CHECK-NEXT: vmovlb.u8 q0, q0
; CHECK-NEXT: vmovnt.i16 q0, q1
; CHECK-NEXT: bx lr
entry:
@@ -229,9 +226,7 @@ entry:
define arm_aapcs_vfpcc <16 x i8> @vqmovni16_uminmax_b1(<8 x i16> %s0, <16 x i8> %src1) {
; CHECK-LABEL: vqmovni16_uminmax_b1:
; CHECK: @ %bb.0: @ %entry
-; CHECK-NEXT: vqmovnb.u16 q0, q0
-; CHECK-NEXT: vmovlb.u8 q0, q0
-; CHECK-NEXT: vmovnb.i16 q1, q0
+; CHECK-NEXT: vqmovnb.u16 q1, q0
; CHECK-NEXT: vmov q0, q1
; CHECK-NEXT: bx lr
entry:
More information about the llvm-commits
mailing list