Skip to content

Commit f2593a0

Browse files
committed
[AArch64][SVE] Remove redundant PTEST of MATCH/NMATCH results
Co-authored-by: Paul Walker <[email protected]> Differential Revision: https://reviews.llvm.org/D99584
1 parent aa3e78a commit f2593a0

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7513,6 +7513,7 @@ class sve2_char_match<bit sz, bit opc, string asm,
75137513
let Inst{3-0} = Pd;
75147514

75157515
let Defs = [NZCV];
7516+
let isPTestLike = 1;
75167517
}
75177518

75187519
multiclass sve2_char_match<bit opc, string asm, SDPatternOperator op> {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -mtriple=aarch64--linux-gnu -mattr=+sve2 %s -o - | FileCheck %s
3+
4+
;
5+
; MATCH
6+
;
7+
8+
define i32 @match_nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) {
9+
; CHECK-LABEL: match_nxv16i8:
10+
; CHECK: // %bb.0:
11+
; CHECK-NEXT: match p0.b, p0/z, z0.b, z1.b
12+
; CHECK-NEXT: cset w0, ne
13+
; CHECK-NEXT: ret
14+
%1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b)
15+
%2 = tail call i1 @llvm.aarch64.sve.ptest.any(<vscale x 16 x i1> %pg, <vscale x 16 x i1> %1)
16+
%conv = zext i1 %2 to i32
17+
ret i32 %conv
18+
}
19+
20+
;
21+
; NMATCH
22+
;
23+
24+
define i32 @nmatch_nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) {
25+
; CHECK-LABEL: nmatch_nxv16i8:
26+
; CHECK: // %bb.0:
27+
; CHECK-NEXT: nmatch p0.b, p0/z, z0.b, z1.b
28+
; CHECK-NEXT: cset w0, ne
29+
; CHECK-NEXT: ret
30+
%1 = tail call <vscale x 16 x i1> @llvm.aarch64.sve.nmatch.nxv16i8(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b)
31+
%2 = tail call i1 @llvm.aarch64.sve.ptest.any(<vscale x 16 x i1> %pg, <vscale x 16 x i1> %1)
32+
%conv = zext i1 %2 to i32
33+
ret i32 %conv
34+
}
35+
36+
declare <vscale x 16 x i1> @llvm.aarch64.sve.match.nxv16i8(<vscale x 16 x i1>, <vscale x 16 x i8>, <vscale x 16 x i8>)
37+
declare <vscale x 16 x i1> @llvm.aarch64.sve.nmatch.nxv16i8(<vscale x 16 x i1>, <vscale x 16 x i8>, <vscale x 16 x i8>)
38+
declare i1 @llvm.aarch64.sve.ptest.any(<vscale x 16 x i1>, <vscale x 16 x i1>)

0 commit comments

Comments
 (0)