[binutils-gdb] x86: slightly simplify offset_in_range()
Jan Beulich
jbeulich@sourceware.org
Tue Jun 15 06:01:44 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=649658972ca923250019ca15e4ddd98bf28bf123
commit 649658972ca923250019ca15e4ddd98bf28bf123
Author: Jan Beulich <jbeulich@suse.com>
Date: Tue Jun 15 08:00:17 2021 +0200
x86: slightly simplify offset_in_range()
Applying a mask with all bits set (or its inverse, with hence all bits
clear) won't alter the result (or won't trigger the warning). Re-arrange
the code to eliminate two more of the somewhat odd (2 << width_minus_1)
constructs.
Diff:
---
gas/ChangeLog | 5 +++++
gas/config/tc-i386.c | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 0a59cd74d6a..76994470180 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-15 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (offset_in_range): Bail early when mask would
+ cover all bits anyway.
+
2021-06-15 Jan Beulich <jbeulich@suse.com>
* config/tc-i386.c (optimize_disp): Generalize disp32 part of
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index e6276dcab5c..945a1a6958e 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2556,10 +2556,10 @@ offset_in_range (offsetT val, int size)
{
case 1: mask = ((addressT) 1 << 8) - 1; break;
case 2: mask = ((addressT) 1 << 16) - 1; break;
- case 4: mask = ((addressT) 2 << 31) - 1; break;
#ifdef BFD64
- case 8: mask = ((addressT) 2 << 63) - 1; break;
+ case 4: mask = ((addressT) 1 << 32) - 1; break;
#endif
+ case sizeof (val): return val;
default: abort ();
}
More information about the Binutils-cvs
mailing list