mirror of git://gcc.gnu.org/git/gcc.git
re PR target/58779 (wrong code at -O1 on x86_64-linux-gnu)
PR target/58779 * config/i386/i386.c (put_condition_code) <case GTU, case LEU>: Remove CCCmode handling. <case LTU>: Return 'c' suffix for CCCmode. <case GEU>: Return 'nc' suffix for CCCmode. (ix86_cc_mode) <case GTU, case LEU>: Do not generate overflow checks. * config/i386/i386.md (*sub<mode>3_cconly_overflow): Remove. (*sub<mode>3_cc_overflow): Ditto. (*subsi3_zext_cc_overflow): Ditto. testsuite/ChangeLog: PR target/58779 * gcc.target/i386/pr30315.c: Remove MINUSCC, DECCC, MINUSCCONLY and MINUSCCZEXT defines. Update scan-assembler dg directive. * gcc.dg/torture/pr58779.c: New test. From-SVN: r203935
This commit is contained in:
parent
fb61ee69c3
commit
9ae93484ed
|
|
@ -1,3 +1,15 @@
|
||||||
|
2013-10-22 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
|
PR target/58779
|
||||||
|
* config/i386/i386.c (put_condition_code) <case GTU, case LEU>:
|
||||||
|
Remove CCCmode handling.
|
||||||
|
<case LTU>: Return 'c' suffix for CCCmode.
|
||||||
|
<case GEU>: Return 'nc' suffix for CCCmode.
|
||||||
|
(ix86_cc_mode) <case GTU, case LEU>: Do not generate overflow checks.
|
||||||
|
* config/i386/i386.md (*sub<mode>3_cconly_overflow): Remove.
|
||||||
|
(*sub<mode>3_cc_overflow): Ditto.
|
||||||
|
(*subsi3_zext_cc_overflow): Ditto.
|
||||||
|
|
||||||
2013-10-22 Steve Ellcey <sellcey@mips.com>
|
2013-10-22 Steve Ellcey <sellcey@mips.com>
|
||||||
|
|
||||||
* config/mips/mips.c (mips_rtx_costs): Fix cost estimate for nor
|
* config/mips/mips.c (mips_rtx_costs): Fix cost estimate for nor
|
||||||
|
|
|
||||||
|
|
@ -14103,8 +14103,6 @@ put_condition_code (enum rtx_code code, enum machine_mode mode, bool reverse,
|
||||||
Those same assemblers have the same but opposite lossage on cmov. */
|
Those same assemblers have the same but opposite lossage on cmov. */
|
||||||
if (mode == CCmode)
|
if (mode == CCmode)
|
||||||
suffix = fp ? "nbe" : "a";
|
suffix = fp ? "nbe" : "a";
|
||||||
else if (mode == CCCmode)
|
|
||||||
suffix = "b";
|
|
||||||
else
|
else
|
||||||
gcc_unreachable ();
|
gcc_unreachable ();
|
||||||
break;
|
break;
|
||||||
|
|
@ -14126,8 +14124,12 @@ put_condition_code (enum rtx_code code, enum machine_mode mode, bool reverse,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LTU:
|
case LTU:
|
||||||
gcc_assert (mode == CCmode || mode == CCCmode);
|
if (mode == CCmode)
|
||||||
suffix = "b";
|
suffix = "b";
|
||||||
|
else if (mode == CCCmode)
|
||||||
|
suffix = "c";
|
||||||
|
else
|
||||||
|
gcc_unreachable ();
|
||||||
break;
|
break;
|
||||||
case GE:
|
case GE:
|
||||||
switch (mode)
|
switch (mode)
|
||||||
|
|
@ -14147,20 +14149,20 @@ put_condition_code (enum rtx_code code, enum machine_mode mode, bool reverse,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GEU:
|
case GEU:
|
||||||
/* ??? As above. */
|
if (mode == CCmode)
|
||||||
gcc_assert (mode == CCmode || mode == CCCmode);
|
suffix = fp ? "nb" : "ae";
|
||||||
suffix = fp ? "nb" : "ae";
|
else if (mode == CCCmode)
|
||||||
|
suffix = "nc";
|
||||||
|
else
|
||||||
|
gcc_unreachable ();
|
||||||
break;
|
break;
|
||||||
case LE:
|
case LE:
|
||||||
gcc_assert (mode == CCmode || mode == CCGCmode || mode == CCNOmode);
|
gcc_assert (mode == CCmode || mode == CCGCmode || mode == CCNOmode);
|
||||||
suffix = "le";
|
suffix = "le";
|
||||||
break;
|
break;
|
||||||
case LEU:
|
case LEU:
|
||||||
/* ??? As above. */
|
|
||||||
if (mode == CCmode)
|
if (mode == CCmode)
|
||||||
suffix = "be";
|
suffix = "be";
|
||||||
else if (mode == CCCmode)
|
|
||||||
suffix = fp ? "nb" : "ae";
|
|
||||||
else
|
else
|
||||||
gcc_unreachable ();
|
gcc_unreachable ();
|
||||||
break;
|
break;
|
||||||
|
|
@ -18862,12 +18864,7 @@ ix86_cc_mode (enum rtx_code code, rtx op0, rtx op1)
|
||||||
return CCmode;
|
return CCmode;
|
||||||
case GTU: /* CF=0 & ZF=0 */
|
case GTU: /* CF=0 & ZF=0 */
|
||||||
case LEU: /* CF=1 | ZF=1 */
|
case LEU: /* CF=1 | ZF=1 */
|
||||||
/* Detect overflow checks. They need just the carry flag. */
|
return CCmode;
|
||||||
if (GET_CODE (op0) == MINUS
|
|
||||||
&& rtx_equal_p (op1, XEXP (op0, 0)))
|
|
||||||
return CCCmode;
|
|
||||||
else
|
|
||||||
return CCmode;
|
|
||||||
/* Codes possibly doable only with sign flag when
|
/* Codes possibly doable only with sign flag when
|
||||||
comparing against zero. */
|
comparing against zero. */
|
||||||
case GE: /* SF=OF or SF=0 */
|
case GE: /* SF=OF or SF=0 */
|
||||||
|
|
|
||||||
|
|
@ -6489,7 +6489,7 @@
|
||||||
(set_attr "use_carry" "1")
|
(set_attr "use_carry" "1")
|
||||||
(set_attr "mode" "<MODE>")])
|
(set_attr "mode" "<MODE>")])
|
||||||
|
|
||||||
;; Overflow setting add and subtract instructions
|
;; Overflow setting add instructions
|
||||||
|
|
||||||
(define_insn "*add<mode>3_cconly_overflow"
|
(define_insn "*add<mode>3_cconly_overflow"
|
||||||
[(set (reg:CCC FLAGS_REG)
|
[(set (reg:CCC FLAGS_REG)
|
||||||
|
|
@ -6504,43 +6504,31 @@
|
||||||
[(set_attr "type" "alu")
|
[(set_attr "type" "alu")
|
||||||
(set_attr "mode" "<MODE>")])
|
(set_attr "mode" "<MODE>")])
|
||||||
|
|
||||||
(define_insn "*sub<mode>3_cconly_overflow"
|
(define_insn "*add<mode>3_cc_overflow"
|
||||||
[(set (reg:CCC FLAGS_REG)
|
[(set (reg:CCC FLAGS_REG)
|
||||||
(compare:CCC
|
(compare:CCC
|
||||||
(minus:SWI
|
(plus:SWI
|
||||||
(match_operand:SWI 0 "nonimmediate_operand" "<r>m,<r>")
|
(match_operand:SWI 1 "nonimmediate_operand" "%0,0")
|
||||||
(match_operand:SWI 1 "<general_operand>" "<r><i>,<r>m"))
|
|
||||||
(match_dup 0)))]
|
|
||||||
""
|
|
||||||
"cmp{<imodesuffix>}\t{%1, %0|%0, %1}"
|
|
||||||
[(set_attr "type" "icmp")
|
|
||||||
(set_attr "mode" "<MODE>")])
|
|
||||||
|
|
||||||
(define_insn "*<plusminus_insn><mode>3_cc_overflow"
|
|
||||||
[(set (reg:CCC FLAGS_REG)
|
|
||||||
(compare:CCC
|
|
||||||
(plusminus:SWI
|
|
||||||
(match_operand:SWI 1 "nonimmediate_operand" "<comm>0,0")
|
|
||||||
(match_operand:SWI 2 "<general_operand>" "<r><i>,<r>m"))
|
(match_operand:SWI 2 "<general_operand>" "<r><i>,<r>m"))
|
||||||
(match_dup 1)))
|
(match_dup 1)))
|
||||||
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>")
|
(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>")
|
||||||
(plusminus:SWI (match_dup 1) (match_dup 2)))]
|
(plus:SWI (match_dup 1) (match_dup 2)))]
|
||||||
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
|
"ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
|
||||||
"<plusminus_mnemonic>{<imodesuffix>}\t{%2, %0|%0, %2}"
|
"add{<imodesuffix>}\t{%2, %0|%0, %2}"
|
||||||
[(set_attr "type" "alu")
|
[(set_attr "type" "alu")
|
||||||
(set_attr "mode" "<MODE>")])
|
(set_attr "mode" "<MODE>")])
|
||||||
|
|
||||||
(define_insn "*<plusminus_insn>si3_zext_cc_overflow"
|
(define_insn "*addsi3_zext_cc_overflow"
|
||||||
[(set (reg:CCC FLAGS_REG)
|
[(set (reg:CCC FLAGS_REG)
|
||||||
(compare:CCC
|
(compare:CCC
|
||||||
(plusminus:SI
|
(plus:SI
|
||||||
(match_operand:SI 1 "nonimmediate_operand" "<comm>0")
|
(match_operand:SI 1 "nonimmediate_operand" "%0")
|
||||||
(match_operand:SI 2 "x86_64_general_operand" "rme"))
|
(match_operand:SI 2 "x86_64_general_operand" "rme"))
|
||||||
(match_dup 1)))
|
(match_dup 1)))
|
||||||
(set (match_operand:DI 0 "register_operand" "=r")
|
(set (match_operand:DI 0 "register_operand" "=r")
|
||||||
(zero_extend:DI (plusminus:SI (match_dup 1) (match_dup 2))))]
|
(zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))]
|
||||||
"TARGET_64BIT && ix86_binary_operator_ok (<CODE>, SImode, operands)"
|
"TARGET_64BIT && ix86_binary_operator_ok (PLUS, SImode, operands)"
|
||||||
"<plusminus_mnemonic>{l}\t{%2, %k0|%k0, %2}"
|
"add{l}\t{%2, %k0|%k0, %2}"
|
||||||
[(set_attr "type" "alu")
|
[(set_attr "type" "alu")
|
||||||
(set_attr "mode" "SI")])
|
(set_attr "mode" "SI")])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
2013-10-22 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
|
PR target/58779
|
||||||
|
* gcc.target/i386/pr30315.c: Remove MINUSCC, DECCC, MINUSCCONLY
|
||||||
|
and MINUSCCZEXT defines. Update scan-assembler dg directive.
|
||||||
|
* gcc.dg/torture/pr58779.c: New test.
|
||||||
|
|
||||||
2013-10-22 Steve Ellcey <sellcey@mips.com>
|
2013-10-22 Steve Ellcey <sellcey@mips.com>
|
||||||
|
|
||||||
* gcc.target/mips/nor.c: New.
|
* gcc.target/mips/nor.c: New.
|
||||||
|
|
@ -27,8 +34,7 @@
|
||||||
2013-10-21 Vidya Praveen <vidyapraveen@arm.com>
|
2013-10-21 Vidya Praveen <vidyapraveen@arm.com>
|
||||||
|
|
||||||
* gcc.dg/20050922-1.c: Remove stdlib.h and declare abort().
|
* gcc.dg/20050922-1.c: Remove stdlib.h and declare abort().
|
||||||
* gcc.dg/20050922-1.c: Remove stdlib.h and declare abort() and
|
* gcc.dg/20050922-1.c: Remove stdlib.h and declare abort() and exit().
|
||||||
exit().
|
|
||||||
|
|
||||||
2013-10-21 Richard Biener <rguenther@suse.de>
|
2013-10-21 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
|
@ -228,8 +234,8 @@
|
||||||
|
|
||||||
2013-10-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
2013-10-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||||
|
|
||||||
* gcc.dg/torture/pr58670.c (ASM_STR) [__i386__ || __x86_64__]: Use
|
* gcc.dg/torture/pr58670.c (ASM_STR) [__i386__ || __x86_64__]:
|
||||||
btsl.
|
Use btsl.
|
||||||
|
|
||||||
2013-10-14 Eric Botcazou <ebotcazou@adacore.com>
|
2013-10-14 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
/* { dg-do run } */
|
||||||
|
|
||||||
|
int a, c;
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
int e = -1;
|
||||||
|
short d = (c <= 0) ^ e;
|
||||||
|
if ((unsigned int) a - (a || d) <= (unsigned int) a)
|
||||||
|
__builtin_abort ();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* { dg-do compile } */
|
/* { dg-do compile } */
|
||||||
/* { dg-options "-O2" } */
|
/* { dg-options "-O2" } */
|
||||||
/* { dg-final { scan-assembler-times "cmp" 4 } } */
|
/* { dg-final { scan-assembler-not "cmp" } } */
|
||||||
|
|
||||||
extern void abort (void);
|
extern void abort (void);
|
||||||
int c;
|
int c;
|
||||||
|
|
@ -34,39 +34,10 @@ void pluscconly##t##C (T a, T b) \
|
||||||
}
|
}
|
||||||
#define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b)
|
#define PLUSCCONLY(T, t) PLUSCCONLY1(T, t, a) PLUSCCONLY1(T, t, b)
|
||||||
|
|
||||||
#define MINUSCC(T, t) \
|
|
||||||
T minuscc##t (T a, T b) \
|
|
||||||
{ \
|
|
||||||
T difference = a - b; \
|
|
||||||
if (difference > a) \
|
|
||||||
abort (); \
|
|
||||||
return difference; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DECCC(T, t) \
|
|
||||||
T deccc##t (T a, T b) \
|
|
||||||
{ \
|
|
||||||
T difference = a - b; \
|
|
||||||
if (difference > a) \
|
|
||||||
c --; \
|
|
||||||
return difference; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MINUSCCONLY(T, t) \
|
|
||||||
void minuscconly##t (T a, T b) \
|
|
||||||
{ \
|
|
||||||
T difference = a - b; \
|
|
||||||
if (difference > a) \
|
|
||||||
abort (); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define TEST(T, t) \
|
#define TEST(T, t) \
|
||||||
PLUSCC(T, t) \
|
PLUSCC(T, t) \
|
||||||
PLUSCCONLY(T, t) \
|
PLUSCCONLY(T, t) \
|
||||||
INCCC(T, t) \
|
INCCC(T, t)
|
||||||
MINUSCC(T, t) \
|
|
||||||
MINUSCCONLY(T, t) \
|
|
||||||
DECCC(T, t)
|
|
||||||
|
|
||||||
TEST (unsigned long, l)
|
TEST (unsigned long, l)
|
||||||
TEST (unsigned int, i)
|
TEST (unsigned int, i)
|
||||||
|
|
@ -84,14 +55,3 @@ unsigned long pluscczext##C (unsigned int a, unsigned int b) \
|
||||||
|
|
||||||
PLUSCCZEXT(a)
|
PLUSCCZEXT(a)
|
||||||
PLUSCCZEXT(b)
|
PLUSCCZEXT(b)
|
||||||
|
|
||||||
#define MINUSCCZEXT \
|
|
||||||
unsigned long minuscczext (unsigned int a, unsigned int b) \
|
|
||||||
{ \
|
|
||||||
unsigned int difference = a - b; \
|
|
||||||
if (difference > a) \
|
|
||||||
abort (); \
|
|
||||||
return difference; \
|
|
||||||
}
|
|
||||||
|
|
||||||
MINUSCCZEXT
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue