Patchwork [alpha] : Fix ICE in alpha_emit_conditional_move, at config/alpha/alpha.c:2649

login
register
mail settings
Submitter Uros Bizjak
Date May 10, 2012, 11:54 p.m.
Message ID <CAFULd4aQU0mYX9WmK3BuTwJVPOpR8Q7+MaoGvhTZ_Y2y+0czow@mail.gmail.com>
Download mbox | patch
Permalink /patch/158413/
State New
Headers show

Comments

Uros Bizjak - May 10, 2012, 11:54 p.m.
Hello!

Recently testsuite/gcc.c-torture/execute/ieee/pr50310.c started to ICE
when compiled with -O3 -mieee on alphaev68-pc-linux-gnu:

$ ~/gcc-build-alpha/gcc/cc1 -O3 -mieee -quiet pr50310.c
pr50310.c: In function ‘foo’:
pr50310.c:31:20: internal compiler error: in
alpha_emit_conditional_move, at config/alpha/alpha.c:2649
     s3[10 * 4 + i] = __builtin_isunordered (s1[i], s2[i]) ? -1.0 : 0.0;
                    ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

It turned out that UNORDERED and ORDERED RTX codes are not handled in
alpha_emit_conditional_move. Attached patch fixes this oversight.

2012-05-11  Uros Bizjak  <ubizjak@gmail.com>

	* config/alpha/alpha.c (alpha_emit_conditional_branch): Handle
	ORDERED and UNORDERED conditions.

Patch was bootstrapped and regression tested on
alphaev68-pc-linux-gnu.  OK for mainline SVN and release branches?

Uros.

Patch

Index: config/alpha/alpha.c
===================================================================
--- config/alpha/alpha.c	(revision 187371)
+++ config/alpha/alpha.c	(working copy)
@@ -2335,7 +2335,7 @@  alpha_emit_conditional_branch (rtx operands[], enu
     {
     case EQ:  case LE:  case LT:  case LEU:  case LTU:
     case UNORDERED:
-      /* We have these compares: */
+      /* We have these compares.  */
       cmp_code = code, branch_code = NE;
       break;
 
@@ -2572,13 +2572,15 @@  alpha_emit_conditional_move (rtx cmp, enum machine
       switch (code)
 	{
 	case EQ: case LE: case LT: case LEU: case LTU:
+	case UNORDERED:
 	  /* We have these compares.  */
 	  cmp_code = code, code = NE;
 	  break;
 
 	case NE:
-	  /* This must be reversed.  */
-	  cmp_code = EQ, code = EQ;
+	case ORDERED:
+	  /* These must be reversed.  */
+	  cmp_code = reverse_condition (code), code = EQ;
 	  break;
 
 	case GE: case GT: case GEU: case GTU:
@@ -2627,11 +2629,13 @@  alpha_emit_conditional_move (rtx cmp, enum machine
   switch (code)
     {
     case EQ:  case LE:  case LT:  case LEU:  case LTU:
+    case UNORDERED:
       /* We have these compares: */
       break;
 
     case NE:
-      /* This must be reversed.  */
+    case ORDERED:
+      /* These must be reversed.  */
       code = reverse_condition (code);
       cmov_code = EQ;
       break;