Implemented Builtins for vector right and left shift along with appropriate test cases for ISA3.1. Depends on D83516.
Details
- Reviewers
saghir nemanjai hfinkel amyk - Group Reviewers
Restricted Project - Commits
- rG3136cbe29e74: [PowerPC] Implement Vector Shift Builtins
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This will need to be rebased against your 2608 instruction definitions patch.
But yes, I believe you are missing the clang and llc test case for this patch. Requesting changes due to missing tests.
clang/lib/Headers/altivec.h | ||
---|---|---|
17325 | /* vs[l | r | raq] */ (with a new line after the comment) |
clang/lib/Headers/altivec.h | ||
---|---|---|
17325 | I think we can remove /* vector shifts for quadwords */. | |
clang/test/CodeGen/builtins-ppc-p10vector.c | ||
741 | vector unsigned you mean? For the return of this test and every other unsigned test case. | |
llvm/lib/Target/PowerPC/PPCInstrPrefix.td | ||
1266โ1267 | nit: remove extra space after < | |
1268 | nit: remove after space before , | |
1274 | Unrelated space change? | |
llvm/test/CodeGen/PowerPC/p10-vector-shift.ll | ||
11 | Can probably remove these globals as you are not using them in your test. |
clang/lib/Headers/altivec.h | ||
---|---|---|
17327 | I believe there are supposed to be signed and unsigned versions of the functions? It looks like you currently have all of them as unsigned. |
Formatting fixes, fixed test case return type, updated builtins' signatures to correct signatures.
Just a few nits for this patch.
Edit: Please wait for Amy to give the approval.
clang/lib/Headers/altivec.h | ||
---|---|---|
17332 | nit: | |
llvm/test/CodeGen/PowerPC/p10-vector-shift.ll | ||
11 | nit: | |
42 | nit: |
Overall seems fine to me, but of course, please wait to hear from Amy.
Just some nits for the test case.
llvm/test/CodeGen/PowerPC/p10-vector-shift.ll | ||
---|---|---|
10 | nit: please add a description for test purpose. | |
11 | nit: The test name and CHECK-LABEL should use test_vec_vslq | |
11 | +1, if no specific attributes needed. please remove all the #0 and #1 |
Please also change the function names.
clang/lib/Headers/altivec.h | ||
---|---|---|
17325 | Actually, sorry, I think this comment should be the following instead: | |
17332 | Actually vec_sl seems to be correct. However, that would mean the other functions need to be renamed as the functions are supposed to be: vec_sl, vec_sr, vec_sra. Albion, could you please rename these functions and also ensure your test uses the correct naming. |
I realize it may be possible to open code these, as these functions already exist in altivec.h. Could you look into if this is the case?
Converted the impelmentation to an open coded implementation and updated the test cases as appropriate.
Please address the auto generated clang-format issues for the added code in this patch.
clang/lib/Headers/altivec.h | ||
---|---|---|
17325 | Add a space after this comment. | |
17335 | Please remove any commented code. | |
17351 | Could you please fix the indentation of the returns to make them all consistent? | |
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
1127 | No brackets are needed here. Also, I think it might make sense to move this block into the previous hasP9Altivec condition since in there it has: setOperationAction(ISD::SHL, MVT::v1i128, Legal); setOperationAction(ISD::SRL, MVT::v1i128, Legal); | |
llvm/lib/Target/PowerPC/PPCInstrPrefix.td | ||
1306 | There is no need to make a new predicate block, you can put these anonymous patterns in the block above. | |
1309 | I noticed that we have patterns for the PPCISD nodes, but I think no tests to show these patterns? |
llvm/lib/Target/PowerPC/PPCISelLowering.cpp | ||
---|---|---|
1127 | Oops, I made that comment above since I thought you were putting the block inside a hasP9Altivec block. Sorry. Maybe you can move this condition right underneath the hasP9Altivec block that contains the SHL/SRL to be closer to those instructions. |
llvm/lib/Target/PowerPC/PPCInstrPrefix.td | ||
---|---|---|
1309 | My apologies, upon closer inspection I noticed that your tests are in fact the ones with the PPCISD nodes but you are missing the regular shl/srl/sra. Please add the tests for these, as well. |
Added shl tests, formatting fixes
clang/lib/Headers/altivec.h | ||
---|---|---|
17351 | I ran clang-format this time, lmk if we should change this as it doesn't look like clang-format was too consistent with itself |
Thanks for addressing the comments. LGTM.
llvm/test/CodeGen/PowerPC/p10-vector-shift.ll | ||
---|---|---|
11 | nit: These test cases demonstrate that the vector shift quadword instructions introduced within Power10 are correctly exploited. |
/* vs[l | r | raq] */ (with a new line after the comment)