This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] x86: Rewrite NOP generation for fill and alignment
- From: Martin Liška <mliska at suse dot cz>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>, Binutils <binutils at sourceware dot org>
- Date: Tue, 6 Mar 2018 11:31:48 +0100
- Subject: Re: [PATCH] x86: Rewrite NOP generation for fill and alignment
- Authentication-results: sourceware.org; auth=none
- References: <20180301135601.GA5941@intel.com> <CAMe9rOrqnNvAnxKhQmcRR2h-3P=eAteCUhoc8gyADErwUKB6kg@mail.gmail.com>
On 03/02/2018 06:00 PM, H.J. Lu wrote:
> On Thu, Mar 1, 2018 at 5:56 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> Sorry if you get this email twice. The first one may be too large for
>> binutils mailing list. It is also at
>>
>> https://github.com/hjl-tools/binutils-gdb/commit/df9716667487e6df69264dd976ec7a3451433e3c
>>
>> Rewrite NOP generation for fill and code alignment by:
>>
>> 1. Add a 11-byte NOP with another 0x66 prefix.
>> 2. Remove the multi-byte NOP entries which consist of 2 instructions.
>> 3. Select proper NOPs based on ISA and processor tuning.
>> 4. Generate multiple NOPs with the longer NOPs first followed by the
>> shorter NOP.
>> 5. Use jump for larger NOP padding:
>> a. > 8 bytes (2 NOPs) in 16-bit mode.
>> b. > 14 bytes (2 NOPs) for older processors.
>> c. > 77 bytes (7 NOPs) for newer processors.
>> 6. Update MAX_MEM_FOR_RS_ALIGN_CODE to 4095.
>>
>> Any comments?
>>
>> H.J.
>> PR gas/22874
>> * config/tc-i386.c (f32_5): Removed.
>> (f32_8): Likewise.
>> (f32_9): Likewise.
>> (f32_10): Likewise.
>> (f32_11): Likewise.
>> (f32_12): Likewise.
>> (f32_13): Likewise.
>> (f32_14): Likewise.
>> (f16_5): Likewise.
>> (f16_6): Likewise.
>> (f16_7): Likewise.
>> (f16_8): Likewise.
>> (jump_31): Likewise.
>> (alt64_11): Likewise.
>> (alt64_patt): Likewise.
>> (jump_disp8): New.
>> (jump32_disp32): Likewise.
>> (jump16_disp32): Likewise.
>> (alt_11): Likewise.
>> (f32_patt): Updated.
>> (f16_patt): Likewise.
>> (alt_patt): Add alt_11.
>> (i386_align_code): Merged with ...
>> (i386_generate_nops): This. Rewritten.
>> (fits_in_imm7): Moved before i386_generate_nops.
>> (fits_in_imm31): Likewise.
>> * config/tc-i386.h (MAX_MEM_FOR_RS_ALIGN_CODE): Updated to
>> 4095.
>> (i386_align_code): Removed.
>> (HANDLE_ALIGN): Rewritten with i386_generate_nops.
>> * doc/as.texinfo: Update limits of control byte for x86 .nops
>> directive.
>> * testsuite/gas/i386/i386.exp: Run nops-7 and x86-64-nops-7.
>> * gas/testsuite/gas/i386/noavx-3.l: Updated.
>> * gas/testsuite/gas/i386/nop-1.d: Likewise.
>> * gas/testsuite/gas/i386/nop-1.s: Likewise.
>> * gas/testsuite/gas/i386/nop-2.d: Likewise.
>> * gas/testsuite/gas/i386/nop-2.s: Likewise.
>> * gas/testsuite/gas/i386/nop-3.d: Likewise.
>> * gas/testsuite/gas/i386/nop-4.d: Likewise.
>> * gas/testsuite/gas/i386/nop-5.d: Likewise.
>> * gas/testsuite/gas/i386/nop-5.s: Likewise.
>> * gas/testsuite/gas/i386/nop-6.d: Likewise.
>> * gas/testsuite/gas/i386/nop-bad-1.l: Likewise.
>> * gas/testsuite/gas/i386/nops-1-core2.d: Likewise.
>> * gas/testsuite/gas/i386/nops-1-i386-i686.d: Likewise.
>> * gas/testsuite/gas/i386/nops-1-i386.d: Likewise.
>> * gas/testsuite/gas/i386/nops-1-i686.d: Likewise.
>> * gas/testsuite/gas/i386/nops-1-k8.d: Likewise.
>> * gas/testsuite/gas/i386/nops-1.d: Likewise.
>> * gas/testsuite/gas/i386/nops-2-core2.d: Likewise.
>> * gas/testsuite/gas/i386/nops-2-i386.d: Likewise.
>> * gas/testsuite/gas/i386/nops-2.d: Likewise.
>> * gas/testsuite/gas/i386/nops-3-i386.d: Likewise.
>> * gas/testsuite/gas/i386/nops-3-i686.d: Likewise.
>> * gas/testsuite/gas/i386/nops-3.d: Likewise.
>> * gas/testsuite/gas/i386/nops-4-i386.d: Likewise.
>> * gas/testsuite/gas/i386/nops-4-i686.d: Likewise.
>> * gas/testsuite/gas/i386/nops-4.d: Likewise.
>> * gas/testsuite/gas/i386/nops-4a-i686.d: Likewise.
>> * gas/testsuite/gas/i386/nops-5-i686.d: Likewise.
>> * gas/testsuite/gas/i386/nops-5.d: Likewise.
>> * gas/testsuite/gas/i386/nops-6.d: Likewise.
>> * gas/testsuite/gas/i386/nops16-1.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nop-1.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nop-2.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nop-5.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-1-core2.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-1-g64.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-1-k8.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-1-pentium.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-1.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-2.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-3.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-4-core2.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-4-k8.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-4.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-5-k8.d: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-5.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-1-core2.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-1-k8.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-1-pentium.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-1.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-2.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-3.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-4-core2.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-4-k8.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-4.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-5-k8.d: Likewise.
>> * gas/testsuite/gas/i386/ilp32/x86-64-nops-5.d: Likewise.
>> * gas/testsuite/gas/i386/nops-7.d: New file.
>> * gas/testsuite/gas/i386/nops-7.s: Likewise.
>> * gas/testsuite/gas/i386/x86-64-nops-7.d: Likewise.
>
> I tested it with Linux kernel, glibc, GCC and binutils on i686 and x86-64.
> I will check it in next week.
>
Thank you very much. Please let me now when it's checked in.
Martin