Skip to content

Commit ae9048f

Browse files
committed
fixup! fixup! [AArch64][GlobalISel] Legalize G_ABS for Larger/Smaller Vectors
1 parent 0a2704e commit ae9048f

File tree

2 files changed

+9
-39
lines changed

2 files changed

+9
-39
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
993993
.clampNumElements(0, v4s16, v8s16)
994994
.clampNumElements(0, v2s32, v4s32)
995995
.clampNumElements(0, v2s64, v2s64)
996+
.moreElementsToNextPow2(0)
996997
.lower();
997998

998999
// For fadd reductions we have pairwise operations available. We treat the

llvm/test/CodeGen/AArch64/abs.ll

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -350,52 +350,21 @@ entry:
350350
declare <3 x i16> @llvm.abs.v3i16(<3 x i16>, i1)
351351

352352
define <7 x i16> @abs_v7i16(<7 x i16> %a){
353-
; CHECK-SD-LABEL: abs_v7i16:
354-
; CHECK-SD: // %bb.0: // %entry
355-
; CHECK-SD-NEXT: abs v0.8h, v0.8h
356-
; CHECK-SD-NEXT: ret
357-
;
358-
; CHECK-GI-LABEL: abs_v7i16:
359-
; CHECK-GI: // %bb.0: // %entry
360-
; CHECK-GI-NEXT: mov w8, #15 // =0xf
361-
; CHECK-GI-NEXT: fmov s1, w8
362-
; CHECK-GI-NEXT: mov v2.16b, v1.16b
363-
; CHECK-GI-NEXT: mov v2.h[1], v1.h[0]
364-
; CHECK-GI-NEXT: mov v2.h[2], v1.h[0]
365-
; CHECK-GI-NEXT: mov v2.h[3], v1.h[0]
366-
; CHECK-GI-NEXT: mov v2.h[4], v1.h[0]
367-
; CHECK-GI-NEXT: mov v2.h[5], v1.h[0]
368-
; CHECK-GI-NEXT: mov v2.h[6], v1.h[0]
369-
; CHECK-GI-NEXT: mov v2.h[7], v0.h[0]
370-
; CHECK-GI-NEXT: neg v1.8h, v2.8h
371-
; CHECK-GI-NEXT: sshl v1.8h, v0.8h, v1.8h
372-
; CHECK-GI-NEXT: add v0.8h, v0.8h, v1.8h
373-
; CHECK-GI-NEXT: eor v0.16b, v0.16b, v1.16b
374-
; CHECK-GI-NEXT: ret
353+
; CHECK-LABEL: abs_v7i16:
354+
; CHECK: // %bb.0: // %entry
355+
; CHECK-NEXT: abs v0.8h, v0.8h
356+
; CHECK-NEXT: ret
375357
entry:
376358
%res = call <7 x i16> @llvm.abs.v7i16(<7 x i16> %a, i1 0)
377359
ret <7 x i16> %res
378360
}
379361
declare <7 x i16> @llvm.abs.v7i16(<7 x i16>, i1)
380362

381363
define <3 x i32> @abs_v3i32(<3 x i32> %a){
382-
; CHECK-SD-LABEL: abs_v3i32:
383-
; CHECK-SD: // %bb.0: // %entry
384-
; CHECK-SD-NEXT: abs v0.4s, v0.4s
385-
; CHECK-SD-NEXT: ret
386-
;
387-
; CHECK-GI-LABEL: abs_v3i32:
388-
; CHECK-GI: // %bb.0: // %entry
389-
; CHECK-GI-NEXT: mov w8, #31 // =0x1f
390-
; CHECK-GI-NEXT: fmov s1, w8
391-
; CHECK-GI-NEXT: mov v1.s[1], w8
392-
; CHECK-GI-NEXT: mov v1.s[2], w8
393-
; CHECK-GI-NEXT: mov v1.s[3], w8
394-
; CHECK-GI-NEXT: neg v1.4s, v1.4s
395-
; CHECK-GI-NEXT: sshl v1.4s, v0.4s, v1.4s
396-
; CHECK-GI-NEXT: add v0.4s, v0.4s, v1.4s
397-
; CHECK-GI-NEXT: eor v0.16b, v0.16b, v1.16b
398-
; CHECK-GI-NEXT: ret
364+
; CHECK-LABEL: abs_v3i32:
365+
; CHECK: // %bb.0: // %entry
366+
; CHECK-NEXT: abs v0.4s, v0.4s
367+
; CHECK-NEXT: ret
399368
entry:
400369
%res = call <3 x i32> @llvm.abs.v3i32(<3 x i32> %a, i1 0)
401370
ret <3 x i32> %res

0 commit comments

Comments
 (0)