aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-12-18 14:03:43 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-12-18 14:07:36 -0800
commita28def75916fb4fa8280404f8c023adc0773162d (patch)
tree09f0d7747821f48fed4d4b5c4dd936d7c7ba2fb6 /gas
parent5f2dfcfdb5def494d13bff72275f6ff75fe75f40 (diff)
downloadgdb-a28def75916fb4fa8280404f8c023adc0773162d.zip
gdb-a28def75916fb4fa8280404f8c023adc0773162d.tar.gz
gdb-a28def75916fb4fa8280404f8c023adc0773162d.tar.bz2
Process 64-bit imm/disp only for 64-bit BFD
We only need to store 32-bit immediate in 64-bit and optimize 64-bit displacement to 32-bit only for 64-bit BFD. * config/tc-i386.c (optimize_imm): Store 32-bit immediate in 64-bit only for 64-bit BFD (optimize_disp): Optimize 64-bit displacement to 32-bit only for 64-bit BFD.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/config/tc-i386.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 3147d22..e80a36d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2015-12-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/tc-i386.c (optimize_imm): Store 32-bit immediate in
+ 64-bit only for 64-bit BFD.
+ (optimize_disp): Optimize 64-bit displacement to 32-bit only
+ for 64-bit BFD.
+
2015-12-17 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
* gas/config/tc-arm.c (aeabi_set_public_attributes): Adjust
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 1573043..4940a80 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4218,6 +4218,8 @@ optimize_imm (void)
i.op[op].imms->X_add_number =
(((i.op[op].imms->X_add_number & 0xffff) ^ 0x8000) - 0x8000);
}
+#ifdef BFD64
+ /* Store 32-bit immediate in 64-bit for 64-bit BFD. */
if ((i.types[op].bitfield.imm32)
&& ((i.op[op].imms->X_add_number & ~(((offsetT) 2 << 31) - 1))
== 0))
@@ -4226,6 +4228,7 @@ optimize_imm (void)
^ ((offsetT) 1 << 31))
- ((offsetT) 1 << 31));
}
+#endif
i.types[op]
= operand_type_or (i.types[op],
smallest_imm_type (i.op[op].imms->X_add_number));
@@ -4306,6 +4309,8 @@ optimize_disp (void)
op_disp = (((op_disp & 0xffff) ^ 0x8000) - 0x8000);
i.types[op].bitfield.disp64 = 0;
}
+#ifdef BFD64
+ /* Optimize 64-bit displacement to 32-bit for 64-bit BFD. */
if (i.types[op].bitfield.disp32
&& (op_disp & ~(((offsetT) 2 << 31) - 1)) == 0)
{
@@ -4316,6 +4321,7 @@ optimize_disp (void)
op_disp = (op_disp ^ ((offsetT) 1 << 31)) - ((addressT) 1 << 31);
i.types[op].bitfield.disp64 = 0;
}
+#endif
if (!op_disp && i.types[op].bitfield.baseindex)
{
i.types[op].bitfield.disp8 = 0;