Skip to content

Commit 1fa8b26

Browse files
committed
Fix vector_select
1 parent 44e3ea3 commit 1fa8b26

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/builder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,9 +1613,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
16131613
let masks = self.bitcast_if_needed(masks, then_val.get_type());
16141614
let then_vals = masks & then_val;
16151615

1616-
let ones = vec![self.context.new_rvalue_one(element_type); num_units];
1617-
let ones = self.context.new_rvalue_from_vector(None, cond_type, &ones);
1618-
let inverted_masks = masks + ones;
1616+
let minus_ones = vec![self.context.new_rvalue_from_int(element_type, -1); num_units];
1617+
let minus_ones = self.context.new_rvalue_from_vector(None, cond_type, &minus_ones);
1618+
let inverted_masks = masks ^ minus_ones;
16191619
// NOTE: sometimes, the type of else_val can be different than the type of then_val in
16201620
// libgccjit (vector of int vs vector of int32_t), but they should be the same for the AND
16211621
// operation to work.

0 commit comments

Comments
 (0)