If we already have a AArch64ISD::ANDS node with identical operands, we can merge any ISD::AND into it, reducing the instruction count by calculating the value and the flags in a single operation. This code is taken from the X86 backend, and could also handle AArch64ISD::ADDS and AArch64ISD::SUBS, but I couldn't find any test cases where it came up.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14372 | Did you see the Note 2 lines up :) This code can also be used for AArch64::ADDS and AArch64::SUBS, I just couldn't find a testcase where it modified things yet. On X86 they lower certain x86 intrinsics straight to the nodes with make them easier to write tests for. | |
14382 | Hmm. A node that produces 2 results needs to be replaced by a node the produces 2 results. |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14372 | I did indeed. :) And despite that I still wondered if it was worth adding the extra argument at this point given there isn't any evidence that it's needed yet. |
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
14372 | Hmm. I think it makes the function less generic, and it would be good to re-use it for ADDS/SUBS. I feel like that's just worse. But then I did rename the functions already (I didn't like the old name it had), and never found a good test case for the ADDS/SUBS which was a shame. |
Nice one. LGTM if david has no other comments
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | ||
---|---|---|
17355 | ANDS -> ADDS |
Is there any need to pass in GenericOpc as it seems to always be ISD::AND?