Skip to content

Commit 71b87d1

Browse files
[LLVM][SVE] Ensure all fixed length mask bits are defined. (#116819)
convertFixedMaskToScalableVector expects the mask input to honour the BoolContents scheme employed by the target. For AArch64 this means a mask should be zero or all ones, and thus when promoting a mask we must use a sign extend.
1 parent b17f607 commit 71b87d1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28163,7 +28163,7 @@ SDValue AArch64TargetLowering::LowerFixedLengthVectorMLoadToSVE(
2816328163
if (VT.getScalarSizeInBits() > Mask.getValueType().getScalarSizeInBits()) {
2816428164
assert(Load->getExtensionType() != ISD::NON_EXTLOAD &&
2816528165
"Incorrect mask type");
28166-
Mask = DAG.getNode(ISD::ANY_EXTEND, DL, VT, Mask);
28166+
Mask = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Mask);
2816728167
}
2816828168
Mask = convertFixedMaskToScalableVector(Mask, DAG);
2816928169

llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-masked-load.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,7 +2677,7 @@ define <3 x i32> @masked_load_zext_v3i32(ptr %load_ptr, <3 x i1> %pm) {
26772677
; CHECK-NEXT: and z0.d, z0.d, z1.d
26782678
; CHECK-NEXT: lsl z0.h, z0.h, #15
26792679
; CHECK-NEXT: asr z0.h, z0.h, #15
2680-
; CHECK-NEXT: uunpklo z0.s, z0.h
2680+
; CHECK-NEXT: sunpklo z0.s, z0.h
26812681
; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0
26822682
; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
26832683
; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
@@ -2750,7 +2750,7 @@ define <3 x i32> @masked_load_sext_v3i32(ptr %load_ptr, <3 x i1> %pm) {
27502750
; CHECK-NEXT: and z0.d, z0.d, z1.d
27512751
; CHECK-NEXT: lsl z0.h, z0.h, #15
27522752
; CHECK-NEXT: asr z0.h, z0.h, #15
2753-
; CHECK-NEXT: uunpklo z0.s, z0.h
2753+
; CHECK-NEXT: sunpklo z0.s, z0.h
27542754
; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0
27552755
; CHECK-NEXT: ld1sh { z0.s }, p0/z, [x0]
27562756
; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0

0 commit comments

Comments
 (0)