forked from OSchip/llvm-project
[SelectionDAG] Prevent warnings when extracting fixed length vector from scalable.
ComputeNumSignBits and computeKnownBits both trigger "Scalable flag may be dropped" warnings when a fixed length vector is extracted from a scalable vector. This patch assumes nothing about the demanded elements thus matching the behaviour when extracting a scalable vector from a scalable vector. Differential Revision: https://reviews.llvm.org/D83642
This commit is contained in:
parent
3cdbacc464
commit
6e198aae1d
|
@ -2718,6 +2718,9 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
|
|||
case ISD::EXTRACT_SUBVECTOR: {
|
||||
// Offset the demanded elts by the subvector index.
|
||||
SDValue Src = Op.getOperand(0);
|
||||
// Bail until we can represent demanded elements for scalable vectors.
|
||||
if (Src.getValueType().isScalableVector())
|
||||
break;
|
||||
uint64_t Idx = Op.getConstantOperandVal(1);
|
||||
unsigned NumSrcElts = Src.getValueType().getVectorNumElements();
|
||||
APInt DemandedSrcElts = DemandedElts.zextOrSelf(NumSrcElts).shl(Idx);
|
||||
|
@ -3973,6 +3976,9 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
|
|||
case ISD::EXTRACT_SUBVECTOR: {
|
||||
// Offset the demanded elts by the subvector index.
|
||||
SDValue Src = Op.getOperand(0);
|
||||
// Bail until we can represent demanded elements for scalable vectors.
|
||||
if (Src.getValueType().isScalableVector())
|
||||
break;
|
||||
uint64_t Idx = Op.getConstantOperandVal(1);
|
||||
unsigned NumSrcElts = Src.getValueType().getVectorNumElements();
|
||||
APInt DemandedSrcElts = DemandedElts.zextOrSelf(NumSrcElts).shl(Idx);
|
||||
|
|
|
@ -13,7 +13,10 @@
|
|||
; RUN: llc -aarch64-sve-vector-bits-min=1664 -aarch64-enable-atomic-cfg-tidy=false < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
|
||||
; RUN: llc -aarch64-sve-vector-bits-min=1792 -aarch64-enable-atomic-cfg-tidy=false < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
|
||||
; RUN: llc -aarch64-sve-vector-bits-min=1920 -aarch64-enable-atomic-cfg-tidy=false < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
|
||||
; RUN: llc -aarch64-sve-vector-bits-min=2048 -aarch64-enable-atomic-cfg-tidy=false < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024,VBITS_GE_2048
|
||||
; RUN: llc -aarch64-sve-vector-bits-min=2048 -aarch64-enable-atomic-cfg-tidy=false < %s 2>%t | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024,VBITS_GE_2048
|
||||
; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
|
||||
|
||||
; WARN-NOT: warning
|
||||
|
||||
; Test we can code generater patterns of the form:
|
||||
; fixed_length_vector = ISD::EXTRACT_SUBVECTOR scalable_vector, 0
|
||||
|
@ -85,4 +88,19 @@ bb1:
|
|||
ret void
|
||||
}
|
||||
|
||||
;
|
||||
define <8 x i1> @no_warn_dropped_scalable(<8 x i32>* %in) #0 {
|
||||
; CHECK-LABEL: no_warn_dropped_scalable:
|
||||
; CHECK: ptrue [[PG:p[0-9]+]].s, vl8
|
||||
; CHECK: ld1w { z{{[0-9]+}}.s }, [[PG]]/z, [x0]
|
||||
; CHECK-COUNT-8: cmp w{{[0-9]+}}, #0
|
||||
; CHECK: ret
|
||||
%a = load <8 x i32>, <8 x i32>* %in
|
||||
br label %bb1
|
||||
|
||||
bb1:
|
||||
%cond = icmp sgt <8 x i32> %a, zeroinitializer
|
||||
ret <8 x i1> %cond
|
||||
}
|
||||
|
||||
attributes #0 = { "target-features"="+sve" }
|
||||
|
|
Loading…
Reference in New Issue