Skip to content

Commit fa4d5b7

Browse files
- Add asserts for the result & operand types to ReplaceGetActiveLaneMaskResults
- Rename new test with partial extracts
1 parent 52434bc commit fa4d5b7

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27335,12 +27335,19 @@ void AArch64TargetLowering::ReplaceGetActiveLaneMaskResults(
2733527335
if (!Subtarget->hasSVE2p1())
2733627336
return;
2733727337

27338+
assert(N->getValueType(0) == MVT::nxv32i1 &&
27339+
"Unexpected result type for get.active.lane.mask");
27340+
2733827341
SDLoc DL(N);
2733927342
SDValue Idx = N->getOperand(0);
2734027343
SDValue TC = N->getOperand(1);
27344+
27345+
assert(Idx.getValueType().getFixedSizeInBits() <= 64 &&
27346+
"Unexpected operand type for get.active.lane.mask");
27347+
2734127348
if (Idx.getValueType() != MVT::i64) {
27342-
Idx = DAG.getZExtOrTrunc(Idx, DL, MVT::i64);
27343-
TC = DAG.getZExtOrTrunc(TC, DL, MVT::i64);
27349+
Idx = DAG.getNode(ISD::ZERO_EXTEND, DL, MVT::i64, Idx);
27350+
TC = DAG.getNode(ISD::ZERO_EXTEND, DL, MVT::i64, TC);
2734427351
}
2734527352

2734627353
SDValue ID =

llvm/test/CodeGen/AArch64/get-active-lane-mask-extract.ll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,8 @@ define void @test_2x16bit_mask_with_32bit_index_and_trip_count_ext8(i32 %i, i32
272272
ret void
273273
}
274274

275-
; Negative test for when not extracting exactly two halves of the source vector
276-
define void @test_illegal_type_with_partial_extracts(i32 %i, i32 %n) #0 {
277-
; CHECK-SVE-LABEL: test_illegal_type_with_partial_extracts:
275+
define void @test_2x16bit_mask_with_32bit_index_and_trip_count_part_extracts(i32 %i, i32 %n) #0 {
276+
; CHECK-SVE-LABEL: test_2x16bit_mask_with_32bit_index_and_trip_count_part_extracts:
278277
; CHECK-SVE: // %bb.0:
279278
; CHECK-SVE-NEXT: rdvl x8, #1
280279
; CHECK-SVE-NEXT: adds w8, w0, w8
@@ -285,7 +284,7 @@ define void @test_illegal_type_with_partial_extracts(i32 %i, i32 %n) #0 {
285284
; CHECK-SVE-NEXT: punpkhi p1.h, p1.b
286285
; CHECK-SVE-NEXT: b use
287286
;
288-
; CHECK-SVE2p1-LABEL: test_illegal_type_with_partial_extracts:
287+
; CHECK-SVE2p1-LABEL: test_2x16bit_mask_with_32bit_index_and_trip_count_part_extracts:
289288
; CHECK-SVE2p1: // %bb.0:
290289
; CHECK-SVE2p1-NEXT: mov w8, w1
291290
; CHECK-SVE2p1-NEXT: mov w9, w0

0 commit comments

Comments
 (0)