This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Another PPro patch for long long conditional move


Hi,

I have 2 patches for egcs 980519, egcs-980519.ppro.diff and
egcs-980519.ll.diff. egcs-980519.ppro.diff fixes various PPro
bugs in egcs 980519 and egcs-980519.ll.diff adds the conditional
move for long long on PPro. You have to apply egcs-980519.ppro.diff
first and then egcs-980519.ll.diff. They should be ok for egcs
980517.

I am enclosing egcs-980519.ll.diff here. I have sent in
egcs-980519.ppro.diff earlier. They are both available at

ftp://ftp.yggdrasil.com/private/hjl



H.J.
--
Tue May 19 18:14:19 1998  H.J. Lu  (hjl@gnu.org)

	* config/i386/i386.c (output_fp_conditional_move): Abort if
	fp constants are used as input operands.
	(output_int_conditional_move): Handle long long int conditional
	move. Abort for unknown alternative.

	* config/i386/i386.md (movdicc, movdicc_1): Mew patterns for
	long long int conditional move.
	(movsicc_1, movhicc_1): Use "register_operand" as output
	predicate.

--- i386.c.ppro	Tue May 19 10:11:26 1998
+++ i386.c	Tue May 19 16:24:51 1998
@@ -5198,6 +5198,9 @@ output_fp_conditional_move (which_altern
 	output_asm_insn (AS1 (fld%z2,%y2), operands);
       else
         {
+#if 1
+	  abort ();
+#else
 	  int conval = standard_80387_constant_p (operands[2]);
     
 	  switch (conval)
@@ -5209,16 +5212,13 @@ output_fp_conditional_move (which_altern
 	      fprintf (asm_out_file, "\tfld1\n");
 	      break;
 	    default:
-#if 1
-	      abort ();
-#else
 	      operands[2] = CONST_DOUBLE_MEM (operands[2]);
 	      if (GET_CODE (operands[2]) != MEM)
 		abort ();
 	      output_asm_insn (AS1 (fld%z2,%y2), operands);
-#endif
 	      break;
 	    }
+#endif
 	}
       output_asm_insn ("jmp %l1", xops);
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[0]));
@@ -5226,6 +5226,9 @@ output_fp_conditional_move (which_altern
 	  output_asm_insn (AS1 (fld%z3,%y3), operands);
       else
 	{
+#if 1
+	  abort ();
+#else
 	  int conval = standard_80387_constant_p (operands[2]);
     
 	  switch (conval)
@@ -5237,16 +5240,13 @@ output_fp_conditional_move (which_altern
 	      fprintf (asm_out_file, "\tfld1\n");
 	      break;
 	    default:
-#if 1
-	      abort ();
-#else
 	      operands[3] = CONST_DOUBLE_MEM (operands[3]);
 	      if (GET_CODE (operands[3]) != MEM)
 		abort ();
 	      output_asm_insn (AS1 (fld%z3,%y3), operands);
-#endif
 	      break;
 	    }
+#endif
 	}
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[1]));
     }
@@ -5268,19 +5268,72 @@ output_int_conditional_move (which_alter
   if (which_alternative == 0)
     {
       /* r <- cond ? arg : r */
-      output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
+      if (GET_MODE (operands [0]) == DImode)
+	{
+	  rtx xops[3];
+
+	  xops [0] = gen_rtx_SUBREG (SImode, operands [0], 0);
+	  xops [1] = operands [1];
+	  xops [2] = gen_rtx_SUBREG (SImode, operands [2], 0);
+	  output_asm_insn (AS2 (cmov%C1,%2,%0), xops);
+	  xops [0] = gen_rtx_SUBREG (SImode, operands [0], 1);
+	  xops [2] = gen_rtx_SUBREG (SImode, operands [2], 1);
+	  output_asm_insn (AS2 (cmov%C1,%2,%0), xops);
+	}
+      else
+	{
+	  output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
+	}
     }
   else if (which_alternative == 1)
     {
       /* r <- cond ? r : arg */
-      output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
+      if (GET_MODE (operands [0]) == DImode)
+	{
+	  rtx xops[3];
+
+	  xops [0] = gen_rtx_SUBREG (SImode, operands [0], 0);
+	  xops [1] = operands [1];
+	  xops [2] = gen_rtx_SUBREG (SImode, operands [3], 0);
+	  output_asm_insn (AS2 (cmov%c1,%2,%0), xops);
+	  xops [0] = gen_rtx_SUBREG (SImode, operands [0], 1);
+	  xops [2] = gen_rtx_SUBREG (SImode, operands [3], 1);
+	  output_asm_insn (AS2 (cmov%c1,%2,%0), xops);
+	}
+      else
+	{
+	  output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
+	}
     }
   else if (which_alternative == 2)
     {
       /* r <- cond ? arg1 : arg2 */
-      output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
-      output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
+      if (GET_MODE (operands [0]) == DImode)
+	{
+	  rtx xops[4];
+
+	  xops [0] = gen_rtx_SUBREG (SImode, operands [0], 0);
+	  xops [1] = operands [1];
+	  xops [2] = gen_rtx_SUBREG (SImode, operands [2], 0);
+	  xops [3] = gen_rtx_SUBREG (SImode, operands [3], 0);
+	  output_asm_insn (AS2 (cmov%C1,%2,%0), xops);
+	  output_asm_insn (AS2 (cmov%c1,%3,%0), xops);
+	  xops [0] = gen_rtx_SUBREG (SImode, operands [0], 1);
+	  xops [2] = gen_rtx_SUBREG (SImode, operands [2], 1);
+	  xops [3] = gen_rtx_SUBREG (SImode, operands [3], 1);
+	  output_asm_insn (AS2 (cmov%C1,%2,%0), xops);
+	  output_asm_insn (AS2 (cmov%c1,%3,%0), xops);
+	}
+      else
+	{
+	  output_asm_insn (AS2 (cmov%C1,%2,%0), operands);
+	  output_asm_insn (AS2 (cmov%c1,%3,%0), operands);
+	}
     }
+#if 1
+  else
+    abort ();
+#else
   else if (which_alternative == 3)
     {
       /* r <- cond ? arg1 : arg2 */
@@ -5317,6 +5370,7 @@ output_int_conditional_move (which_alter
 	}
       ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L", CODE_LABEL_NUMBER (xops[1]));
     }
+#endif
 
   return "";
 }
--- i386.md.ppro	Tue May 19 10:11:33 1998
+++ i386.md	Tue May 19 12:35:28 1998
@@ -7230,6 +7230,18 @@ byte_xor_operation:
 
 /* Conditional move define_insns.  */
 
+(define_expand "movdicc"
+  [(match_dup 4)
+   (set (match_operand 0 "register_operand" "")
+	(if_then_else:DI (match_operand 1 "comparison_operator" "")
+			 (match_operand:DI 2 "general_operand" "")
+			 (match_operand:DI 3 "general_operand" "")))]
+  "TARGET_CMOVE"
+  "
+{
+  expand_int_conditional_move (operands);
+}")
+
 (define_expand "movsicc"
   [(match_dup 4)
    (set (match_operand 0 "register_operand" "")
@@ -7254,8 +7266,17 @@ byte_xor_operation:
   expand_int_conditional_move (operands);
 }")
 
+(define_insn "movdicc_1"
+  [(set (match_operand:DI 0 "register_operand" "=r,r,&r")
+	(if_then_else:DI (match_operator 1 "comparison_operator" 
+				[(cc0) (const_int 0)])
+		      (match_operand:DI 2 "nonimmediate_operand" "rm,0,rm")
+		      (match_operand:DI 3 "nonimmediate_operand" "0,rm,rm")))]
+  "TARGET_CMOVE"
+  "* return output_int_conditional_move (which_alternative, operands);")
+
 (define_insn "movsicc_1"
-  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,&r")
+  [(set (match_operand:SI 0 "register_operand" "=r,r,&r")
 	(if_then_else:SI (match_operator 1 "comparison_operator" 
 				[(cc0) (const_int 0)])
 		      (match_operand:SI 2 "nonimmediate_operand" "rm,0,rm")
@@ -7264,7 +7285,7 @@ byte_xor_operation:
   "* return output_int_conditional_move (which_alternative, operands);")
 
 (define_insn "movhicc_1"
-  [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,&r")
+  [(set (match_operand:HI 0 "register_operand" "=r,r,&r")
 	(if_then_else:HI (match_operator 1 "comparison_operator" 
 				[(cc0) (const_int 0)])
 		      (match_operand:HI 2 "nonimmediate_operand" "rm,0,rm")


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]