[llvm] [AArch64] Add flag setting instructions to scheduling model. (PR #96880)

Rin Dobrescu via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 08:26:54 PDT 2024


https://github.com/Rin18 updated https://github.com/llvm/llvm-project/pull/96880

>From 81767ce9ee7b12e0c97d37e2da0713e61227f615 Mon Sep 17 00:00:00 2001
From: Rin Dobrescu <rin.dobrescu at arm.com>
Date: Wed, 26 Jun 2024 13:24:40 +0000
Subject: [PATCH 1/3] Add flag setting instructions to scheduling model.

---
 .../Target/AArch64/AArch64SchedNeoverseV2.td  |   9 +-
 .../AArch64/Neoverse/V2-basic-instructions.s  | 138 +++++++++---------
 2 files changed, 77 insertions(+), 70 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td b/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
index 7fed8fed90017..9f43db10c8d0f 100644
--- a/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
+++ b/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
@@ -1108,12 +1108,19 @@ def : InstRW<[V2Write_1cyc_1B_1R], (instrs BL, BLR)>;
 // ALU, basic
 // ALU, basic, flagset
 def : SchedAlias<WriteI, V2Write_1cyc_1I>;
-def : InstRW<[V2Write_1cyc_1F], (instregex "^(ADC|SBC)S[WX]r$")>;
+def : InstRW<[V2Write_1cyc_1F], (instregex "^(ADD|SUB)S[WX]r[ir]$",
+                        "^(ADC|SBC)S[WX]r$",
+                        "^ANDS[WX]ri$",
+                        "^(AND|BIC)S[WX]rr$")>;
 def : InstRW<[V2Write_0or1cyc_1I], (instregex "^MOVZ[WX]i$")>;
 
 // ALU, extend and shift
 def : SchedAlias<WriteIEReg, V2Write_2cyc_1M>;
 
+// Conditional compare
+def : InstRW<[V2Write_1cyc_1F],
+            (instregex "^CCMP(W|X)(i|r)", "^CCMN(W|X)(i|r)")>;
+
 // Arithmetic, LSL shift, shift <= 4
 // Arithmetic, flagset, LSL shift, shift <= 4
 // Arithmetic, LSR/ASR/ROR shift or LSL shift > 4
diff --git a/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s b/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s
index 20a38a55c1be1..32ec8247f3301 100644
--- a/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s
+++ b/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s
@@ -1404,16 +1404,16 @@ drps
 # CHECK-NEXT:  1      1     0.17                        sub	w4, w20, #546, lsl #12
 # CHECK-NEXT:  1      1     0.17                        sub	sp, sp, #288
 # CHECK-NEXT:  1      1     0.17                        sub	wsp, w19, #16
-# CHECK-NEXT:  1      1     0.17                        adds	w13, w23, #291, lsl #12
-# CHECK-NEXT:  1      1     0.17                        cmn	w2, #4095
-# CHECK-NEXT:  1      1     0.17                        adds	w20, wsp, #0
-# CHECK-NEXT:  1      1     0.17                        cmn	x3, #1, lsl #12
-# CHECK-NEXT:  1      1     0.17                        cmp	sp, #20, lsl #12
-# CHECK-NEXT:  1      1     0.17                        cmp	x30, #4095
-# CHECK-NEXT:  1      1     0.17                        subs	x4, sp, #3822
-# CHECK-NEXT:  1      1     0.17                        cmn	w3, #291, lsl #12
-# CHECK-NEXT:  1      1     0.17                        cmn	wsp, #1365
-# CHECK-NEXT:  1      1     0.17                        cmn	sp, #1092, lsl #12
+# CHECK-NEXT:  1      1     0.25                        adds	w13, w23, #291, lsl #12
+# CHECK-NEXT:  1      1     0.25                        cmn	w2, #4095
+# CHECK-NEXT:  1      1     0.25                        adds	w20, wsp, #0
+# CHECK-NEXT:  1      1     0.25                        cmn	x3, #1, lsl #12
+# CHECK-NEXT:  1      1     0.25                        cmp	sp, #20, lsl #12
+# CHECK-NEXT:  1      1     0.25                        cmp	x30, #4095
+# CHECK-NEXT:  1      1     0.25                        subs	x4, sp, #3822
+# CHECK-NEXT:  1      1     0.25                        cmn	w3, #291, lsl #12
+# CHECK-NEXT:  1      1     0.25                        cmn	wsp, #1365
+# CHECK-NEXT:  1      1     0.25                        cmn	sp, #1092, lsl #12
 # CHECK-NEXT:  1      1     0.17                        mov	sp, x30
 # CHECK-NEXT:  1      1     0.17                        mov	wsp, w20
 # CHECK-NEXT:  1      1     0.17                        mov	x11, sp
@@ -1699,30 +1699,30 @@ drps
 # CHECK-NEXT:  1      1     0.50                        b.ne	#4
 # CHECK-NEXT:  1      1     0.50                        b.ge	#1048572
 # CHECK-NEXT:  1      1     0.50                        b.ge	#-4
-# CHECK-NEXT:  1      1     0.17                        ccmp	w1, #31, #0, eq
-# CHECK-NEXT:  1      1     0.17                        ccmp	w3, #0, #15, hs
-# CHECK-NEXT:  1      1     0.17                        ccmp	wzr, #15, #13, hs
-# CHECK-NEXT:  1      1     0.17                        ccmp	x9, #31, #0, le
-# CHECK-NEXT:  1      1     0.17                        ccmp	x3, #0, #15, gt
-# CHECK-NEXT:  1      1     0.17                        ccmp	xzr, #5, #7, ne
-# CHECK-NEXT:  1      1     0.17                        ccmn	w1, #31, #0, eq
-# CHECK-NEXT:  1      1     0.17                        ccmn	w3, #0, #15, hs
-# CHECK-NEXT:  1      1     0.17                        ccmn	wzr, #15, #13, hs
-# CHECK-NEXT:  1      1     0.17                        ccmn	x9, #31, #0, le
-# CHECK-NEXT:  1      1     0.17                        ccmn	x3, #0, #15, gt
-# CHECK-NEXT:  1      1     0.17                        ccmn	xzr, #5, #7, ne
-# CHECK-NEXT:  1      1     0.17                        ccmp	w1, wzr, #0, eq
-# CHECK-NEXT:  1      1     0.17                        ccmp	w3, w0, #15, hs
-# CHECK-NEXT:  1      1     0.17                        ccmp	wzr, w15, #13, hs
-# CHECK-NEXT:  1      1     0.17                        ccmp	x9, xzr, #0, le
-# CHECK-NEXT:  1      1     0.17                        ccmp	x3, x0, #15, gt
-# CHECK-NEXT:  1      1     0.17                        ccmp	xzr, x5, #7, ne
-# CHECK-NEXT:  1      1     0.17                        ccmn	w1, wzr, #0, eq
-# CHECK-NEXT:  1      1     0.17                        ccmn	w3, w0, #15, hs
-# CHECK-NEXT:  1      1     0.17                        ccmn	wzr, w15, #13, hs
-# CHECK-NEXT:  1      1     0.17                        ccmn	x9, xzr, #0, le
-# CHECK-NEXT:  1      1     0.17                        ccmn	x3, x0, #15, gt
-# CHECK-NEXT:  1      1     0.17                        ccmn	xzr, x5, #7, ne
+# CHECK-NEXT:  1      1     0.25                        ccmp	w1, #31, #0, eq
+# CHECK-NEXT:  1      1     0.25                        ccmp	w3, #0, #15, hs
+# CHECK-NEXT:  1      1     0.25                        ccmp	wzr, #15, #13, hs
+# CHECK-NEXT:  1      1     0.25                        ccmp	x9, #31, #0, le
+# CHECK-NEXT:  1      1     0.25                        ccmp	x3, #0, #15, gt
+# CHECK-NEXT:  1      1     0.25                        ccmp	xzr, #5, #7, ne
+# CHECK-NEXT:  1      1     0.25                        ccmn	w1, #31, #0, eq
+# CHECK-NEXT:  1      1     0.25                        ccmn	w3, #0, #15, hs
+# CHECK-NEXT:  1      1     0.25                        ccmn	wzr, #15, #13, hs
+# CHECK-NEXT:  1      1     0.25                        ccmn	x9, #31, #0, le
+# CHECK-NEXT:  1      1     0.25                        ccmn	x3, #0, #15, gt
+# CHECK-NEXT:  1      1     0.25                        ccmn	xzr, #5, #7, ne
+# CHECK-NEXT:  1      1     0.25                        ccmp	w1, wzr, #0, eq
+# CHECK-NEXT:  1      1     0.25                        ccmp	w3, w0, #15, hs
+# CHECK-NEXT:  1      1     0.25                        ccmp	wzr, w15, #13, hs
+# CHECK-NEXT:  1      1     0.25                        ccmp	x9, xzr, #0, le
+# CHECK-NEXT:  1      1     0.25                        ccmp	x3, x0, #15, gt
+# CHECK-NEXT:  1      1     0.25                        ccmp	xzr, x5, #7, ne
+# CHECK-NEXT:  1      1     0.25                        ccmn	w1, wzr, #0, eq
+# CHECK-NEXT:  1      1     0.25                        ccmn	w3, w0, #15, hs
+# CHECK-NEXT:  1      1     0.25                        ccmn	wzr, w15, #13, hs
+# CHECK-NEXT:  1      1     0.25                        ccmn	x9, xzr, #0, le
+# CHECK-NEXT:  1      1     0.25                        ccmn	x3, x0, #15, gt
+# CHECK-NEXT:  1      1     0.25                        ccmn	xzr, x5, #7, ne
 # CHECK-NEXT:  1      1     0.17                        csel	w1, w0, w19, ne
 # CHECK-NEXT:  1      1     0.17                        csel	wzr, w5, w9, eq
 # CHECK-NEXT:  1      1     0.17                        csel	w9, wzr, w30, gt
@@ -2585,7 +2585,7 @@ drps
 
 # CHECK:      Resource pressure per iteration:
 # CHECK-NEXT: [0.0]  [0.1]  [1.0]  [1.1]  [2]    [3.0]  [3.1]  [4]    [5]    [6]    [7]    [8]    [9]    [10]   [11]   [12]   [13]
-# CHECK-NEXT: 11.00  11.00  33.00  33.00  99.00  165.00 165.00 326.58 181.58 109.58 109.58 91.83  91.83  190.00 146.00 30.00  10.00
+# CHECK-NEXT: 11.00  11.00  33.00  33.00  99.00  165.00 165.00 329.42 184.42 112.42 112.42 86.17  86.17  190.00 146.00 30.00  10.00
 
 # CHECK:      Resource pressure by instruction:
 # CHECK-NEXT: [0.0]  [0.1]  [1.0]  [1.1]  [2]    [3.0]  [3.1]  [4]    [5]    [6]    [7]    [8]    [9]    [10]   [11]   [12]   [13]   Instructions:
@@ -2604,16 +2604,16 @@ drps
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     sub	w4, w20, #546, lsl #12
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     sub	sp, sp, #288
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     sub	wsp, w19, #16
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     adds	w13, w23, #291, lsl #12
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     cmn	w2, #4095
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     adds	w20, wsp, #0
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     cmn	x3, #1, lsl #12
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     cmp	sp, #20, lsl #12
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     cmp	x30, #4095
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     subs	x4, sp, #3822
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     cmn	w3, #291, lsl #12
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     cmn	wsp, #1365
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     cmn	sp, #1092, lsl #12
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     adds	w13, w23, #291, lsl #12
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     cmn	w2, #4095
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     adds	w20, wsp, #0
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     cmn	x3, #1, lsl #12
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     cmp	sp, #20, lsl #12
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     cmp	x30, #4095
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     subs	x4, sp, #3822
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     cmn	w3, #291, lsl #12
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     cmn	wsp, #1365
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     cmn	sp, #1092, lsl #12
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     mov	sp, x30
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     mov	wsp, w20
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     mov	x11, sp
@@ -2899,30 +2899,30 @@ drps
 # CHECK-NEXT: 0.50   0.50    -      -      -      -      -      -      -      -      -      -      -      -      -      -      -     b.ne	#4
 # CHECK-NEXT: 0.50   0.50    -      -      -      -      -      -      -      -      -      -      -      -      -      -      -     b.ge	#1048572
 # CHECK-NEXT: 0.50   0.50    -      -      -      -      -      -      -      -      -      -      -      -      -      -      -     b.ge	#-4
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	w1, #31, #0, eq
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	w3, #0, #15, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	wzr, #15, #13, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	x9, #31, #0, le
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	x3, #0, #15, gt
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	xzr, #5, #7, ne
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	w1, #31, #0, eq
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	w3, #0, #15, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	wzr, #15, #13, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	x9, #31, #0, le
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	x3, #0, #15, gt
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	xzr, #5, #7, ne
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	w1, wzr, #0, eq
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	w3, w0, #15, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	wzr, w15, #13, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	x9, xzr, #0, le
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	x3, x0, #15, gt
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmp	xzr, x5, #7, ne
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	w1, wzr, #0, eq
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	w3, w0, #15, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	wzr, w15, #13, hs
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	x9, xzr, #0, le
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	x3, x0, #15, gt
-# CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     ccmn	xzr, x5, #7, ne
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	w1, #31, #0, eq
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	w3, #0, #15, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	wzr, #15, #13, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	x9, #31, #0, le
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	x3, #0, #15, gt
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	xzr, #5, #7, ne
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	w1, #31, #0, eq
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	w3, #0, #15, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	wzr, #15, #13, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	x9, #31, #0, le
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	x3, #0, #15, gt
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	xzr, #5, #7, ne
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	w1, wzr, #0, eq
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	w3, w0, #15, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	wzr, w15, #13, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	x9, xzr, #0, le
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	x3, x0, #15, gt
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmp	xzr, x5, #7, ne
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	w1, wzr, #0, eq
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	w3, w0, #15, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	wzr, w15, #13, hs
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	x9, xzr, #0, le
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	x3, x0, #15, gt
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ccmn	xzr, x5, #7, ne
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     csel	w1, w0, w19, ne
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     csel	wzr, w5, w9, eq
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     csel	w9, wzr, w30, gt

>From c4e73ac97de233bc403eb13cecac0b69b6ed4ee5 Mon Sep 17 00:00:00 2001
From: Rin Dobrescu <rin.dobrescu at arm.com>
Date: Thu, 27 Jun 2024 11:20:08 +0000
Subject: [PATCH 2/3] Remove duplicate of logical flagset.

---
 llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td b/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
index 9f43db10c8d0f..8c18baa02352b 100644
--- a/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
+++ b/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
@@ -1110,8 +1110,7 @@ def : InstRW<[V2Write_1cyc_1B_1R], (instrs BL, BLR)>;
 def : SchedAlias<WriteI, V2Write_1cyc_1I>;
 def : InstRW<[V2Write_1cyc_1F], (instregex "^(ADD|SUB)S[WX]r[ir]$",
                         "^(ADC|SBC)S[WX]r$",
-                        "^ANDS[WX]ri$",
-                        "^(AND|BIC)S[WX]rr$")>;
+                        "^ANDS[WX]ri$")>;
 def : InstRW<[V2Write_0or1cyc_1I], (instregex "^MOVZ[WX]i$")>;
 
 // ALU, extend and shift

>From 4119a7139b0c38328189b5e827c9ec3934f56b10 Mon Sep 17 00:00:00 2001
From: Rin Dobrescu <rin.dobrescu at arm.com>
Date: Thu, 27 Jun 2024 15:24:24 +0000
Subject: [PATCH 3/3] Address PR comments.

---
 llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td         | 3 +--
 .../llvm-mca/AArch64/Neoverse/V2-basic-instructions.s     | 8 +++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td b/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
index 8c18baa02352b..c17a3884867e8 100644
--- a/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
+++ b/llvm/lib/Target/AArch64/AArch64SchedNeoverseV2.td
@@ -1117,8 +1117,7 @@ def : InstRW<[V2Write_0or1cyc_1I], (instregex "^MOVZ[WX]i$")>;
 def : SchedAlias<WriteIEReg, V2Write_2cyc_1M>;
 
 // Conditional compare
-def : InstRW<[V2Write_1cyc_1F],
-            (instregex "^CCMP(W|X)(i|r)", "^CCMN(W|X)(i|r)")>;
+def : InstRW<[V2Write_1cyc_1F], (instregex "^CCM[NP][WX][ir]")>;
 
 // Arithmetic, LSL shift, shift <= 4
 // Arithmetic, flagset, LSL shift, shift <= 4
diff --git a/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s b/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s
index 32ec8247f3301..9a3bcac69582a 100644
--- a/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s
+++ b/llvm/test/tools/llvm-mca/AArch64/Neoverse/V2-basic-instructions.s
@@ -1294,6 +1294,8 @@ ldnp      q23, q29, [x1, #-1024]
 
 mov      w3, #983055
 mov      x10, #-6148914691236517206
+ands     w4, w4, #983055
+ands     x11, x11, #-6148914691236517206
 
 #------------------------------------------------------------------------------
 # Logical (shifted register)
@@ -2508,6 +2510,8 @@ drps
 # CHECK-NEXT:  3      6     0.67    *                   ldnp	q23, q29, [x1, #-1024]
 # CHECK-NEXT:  1      1     0.17                        mov	w3, #983055
 # CHECK-NEXT:  1      1     0.17                        mov	x10, #-6148914691236517206
+# CHECK-NEXT:  1      1     0.25                        ands	w4, w4, #0xf000f
+# CHECK-NEXT:  1      1     0.25                        ands	x11, x11, #0xaaaaaaaaaaaaaaaa
 # CHECK-NEXT:  1      1     0.17                        and	w12, w23, w21
 # CHECK-NEXT:  1      1     0.17                        and	w16, w15, w1, lsl #1
 # CHECK-NEXT:  1      1     0.17                        and	w9, w4, w10, lsl #31
@@ -2585,7 +2589,7 @@ drps
 
 # CHECK:      Resource pressure per iteration:
 # CHECK-NEXT: [0.0]  [0.1]  [1.0]  [1.1]  [2]    [3.0]  [3.1]  [4]    [5]    [6]    [7]    [8]    [9]    [10]   [11]   [12]   [13]
-# CHECK-NEXT: 11.00  11.00  33.00  33.00  99.00  165.00 165.00 329.42 184.42 112.42 112.42 86.17  86.17  190.00 146.00 30.00  10.00
+# CHECK-NEXT: 11.00  11.00  33.00  33.00  99.00  165.00 165.00 329.92 184.92 112.92 112.92 86.17  86.17  190.00 146.00 30.00  10.00
 
 # CHECK:      Resource pressure by instruction:
 # CHECK-NEXT: [0.0]  [0.1]  [1.0]  [1.1]  [2]    [3.0]  [3.1]  [4]    [5]    [6]    [7]    [8]    [9]    [10]   [11]   [12]   [13]   Instructions:
@@ -3708,6 +3712,8 @@ drps
 # CHECK-NEXT:  -      -      -      -     0.67   0.67   0.67    -      -      -      -      -      -      -      -      -      -     ldnp	q23, q29, [x1, #-1024]
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     mov	w3, #983055
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     mov	x10, #-6148914691236517206
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ands	w4, w4, #0xf000f
+# CHECK-NEXT:  -      -      -      -      -      -      -     0.25   0.25   0.25   0.25    -      -      -      -      -      -     ands	x11, x11, #0xaaaaaaaaaaaaaaaa
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     and	w12, w23, w21
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     and	w16, w15, w1, lsl #1
 # CHECK-NEXT:  -      -      -      -      -      -      -     0.17   0.17   0.17   0.17   0.17   0.17    -      -      -      -     and	w9, w4, w10, lsl #31



More information about the llvm-commits mailing list