[AArch64] Increase AddedComplexity of BIC
authorAlexander Shaposhnikov <ashaposhnikov@google.com>
Tue, 6 Sep 2022 20:28:17 +0000 (20:28 +0000)
committerAlexander Shaposhnikov <ashaposhnikov@google.com>
Tue, 6 Sep 2022 20:31:24 +0000 (20:31 +0000)
commit6a2442e9be2529ee00b0239330df068b91c92aab
tree96f2da0c9b746f86ba16a9101f2d1aaa566c26a3
parent31f434ee3b06e99bff86adc8bae7fd6ba705c097
[AArch64] Increase AddedComplexity of BIC

This diff adjusts AddedComplexity of BIC to bump its position
in the list of patterns to make LLVM pick it instead of MVN + AND.
MVN + AND requires 2 cycles, so does e.g. MOV + BIC, but the latter
outperforms the former if the instructions producing the operands of
BIC can be issued in parallel.

One may consider the following example:

ldur x15, [x0, #2] # 4 cycles
mvn x10, x15 # 1 cycle (depends on ldur)
and x9, x10, #0x8080808080808080

vs.

ldur x15, [x0, #2] # 4 cycles
mov x9, #0x8080808080808080 # 1 cycle (can be executed in parallel with ldur)
bic x9, x9, x15. # 1 cycle

Test plan: ninja check-all

Differential revision: https://reviews.llvm.org/D133345
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/test/CodeGen/AArch64/addsub.ll
llvm/test/CodeGen/AArch64/dag-combine-setcc.ll
llvm/test/CodeGen/AArch64/select_const.ll