[PATCH] D136244: [AArch64] Optimize memcmp when the result is tested for [in]equality with 0
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 22 06:55:52 PDT 2022
dmgreen added a comment.
Could this be done during lowering, int AArch64TargetLowering::LowerSETCC, or does that not work?
The getNZCVToSatisfyCondCode method is useful for getting the constant needed for CCMP's.
================
Comment at: llvm/test/CodeGen/AArch64/i128-cmp.ll:11
+; CHECK-NEXT: ccmp x1, x3, #0, eq
+; CHECK-NEXT: cset w0, ne
; CHECK-NEXT: ret
----------------
Are you sure this is correct? It doesn't look right.
I think I would expect `ccmp #0, eq; cset eq`.
================
Comment at: llvm/test/CodeGen/AArch64/i128-cmp.ll:21-22
+; CHECK-NEXT: cmp x0, x2
+; CHECK-NEXT: ccmp x1, x3, #0, eq
+; CHECK-NEXT: cset w0, eq
; CHECK-NEXT: ret
----------------
And here it needs to set based on ne, so maybe `ccmp #8, eq; cmp ne`.
Those two verify as equivalent.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136244/new/
https://reviews.llvm.org/D136244
More information about the llvm-commits
mailing list