This patch is in a series of patches to provide
builtins for compatibility with the XL compiler.
This patch adds builtins related to floating point
operations
Details
- Reviewers
nemanjai stefanp amyk NeHuang - Group Reviewers
Restricted Project - Commits
- rGe002d251dd34: [PowerPC] Floating Point Builtins for XL Compat.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/test/CodeGen/builtins-ppc-xlcompat-sync.c | ||
---|---|---|
2 ↗ | (On Diff #352240) | Why change pwr7 to pwr8? |
llvm/lib/Target/PowerPC/PPCInstrInfo.td | ||
3341 | Seems we didn't exploit XXSEL in this case. But for sqrt/rsqrt, PPC has VSX and non-VSX versions for them: frsqrte - xsrsqrtedp frsqrtes - xsrsqrtesp fsqrt - xssqrtdp fsqrts - xssqrtsp So needs to add frsqrte here and xsrsqrtesp/xssqrtsp in VSX part? | |
llvm/test/CodeGen/builtins-ppc-xlcompat-fp.ll | ||
10 | You can use update_llc_test script to automatically update this file. And add non-vsx test? |
Overall looks good. Some nits as below.
clang/test/CodeGen/builtins-ppc-xlcompat-fp.c | ||
---|---|---|
10 |
extern double a; extern float b; extern float c;
| |
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
4986 | you can delete blank line and better add comments for the operation below. | |
4988 | Please use Ops as the variable name. |
llvm/test/CodeGen/builtins-ppc-xlcompat-fp.ll | ||
---|---|---|
19 | you can remove #0, #1 and #2 |
clang/test/CodeGen/builtins-ppc-xlcompat-sync.c | ||
---|---|---|
2 ↗ | (On Diff #352240) | This was to match the testing convention for XL compatibility builtins of targeting pwr7 for big endian and pwr8 for little endian. However, I will not be changing the sync tests in this patch, I have reversed those changes and will be putting them into a different patch. |
clang/test/CodeGen/builtins-ppc-xlcompat-fp.c | ||
---|---|---|
4 | nit: indentation on every second run line. We usually do two spaces more than the previous line. So I think it would look like: | |
20 | Do the entry lines cause an issue when we don't have asserts? | |
llvm/include/llvm/IR/IntrinsicsPowerPC.td | ||
1564 | Minor indentation nit. | |
1567 | Minor indentation nit to make it aligned with above. | |
llvm/test/CodeGen/builtins-ppc-xlcompat-fp.ll | ||
3 | Minor indentation nit: |
clang/test/CodeGen/builtins-ppc-xlcompat-fp.c | ||
---|---|---|
6 | AFAICT, nothing changes with Power8 so you might as well just have run lines for Power7 (AIX) and Power8 (LE). | |
llvm/include/llvm/IR/IntrinsicsPowerPC.td | ||
1564 | I don't think this indentation is desired. This makes it look like the first type on line 1529 belongs in the first list rather than the second list it belongs to. I suggest the following: def int_ppc_fsel : GCCBuiltin<"__builtin_ppc_fsel">, Intrinsic<[llvm_double_ty], [llvm_double_ty, llvm_double_ty, llvm_double_ty], [IntrNoMem]>; | |
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
4986 | I agree that this warrants a comment. However I don't think this is really what Victor had in mind. In general if your comment boils down to "this is what we are doing" and simply describes the code, it is not very useful. What your comment should address is "why are we doing this here and this way". To me as a reader, it is not at all clear why we manually select this to PPC::FSELS here. All the other intrinsics are matched with patterns in the .td file but this one is matched specifically here. Why? | |
llvm/test/CodeGen/builtins-ppc-xlcompat-fp.ll | ||
3 | Again, this is excessive. There should be run lines for Power8, Power8-32-bit, Power8-no-vsx, Power7. We don't really need a cross-product of triples and CPUs. |
Requesting changes to remove it from the queue until comments are addressed or answered.
LGTM aside from a very minor nit.
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | ||
---|---|---|
4986 | s/ppc_fels intrinsic/PPC::FSELS instruction since we aren't emitting an intrinsic, we are consuming it and emitting the instruction (well a MachineSDNode, but it represents an instruction). |
You missed a REQUIRES for the llvm test, I added one in: https://reviews.llvm.org/rG2404834c206a8930b0c420d94f4941b31c355de5
So if you see Arm-AArch64 quick bot failures, that was the reason.
Right, sorry about that. Thank you, I will also move the test to llvm/test/CodeGen/PowerPC
nit: indentation on every second run line. We usually do two spaces more than the previous line. So I think it would look like: