abrown opened Issue #1421:
In looking over
encodings.rs
again in #1208, I noticed that I had allowed x86's 32-bit mode in cranelift-codegen-meta to infer REX prefixes. This should not be allowed since REX prefixes are only available in 64-bit mode.Once this is changed in
enc_both_inferred*
(and after adding size calculator functions to the{g,f}pr{,disp8,disp32}
recipes), a simplification is possible. Loads and stores could be simplified from:e.enc32_maybe_isap(inst.clone().bind(I32), template.clone(), isap); // REX-less encoding must come after REX encoding so we don't use it by // default. Otherwise reg-alloc would never use r8 and up. e.enc64_maybe_isap(inst.clone().bind(I32), template.clone().rex(), isap); e.enc64_maybe_isap(inst.clone().bind(I32), template.clone(), isap); // Similar to above; TODO some of this duplication can be cleaned up by infer_rex() // tracked in https://github.com/bytecodealliance/cranelift/issues/1090 e.enc64_maybe_isap(inst.clone().bind(I64), template.clone().rex(), isap); e.enc64_maybe_isap(inst.bind(I64), template, isap);to:
e.enc_both_inferred_maybe_isap(inst.clone().bind(I32), template.clone(), isap); e.enc64_maybe_isap(inst.bind(I64), template.infer_rex(), isap);
abrown labeled Issue #1421:
In looking over
encodings.rs
again in #1208, I noticed that I had allowed x86's 32-bit mode in cranelift-codegen-meta to infer REX prefixes. This should not be allowed since REX prefixes are only available in 64-bit mode.Once this is changed in
enc_both_inferred*
(and after adding size calculator functions to the{g,f}pr{,disp8,disp32}
recipes), a simplification is possible. Loads and stores could be simplified from:e.enc32_maybe_isap(inst.clone().bind(I32), template.clone(), isap); // REX-less encoding must come after REX encoding so we don't use it by // default. Otherwise reg-alloc would never use r8 and up. e.enc64_maybe_isap(inst.clone().bind(I32), template.clone().rex(), isap); e.enc64_maybe_isap(inst.clone().bind(I32), template.clone(), isap); // Similar to above; TODO some of this duplication can be cleaned up by infer_rex() // tracked in https://github.com/bytecodealliance/cranelift/issues/1090 e.enc64_maybe_isap(inst.clone().bind(I64), template.clone().rex(), isap); e.enc64_maybe_isap(inst.bind(I64), template, isap);to:
e.enc_both_inferred_maybe_isap(inst.clone().bind(I32), template.clone(), isap); e.enc64_maybe_isap(inst.bind(I64), template.infer_rex(), isap);
abrown closed Issue #1421:
In looking over
encodings.rs
again in #1208, I noticed that I had allowed x86's 32-bit mode in cranelift-codegen-meta to infer REX prefixes. This should not be allowed since REX prefixes are only available in 64-bit mode.Once this is changed in
enc_both_inferred*
(and after adding size calculator functions to the{g,f}pr{,disp8,disp32}
recipes), a simplification is possible. Loads and stores could be simplified from:e.enc32_maybe_isap(inst.clone().bind(I32), template.clone(), isap); // REX-less encoding must come after REX encoding so we don't use it by // default. Otherwise reg-alloc would never use r8 and up. e.enc64_maybe_isap(inst.clone().bind(I32), template.clone().rex(), isap); e.enc64_maybe_isap(inst.clone().bind(I32), template.clone(), isap); // Similar to above; TODO some of this duplication can be cleaned up by infer_rex() // tracked in https://github.com/bytecodealliance/cranelift/issues/1090 e.enc64_maybe_isap(inst.clone().bind(I64), template.clone().rex(), isap); e.enc64_maybe_isap(inst.bind(I64), template, isap);to:
e.enc_both_inferred_maybe_isap(inst.clone().bind(I32), template.clone(), isap); e.enc64_maybe_isap(inst.bind(I64), template.infer_rex(), isap);
Last updated: Nov 22 2024 at 17:03 UTC