From: Uros Bizjak Date: Mon, 30 Apr 2012 10:22:39 +0000 (+0200) Subject: backport: re PR target/53138 (spaceship operator miscompiled) X-Git-Tag: releases/gcc-4.5.4~123 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa384bf4870fe7d05ca03f02eb6779b38ff57aa1;p=thirdparty%2Fgcc.git backport: re PR target/53138 (spaceship operator miscompiled) Backport from mainline 2012-04-27 Paolo Bonzini PR target/53138 * config/i386/i386.md (x86_movcc_0_m1_neg): Add clobber. testsuite/ChangeLog: Backport from mainline 2012-04-27 Paolo Bonzini PR target/53138 * gcc.c-torture/execute/20120427-1.c: New testcase. From-SVN: r186964 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9b425d24053f..f07f6ce8a829 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-04-30 Uros Bizjak + + Backport from mainline + 2012-04-27 Paolo Bonzini + + PR target/53138 + * config/i386/i386.md (x86_movcc_0_m1_neg): Add clobber. + 2012-04-20 Thomas Schwinge struct siginfo vs. siginfo_t diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index ce7d7ffe2cc6..a0c74c495f1a 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -18557,7 +18557,8 @@ (define_insn "*x86_movcc_0_m1_neg" [(set (match_operand:SWI48 0 "register_operand" "=r") (neg:SWI48 (match_operator 1 "ix86_carry_flag_operator" - [(reg FLAGS_REG) (const_int 0)])))] + [(reg FLAGS_REG) (const_int 0)]))) + (clobber (reg:CC FLAGS_REG))] "" "sbb{}\t%0, %0" [(set_attr "type" "alu") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca046fcaef5a..e870e5cec3b1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2012-04-30 Uros Bizjak + + Backport from mainline + 2012-04-27 Paolo Bonzini + + PR target/53138 + * gcc.c-torture/execute/20120427-1.c: New testcase. + 2012-03-28 Martin Jambor Backported from mainline diff --git a/gcc/testsuite/gcc.c-torture/execute/20120427-1.c b/gcc/testsuite/gcc.c-torture/execute/20120427-1.c new file mode 100644 index 000000000000..46ed76ae9430 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20120427-1.c @@ -0,0 +1,36 @@ +typedef struct sreal +{ + unsigned sig; /* Significant. */ + int exp; /* Exponent. */ +} sreal; + +sreal_compare (sreal *a, sreal *b) +{ + if (a->exp > b->exp) + return 1; + if (a->exp < b->exp) + return -1; + if (a->sig > b->sig) + return 1; + return -(a->sig < b->sig); +} + +sreal a[] = { + { 0, 0 }, + { 1, 0 }, + { 0, 1 }, + { 1, 1 } +}; + +int main() +{ + int i, j; + for (i = 0; i <= 3; i++) { + for (j = 0; j < 3; j++) { + if (i < j && sreal_compare(&a[i], &a[j]) != -1) abort(); + if (i == j && sreal_compare(&a[i], &a[j]) != 0) abort(); + if (i > j && sreal_compare(&a[i], &a[j]) != 1) abort(); + } + } + return 0; +}