This patch is in a series of patches to provide builtins for compatibility
with the XL compiler. This patch adds the builtins and emit target independent
code for rotate related operations.
Details
- Reviewers
nemanjai stefanp - Group Reviewers
Restricted Project - Commits
- rGd40e8091bd1f: [PowerPC] Add PowerPC rotate related builtins and emit target independent code…
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
- Rebased the patch with ToT and the patch https://reviews.llvm.org/D102875
- Create the patch with all contexts. (Thanks @qiucf)
clang/include/clang/Sema/Sema.h | ||
---|---|---|
12559 | I don't think these names adequately describe what the check is. We are not checking if PPC/PPC64 is a run of ones. In fact, the concept of a contiguous mask is in no way specific to PPC so we don't really need to differentiate this as a PPC-specific check. | |
clang/lib/Sema/SemaChecking.cpp | ||
3315 | Isn't a zero technically a contiguous run of ones (of length zero)? | |
3406 | Please describe in a comment why we need to ensure that the argument is a contiguous mask. | |
3407 | We seem to populate the Result here. If we already have the Result (i.e. the constant value) can't we just simply check if that is a run of ones? Then we can greatly simplify CheckPPCisRunOfOnes() and CheckPPC64isRunOfOnes() (and we may not actually need two functions since Result will be an APSInt that knows how wide it is. We could presumably just have: |
LGTM other than a couple of nits.
clang/lib/CodeGen/CGBuiltin.cpp | ||
---|---|---|
15175 | Please add a comment describing the emitted code. Something like: // Rotate and insert under mask operation. // __rlwimi(rs, is, shift, mask) // rotl(rs, shift) & mask) | (is & ~mask) | |
15181 | Nit: s/shift/Shift to conform to variable naming conventions. Here and elsewhere. |
I don't think these names adequately describe what the check is. We are not checking if PPC/PPC64 is a run of ones. In fact, the concept of a contiguous mask is in no way specific to PPC so we don't really need to differentiate this as a PPC-specific check.
Also, the convention seems to be to prefix all names with Sema. Let's not part with that convention.
Perhaps SemaValueIsRunOfOnes() or SemaArgIsRunOfOnes().