llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Piotr Kubaj (pkubaj)

<details>
<summary>Changes</summary>

The big-endian vbpermq permute constant in the ppc_wrappers
_mm_movemask_ps lists the four sign-bit indices as 0x00 0x20 0x40 0x60,
which lands element 0 in the most significant of the four result bits.
x86 semantics (and the little-endian branch) put element 0 in bit 0.
Reverse the index order so big-endian returns the same mask as x86.

Verified on FreeBSD/powerpc64 (POWER9, -mcpu=power8): for the inputs
{-1,2,-3,4} and {1,2,3,-4} the header returned 10 and 1 instead of 5
and 8; embree's BVH traversal, which selects child nodes from this
mask, crashed with a wild pointer.  _mm_movemask_pd and
_mm_movemask_epi8 already produce x86-compatible results on both
endians.

Assisted-by: Claude Fable 5.1


---
Full diff: https://github.com/llvm/llvm-project/pull/224328.diff


1 Files Affected:

- (modified) clang/lib/Headers/ppc_wrappers/xmmintrin.h (+1-1) 


``````````diff
diff --git a/clang/lib/Headers/ppc_wrappers/xmmintrin.h 
b/clang/lib/Headers/ppc_wrappers/xmmintrin.h
index 9dd21b65c2f70..96a309be25b29 100644
--- a/clang/lib/Headers/ppc_wrappers/xmmintrin.h
+++ b/clang/lib/Headers/ppc_wrappers/xmmintrin.h
@@ -1318,7 +1318,7 @@ extern __inline int
 #ifdef __LITTLE_ENDIAN__
       0x00204060, 0x80808080, 0x80808080, 0x80808080
 #else
-      0x80808080, 0x80808080, 0x80808080, 0x00204060
+      0x80808080, 0x80808080, 0x80808080, 0x60402000
 #endif
   };
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/224328
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to