Fix scalar_to_vector: move not wide enough for 64-bit values (#1287)

Previously, the use of `enc_x86_64` emitted two 64-bit mode encodings for `scalar_to_vector.i64`, neither of which contained the REX.W bit telling `MOVD/MOVQ` to move 64 bits of data instead of 32 bits. Now, `scalar_to_vector.i64` will always use a sole 64-bit mode REX.W encoding and `scalar_to_vector` with other widths will have three encodings: a 32-bit mode move, a 64-bit mode move with no REX, and a 64-bit mode move with REX (but not REX.W).
This commit is contained in:
Andrew Brown
2019-12-16 10:17:08 -08:00
committed by GitHub
parent fcb0593796
commit 0604ec480c
3 changed files with 20 additions and 3 deletions

View File

@@ -1746,10 +1746,13 @@ pub(crate) fn define(
} else {
let template = rec_frurm.opcodes(&MOVD_LOAD_XMM);
if ty.lane_bits() < 64 {
// no 32-bit encodings for 64-bit widths
e.enc32(instruction.clone(), template.clone());
e.enc_x86_64(instruction, template);
} else {
// No 32-bit encodings for 64-bit widths.
assert_eq!(ty.lane_bits(), 64);
e.enc64(instruction, template.rex().w());
}
e.enc_x86_64(instruction, template);
}
}