libc++abi LIT test case vec_reg_restore.pass.cpp for AIX uses instructions mtvsrd and mfvsrd that are only available on Power8 CPU and higher, and therefore, fails on Power7 which is supported by the current AIX Clang. This patch replaces mtvsrd/mfvsrd with vector instructions available on Power7.
Details
- Reviewers
compnerd nemanjai daltenty - Group Reviewers
Restricted Project - Commits
- rG1e3e3e28a624: [libc++abi][LIT][AIX] Use Vector instructions available on Power7 in…
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Getting libc++ out of the way. If it looks good to AIX folks, feel free to ship it.
Also, can someone on your side please take a look at the CI failures? They've been ongoing for some days now.
Thanks!
Also, can someone on your side please take a look at the CI failures? They've been ongoing for some days now.
Will do.
libcxxabi/test/vendor/ibm/vec_reg_restore.pass.cpp | ||
---|---|---|
45 | This test case can be significantly simplified by just materializing a value into the callee-saved registers you're looking to clobber. This implementation is potentially problematic because:
I would recommend just something like this: // Set vs63 to 16 bytes each with value 9 asm volatile("vspltisb 31, 9" : : : "v31"); // Set vs62 to 16 bytes each with value 12 asm volatile("vspltisb 30, 12" : : : "v30") | |
67–83 | I understand that this was here in the original test case, but I find it odd that we are comparing just the first doubleword of each vector. Although it is unlikely, we would miss any corruption in the second doubleword of each vector. | |
87 | Similarly here, we can simply set the vector registers to different values using vspltisb. | |
113–114 | Rather than doing this, what I would recommend is that we populate 2 new vectors with expected values and then compare them against v31/v30 using vcmpequb.. #define cmp63(vec, res) { \ vector unsigned char gbg; \ asm volatile("vcmpequb. %[gbg], 31, %[veca];" \ "mfocrf %[res], 2;" \ "rlwinm %[res], %[res], 25, 31, 31" \ : [res] "=r" (res), [gbg] "=v" (gbg) \ : [veca] "v" (vec) \ : "cr6" \ ); \ } #define cmp62(vec, res) { \ vector unsigned char gbg; \ asm volatile("vcmpequb. %[gbg], 30, %[veca];" \ "mfocrf %[res], 2;" \ "rlwinm %[res], %[res], 25, 31, 31" \ : [res] "=r" (res), [gbg] "=v" (gbg) \ : [veca] "v" (vec) \ : "cr6" \ ); \ } The results for these two will be placed in variable you pass as the second operand to the macro and the value should be 1 if the vectors are equal. |
Addressed comments:
- use instruction vspltisb to initialize RS63, RS62
- set RS63, RS62 to 16 bytes each with value 0x01 and 0x02 respectively
- compare RS63/RS62 against expected values using instruction vcmpequb
This test case can be significantly simplified by just materializing a value into the callee-saved registers you're looking to clobber. This implementation is potentially problematic because:
I would recommend just something like this: