Patchwork [alpha] : Fix ICE with conditional moves using DFmode compare with zero.

login
register
mail settings
Submitter Uros Bizjak
Date June 1, 2013, 6:01 p.m.
Message ID <CAFULd4YgGcH-xmrEdx7On6LTWA+qp+1jeL4+XD7iOBWxvyggCA@mail.gmail.com>
Download mbox | patch
Permalink /patch/248086/
State New
Headers show

Comments

Uros Bizjak - June 1, 2013, 6:01 p.m.
Hello!

Attached patch fixes

FAIL: c-c++-common/cilk-plus/AN/builtin_fn_mutating.c  -O3

cilkplus failure on alpha [1]. The problem was triggered only with
-O3, due to direct expansion of conditional move. The attached patch
swaps all compares, modulo DImode compares with zero, in the same way
as expansions of conditional branch and setcc patterns.

2013-06-01  Uros Bizjak  <ubizjak@gmail.com>

    * config/alpha/alpha.c (alpha_emit_conditional_move): Swap all
    GE, GT, GEU and GTU compares, modulo DImode compares with zero.

OK for mainline and release branches?

[1] http://gcc.gnu.org/ml/gcc-testresults/2013-05/msg02980.html

Uros.

Patch

Index: alpha.c
===================================================================
--- alpha.c	(revision 199439)
+++ alpha.c	(working copy)
@@ -2700,12 +2700,12 @@  alpha_emit_conditional_move (rtx cmp, enum machine
       break;
 
     case GE:  case GT:  case GEU:  case GTU:
-      /* These must be swapped.  */
-      if (op1 != CONST0_RTX (cmp_mode))
-	{
-	  code = swap_condition (code);
-	  tem = op0, op0 = op1, op1 = tem;
-	}
+      /* These normally need swapping, but for integer zero we have
+	 special patterns that recognize swapped operands.  */
+      if (cmp_mode == DImode && op1 == const0_rtx)
+	break;
+      code = swap_condition (code);
+      tem = op0, op0 = op1, op1 = tem;
       break;
 
     default: