diff --git a/cranelift/codegen/meta/src/isa/x86/encodings.rs b/cranelift/codegen/meta/src/isa/x86/encodings.rs index c5bbfe1a83..a71b2cc68f 100644 --- a/cranelift/codegen/meta/src/isa/x86/encodings.rs +++ b/cranelift/codegen/meta/src/isa/x86/encodings.rs @@ -683,10 +683,7 @@ pub fn define( for &ty in &[B1, B8, B16, B32] { e.enc_both(bconst.bind(ty), rec_pu_id_bool.opcodes(vec![0xb8])); } - e.enc64( - bconst.bind(B64), - rec_pu_id_bool.opcodes(vec![0xb8]).rex().w(), - ); + e.enc64(bconst.bind(B64), rec_pu_id_bool.opcodes(vec![0xb8]).rex()); // Shifts and rotates. // Note that the dynamic shift amount is only masked by 5 or 6 bits; the 8-bit diff --git a/cranelift/filetests/filetests/isa/x86/binary64-run.clif b/cranelift/filetests/filetests/isa/x86/binary64-run.clif new file mode 100644 index 0000000000..b255770c1e --- /dev/null +++ b/cranelift/filetests/filetests/isa/x86/binary64-run.clif @@ -0,0 +1,10 @@ +test run +target x86_64 + +; this verifies that returning b64 immediates does not result in a segmentation fault, see https://github.com/CraneStation/cranelift/issues/911 +function %test_b64() -> b64 { +ebb0: +[-, %r10] v0 = bconst.b64 true + return v0 +} +; run diff --git a/cranelift/filetests/filetests/isa/x86/binary64.clif b/cranelift/filetests/filetests/isa/x86/binary64.clif index a65b3d3d1d..7742a24ee3 100644 --- a/cranelift/filetests/filetests/isa/x86/binary64.clif +++ b/cranelift/filetests/filetests/isa/x86/binary64.clif @@ -1642,3 +1642,10 @@ ebb0: return } + +function %B64() { +ebb0: + [-, %rax] v1 = bconst.b64 true ; bin: 40 b8 00000001 + [-, %r10] v0 = bconst.b64 true ; bin: 41 ba 00000001 + return +}