x64: Deduplicate fcmp emission logic (#6113)
* x64: Deduplicate fcmp emission logic The `select`-of-`fcmp` lowering duplicated a good deal of `FloatCC` lowering logic that was already done by `emit_fcmp`, so this commit refactors these lowering rules to instead delegate to `emit_fcmp` and then handle that result. * Swap order of condition codes Shouldn't affect the correctness of this operation and it's a bit more natural to write the lowering rule this way. * Swap the order of comparison operands No need to swap `a b`, only the `x y` needs swapping. * Fix x64 printing of `XmmCmove`
This commit is contained in:
@@ -1589,20 +1589,19 @@ impl PrettyPrint for Inst {
|
||||
let alternative = pretty_print_reg(alternative.to_reg(), size, allocs);
|
||||
let dst = pretty_print_reg(dst.to_reg().to_reg(), size, allocs);
|
||||
let consequent = consequent.pretty_print(size, allocs);
|
||||
let suffix = match *ty {
|
||||
types::F64 => "sd",
|
||||
types::F32 => "ss",
|
||||
types::F32X4 => "aps",
|
||||
types::F64X2 => "apd",
|
||||
_ => "dqa",
|
||||
};
|
||||
format!(
|
||||
"mov {}, {}; j{} $next; mov{} {}, {}; $next: ",
|
||||
"mov{suffix} {alternative}, {dst}; \
|
||||
j{} $next; \
|
||||
mov{suffix} {consequent}, {dst}; \
|
||||
$next:",
|
||||
cc.invert().to_string(),
|
||||
match *ty {
|
||||
types::F64 => "sd",
|
||||
types::F32 => "ss",
|
||||
types::F32X4 => "aps",
|
||||
types::F64X2 => "apd",
|
||||
_ => "dqa",
|
||||
},
|
||||
consequent,
|
||||
dst,
|
||||
alternative,
|
||||
dst,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user