Avoid extra register movement when lowering the x86 extractlane of a float vector
This commit is based on the assumption that floats are already stored in XMM registers in x86. When extracting a lane, cranelift was moving the float to a regular register and back to an XMM register; this change avoids this by shuffling the float value to the lowest bits of the XMM register. It also assumes that the upper bits can be left as is (instead of zeroing them out).
This commit is contained in:
@@ -291,5 +291,22 @@ pub(crate) fn define(
|
||||
.operands_out(vec![a]),
|
||||
);
|
||||
|
||||
let Idx = &operand_doc("Idx", uimm8, "Lane index");
|
||||
let x = &operand("x", TxN);
|
||||
let a = &operand("a", &TxN.lane_of());
|
||||
|
||||
ig.push(
|
||||
Inst::new(
|
||||
"x86_pextr",
|
||||
r#"
|
||||
Extract lane ``Idx`` from ``x``.
|
||||
The lane index, ``Idx``, is an immediate value, not an SSA value. It
|
||||
must indicate a valid lane index for the type of ``x``.
|
||||
"#,
|
||||
)
|
||||
.operands_in(vec![x, Idx])
|
||||
.operands_out(vec![a]),
|
||||
);
|
||||
|
||||
ig.build()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user