GitHub Issue #61767
With a previous patch to canonicalize SPF to min/max intrinsics (a266af721153), we saw a 6% performance regression from our out-of-tree compiler on 372.smithwa.
This patch attempts to recover from the SPF canonicalization by peeping smin(a,0) and smax(a,0) SELECT_CC patterns during AArch64ISelLowering. We'll match the following patterns:
(SELECT_CC setgt, lhs, 0, lhs, 0) -> (BIC lhs, (SRA lhs, typesize-1))
(SELECT_CC setlt, lhs, 0, lhs, 0) -> (AND lhs, (SRA lhs, typesize-1))
Notice that there's some noise in the existing test cases. They haven't been run through update_llc_test_checks.py since the assembly comments for constants have been added. I will update those tests pre-commit if that will help.
Is this checking both operands for zero because they might still be different zeroes?