[PATCH] D116749: [AArch64][SVE] Fold predicate into compare
Cullen Rhodes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 7 04:20:53 PST 2022
c-rhodes marked an inline comment as done.
c-rhodes added inline comments.
================
Comment at: llvm/lib/Target/AArch64/SVEInstrFormats.td:4644
(cmp $Op1, $Op3, $Op2)>;
+ def : Pat<(predvt (and predvt:$Pg, (AArch64setcc_z (predvt (AArch64ptrue 31)), intvt:$Op2, intvt:$Op3, cc))),
+ (cmp $Pg, $Op2, $Op3)>;
----------------
david-arm wrote:
> I do wonder if it's also worth creating patterns for ands matching the first operand too, i.e.
>
> def : Pat<(predvt (and (AArch64setcc_z (predvt (AArch64ptrue 31)), intvt:$Op2, intvt:$Op3, cc))),
> (cmp $Pg, $Op2, $Op3), predvt:$Pg>;
>
> I'm thinking about the case where only one input to the `and` instruction is a `setcc`, i.e. see my comment about writing other test cases below.
> I do wonder if it's also worth creating patterns for ands matching the first operand too, i.e.
>
> def : Pat<(predvt (and (AArch64setcc_z (predvt (AArch64ptrue 31)), intvt:$Op2, intvt:$Op3, cc))),
> (cmp $Pg, $Op2, $Op3), predvt:$Pg>;
>
> I'm thinking about the case where only one input to the `and` instruction is a `setcc`, i.e. see my comment about writing other test cases below.
I've added the testcase you suggested and the codegen is as expected without this pattern, so I think we're good unless I'm missing something?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116749/new/
https://reviews.llvm.org/D116749
More information about the llvm-commits
mailing list