From 81588de012f9c59f2e02d7c74e1f51123025707c Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 3 Mar 2023 08:45:12 +0100 Subject: [PATCH] x86: avoid .byte in testcases where possible In the course of using the upcoming .insn directive to eliminate various .byte uses in testcases I've come across these, which needlessly use more .byte than necessary even without the availability of .insn. --- gas/testsuite/gas/i386/notrack.s | 11 +- gas/testsuite/gas/i386/opcode.s | 2 +- gas/testsuite/gas/i386/prefix.s | 339 ++++++++++-------------- gas/testsuite/gas/i386/x86-64-notrack.s | 20 +- 4 files changed, 152 insertions(+), 220 deletions(-) diff --git a/gas/testsuite/gas/i386/notrack.s b/gas/testsuite/gas/i386/notrack.s index e6db928feeb..52df4dc8df2 100644 --- a/gas/testsuite/gas/i386/notrack.s +++ b/gas/testsuite/gas/i386/notrack.s @@ -54,14 +54,11 @@ _start: bnd notrack call DWORD PTR [eax] bnd notrack call WORD PTR [eax] + .att_syntax prefix # bnd notrack call *%eax - .byte 0xf2 - .byte 0x3e - .byte 0xff - .byte 0xd0 + bnd + notrack call *%eax # notrack callw *%ax .byte 0x66 - .byte 0x3e - .byte 0xff - .byte 0xd0 + notrack call *%eax diff --git a/gas/testsuite/gas/i386/opcode.s b/gas/testsuite/gas/i386/opcode.s index 8b87dd70694..f2ac1e8fed5 100644 --- a/gas/testsuite/gas/i386/opcode.s +++ b/gas/testsuite/gas/i386/opcode.s @@ -606,7 +606,7 @@ foo: .byte 0x82, 0xf3, 0x01 .byte 0x82, 0xfb, 0x01 - .byte 0x62, 0xf3, 0x7d, 0x08, 0x15, 0xe8, 0xab + {evex} {store} vpextrw $0xab, %xmm5, %eax .byte 0xf6, 0xc9, 0x01 .byte 0x66, 0xf7, 0xc9, 0x02, 0x00 diff --git a/gas/testsuite/gas/i386/prefix.s b/gas/testsuite/gas/i386/prefix.s index 8d563e16267..fccb7cbafc7 100644 --- a/gas/testsuite/gas/i386/prefix.s +++ b/gas/testsuite/gas/i386/prefix.s @@ -24,370 +24,311 @@ # data16 movsd %xmm4,(%edx) .byte 0xf2 - .byte 0x66 - .byte 0x0f - .byte 0x11 - .byte 0x22 + movupd %xmm4, (%edx) # data16 movsd %xmm4,(%bp,%si) .byte 0xf2 - .byte 0x67 - .byte 0x66 - .byte 0x0f - .byte 0x11 - .byte 0x22 + movupd %xmm4, (%bp,%si) # lock data16 movsd %xmm4,(%bp,%si) .byte 0xf2 .byte 0x67 - .byte 0xf0 - .byte 0x66 - .byte 0x0f - .byte 0x11 - .byte 0x22 + lock + movupd %xmm4, (%edx) # data16 movss %xmm4,(%edx) .byte 0xf3 - .byte 0x66 - .byte 0x0f - .byte 0x11 - .byte 0x22 + movupd %xmm4, (%edx) # lock data16 movss %xmm4,(%bp,%si) .byte 0xf3 .byte 0x67 - .byte 0xf0 - .byte 0x66 - .byte 0x0f - .byte 0x11 - .byte 0x22 + lock + movupd %xmm4, (%edx) # repz data16 movsd %xmm4,(%bp,%si) - .byte 0xf3 + repz .byte 0x67 .byte 0xf2 - .byte 0x66 - .byte 0x0f - .byte 0x11 - .byte 0x22 + movupd %xmm4, (%edx) # data16 movss %xmm4,%ds:(%edx) .byte 0xf3 .byte 0x66 - .byte 0x3e - .byte 0x0f - .byte 0x11 - .byte 0x22 + ds + movups %xmm4, (%edx) # data16 movsd %xmm4,%ss:(%edx) .byte 0xf2 .byte 0x66 - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + movups %xmm4, %ss:(%edx) # repz lock data16 movsd %xmm4,%ss:(%edx) - .byte 0xf3 - .byte 0xf0 + repz + lock .byte 0xf2 .byte 0x66 - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + movups %xmm4, %ss:(%edx) # data16 ds movsd %xmm4,%ss:(%edx) .byte 0xf2 .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + ds + movups %xmm4, %ss:(%edx) # data16 ds movsd %xmm4,%ss:(%bp,%si) .byte 0xf2 .byte 0x67 .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + ds + movups %xmm4, %ss:(%edx) # lock data16 ds movsd %xmm4,%ss:(%bp,%si) .byte 0xf2 .byte 0x67 - .byte 0xf0 + lock .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + ds + movups %xmm4, %ss:(%edx) # data16 ds movss %xmm4,%ss:(%edx) .byte 0xf3 .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + ds + movups %xmm4, %ss:(%edx) # lock data16 ds movss %xmm4,%ss:(%edx) .byte 0xf3 - .byte 0xf0 + lock .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + ds + movups %xmm4, %ss:(%edx) # repz data16 ds movsd %xmm4,%ss:(%bp,%si) .byte 0xf3 .byte 0x67 .byte 0xf2 .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x0f - .byte 0x11 - .byte 0x22 + ds + movups %xmm4, %ss:(%edx) # repnz; xchg %ax,%ax - .byte 0xf2 - .byte 0x66 - .byte 0x90 + repnz + xchg %ax, %ax # repnz; addr16 xchg %ax,%ax - .byte 0xf2 + repnz .byte 0x67 - .byte 0x66 - .byte 0x90 + xchg %ax, %ax # repnz; addr16 lock xchg %ax,%ax - .byte 0xf2 + repnz .byte 0x67 - .byte 0xf0 - .byte 0x66 - .byte 0x90 + lock + xchg %ax, %ax # data16 pause - .byte 0xf3 - .byte 0x66 - .byte 0x90 + repz + xchg %ax, %ax # addr16 lock data16 pause .byte 0xf3 .byte 0x67 - .byte 0xf0 - .byte 0x66 - .byte 0x90 + lock + xchg %ax, %ax # repz; addr16; repnz; xchg %ax,%ax - .byte 0xf3 + repz .byte 0x67 - .byte 0xf2 - .byte 0x66 - .byte 0x90 + repnz + xchg %ax, %ax # repnz; ds nop - .byte 0xf2 - .byte 0x3e - .byte 0x90 + repnz + ds + nop # repnz; lock addr16 ds nop - .byte 0xf2 - .byte 0xf0 + repnz + lock .byte 0x67 - .byte 0x3e - .byte 0x90 + ds + nop # ds pause .byte 0xf3 - .byte 0x3e - .byte 0x90 + ds + nop # data16 ds pause .byte 0xf3 .byte 0x66 - .byte 0x3e - .byte 0x90 + ds + nop # lock ds pause .byte 0xf3 - .byte 0xf0 - .byte 0x3e - .byte 0x90 + lock + ds + nop # lock addr16 ds pause .byte 0xf3 - .byte 0xf0 + lock .byte 0x67 - .byte 0x3e - .byte 0x90 + ds + nop # repz; repnz; addr16 ds nop .byte 0xf3 - .byte 0xf2 + repnz .byte 0x67 - .byte 0x3e - .byte 0x90 + ds + nop # lock ss xchg %ax,%ax .byte 0x66 - .byte 0xf0 - .byte 0x36 - .byte 0x90 + lock + ss + nop # repnz; ss nop - .byte 0xf2 - .byte 0x36 - .byte 0x90 + repnz + ss + nop # repnz; ss xchg %ax,%ax - .byte 0xf2 + repnz .byte 0x66 - .byte 0x36 - .byte 0x90 + ss + nop # repnz; lock ss nop - .byte 0xf2 - .byte 0xf0 - .byte 0x36 - .byte 0x90 + repnz + lock + ss + nop # repnz; lock addr16 ss nop - .byte 0xf2 - .byte 0xf0 + repnz + lock .byte 0x67 - .byte 0x36 - .byte 0x90 + ss + nop # ss pause - .byte 0xf3 - .byte 0x36 - .byte 0x90 + repz + ss + nop # addr16 ss pause - .byte 0xf3 + repz .byte 0x67 - .byte 0x36 - .byte 0x90 + ss + nop # lock addr16 ss pause - .byte 0xf3 - .byte 0xf0 + repz + lock .byte 0x67 - .byte 0x36 - .byte 0x90 + ss + nop # repz; repnz; ss nop - .byte 0xf3 - .byte 0xf2 - .byte 0x36 - .byte 0x90 + repz + repnz + ss + nop # repz; repnz; addr16 ss nop - .byte 0xf3 - .byte 0xf2 + repz + repnz .byte 0x67 - .byte 0x36 - .byte 0x90 + ss + nop # repz; lock; repnz; ss xchg %ax,%ax - .byte 0xf3 - .byte 0xf0 - .byte 0xf2 + repz + lock + repnz .byte 0x66 - .byte 0x36 - .byte 0x90 + ss + nop # ds ss xchg %ax,%ax .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x90 + ds + ss + nop # addr16 ds ss xchg %ax,%ax .byte 0x67 .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x90 + ds + ss + nop # addr16 lock ds ss xchg %ax,%ax .byte 0x67 - .byte 0xf0 + lock .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x90 + ds + ss + nop # data16 ds ss pause - .byte 0xf3 + repz .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x90 + ds + ss + nop # lock data16 ds ss pause - .byte 0xf3 - .byte 0xf0 + repz + lock .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x90 + ds + ss + nop # repz; repnz; addr16 ds ss nop - .byte 0xf3 - .byte 0xf2 + repz + repnz .byte 0x67 - .byte 0x3e - .byte 0x36 - .byte 0x90 + ds + ss + nop # repz; addr16; repnz; ds ss xchg %ax,%ax - .byte 0xf3 + repz .byte 0x67 - .byte 0xf2 + repnz .byte 0x66 - .byte 0x3e - .byte 0x36 - .byte 0x90 + ds + ss + nop # repz; rdseed %eax - .byte 0xf3 - .byte 0x0f - .byte 0xc7 - .byte 0xf8 + repz + rdseed %eax nop # repz; rdrand %eax - .byte 0xf3 - .byte 0x0f - .byte 0xc7 - .byte 0xf0 + repz + rdrand %eax nop # repnz; rdseed %eax - .byte 0xf2 - .byte 0x0f - .byte 0xc7 - .byte 0xf8 + repnz + rdseed %eax nop # repnz; rdrand %eax - .byte 0xf2 - .byte 0x0f - .byte 0xc7 - .byte 0xf0 + repnz + rdrand %eax nop diff --git a/gas/testsuite/gas/i386/x86-64-notrack.s b/gas/testsuite/gas/i386/x86-64-notrack.s index aeebd11a766..2681c2de89c 100644 --- a/gas/testsuite/gas/i386/x86-64-notrack.s +++ b/gas/testsuite/gas/i386/x86-64-notrack.s @@ -78,20 +78,14 @@ _start: bnd notrack call QWORD PTR [eax] bnd notrack call QWORD PTR [r8d] + .att_syntax prefix # bnd notrack callq *%rax - .byte 0xf2 - .byte 0x3e - .byte 0xff - .byte 0xd0 + bnd + notrack call *%rax - # ds callw *%ax - .byte 0x3e - .byte 0x66 - .byte 0xff - .byte 0xd0 + # notrack callw *%ax + notrack call *%ax - # ds callw *%ax + # notrack callw *%ax .byte 0x66 - .byte 0x3e - .byte 0xff - .byte 0xd0 + notrack call *%rax -- 2.30.2