Skip to content

Commit 03f752f

Browse files
- Expand get_active_lane_mask with type nxv1i1.
1 parent c4a7e8a commit 03f752f

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,9 +2105,10 @@ bool AArch64TargetLowering::shouldExpandGetActiveLaneMask(EVT ResVT,
21052105
if (!Subtarget->hasSVE() || ResVT.getVectorElementType() != MVT::i1)
21062106
return true;
21072107

2108-
// Only support illegal types if the result is scalable.
2109-
if (ResVT.isFixedLengthVector() && (ResVT.getVectorNumElements() > 16 ||
2110-
(OpVT != MVT::i32 && OpVT != MVT::i64)))
2108+
// Only support illegal types if the result is scalable and min elements > 1.
2109+
if (ResVT.getVectorMinNumElements() == 1 ||
2110+
(ResVT.isFixedLengthVector() && (ResVT.getVectorNumElements() > 16 ||
2111+
(OpVT != MVT::i32 && OpVT != MVT::i64))))
21112112
return true;
21122113

21132114
// 32 & 64 bit operands are supported. We can promote anything < 64 bits,

llvm/test/CodeGen/AArch64/active_lane_mask.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,22 @@ define <vscale x 7 x i1> @lane_mask_nxv7i1_i64(i64 %index, i64 %TC) {
174174
ret <vscale x 7 x i1> %active.lane.mask
175175
}
176176

177+
define <vscale x 1 x i1> @lane_mask_nxv1i1_i8(i32 %index, i32 %TC) {
178+
; CHECK-LABEL: lane_mask_nxv1i1_i8:
179+
; CHECK: // %bb.0:
180+
; CHECK-NEXT: index z0.s, #0, #1
181+
; CHECK-NEXT: mov z1.s, w0
182+
; CHECK-NEXT: ptrue p0.s
183+
; CHECK-NEXT: uqadd z0.s, z0.s, z1.s
184+
; CHECK-NEXT: mov z1.s, w1
185+
; CHECK-NEXT: cmphi p0.s, p0/z, z1.s, z0.s
186+
; CHECK-NEXT: punpklo p0.h, p0.b
187+
; CHECK-NEXT: punpklo p0.h, p0.b
188+
; CHECK-NEXT: ret
189+
%active.lane.mask = call <vscale x 1 x i1> @llvm.get.active.lane.mask.nxv1i1.i32(i32 %index, i32 %TC)
190+
ret <vscale x 1 x i1> %active.lane.mask
191+
}
192+
177193
; UTC_ARGS: --disable
178194
; This test exists to protect against a compiler crash caused by an attempt to
179195
; convert (via changeVectorElementType) an MVT into an EVT, which is impossible.
@@ -392,6 +408,7 @@ declare <vscale x 16 x i1> @llvm.get.active.lane.mask.nxv16i1.i32(i32, i32)
392408
declare <vscale x 8 x i1> @llvm.get.active.lane.mask.nxv8i1.i32(i32, i32)
393409
declare <vscale x 4 x i1> @llvm.get.active.lane.mask.nxv4i1.i32(i32, i32)
394410
declare <vscale x 2 x i1> @llvm.get.active.lane.mask.nxv2i1.i32(i32, i32)
411+
declare <vscale x 1 x i1> @llvm.get.active.lane.mask.nxv1i1.i32(i32, i32)
395412

396413
declare <vscale x 64 x i1> @llvm.get.active.lane.mask.nxv64i1.i64(i64, i64)
397414
declare <vscale x 32 x i1> @llvm.get.active.lane.mask.nxv32i1.i64(i64, i64)

0 commit comments

Comments
 (0)