aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-11-09 12:55:52 +0100
committerJan Beulich <jbeulich@suse.com>2023-11-09 12:55:52 +0100
commite7d74879870833fb0c42282da940e60fee13948e (patch)
tree96ee80096c01d0b0594f34216347f7976cc76e64 /gas
parent706ce98422dcbfa1ae073853c479854cb7c7f2a0 (diff)
downloadbinutils-e7d74879870833fb0c42282da940e60fee13948e.zip
binutils-e7d74879870833fb0c42282da940e60fee13948e.tar.gz
binutils-e7d74879870833fb0c42282da940e60fee13948e.tar.bz2
x86: rework UWRMSR operand swapping
As indicated during review already, doing the swapping early is overall cheaper than doing it only after operand matching.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-i386.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index a351897..235e41e 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -5188,10 +5188,14 @@ md_assemble (char *line)
&& operand_type_check (i.types[1], imm)))
swap_operands ();
- /* The order of the immediates should be reversed
- for 2 immediates extrq and insertq instructions */
- if (i.imm_operands == 2
- && (t->mnem_off == MN_extrq || t->mnem_off == MN_insertq))
+ /* The order of the immediates should be reversed for 2-immediates EXTRQ
+ and INSERTQ instructions. Also UWRMSR wants its immediate to be in the
+ "canonical" place (first), despite it appearing last (in AT&T syntax, or
+ because of the swapping above) in the incoming set of operands. */
+ if ((i.imm_operands == 2
+ && (t->mnem_off == MN_extrq || t->mnem_off == MN_insertq))
+ || (t->mnem_off == MN_uwrmsr && i.imm_operands
+ && i.operands > i.imm_operands))
swap_2_operands (0, 1);
if (i.imm_operands)
@@ -7544,17 +7548,6 @@ match_template (char mnem_suffix)
break;
}
- /* This pattern aims to put the unusually placed imm operand to a usual
- place. The constraints are currently only adapted to uwrmsr, and may
- need further tweaking when new similar instructions become available. */
- if (i.imm_operands && i.imm_operands < i.operands
- && operand_type_check (operand_types[i.operands - 1], imm))
- {
- i.tm.operand_types[0] = operand_types[i.operands - 1];
- i.tm.operand_types[i.operands - 1] = operand_types[0];
- swap_2_operands(0, i.operands - 1);
- }
-
return t;
}