summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-08-15 13:17:41 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-08-16 14:40:30 -0700
commitff01bb6c2321680660979fb9a4ab027348ea94ed (patch)
tree41709f4023800706f61c5271a10b2bbf8569be08
parent892a1e530379eeea924e938c8a588fbf3845f4fa (diff)
downloadbinutils-gdb-ff01bb6c2321680660979fb9a4ab027348ea94ed.tar.gz
x86: Don't pad .tfloat directive output
.tfloat output should always be 10 bytes without padding, independent of psABIs. In glibc, x86 assembly codes expect 10-byte .tfloat output. This also reduces .ds.x output and .tfloat output with hex input from 12 bytes to 10 bytes to match .tfloat output. PR gas/28230 * NEWS: Mention changes of .ds.x output and .tfloat output with hex input. * config/tc-i386.c (x86_tfloat_pad): Removed. * config/tc-i386.h (X_PRECISION_PAD): Changed to 0. (x86_tfloat_pad): Removed. * testsuite/gas/i386/fp.s: If NO_TFLOAT_PADDING isn't defined, add explicit paddings after .tfloat, .ds.x, .dc.x and .dcb.x directives. * testsuite/gas/i386/i386.exp (ASFLAGS): Append "--defsym NO_TFLOAT_PADDING=1" when running the fp test.
-rw-r--r--gas/NEWS4
-rw-r--r--gas/config/tc-i386.c13
-rw-r--r--gas/config/tc-i386.h3
-rw-r--r--gas/testsuite/gas/i386/fp.s119
-rw-r--r--gas/testsuite/gas/i386/i386.exp3
5 files changed, 127 insertions, 15 deletions
diff --git a/gas/NEWS b/gas/NEWS
index 9e24e4ddc17..8046ed541a8 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -1,5 +1,9 @@
-*- text -*-
+* Outputs of .ds.x directive and .tfloat directive with hex input from
+ x86 assembler have been reduced from 12 bytes to 10 bytes to match the
+ output of .tfloat directive.
+
* Add support for Intel AVX512_FP16 instructions.
Changes in 2.37:
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index dc29fa2ba52..7148c073247 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -10231,19 +10231,6 @@ x86_cons_fix_new (fragS *frag, unsigned int off, unsigned int len,
fix_new_exp (frag, off, len, exp, 0, r);
}
-/* Return the number of padding LITTLENUMs following a tbyte floating
- point value. */
-
-int
-x86_tfloat_pad (void)
-{
-#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
- if (IS_ELF)
- return object_64bit ? 3 : 1;
-#endif
- return 0;
-}
-
/* Export the ABI address size for use by TC_ADDRESS_BYTES for the
purpose of the `.dc.a' internal pseudo-op. */
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 2dc6312f28e..f50169cbcc0 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -135,8 +135,7 @@ extern void x86_cons_fix_new
(fragS *, unsigned int, unsigned int, expressionS *, bfd_reloc_code_real_type);
#define X_PRECISION 5
-#define X_PRECISION_PAD x86_tfloat_pad ()
-extern int x86_tfloat_pad (void);
+#define X_PRECISION_PAD 0
#define TC_ADDRESS_BYTES x86_address_bytes
extern int x86_address_bytes (void);
diff --git a/gas/testsuite/gas/i386/fp.s b/gas/testsuite/gas/i386/fp.s
index a63464b6cd2..90854b740ad 100644
--- a/gas/testsuite/gas/i386/fp.s
+++ b/gas/testsuite/gas/i386/fp.s
@@ -1,6 +1,13 @@
.data
# .tfloat is 80-bit floating point format.
.tfloat 3.32192809488736218171e0
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
# .byte 0x0, 0x88, 0x1b, 0xcd, 0x4b, 0x78, 0x9a, 0xd4, 0x0, 0x40
# .double is 64-bit floating point format.
.double 3.32192809488736218171e0
@@ -23,11 +30,39 @@
.p2align 4,0
.ds.x 1, -1
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte -1, -1, -1, -1, -1, -1
+ .else
+ .byte -1, -1
+ .endif
+.endif
.p2align 4,0xcc
.tfloat 0x:3ffe80
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.dc.x 0x:bffd80
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.dcb.x 1, 0x:03ff80
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0xaa
.hfloat 1, -2, 0x:3c00
@@ -39,6 +74,13 @@
.single Inf
.double Inf
.tfloat Inf
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x44
.hfloat +Inf
@@ -46,6 +88,13 @@
.single +Inf
.double +Inf
.tfloat +Inf
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x33
.hfloat -Inf
@@ -53,6 +102,13 @@
.single -Inf
.double -Inf
.tfloat -Inf
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x22
.hfloat NaN
@@ -60,6 +116,13 @@
.single NaN
.double NaN
.tfloat NaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x44
.hfloat +NaN
@@ -67,6 +130,13 @@
.single +NaN
.double +NaN
.tfloat +NaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x33
.hfloat -NaN
@@ -74,6 +144,13 @@
.single -NaN
.double -NaN
.tfloat -NaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x22
.hfloat QNaN
@@ -81,6 +158,13 @@
.single QNaN
.double QNaN
.tfloat QNaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x44
.hfloat +QNaN
@@ -88,6 +172,13 @@
.single +QNaN
.double +QNaN
.tfloat +QNaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x33
.hfloat -QNaN
@@ -95,6 +186,13 @@
.single -QNaN
.double -QNaN
.tfloat -QNaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x22
.hfloat SNaN
@@ -102,6 +200,13 @@
.single SNaN
.double SNaN
.tfloat SNaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x44
.hfloat +SNaN
@@ -109,6 +214,13 @@
.single +SNaN
.double +SNaN
.tfloat +SNaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x33
.hfloat -SNaN
@@ -116,4 +228,11 @@
.single -SNaN
.double -SNaN
.tfloat -SNaN
+.ifndef NO_TFLOAT_PADDING
+ .ifdef x86_64
+ .byte 0, 0, 0, 0, 0, 0
+ .else
+ .byte 0, 0
+ .endif
+.endif
.p2align 4,0x22
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
index 122da6a2315..189121f1428 100644
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -698,7 +698,10 @@ if [gas_32_check] then {
run_list_test "iamcu-inval-1" "-march=iamcu -al"
}
} else {
+ set saved_ASFLAGS "$ASFLAGS"
+ append ASFLAGS " --defsym NO_TFLOAT_PADDING=1"
run_dump_test "fp"
+ set $ASFLAGS "$saved_ASFLAGS"
}
# This is a PE specific test.