Browse Source
* x64: Refactor float comparisons and their representations Currently the `XmmCmpRmR` instruction variant has a `dst` and a `src` field. The instruction doesn't actually write to `dst`, however, and the constructor of `xmm_cmp_rm_r` takes the `src` first followed by the `dst`. This is inconsistent with most other xmm-related instructions where the "src1" comes first and the "src2", which is a memory operand, comes second. This memory-operand-second pattern also matches the Intel manuals more closely. This commit refactors the `XmmCmpRmR` instruction variant with the following changes: * `dst` is renamed to `src1` * `src` is renamed to `src2` * The `xmm_cmp_rm_r` helpers, and callers, swapped their arguments to take `Xmm` first and `XmmMem` second. * The `x64_ptest` instruction followed suit as it was modelled after the same. * Callers of `x64_ucomis` swapped their arguments to preserve the operand orders. * The `Inst::xmm_cmp_rm_r` helper swapped operand order and additionally callers were updated. * The VCode rendering of `XmmCmpRmR` swapped order of its operands, explaining changes in rendering of filetests (although machine code is not changing here). The changes were then additionally propagated to Winch as well. In Winch the `src`/`dst` naming was inherited so it was renamed to `src1` and `src2` which swapped operands as well. In the case of Winch there was additionally an accident in `float_cmp_op` where values were popped in reverse order. This swapping-of-swapping all worked out prior, but to get all the names to align correctly I've swapped this to be more consistent. Sorry there's a lot of swaps-of-swaps here but the basic idea is that the low-level instruction constructor swapped arguments so to preserve the same (correct) output today something else needed to be swapped. In Winch's case it wasn't the immediate caller of the instruction constructor since that method looked correct, but it was instead a higher-level `float_cmp_op` which then called a helper which then called the low-level constructor which had operands swapped. * Review commentspull/8410/head
Alex Crichton
7 months ago
committed by
GitHub
7 changed files with 66 additions and 59 deletions
Loading…
Reference in new issue