Allow wrap-around when subtracting type size to immediate in try_fold_extended_move;

This commit is contained in:
Benjamin Bouvier
2019-10-08 16:09:26 +02:00
parent 13676cafd1
commit cbbd94db02
2 changed files with 15 additions and 1 deletions

View File

@@ -508,7 +508,7 @@ fn try_fold_extended_move(
}
let imm_bits: i64 = imm.into();
let ireduce_ty = match dest_ty.lane_bits() as i64 - imm_bits {
let ireduce_ty = match (dest_ty.lane_bits() as i64).wrapping_sub(imm_bits) {
8 => I8,
16 => I16,
32 => I32,