Skip to content

Commit dfe2283

Browse files
authored
Fix the order of the rex2 registers for r_ib_unsigned_gpr (bytecodealliance#1424)
Fixes bytecodealliance#1423
1 parent 9d40e10 commit dfe2283

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

cranelift/codegen/meta/src/isa/x86/recipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ pub(crate) fn define<'shared>(
10081008
))
10091009
.emit(
10101010
r#"
1011-
{{PUT_OP}}(bits, rex2(in_reg0, out_reg0), sink);
1011+
{{PUT_OP}}(bits, rex2(out_reg0, in_reg0), sink);
10121012
modrm_rr(out_reg0, in_reg0, sink); // note the flipped register in the ModR/M byte
10131013
let imm:i64 = lane.into();
10141014
sink.put1(imm as u8);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
test binemit
2+
set enable_simd
3+
target x86_64 haswell
4+
5+
function u0:0(i64 fp [%rbp]) -> i32 [%rax], i64 fp [%rbp] system_v {
6+
ss0 = explicit_slot 32, offset -48
7+
ss1 = spill_slot 16, offset -64
8+
ss2 = incoming_arg 16, offset -16
9+
sig0 = () system_v
10+
fn0 = colocated u0:2 sig0
11+
12+
block0(v5: i64 [%rbp]):
13+
[-] x86_push v5
14+
[-] copy_special %rsp -> %rbp
15+
[-] adjust_sp_down_imm 48
16+
[-,%rax] v0 = stack_addr.i64 ss0
17+
[-,%xmm15] v4 = load.i32x4 v0
18+
[-,%rax] v2 = x86_pextr v4, 1 ; bin: 66 44 0f 3a 16 f8 01
19+
[-] adjust_sp_up_imm 48
20+
[-] v6 = x86_pop.i64
21+
[-] return v2, v6
22+
}

0 commit comments

Comments
 (0)