We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2768789 + b886be1 commit ba7404aCopy full SHA for ba7404a
src/intrinsics/simd.rs
@@ -853,7 +853,13 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
853
};
854
855
for lane in 0..lane_count {
856
- let m_lane = fx.bcx.ins().ushr_imm(m, u64::from(lane) as i64);
+ // The bit order of the mask depends on the byte endianness, LSB-first for
857
+ // little endian and MSB-first for big endian.
858
+ let mask_lane = match fx.tcx.sess.target.endian {
859
+ Endian::Big => lane_count - 1 - lane,
860
+ Endian::Little => lane,
861
+ };
862
+ let m_lane = fx.bcx.ins().ushr_imm(m, u64::from(mask_lane) as i64);
863
let m_lane = fx.bcx.ins().band_imm(m_lane, 1);
864
let a_lane = a.value_lane(fx, lane).load_scalar(fx);
865
let b_lane = b.value_lane(fx, lane).load_scalar(fx);
0 commit comments