[i386] : Fix spurious testsuite failure in gcc.target/i386/pad-10.c

Submitted by Uros Bizjak on Sept. 30, 2012, 7:26 p.m.

Details

Message ID CAFULd4acoarCePNP1=uSeYgj+EzJ_Z6+gwYfXgfV-Y+qpSAafA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Sept. 30, 2012, 7:26 p.m.
Hello!

Recently, gcc become smart enough to merge:

        leal    (%rdi), %eax
        addl    %esi, %eax

into

        leal    (%rsi,%rdi), %eax

The generated sequence (without ret) becomes shorter than 4 instructions:

        cmpl    $1, %esi
        leal    (%rsi,%rdi), %eax
        je      .L8
        nop
        nop
        ret

and nop insertion for ATOM was triggered.

Following patch changes arithmetic to again generate correct number of
instructions, without compromising the intention of the test.

        leal    (%rsi), %eax
        subl    %edi, %eax
        cmpl    $1, %esi
        je      .L8
        ret

2012-09-30  Uros Bizjak  <ubizjak@gmail.com>

	* gcc.target/i386/pad-10.c (foo2): Return x - z.

Tested on x86_64-pc-linux-gnu, committed to mainline SVN.

Uros.

Patch hide | download patch | download mbox

Index: gcc.target/i386/pad-10.c
===================================================================
--- gcc.target/i386/pad-10.c    (revision 191866)
+++ gcc.target/i386/pad-10.c    (working copy)
@@ -15,5 +15,5 @@ 
       return z;
     }
   else
-    return x + z;
+    return x - z;
 }