Commit 511d31d8 by Andreas Schwab Committed by Andreas Schwab

final.c (final_scan_insn): Handle all comparison codes in non-jump and cmove insn.

* gcc/final.c (final_scan_insn) [HAVE_cc0]: Handle all comparison
codes in non-jump and cmove insn.

* gcc/testsuite/gcc.dg/torture/fp-compare.c: New testcase.

From-SVN: r193187
parent e77c9aed
2012-11-05 Andreas Schwab <schwab@linux-m68k.org>
* final.c (final_scan_insn) [HAVE_cc0]: Handle all comparison
codes in non-jump and cmove insn.
2012-11-05 Uros Bizjak <ubizjak@gmail.com> 2012-11-05 Uros Bizjak <ubizjak@gmail.com>
Vladimir Yakovlev <vladimir.b.yakovlev@intel.com> Vladimir Yakovlev <vladimir.b.yakovlev@intel.com>
/* Convert RTL to assembler code and output it, for GNU compiler. /* Convert RTL to assembler code and output it, for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010, 2011 2010, 2011, 2012
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -2689,36 +2689,19 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, ...@@ -2689,36 +2689,19 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
else_rtx = const0_rtx; else_rtx = const0_rtx;
} }
switch (GET_CODE (cond_rtx)) if (COMPARISON_P (cond_rtx)
&& XEXP (cond_rtx, 0) == cc0_rtx)
{ {
case GTU: int result;
case GT: result = alter_cond (cond_rtx);
case LTU: if (result == 1)
case LT: validate_change (insn, &SET_SRC (set), then_rtx, 0);
case GEU: else if (result == -1)
case GE: validate_change (insn, &SET_SRC (set), else_rtx, 0);
case LEU: else if (result == 2)
case LE: INSN_CODE (insn) = -1;
case EQ: if (SET_DEST (set) == SET_SRC (set))
case NE: delete_insn (insn);
{
int result;
if (XEXP (cond_rtx, 0) != cc0_rtx)
break;
result = alter_cond (cond_rtx);
if (result == 1)
validate_change (insn, &SET_SRC (set), then_rtx, 0);
else if (result == -1)
validate_change (insn, &SET_SRC (set), else_rtx, 0);
else if (result == 2)
INSN_CODE (insn) = -1;
if (SET_DEST (set) == SET_SRC (set))
delete_insn (insn);
}
break;
default:
break;
} }
} }
......
2012-11-05 Andreas Schwab <schwab@linux-m68k.org>
* gcc.dg/torture/fp-compare.c: New testcase.
2012-11-05 Jan Hubicka <jh@suse.cz> 2012-11-05 Jan Hubicka <jh@suse.cz>
* gcc.dg/const-1.c: Update. * gcc.dg/const-1.c: Update.
......
/* { dg-do run } */
/* Check that find_scan_insn properly handles swapped FP comparisons. */
static double x;
static int exit_code;
void __attribute__ ((noinline))
check_int (int a, int b)
{
exit_code += (a != b);
}
int
main (void)
{
x = 0.0;
asm ("" : "+m" (x));
check_int (__builtin_isgreater (x, 1.0), 0);
check_int (__builtin_isgreaterequal (x, 1.0), 0);
check_int (__builtin_isless (x, 1.0), 1);
check_int (__builtin_islessequal (x, 1.0), 1);
check_int (__builtin_islessgreater (x, 1.0), 1);
return exit_code;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment