aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-02-03 08:22:12 +0100
committerJan Beulich <jbeulich@suse.com>2023-02-03 08:22:12 +0100
commit739d764954b69fafd4fa7b238cf95149a86b2bda (patch)
treee267b3aed6da3972a3c525d22dbb06c55d02e2d0 /gas
parent691963912563534ed4eb4dd5d1b4349e3cd74ece (diff)
downloadgdb-739d764954b69fafd4fa7b238cf95149a86b2bda.zip
gdb-739d764954b69fafd4fa7b238cf95149a86b2bda.tar.gz
gdb-739d764954b69fafd4fa7b238cf95149a86b2bda.tar.bz2
x86: respect {nooptimize} for LEA
Dropping a meaningless segment prefix occurs outside of optimize_encoding() and hence needs explicit checking for a request to avoid any optimizations.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-i386.c2
-rw-r--r--gas/testsuite/gas/i386/lea-optimize.d2
-rw-r--r--gas/testsuite/gas/i386/lea.d2
-rw-r--r--gas/testsuite/gas/i386/lea.e4
-rw-r--r--gas/testsuite/gas/i386/lea.s2
-rw-r--r--gas/testsuite/gas/i386/lea16-optimize.d2
-rw-r--r--gas/testsuite/gas/i386/lea16-optimize2.d2
-rw-r--r--gas/testsuite/gas/i386/lea16.d2
8 files changed, 16 insertions, 2 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 235deb8..c3aa40b 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -8159,7 +8159,7 @@ process_operands (void)
{
if (!quiet_warnings)
as_warn (_("segment override on `%s' is ineffectual"), insn_name (&i.tm));
- if (optimize)
+ if (optimize && !i.no_optimize)
{
i.seg[0] = NULL;
i.prefix[SEG_PREFIX] = 0;
diff --git a/gas/testsuite/gas/i386/lea-optimize.d b/gas/testsuite/gas/i386/lea-optimize.d
index 283b994..cec4332 100644
--- a/gas/testsuite/gas/i386/lea-optimize.d
+++ b/gas/testsuite/gas/i386/lea-optimize.d
@@ -10,6 +10,7 @@ Disassembly of section .text:
0+ <start>:
[ ]*[0-9a-f]+:[ ]+8d 04 08[ ]+lea[ ]+\(%eax,%ecx(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+8d 04 08[ ]+lea[ ]+\(%eax,%ecx(,1)?\),%eax
+[ ]*[0-9a-f]+:[ ]+26 8d 04 01[ ]+lea[ ]+%es:\(%ecx,%eax(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+8d 48 01[ ]+lea[ ]+0x1\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+8d 88 00 00 00 00[ ]+lea[ ]+0x0\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+8d 0c 25 00 00 00 00[ ]+lea[ ]+0x0\(,(%eiz)?(,1)?\),%ecx
@@ -21,6 +22,7 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+8b c8[ ]+mov[ ]+%eax,%ecx
[ ]*[0-9a-f]+:[ ]+8b c8[ ]+mov[ ]+%eax,%ecx
[ ]*[0-9a-f]+:[ ]+8b c8[ ]+mov[ ]+%eax,%ecx
+[ ]*[0-9a-f]+:[ ]+64 8d 08[ ]+lea[ ]+%fs:\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+0f b7 c6[ ]+movzwl[ ]+%si,%eax
[ ]*[0-9a-f]+:[ ]+0f b7 f6[ ]+movzwl[ ]+%si,%esi
[ ]*[0-9a-f]+:[ ]+0f b7 c6[ ]+movzwl[ ]+%si,%eax
diff --git a/gas/testsuite/gas/i386/lea.d b/gas/testsuite/gas/i386/lea.d
index bfc9c13..f617269 100644
--- a/gas/testsuite/gas/i386/lea.d
+++ b/gas/testsuite/gas/i386/lea.d
@@ -9,6 +9,7 @@ Disassembly of section .text:
0+ <start>:
[ ]*[0-9a-f]+:[ ]+36 8d 04 08[ ]+lea[ ]+%ss:\(%eax,%ecx(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+36 8d 04 08[ ]+lea[ ]+%ss:\(%eax,%ecx(,1)?\),%eax
+[ ]*[0-9a-f]+:[ ]+26 8d 04 01[ ]+lea[ ]+%es:\(%ecx,%eax(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+8d 48 01[ ]+lea[ ]+0x1\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+8d 88 00 00 00 00[ ]+lea[ ]+0x0\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+8d 0c 25 00 00 00 00[ ]+lea[ ]+0x0\(,(%eiz)?(,1)?\),%ecx
@@ -20,6 +21,7 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+8d 08[ ]+lea[ ]+\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+8d 08[ ]+lea[ ]+\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+65 8d 08[ ]+lea[ ]+%gs:\(%eax\),%ecx
+[ ]*[0-9a-f]+:[ ]+64 8d 08[ ]+lea[ ]+%fs:\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 8d 04[ ]+lea[ ]+\(%si\),%eax
[ ]*[0-9a-f]+:[ ]+67 8d 34[ ]+lea[ ]+\(%si\),%esi
[ ]*[0-9a-f]+:[ ]+67 8d 04[ ]+lea[ ]+\(%si\),%eax
diff --git a/gas/testsuite/gas/i386/lea.e b/gas/testsuite/gas/i386/lea.e
index d0d47ae..dd8f606 100644
--- a/gas/testsuite/gas/i386/lea.e
+++ b/gas/testsuite/gas/i386/lea.e
@@ -1,4 +1,6 @@
.*: Assembler messages:
.*:3: Warning: .* `lea' .*
.*:4: Warning: .* `lea' .*
-.*:19: Warning: .* `lea' .*
+.*:5: Warning: .* `lea' .*
+.*:20: Warning: .* `lea' .*
+.*:21: Warning: .* `lea' .*
diff --git a/gas/testsuite/gas/i386/lea.s b/gas/testsuite/gas/i386/lea.s
index 1fb6aa8..f9f19a5 100644
--- a/gas/testsuite/gas/i386/lea.s
+++ b/gas/testsuite/gas/i386/lea.s
@@ -2,6 +2,7 @@
start:
lea %ss:(%eax,%ecx), %eax
ss lea (%eax,%ecx), %eax
+ {nooptimize} es lea (%ecx,%eax), %eax
.allow_index_reg
lea 1(%eax), %ecx
@@ -17,6 +18,7 @@ start:
lea (%eax), %ecx
lea 1-1(%eax), %ecx
lea %gs:(%eax), %ecx
+ {nooptimize} lea %fs:(%eax), %ecx
lea (%si), %eax
lea (%si), %esi
diff --git a/gas/testsuite/gas/i386/lea16-optimize.d b/gas/testsuite/gas/i386/lea16-optimize.d
index be30758..5585e8d 100644
--- a/gas/testsuite/gas/i386/lea16-optimize.d
+++ b/gas/testsuite/gas/i386/lea16-optimize.d
@@ -10,6 +10,7 @@ Disassembly of section .text:
0+ <start>:
[ ]*[0-9a-f]+:[ ]+67 66 8d 04 08[ ]+lea[ ]+\(%eax,%ecx(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+67 66 8d 04 08[ ]+lea[ ]+\(%eax,%ecx(,1)?\),%eax
+[ ]*[0-9a-f]+:[ ]+26 67 66 8d 04 01[ ]+lea[ ]+%es:\(%ecx,%eax(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+67 66 8d 48 01[ ]+lea[ ]+0x1\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 66 8d 88 00 00 00 00[ ]+lea[ ]+0x0\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 66 8d 0c 25 00 00 00 00[ ]+addr32 lea[ ]+0x0,%ecx
@@ -21,6 +22,7 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+66 8b c8[ ]+mov[ ]+%eax,%ecx
[ ]*[0-9a-f]+:[ ]+66 8b c8[ ]+mov[ ]+%eax,%ecx
[ ]*[0-9a-f]+:[ ]+66 8b c8[ ]+mov[ ]+%eax,%ecx
+[ ]*[0-9a-f]+:[ ]+64 67 66 8d 08[ ]+lea[ ]+%fs:\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+66 8d 04[ ]+lea[ ]+\(%si\),%eax
[ ]*[0-9a-f]+:[ ]+66 8d 34[ ]+lea[ ]+\(%si\),%esi
[ ]*[0-9a-f]+:[ ]+66 8d 04[ ]+lea[ ]+\(%si\),%eax
diff --git a/gas/testsuite/gas/i386/lea16-optimize2.d b/gas/testsuite/gas/i386/lea16-optimize2.d
index d95f9ac..7afd97e 100644
--- a/gas/testsuite/gas/i386/lea16-optimize2.d
+++ b/gas/testsuite/gas/i386/lea16-optimize2.d
@@ -10,6 +10,7 @@ Disassembly of section .text:
0+ <start>:
[ ]*[0-9a-f]+:[ ]+67 66 8d 04 08[ ]+lea[ ]+\(%eax,%ecx(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+67 66 8d 04 08[ ]+lea[ ]+\(%eax,%ecx(,1)?\),%eax
+[ ]*[0-9a-f]+:[ ]+26 67 66 8d 04 01[ ]+lea[ ]+%es:\(%ecx,%eax(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+67 66 8d 48 01[ ]+lea[ ]+0x1\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 66 8d 88 00 00 00 00[ ]+lea[ ]+0x0\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 66 8d 0c 25 00 00 00 00[ ]+addr32 lea[ ]+0x0,%ecx
@@ -21,6 +22,7 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+66 8b c8[ ]+mov[ ]+%eax,%ecx
[ ]*[0-9a-f]+:[ ]+66 8b c8[ ]+mov[ ]+%eax,%ecx
[ ]*[0-9a-f]+:[ ]+66 8b c8[ ]+mov[ ]+%eax,%ecx
+[ ]*[0-9a-f]+:[ ]+64 67 66 8d 08[ ]+lea[ ]+%fs:\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+66 8d 04[ ]+lea[ ]+\(%si\),%eax
[ ]*[0-9a-f]+:[ ]+66 8d 34[ ]+lea[ ]+\(%si\),%esi
[ ]*[0-9a-f]+:[ ]+66 8d 04[ ]+lea[ ]+\(%si\),%eax
diff --git a/gas/testsuite/gas/i386/lea16.d b/gas/testsuite/gas/i386/lea16.d
index 179102a..f01010a 100644
--- a/gas/testsuite/gas/i386/lea16.d
+++ b/gas/testsuite/gas/i386/lea16.d
@@ -10,6 +10,7 @@ Disassembly of section .text:
0+ <start>:
[ ]*[0-9a-f]+:[ ]+36 67 66 8d 04 08[ ]+lea[ ]+%ss:\(%eax,%ecx(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+36 67 66 8d 04 08[ ]+lea[ ]+%ss:\(%eax,%ecx(,1)?\),%eax
+[ ]*[0-9a-f]+:[ ]+26 67 66 8d 04 01[ ]+lea[ ]+%es:\(%ecx,%eax(,1)?\),%eax
[ ]*[0-9a-f]+:[ ]+67 66 8d 48 01[ ]+lea[ ]+0x1\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 66 8d 88 00 00 00 00[ ]+lea[ ]+0x0\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 66 8d 0c 25 00 00 00 00[ ]+addr32 lea[ ]+0x0,%ecx
@@ -21,6 +22,7 @@ Disassembly of section .text:
[ ]*[0-9a-f]+:[ ]+67 66 8d 08[ ]+lea[ ]+\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+67 66 8d 08[ ]+lea[ ]+\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+65 67 66 8d 08[ ]+lea[ ]+%gs:\(%eax\),%ecx
+[ ]*[0-9a-f]+:[ ]+64 67 66 8d 08[ ]+lea[ ]+%fs:\(%eax\),%ecx
[ ]*[0-9a-f]+:[ ]+66 8d 04[ ]+lea[ ]+\(%si\),%eax
[ ]*[0-9a-f]+:[ ]+66 8d 34[ ]+lea[ ]+\(%si\),%esi
[ ]*[0-9a-f]+:[ ]+66 8d 04[ ]+lea[ ]+\(%si\),%eax