Re: jump/alignment considerations

Alan Modra (alan@spri.levels.unisa.edu.au)
Thu, 30 Jan 1997 10:16:18 +1030 (CST)


> From: Mat Hostetter <mat@lcs.mit.edu>
> Date: 29 Jan 1997 15:37:01 -0500
>
> gas 2.7 generates suboptimal padding bytes, but this could be fixed.
> For a two byte NOP gas emits `lea (%esi),%esi', when it could use
> `movl %esi,%esi' and avoid the possibility of an AGI stall. For some
> larger pads it puts two lea's back to back *both using %esi*, which is
> non-pairable and causes a guaranteed AGI stall.

I suppose I should have tried to fix this a long time ago, since I
knew about the problem.

--- gas-970118/gas/config/tc-i386.c Thu Jan 30 09:13:46 1997
+++ ./gas/config/tc-i386.c Thu Jan 30 10:11:03 1997
@@ -249,7 +249,7 @@
{
/* Various efficient no-op patterns for aligning code labels. */
static const char f32_1[] = {0x90};
- static const char f32_2[] = {0x8d,0x36};
+ static const char f32_2[] = {0x89,0xf6};
static const char f32_3[] = {0x8d,0x76,0x00};
static const char f32_4[] = {0x8d,0x74,0x26,0x00};
static const char f32_5[] = {0x90,
@@ -258,29 +258,29 @@
static const char f32_7[] = {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};
static const char f32_8[] = {0x90,
0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};
- static const char f32_9[] = {0x8d,0x36,
- 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};
+ static const char f32_9[] = {0x89,0xf6,
+ 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};
static const char f32_10[] = {0x8d,0x76,0x00,
- 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};
+ 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};
static const char f32_11[] = {0x8d,0x74,0x26,0x00,
- 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};
+ 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};
static const char f32_12[] = {0x8d,0xb6,0x00,0x00,0x00,0x00,
- 0x8d,0xb6,0x00,0x00,0x00,0x00};
+ 0x8d,0xbf,0x00,0x00,0x00,0x00};
static const char f32_13[] = {0x8d,0xb6,0x00,0x00,0x00,0x00,
- 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};
+ 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};
static const char f32_14[] = {0x8d,0xb4,0x26,0x00,0x00,0x00,0x00,
- 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00};
+ 0x8d,0xbc,0x27,0x00,0x00,0x00,0x00};
static const char f32_15[] = {0xeb,0x0d,0x90,0x90,0x90,0x90,0x90,
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90};
static const char f16_4[] = {0x8d,0xb6,0x00,0x00};
static const char f16_5[] = {0x90,
0x8d,0xb6,0x00,0x00};
- static const char f16_6[] = {0x8d,0x36,
- 0x8d,0xb6,0x00,0x00};
+ static const char f16_6[] = {0x89,0xf6,
+ 0x8d,0xbd,0x00,0x00};
static const char f16_7[] = {0x8d,0x76,0x00,
- 0x8d,0xb6,0x00,0x00};
+ 0x8d,0xbd,0x00,0x00};
static const char f16_8[] = {0x8d,0xb6,0x00,0x00,
- 0x8d,0xb6,0x00,0x00};
+ 0x8d,0xbd,0x00,0x00};
static const char *const f32_patt[] = {
f32_1, f32_2, f32_3, f32_4, f32_5, f32_6, f32_7, f32_8,
f32_9, f32_10, f32_11, f32_12, f32_13, f32_14, f32_15