aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2019-03-17 07:39:18 +0800
committerH.J. Lu <hjl.tools@gmail.com>2019-03-17 07:49:06 +0800
commit41fd2579f2ac6a5fca262317b0e52eea07fa7438 (patch)
tree14e5d4037a761c636b0ed0c61a33626e768c59bc /gas
parentdd22218cf26fa5d8beade7266de391a28e63527b (diff)
downloadgdb-41fd2579f2ac6a5fca262317b0e52eea07fa7438.zip
gdb-41fd2579f2ac6a5fca262317b0e52eea07fa7438.tar.gz
gdb-41fd2579f2ac6a5fca262317b0e52eea07fa7438.tar.bz2
x86: Set optimize to INT_MAX for -Os
Set optimize to INT_MAX, instead of -1, for -Os so that -Os will include -O2 optimization. PR gas/24353 * config/tc-i386.c (md_parse_option): Set optimize to INT_MAX for -Os. * testsuite/gas/i386/optimize-2.s: Add a test. * testsuite/gas/i386/x86-64-optimize-3.s: Likewise. * testsuite/gas/i386/optimize-2.d: Updated. * testsuite/gas/i386/x86-64-optimize-3.d: Likewise.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog12
-rw-r--r--gas/config/tc-i386.c13
-rw-r--r--gas/testsuite/gas/i386/optimize-2.d1
-rw-r--r--gas/testsuite/gas/i386/optimize-2.s2
-rw-r--r--gas/testsuite/gas/i386/x86-64-optimize-3.d1
-rw-r--r--gas/testsuite/gas/i386/x86-64-optimize-3.s2
6 files changed, 30 insertions, 1 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e3cba86..e5907d1 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,17 @@
2019-03-17 H.J. Lu <hongjiu.lu@intel.com>
+ PR gas/24353
+ * config/tc-i386.c: Include <limits.h> if it exists and try
+ including <sys/param.h> if we have it.
+ (INT_MAX): Define if not defined.
+ (md_parse_option): Set optimize to INT_MAX for -Os.
+ * testsuite/gas/i386/optimize-2.s: Add a test.
+ * testsuite/gas/i386/x86-64-optimize-3.s: Likewise.
+ * testsuite/gas/i386/optimize-2.d: Updated.
+ * testsuite/gas/i386/x86-64-optimize-3.d: Likewise.
+
+2019-03-17 H.J. Lu <hongjiu.lu@intel.com>
+
PR gas/24352
* config/tc-i386.c (optimize_encoding): Encode 512-bit EVEX
with 128-bit VEX encoding only when AVX is enabled and with
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 959fda2..8047ddf 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -33,6 +33,17 @@
#include "elf/x86-64.h"
#include "opcodes/i386-init.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#else
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifndef INT_MAX
+#define INT_MAX (int) (((unsigned) (-1)) >> 1)
+#endif
+#endif
+
#ifndef REGISTER_WARNINGS
#define REGISTER_WARNINGS 1
#endif
@@ -11350,7 +11361,7 @@ md_parse_option (int c, const char *arg)
{
optimize_for_space = 1;
/* Turn on all encoding optimizations. */
- optimize = -1;
+ optimize = INT_MAX;
}
else
{
diff --git a/gas/testsuite/gas/i386/optimize-2.d b/gas/testsuite/gas/i386/optimize-2.d
index ec989b0..e8a5169 100644
--- a/gas/testsuite/gas/i386/optimize-2.d
+++ b/gas/testsuite/gas/i386/optimize-2.d
@@ -16,4 +16,5 @@ Disassembly of section .text:
+[a-f0-9]+: f6 c3 7f test \$0x7f,%bl
+[a-f0-9]+: f7 c7 7f 00 00 00 test \$0x7f,%edi
+[a-f0-9]+: 66 f7 c7 7f 00 test \$0x7f,%di
+ +[a-f0-9]+: c5 f1 55 e9 vandnpd %xmm1,%xmm1,%xmm5
#pass
diff --git a/gas/testsuite/gas/i386/optimize-2.s b/gas/testsuite/gas/i386/optimize-2.s
index b427a74..c9b57a8 100644
--- a/gas/testsuite/gas/i386/optimize-2.s
+++ b/gas/testsuite/gas/i386/optimize-2.s
@@ -11,3 +11,5 @@ _start:
test $0x7f, %bl
test $0x7f, %edi
test $0x7f, %di
+
+ vandnpd %zmm1, %zmm1, %zmm5
diff --git a/gas/testsuite/gas/i386/x86-64-optimize-3.d b/gas/testsuite/gas/i386/x86-64-optimize-3.d
index b46f728..f85c0af 100644
--- a/gas/testsuite/gas/i386/x86-64-optimize-3.d
+++ b/gas/testsuite/gas/i386/x86-64-optimize-3.d
@@ -24,4 +24,5 @@ Disassembly of section .text:
+[a-f0-9]+: 41 f6 c1 7f test \$0x7f,%r9b
+[a-f0-9]+: 41 f6 c1 7f test \$0x7f,%r9b
+[a-f0-9]+: 41 f6 c1 7f test \$0x7f,%r9b
+ +[a-f0-9]+: c5 f1 55 e9 vandnpd %xmm1,%xmm1,%xmm5
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-optimize-3.s b/gas/testsuite/gas/i386/x86-64-optimize-3.s
index 61c150a..4a52a25 100644
--- a/gas/testsuite/gas/i386/x86-64-optimize-3.s
+++ b/gas/testsuite/gas/i386/x86-64-optimize-3.s
@@ -19,3 +19,5 @@ _start:
test $0x7f, %r9d
test $0x7f, %r9w
test $0x7f, %r9b
+
+ vandnpd %zmm1, %zmm1, %zmm5