]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/8746 (gcc miscompiles Linux kernel ppa driver on x86)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Tue, 25 Mar 2003 10:42:14 +0000 (11:42 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 25 Mar 2003 10:42:14 +0000 (10:42 +0000)
PR optimization/8746
* config/i386/i386.md (and promoting splitters): Disable HImode to
SImode promoting when the sign bit matters and is not preserved.
Disable promoting when optimizing for size.

From-SVN: r64844

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/i386-signbit-1.c
gcc/testsuite/gcc.dg/i386-signbit-2.c
gcc/testsuite/gcc.dg/i386-signbit-3.c

index dd8ef440eee216cadca008d6709f3587fd61d143..19fddbf94cadacaf09cbd637bcfa48e0b21c7244 100644 (file)
@@ -1,3 +1,10 @@
+2003-03-25  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       PR optimization/8746
+       * config/i386/i386.md (and promoting splitters): Disable HImode to
+       SImode promoting when the sign bit matters and is not preserved.
+       Disable promoting when optimizing for size.
+
 2003-03-23  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR optimization/9414
index 34cd0da1aeeacb38484bbe6b99abffc9ad5b1aa6..70ce9598662d27b03a50a55f6b8eb8bc57c8801b 100644 (file)
      operands[2] = gen_lowpart (SImode, operands[2]);
    PUT_MODE (operands[3], SImode);")
 
+; Promote the QImode tests, as i386 has encoding of the AND
+; instruction with 32-bit sign-extended immediate and thus the
+; instruction size is unchanged, except in the %eax case for
+; which it is increased by one byte, hence the ! optimize_size.
 (define_split
   [(set (reg 17)
        (compare (and (match_operand 1 "aligned_operand" "")
    (set (match_operand 0 "register_operand" "")
        (and (match_dup 1) (match_dup 2)))]
   "! TARGET_PARTIAL_REG_STALL && reload_completed
-   && ix86_match_ccmode (insn, CCNOmode)
+   /* Ensure that the operand will remain sign-extended immediate.  */
+   && ix86_match_ccmode (insn, INTVAL (operands[2]) >= 0 ? CCNOmode : CCZmode)
+   && ! optimize_size
    && (GET_MODE (operands[0]) == HImode
-       || (GET_MODE (operands[0]) == QImode 
-          /* Ensure that the operand will remain sign extended immediate.  */
-          && INTVAL (operands[2]) >= 0
-          && (TARGET_PROMOTE_QImode || optimize_size)))"
+       || (GET_MODE (operands[0]) == QImode && TARGET_PROMOTE_QImode))"
   [(parallel [(set (reg:CCNO 17)
                   (compare:CCNO (and:SI (match_dup 1) (match_dup 2))
                                 (const_int 0)))
    operands[0] = gen_lowpart (SImode, operands[0]);
    operands[1] = gen_lowpart (SImode, operands[1]);")
 
-; Don't promote the QImode tests, as i386 don't have encoding of
-; the test instruction with 32bit sign extended immediate and thus
-; the code grows.
+; Don't promote the QImode tests, as i386 doesn't have encoding of
+; the TEST instruction with 32-bit sign-extended immediate and thus
+; the instruction size would at least double, which is not what we
+; want even with ! optimize_size.
 (define_split
   [(set (reg 17)
        (compare (and (match_operand:HI 0 "aligned_operand" "")
                      (match_operand:HI 1 "const_int_operand" ""))
                 (const_int 0)))]
   "! TARGET_PARTIAL_REG_STALL && reload_completed
-   && ix86_match_ccmode (insn, CCNOmode)
-   && GET_MODE (operands[0]) == HImode"
+   /* Ensure that the operand will remain sign-extended immediate.  */
+   && ix86_match_ccmode (insn, INTVAL (operands[1]) >= 0 ? CCNOmode : CCZmode)
+   && ! optimize_size"
   [(set (reg:CCNO 17)
        (compare:CCNO (and:SI (match_dup 0) (match_dup 1))
                      (const_int 0)))]
index 050c59e8e2ef9aca64f9f4711c3b52d6345b9640..98cb57bd00e2169271a045e62ed89ddcb8319633 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-25  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/i386-signbit-1.c: Tweak options.
+       * gcc.dg/i386-signbit-2.c: New test.
+       * gcc.dg/i386-signbit-3.c: New test.
+
 2003-03-24  Jakub Jelinek  <jakub@redhat.com>
 
        * g++.dg/opt/rtti1.C: New test.
index ef162297dc4872dee90020dc6ac0d360bef15d95..3bdc5906b7a9d659389de49adfe4a702060a5760 100644 (file)
@@ -1,6 +1,6 @@
 /* PR optimization/8746 */
-/* { dg-do run } */
-/* { dg-options "-mcpu=i586 -O" { target i?86-*-* } } */
+/* { dg-do run { target i?86-*-* } } */
+/* { dg-options "-O1 -mcpu=i586" } */
 
 extern void abort (void);
 
index 5687d857a0776abacc0b13a9fb0aa4d6ff2ded19..de1605c35da9f268b8576cdbcbee7638957070e3 100644 (file)
@@ -1,6 +1,6 @@
 /* PR optimization/8746 */
 /* { dg-do run { target i?86-*-* } } */
-/* { dg-options "-O1 -mtune=i586" } */
+/* { dg-options "-O1 -mcpu=i586" } */
 
 extern void abort (void);
 
index ae97f215603210ad5460ffdeb959f31d15847893..f48908964b186ce71b074774c190a338eb6c5171 100644 (file)
@@ -1,6 +1,6 @@
 /* PR optimization/8746 */
 /* { dg-do run { target i?86-*-* } } */
-/* { dg-options "-O1 -mtune=i586" } */
+/* { dg-options "-O1 -mcpu=i586" } */
 
 extern void abort (void);