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

login
register
mail settings
Submitter Uros Bizjak
Date Sept. 30, 2012, 7:26 p.m.
Message ID <CAFULd4acoarCePNP1=uSeYgj+EzJ_Z6+gwYfXgfV-Y+qpSAafA@mail.gmail.com>
Download mbox | patch
Permalink /patch/188192/
State New
Headers show

Comments

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

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;
 }