Skip to content

Commit a96b044

Browse files
davemgreentstellar
authored andcommitted
[AArch64] Remove invalid uabdl patterns. (#89272)
These were added in https://reviews.llvm.org/D14208, which look like they attempt to detect abs from xor+add+ashr. They do not appear to be detecting the correct value for the src input though, which I think is intended to be the sub(zext, zext) part of the pattern. We have pattens from abs now, so the old invalid patterns can be removed. Fixes #88784 (cherry picked from commit 851462f)
1 parent aea091b commit a96b044

File tree

2 files changed

+48
-10
lines changed

2 files changed

+48
-10
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.td

-10
Original file line numberDiff line numberDiff line change
@@ -4885,19 +4885,9 @@ defm UABDL : SIMDLongThreeVectorBHSabdl<1, 0b0111, "uabdl",
48854885
def : Pat<(abs (v8i16 (sub (zext (v8i8 V64:$opA)),
48864886
(zext (v8i8 V64:$opB))))),
48874887
(UABDLv8i8_v8i16 V64:$opA, V64:$opB)>;
4888-
def : Pat<(xor (v8i16 (AArch64vashr v8i16:$src, (i32 15))),
4889-
(v8i16 (add (sub (zext (v8i8 V64:$opA)),
4890-
(zext (v8i8 V64:$opB))),
4891-
(AArch64vashr v8i16:$src, (i32 15))))),
4892-
(UABDLv8i8_v8i16 V64:$opA, V64:$opB)>;
48934888
def : Pat<(abs (v8i16 (sub (zext (extract_high_v16i8 (v16i8 V128:$opA))),
48944889
(zext (extract_high_v16i8 (v16i8 V128:$opB)))))),
48954890
(UABDLv16i8_v8i16 V128:$opA, V128:$opB)>;
4896-
def : Pat<(xor (v8i16 (AArch64vashr v8i16:$src, (i32 15))),
4897-
(v8i16 (add (sub (zext (extract_high_v16i8 (v16i8 V128:$opA))),
4898-
(zext (extract_high_v16i8 (v16i8 V128:$opB)))),
4899-
(AArch64vashr v8i16:$src, (i32 15))))),
4900-
(UABDLv16i8_v8i16 V128:$opA, V128:$opB)>;
49014891
def : Pat<(abs (v4i32 (sub (zext (v4i16 V64:$opA)),
49024892
(zext (v4i16 V64:$opB))))),
49034893
(UABDLv4i16_v4i32 V64:$opA, V64:$opB)>;

llvm/test/CodeGen/AArch64/arm64-vabs.ll

+48
Original file line numberDiff line numberDiff line change
@@ -1848,3 +1848,51 @@ define <2 x i128> @uabd_i64(<2 x i64> %a, <2 x i64> %b) {
18481848
%absel = select <2 x i1> %abcmp, <2 x i128> %ababs, <2 x i128> %abdiff
18491849
ret <2 x i128> %absel
18501850
}
1851+
1852+
define <8 x i16> @pr88784(<8 x i8> %l0, <8 x i8> %l1, <8 x i16> %l2) {
1853+
; CHECK-SD-LABEL: pr88784:
1854+
; CHECK-SD: // %bb.0:
1855+
; CHECK-SD-NEXT: usubl.8h v0, v0, v1
1856+
; CHECK-SD-NEXT: cmlt.8h v1, v2, #0
1857+
; CHECK-SD-NEXT: ssra.8h v0, v2, #15
1858+
; CHECK-SD-NEXT: eor.16b v0, v1, v0
1859+
; CHECK-SD-NEXT: ret
1860+
;
1861+
; CHECK-GI-LABEL: pr88784:
1862+
; CHECK-GI: // %bb.0:
1863+
; CHECK-GI-NEXT: usubl.8h v0, v0, v1
1864+
; CHECK-GI-NEXT: sshr.8h v1, v2, #15
1865+
; CHECK-GI-NEXT: ssra.8h v0, v2, #15
1866+
; CHECK-GI-NEXT: eor.16b v0, v1, v0
1867+
; CHECK-GI-NEXT: ret
1868+
%l4 = zext <8 x i8> %l0 to <8 x i16>
1869+
%l5 = ashr <8 x i16> %l2, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
1870+
%l6 = zext <8 x i8> %l1 to <8 x i16>
1871+
%l7 = sub <8 x i16> %l4, %l6
1872+
%l8 = add <8 x i16> %l5, %l7
1873+
%l9 = xor <8 x i16> %l5, %l8
1874+
ret <8 x i16> %l9
1875+
}
1876+
1877+
define <8 x i16> @pr88784_fixed(<8 x i8> %l0, <8 x i8> %l1, <8 x i16> %l2) {
1878+
; CHECK-SD-LABEL: pr88784_fixed:
1879+
; CHECK-SD: // %bb.0:
1880+
; CHECK-SD-NEXT: uabdl.8h v0, v0, v1
1881+
; CHECK-SD-NEXT: ret
1882+
;
1883+
; CHECK-GI-LABEL: pr88784_fixed:
1884+
; CHECK-GI: // %bb.0:
1885+
; CHECK-GI-NEXT: usubl.8h v0, v0, v1
1886+
; CHECK-GI-NEXT: sshr.8h v1, v0, #15
1887+
; CHECK-GI-NEXT: ssra.8h v0, v0, #15
1888+
; CHECK-GI-NEXT: eor.16b v0, v1, v0
1889+
; CHECK-GI-NEXT: ret
1890+
%l4 = zext <8 x i8> %l0 to <8 x i16>
1891+
%l6 = zext <8 x i8> %l1 to <8 x i16>
1892+
%l7 = sub <8 x i16> %l4, %l6
1893+
%l5 = ashr <8 x i16> %l7, <i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15, i16 15>
1894+
%l8 = add <8 x i16> %l5, %l7
1895+
%l9 = xor <8 x i16> %l5, %l8
1896+
ret <8 x i16> %l9
1897+
}
1898+

0 commit comments

Comments
 (0)