Skip to content

Commit 29087c6

Browse files
committed
Clarify that LLVM uses endianness for bit order
1 parent 8dada4c commit 29087c6

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

crates/core_simd/src/masks/full_masks.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ where
147147
// Transmute to the return type, previously asserted to be the same size
148148
let mut bitmask: [u8; N] = core::mem::transmute_copy(&bitmask);
149149

150-
// There is a bug where LLVM appears to implement this operation with the wrong
151-
// bit order.
152-
// TODO fix this in a better way
150+
// LLVM assumes bit order should match endianness
153151
if cfg!(target_endian = "big") {
154152
for x in bitmask.as_mut() {
155153
*x = x.reverse_bits();
@@ -174,9 +172,7 @@ where
174172
// The transmute below allows this function to be marked safe, since it will prevent
175173
// monomorphization errors in the case of an incorrect size.
176174
unsafe {
177-
// There is a bug where LLVM appears to implement this operation with the wrong
178-
// bit order.
179-
// TODO fix this in a better way
175+
// LLVM assumes bit order should match endianness
180176
if cfg!(target_endian = "big") {
181177
for x in bitmask.as_mut() {
182178
*x = x.reverse_bits();
@@ -204,9 +200,7 @@ where
204200
// Safety: U is required to be the appropriate bitmask type
205201
let bitmask: U = unsafe { intrinsics::simd_bitmask(self.0) };
206202

207-
// There is a bug where LLVM appears to implement this operation with the wrong
208-
// bit order.
209-
// TODO fix this in a better way
203+
// LLVM assumes bit order should match endianness
210204
if cfg!(target_endian = "big") {
211205
bitmask.reverse_bits()
212206
} else {
@@ -219,9 +213,7 @@ where
219213
where
220214
super::Mask<T, LANES>: ToBitMask<BitMask = U>,
221215
{
222-
// There is a bug where LLVM appears to implement this operation with the wrong
223-
// bit order.
224-
// TODO fix this in a better way
216+
// LLVM assumes bit order should match endianness
225217
let bitmask = if cfg!(target_endian = "big") {
226218
bitmask.reverse_bits()
227219
} else {

0 commit comments

Comments
 (0)