summaryrefslogtreecommitdiff
path: root/compiler/utils/x86/assembler_x86.h
diff options
context:
space:
mode:
author Ulya Trafimovich <skvadrik@google.com> 2021-07-12 14:20:16 +0100
committer Ulyana Trafimovich <skvadrik@google.com> 2021-07-12 16:24:37 +0000
commitb50ceebb814f28a6ade94974d3e8614c8585760e (patch)
tree8297534745f75989ddf6b6c124ccc623a8eee71f /compiler/utils/x86/assembler_x86.h
parent38837d44f47a14ccd07e9de3c26d3e40b9768d0d (diff)
x86: Add missing variants for XCHG and tests for this instruction.
Add XCHG variants when both operands are registers. Handle the special case when at least one of the register operands is EAX/AX. Add tests for the new variants and for other variants that previously weren't tested. Bug: 65872996 Test: m test-art-host-gtest Change-Id: I1e80d1b86f3d2e804b90c2a181e4eabded30d8ae
Diffstat (limited to 'compiler/utils/x86/assembler_x86.h')
-rw-r--r--compiler/utils/x86/assembler_x86.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h
index db92a80a4e..f6e7fbc8cd 100644
--- a/compiler/utils/x86/assembler_x86.h
+++ b/compiler/utils/x86/assembler_x86.h
@@ -736,8 +736,14 @@ class X86Assembler final : public Assembler {
void fptan();
void fprem();
+ void xchgb(ByteRegister dst, ByteRegister src);
void xchgb(ByteRegister reg, const Address& address);
+
+ // Wrappers for `xchgb` that accept `Register` instead of `ByteRegister` (used for testing).
+ void xchgb(Register dst, Register src);
void xchgb(Register reg, const Address& address);
+
+ void xchgw(Register dst, Register src);
void xchgw(Register reg, const Address& address);
void xchgl(Register dst, Register src);
@@ -1044,6 +1050,10 @@ class X86Assembler final : public Assembler {
uint8_t EmitVexPrefixByteTwo(bool W,
int SET_VEX_L,
int SET_VEX_PP);
+
+ // Helper function to emit a shorter variant of XCHG for when at least one operand is EAX/AX.
+ bool try_xchg_eax(Register dst, Register src);
+
ConstantArea constant_area_;
bool has_AVX_; // x86 256bit SIMD AVX.
bool has_AVX2_; // x86 256bit SIMD AVX 2.0.