From ca66ec5eec6f7407d4bdbb1e091a9ccde66a5194 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 17 Jul 2008 14:22:10 -0700 Subject: smartalign: adjust the alignment threshold Apparently the current recommendation is for a smaller threshold when using the "generic"-style alignment macros (short jumps are cheaper on newer CPUs.) Also change the alignment threshold definition to reflect the maximum number of padding instead of when to start using jumps. --- macros/smartalign.mac | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'macros') diff --git a/macros/smartalign.mac b/macros/smartalign.mac index 6ff294ae..12850867 100644 --- a/macros/smartalign.mac +++ b/macros/smartalign.mac @@ -4,8 +4,9 @@ USE: smartalign %imacro alignmode 1-2.nolist - %define __ALIGN_JMP_THRESHOLD__ 17 %ifidni %1,nop + %define __ALIGN_JMP_THRESHOLD__ 16 + %define __ALIGN_16BIT_1B__ 0x90 %define __ALIGN_16BIT_2B__ 0x90,0x90 %define __ALIGN_16BIT_3B__ 0x90,0x90,0x90 @@ -33,6 +34,8 @@ USE: smartalign %define __ALIGN_64BIT_7B__ 0x90,0x90,0x90,0x90,0x90,0x90,0x90 %define __ALIGN_64BIT_8B__ 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90 %elifidni %1,generic + %define __ALIGN_JMP_THRESHOLD__ 8 + %define __ALIGN_16BIT_1B__ 0x90 %define __ALIGN_16BIT_2B__ 0x89,0xf6 %define __ALIGN_16BIT_3B__ 0x8d,0x74,0x00 @@ -60,6 +63,8 @@ USE: smartalign %define __ALIGN_64BIT_7B__ 0x66,0x66,0x66,0x90,0x66,0x66,0x90 %define __ALIGN_64BIT_8B__ 0x66,0x66,0x66,0x90,0x66,0x66,0x66,0x90 %elifidni %1,k8 + %define __ALIGN_JMP_THRESHOLD__ 16 + %define __ALIGN_16BIT_1B__ 0x90 %define __ALIGN_16BIT_2B__ 0x66,0x90 %define __ALIGN_16BIT_3B__ 0x66,0x66,0x90 @@ -87,6 +92,8 @@ USE: smartalign %define __ALIGN_64BIT_7B__ 0x66,0x66,0x66,0x90,0x66,0x66,0x90 %define __ALIGN_64BIT_8B__ 0x66,0x66,0x66,0x90,0x66,0x66,0x66,0x90 %elifidni %1,k7 + %define __ALIGN_JMP_THRESHOLD__ 16 + %define __ALIGN_16BIT_1B__ 0x90 %define __ALIGN_16BIT_2B__ 0x66,0x90 %define __ALIGN_16BIT_3B__ 0x66,0x66,0x90 @@ -114,6 +121,8 @@ USE: smartalign %define __ALIGN_64BIT_7B__ 0x66,0x66,0x66,0x90,0x66,0x66,0x90 %define __ALIGN_64BIT_8B__ 0x66,0x66,0x66,0x90,0x66,0x66,0x66,0x90 %elifidni %1,p6 + %define __ALIGN_JMP_THRESHOLD__ 16 + %define __ALIGN_16BIT_1B__ 0x90 %define __ALIGN_16BIT_2B__ 0x66,0x90 %define __ALIGN_16BIT_3B__ 0x0f,0x1f,0x00 @@ -156,7 +165,7 @@ USE: smartalign %else %push %assign %$pad ($$-$) % %1 - %if %$pad >= __ALIGN_JMP_THRESHOLD__ + %if %$pad > __ALIGN_JMP_THRESHOLD__ jmp %%end ; We can't re-use %$pad here as $ will have changed! times ($$-$) % %1 db 90h -- cgit v1.2.1