diff options
author | Jan Beulich <jbeulich@suse.com> | 2023-03-03 08:46:41 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2023-03-03 08:46:41 +0100 |
commit | 67748abf53b22fd0273bb374923c101c9d597094 (patch) | |
tree | 762aec973e1a6acee7db06526dc7d416490c7857 | |
parent | 43da3d648ed237496f33dd620a1ee4b4f4538018 (diff) | |
download | gdb-67748abf53b22fd0273bb374923c101c9d597094.zip gdb-67748abf53b22fd0273bb374923c101c9d597094.tar.gz gdb-67748abf53b22fd0273bb374923c101c9d597094.tar.bz2 |
x86: use swap_2_operands() in build_vex_prefix()
Open-coding part of what may eventually be needed is somewhat risky.
Let's use the function we have, taking care of all pieces of data which
may need swapping, no matter that
- right now i.flags[] and i.reloc[] aren't relevant here (yet),
- EVEX masking and embedded broadcast aren't applicable.
-rw-r--r-- | gas/config/tc-i386.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 9ceef27..3e12bf4 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -3593,16 +3593,9 @@ build_vex_prefix (const insn_template *t) && (i.tm.opcode_modifier.load || i.tm.opcode_modifier.d) && i.rex == REX_B) { - unsigned int xchg = i.operands - 1; - union i386_op temp_op; - i386_operand_type temp_type; + unsigned int xchg; - temp_type = i.types[xchg]; - i.types[xchg] = i.types[0]; - i.types[0] = temp_type; - temp_op = i.op[xchg]; - i.op[xchg] = i.op[0]; - i.op[0] = temp_op; + swap_2_operands (0, i.operands - 1); gas_assert (i.rm.mode == 3); @@ -3632,8 +3625,6 @@ build_vex_prefix (const insn_template *t) && !(i.vex.register_specifier->reg_flags & RegRex)) { unsigned int xchg = i.operands - i.reg_operands; - union i386_op temp_op; - i386_operand_type temp_type; gas_assert (i.tm.opcode_space == SPACE_0F); gas_assert (!i.tm.opcode_modifier.sae); @@ -3641,12 +3632,7 @@ build_vex_prefix (const insn_template *t) &i.types[i.operands - 3])); gas_assert (i.rm.mode == 3); - temp_type = i.types[xchg]; - i.types[xchg] = i.types[xchg + 1]; - i.types[xchg + 1] = temp_type; - temp_op = i.op[xchg]; - i.op[xchg] = i.op[xchg + 1]; - i.op[xchg + 1] = temp_op; + swap_2_operands (xchg, xchg + 1); i.rex = 0; xchg = i.rm.regmem | 8; |