Skip to content

Commit d4a6995

Browse files
committed
[AArch64][GlobalISel] Legalize large G_SEXT_INREG
These come from the legalization of other operations, but it makes sense to split the operations into legal sizes before lowering them.
1 parent 4b2f118 commit d4a6995

File tree

9 files changed

+684
-459
lines changed

9 files changed

+684
-459
lines changed

llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,10 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
623623
.legalFor({s32, s64})
624624
.legalFor(PackedVectorAllTypeList)
625625
.maxScalar(0, s64)
626+
.clampNumElements(0, v8s8, v16s8)
627+
.clampNumElements(0, v4s16, v8s16)
628+
.clampNumElements(0, v2s32, v4s32)
629+
.clampMaxNumElements(0, s64, 2)
626630
.lower();
627631

628632
// FP conversions

llvm/test/CodeGen/AArch64/aarch64-addv.ll

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ declare i64 @llvm.vector.reduce.add.v3i64(<3 x i64>)
2323
declare i64 @llvm.vector.reduce.add.v4i64(<4 x i64>)
2424
declare i128 @llvm.vector.reduce.add.v2i128(<2 x i128>)
2525

26-
; GISEL: warning: Instruction selection used fallback path for addv_v2i8
27-
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i8
28-
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v4i8
29-
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v2i16
30-
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i16
31-
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i32
32-
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i64
33-
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v2i128
26+
; GISEL: warning: Instruction selection used fallback path for addv_v2i8
27+
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i8
28+
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v4i8
29+
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v2i16
30+
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i16
31+
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i32
32+
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v3i64
33+
; GISEL-NEXT: warning: Instruction selection used fallback path for addv_v2i128
3434

3535

3636
define i8 @add_B(ptr %arr) {
@@ -101,16 +101,12 @@ define i32 @oversized_ADDV_256(ptr noalias nocapture readonly %arg1, ptr noalias
101101
; GISEL-NEXT: ushll v2.8h, v2.8b, #0
102102
; GISEL-NEXT: usubl v3.4s, v1.4h, v2.4h
103103
; GISEL-NEXT: usubl2 v1.4s, v1.8h, v2.8h
104-
; GISEL-NEXT: cmgt v2.4s, v0.4s, v3.4s
104+
; GISEL-NEXT: neg v2.4s, v3.4s
105+
; GISEL-NEXT: neg v4.4s, v1.4s
106+
; GISEL-NEXT: cmgt v5.4s, v0.4s, v3.4s
105107
; GISEL-NEXT: cmgt v0.4s, v0.4s, v1.4s
106-
; GISEL-NEXT: neg v4.4s, v3.4s
107-
; GISEL-NEXT: neg v5.4s, v1.4s
108-
; GISEL-NEXT: shl v2.4s, v2.4s, #31
109-
; GISEL-NEXT: shl v0.4s, v0.4s, #31
110-
; GISEL-NEXT: sshr v2.4s, v2.4s, #31
111-
; GISEL-NEXT: sshr v0.4s, v0.4s, #31
112-
; GISEL-NEXT: bsl v2.16b, v4.16b, v3.16b
113-
; GISEL-NEXT: bsl v0.16b, v5.16b, v1.16b
108+
; GISEL-NEXT: bif v2.16b, v3.16b, v5.16b
109+
; GISEL-NEXT: bsl v0.16b, v4.16b, v1.16b
114110
; GISEL-NEXT: add v0.4s, v2.4s, v0.4s
115111
; GISEL-NEXT: addv s0, v0.4s
116112
; GISEL-NEXT: fmov w0, s0

0 commit comments

Comments
 (0)