Skip to content

Commit

Permalink
Merge pull request from GHSA-xm67-587q-r2vw
Browse files Browse the repository at this point in the history
This commit fixes an off-by-one error in the subtraction of indices when
shuffling a vector with itself. Lanes 16-and-above are mapped to select
from the first vector since the first and second element are the same,
but the subtraction was with 15 rather than 16 by accident.
  • Loading branch information
alexcrichton authored Mar 8, 2023
1 parent c00d3f0 commit fc13ee1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cranelift/codegen/src/isa/x64/lower/isle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ impl Context for IsleContext<'_, '_, MInst, X64Backend> {
fn shuffle_0_31_mask(&mut self, mask: &VecMask) -> VCodeConstant {
let mask = mask
.iter()
.map(|&b| if b > 15 { b.wrapping_sub(15) } else { b })
.map(|&b| if b > 15 { b.wrapping_sub(16) } else { b })
.map(|b| if b > 15 { 0b10000000 } else { b })
.collect();
self.lower_ctx
Expand Down

0 comments on commit fc13ee1

Please sign in to comment.