[PATCH] D105194: [PowerPC] Add PowerPC cmpb builtin and emit target indepedent code for XL compatibility
Nemanja Ivanovic via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 13 07:29:11 PDT 2021
nemanjai requested changes to this revision.
nemanjai added a comment.
This revision now requires changes to proceed.
Also if we are going to be emitting this complex sequence, in the description of the patch, point out the test case that shows the back end handles this and emits a single instruction.
================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:15081
}
+ case PPC::BI__builtin_ppc_cmpb: {
+ llvm::Type *Ty = Ops[0]->getType();
----------------
I find it rather surprising that we are emitting this complex sequence for this builtin. Perhaps there is a good reason for doing so, but at the very least, this requires a thorough explanation in a comment.
One additional concern I have with this is that if some transformation proves that some portion of this is unused (perhaps using `DemandedBits` analysis), it may optimize out a portion of this, thereby making the sequence emit a whole bunch of xor's, or's, rotates, etc.
For example:
```
...
unsigned long long A = __builtin_ppc_cmpb(B, C);
return A & 0xFF00FF00FF00FF;
```
It is entirely possible that the optimizer will get rid of some of the produced instructions and then the back end won't be able to emit a single `cmpb` but will have to emit a whole bunch of scalar instructions.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105194/new/
https://reviews.llvm.org/D105194
More information about the cfe-commits
mailing list