[llvm] [LLVM][SVE] Ensure all fixed length mask bits are defined. (PR #116819)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 07:04:20 PST 2024
https://github.com/paulwalker-arm created https://github.com/llvm/llvm-project/pull/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.
>From b74f90da534282734562296e923403edafcf7c76 Mon Sep 17 00:00:00 2001
From: Paul Walker <paul.walker at arm.com>
Date: Tue, 19 Nov 2024 14:58:59 +0000
Subject: [PATCH] [LLVM][SVE] Ensure all fixed length mask bits are defined.
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.
---
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 2 +-
.../AArch64/sve-streaming-mode-fixed-length-masked-load.ll | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 2732e495c552a6..4e8b9494437bd2 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -28227,7 +28227,7 @@ SDValue AArch64TargetLowering::LowerFixedLengthVectorMLoadToSVE(
if (VT.getScalarSizeInBits() > Mask.getValueType().getScalarSizeInBits()) {
assert(Load->getExtensionType() != ISD::NON_EXTLOAD &&
"Incorrect mask type");
- Mask = DAG.getNode(ISD::ANY_EXTEND, DL, VT, Mask);
+ Mask = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Mask);
}
Mask = convertFixedMaskToScalableVector(Mask, DAG);
diff --git a/llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-masked-load.ll b/llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-masked-load.ll
index 9055b2efba3282..48a642c908bfe6 100644
--- a/llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-masked-load.ll
+++ b/llvm/test/CodeGen/AArch64/sve-streaming-mode-fixed-length-masked-load.ll
@@ -2677,7 +2677,7 @@ define <3 x i32> @masked_load_zext_v3i32(ptr %load_ptr, <3 x i1> %pm) {
; CHECK-NEXT: and z0.d, z0.d, z1.d
; CHECK-NEXT: lsl z0.h, z0.h, #15
; CHECK-NEXT: asr z0.h, z0.h, #15
-; CHECK-NEXT: uunpklo z0.s, z0.h
+; CHECK-NEXT: sunpklo z0.s, z0.h
; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0
; CHECK-NEXT: ld1h { z0.s }, p0/z, [x0]
; 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) {
; CHECK-NEXT: and z0.d, z0.d, z1.d
; CHECK-NEXT: lsl z0.h, z0.h, #15
; CHECK-NEXT: asr z0.h, z0.h, #15
-; CHECK-NEXT: uunpklo z0.s, z0.h
+; CHECK-NEXT: sunpklo z0.s, z0.h
; CHECK-NEXT: cmpne p0.s, p0/z, z0.s, #0
; CHECK-NEXT: ld1sh { z0.s }, p0/z, [x0]
; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
More information about the llvm-commits
mailing list