[llvm] [AArch64][SVE] Fold ADD+CNTB to INCB and DECB (PR #118280)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 04:22:33 PST 2024


================
@@ -271,9 +271,9 @@ define void @str_with_off_15(ptr %ptr) {
 define void @str_with_off_15mulvl(ptr %ptr) {
 ; CHECK-LABEL: str_with_off_15mulvl:
 ; CHECK:       // %bb.0:
+; CHECK-NEXT:    incb x0, all, mul #15
----------------
rj-jesus wrote:

It is, though for consistency I thought it would be better to default to INCB, which GCC also [seems to prefer](https://godbolt.org/z/34799Kfqr). Since the slow case of INCB has the same performance as ADDVL, the only problem I saw with this was if we had to read/write from different registers, which ADDVL could do in a single instruction whereas INCB would need a MOV too, but I thought this could be matched from MOV+INCB for example.

That said, I'm happy to restrict INCB to the 1/2/4 forms if you think that's better overall. What do you think?

https://github.com/llvm/llvm-project/pull/118280


More information about the llvm-commits mailing list