This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH] Fix PR target/4792


Hi!

arc ICEd during libgcc2.c build because if_then_else in movMMcc patterns
lacked mode. Also, the "optimization" to call insn_extract directly instead
of extract_insn turned out to be bad idea, since the former e.g. doesn't
update recog_data.insn etc., so if some routine called
from arc_final_prescan_insn called extract_insn and then after
arc_final_prescan_insn it did extract_insn_cached on such insn, it would
find stale recog_data.operand array.
Ok to commit?

2002-03-20  Jakub Jelinek  <jakub@redhat.com>

	PR target/4792
	* config/arc/arc.md (movsicc, movdicc, movsfcc, movdfcc): Add mode
	to if_then_else.
	(movsicc_insn, movdicc_insn, movsfcc_insn, movdfcc_insn): Likewise.
	* config/arc/arc.c (arc_final_prescan_insn): Use extract_insn_cached
	instead of insn_extract.

--- gcc/config/arc/arc.md.jj	Fri Jan 14 17:21:46 2000
+++ gcc/config/arc/arc.md	Wed Mar 20 18:35:46 2002
@@ -583,9 +583,9 @@
 
 (define_expand "movsicc"
   [(set (match_operand:SI 0 "register_operand" "")
-	(if_then_else (match_operand 1 "comparison_operator" "")
-		      (match_operand:SI 2 "nonmemory_operand" "")
-		      (match_operand:SI 3 "register_operand" "")))]
+	(if_then_else:SI (match_operand 1 "comparison_operator" "")
+			 (match_operand:SI 2 "nonmemory_operand" "")
+			 (match_operand:SI 3 "register_operand" "")))]
   ""
   "
 {
@@ -599,9 +599,9 @@
 
 ;(define_expand "movdicc"
 ;  [(set (match_operand:DI 0 "register_operand" "")
-;	(if_then_else (match_operand 1 "comparison_operator" "")
-;		      (match_operand:DI 2 "nonmemory_operand" "")
-;		      (match_operand:DI 3 "register_operand" "")))]
+;	(if_then_else:DI (match_operand 1 "comparison_operator" "")
+;			 (match_operand:DI 2 "nonmemory_operand" "")
+;			 (match_operand:DI 3 "register_operand" "")))]
 ;  "0 /* ??? this would work better if we had cmpdi */"
 ;  "
 ;{
@@ -612,12 +612,12 @@
 ;
 ;  operands[1] = gen_rtx (code, VOIDmode, ccreg, const0_rtx);
 ;}")
-(define_expand "movsfcc"
 
+(define_expand "movsfcc"
   [(set (match_operand:SF 0 "register_operand" "")
-	(if_then_else (match_operand 1 "comparison_operator" "")
-		      (match_operand:SF 2 "nonmemory_operand" "")
-		      (match_operand:SF 3 "register_operand" "")))]
+	(if_then_else:SF (match_operand 1 "comparison_operator" "")
+			 (match_operand:SF 2 "nonmemory_operand" "")
+			 (match_operand:SF 3 "register_operand" "")))]
   ""
   "
 {
@@ -631,9 +631,9 @@
 
 ;(define_expand "movdfcc"
 ;  [(set (match_operand:DF 0 "register_operand" "")
-;	(if_then_else (match_operand 1 "comparison_operator" "")
-;		      (match_operand:DF 2 "nonmemory_operand" "")
-;		      (match_operand:DF 3 "register_operand" "")))]
+;	(if_then_else:DF (match_operand 1 "comparison_operator" "")
+;			 (match_operand:DF 2 "nonmemory_operand" "")
+;			 (match_operand:DF 3 "register_operand" "")))]
 ;  "0 /* ??? can generate less efficient code if constants involved */"
 ;  "
 ;{
@@ -647,9 +647,9 @@
 
 (define_insn "*movsicc_insn"
   [(set (match_operand:SI 0 "register_operand" "=r")
-	(if_then_else (match_operand 1 "comparison_operator" "")
-		      (match_operand:SI 2 "nonmemory_operand" "rJi")
-		      (match_operand:SI 3 "register_operand" "0")))]
+	(if_then_else:SI (match_operand 1 "comparison_operator" "")
+			 (match_operand:SI 2 "nonmemory_operand" "rJi")
+			 (match_operand:SI 3 "register_operand" "0")))]
   ""
   "mov.%d1 %0,%S2"
   [(set_attr "type" "cmove")])
@@ -657,9 +657,9 @@
 ; ??? This doesn't properly handle constants.
 ;(define_insn "*movdicc_insn"
 ;  [(set (match_operand:DI 0 "register_operand" "=r,r")
-;	(if_then_else (match_operand 1 "comparison_operator" "")
-;		      (match_operand:DI 2 "nonmemory_operand" "r,Ji")
-;		      (match_operand:DI 3 "register_operand" "0,0")))]
+;	(if_then_else:DI (match_operand 1 "comparison_operator" "")
+;			 (match_operand:DI 2 "nonmemory_operand" "r,Ji")
+;			 (match_operand:DI 3 "register_operand" "0,0")))]
 ;  "0"
 ;  "*
 ;{
@@ -682,9 +682,9 @@
 
 (define_insn "*movsfcc_insn"
   [(set (match_operand:SF 0 "register_operand" "=r,r")
-	(if_then_else (match_operand 1 "comparison_operator" "")
-		      (match_operand:SF 2 "nonmemory_operand" "r,E")
-		      (match_operand:SF 3 "register_operand" "0,0")))]
+	(if_then_else:SF (match_operand 1 "comparison_operator" "")
+			 (match_operand:SF 2 "nonmemory_operand" "r,E")
+			 (match_operand:SF 3 "register_operand" "0,0")))]
   ""
   "@
    mov.%d1 %0,%2
@@ -693,9 +693,9 @@
 
 ;(define_insn "*movdfcc_insn"
 ;  [(set (match_operand:DF 0 "register_operand" "=r,r")
-;	(if_then_else (match_operand 1 "comparison_operator" "")
-;		      (match_operand:DF 2 "nonmemory_operand" "r,E")
-;		      (match_operand:DF 3 "register_operand" "0,0")))]
+;	(if_then_else:DF (match_operand 1 "comparison_operator" "")
+;			 (match_operand:DF 2 "nonmemory_operand" "r,E")
+;			 (match_operand:DF 3 "register_operand" "0,0")))]
 ;  "0"
 ;  "*
 ;{
--- gcc/config/arc/arc.c.jj	Mon Feb 18 17:44:51 2002
+++ gcc/config/arc/arc.c	Wed Mar 20 18:57:13 2002
@@ -2190,7 +2190,7 @@ arc_final_prescan_insn (insn, opvec, nop
 	      if (!this_insn)
 	        {
 		  /* Oh dear! we ran off the end, give up.  */
-		  insn_extract (insn);
+		  extract_insn_cached (insn);
 		  arc_ccfsm_state = 0;
 		  arc_ccfsm_target_insn = NULL;
 		  return;
@@ -2212,9 +2212,8 @@ arc_final_prescan_insn (insn, opvec, nop
 
       /* Restore recog_data.  Getting the attributes of other insns can
 	 destroy this array, but final.c assumes that it remains intact
-	 across this call; since the insn has been recognized already we
-	 call insn_extract direct.  */
-      insn_extract (insn);
+	 across this call.  */
+      extract_insn_cached (insn);
     }
 }
 

	Jakub


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