public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix attributes for SSE/MMX instructions
@ 2002-04-27 16:15 Jan Hubicka
  2002-04-29 15:19 ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Jan Hubicka @ 2002-04-27 16:15 UTC (permalink / raw)
  To: gcc-patches, rth, patches


Hi
this patch adds a lot of boring stuff to make SSE/MMX scheduling possible.
It adds several sse/mmx subtypes and reorganize the attributes to handle
SSE/MMX as they should.

I've tested it by bootstrapping mainline and on the dfa-branch using new
scheduler description for Athlon.
The insn-attrtab.c code size growth (including scheduler description)
is about 90Kb.

Hope I didn't messed up something important.

Honza

Sun Apr 28 02:15:40 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* i386.md (type): Add new SSE/MMX subtypes, remove usused fop1.
	(mode): Add vector modes
	(i387): Kill attribute.
	(unit): New attribute.
	(length_immediate): Grok new types.
	(prefix_data16, prefix_rep, prefix_0f): Fix for SSE/MMX.
	(modrm): Use "unit".
	(memory): Handle MMX/SSE properly.
	(scheduling descriptions): Kill uses of fop1.
	(sse, mmx, fp patterns): Set type and mode properly.

*** /p1/cfg10/egcs/gcc/config/i386/i386.md	Sat Feb  9 19:53:33 2002
--- i386.md	Sun Apr 28 02:12:09 2002
***************
*** 116,139 ****
  ;; A basic instruction type.  Refinements due to arguments to be
  ;; provided in other attributes.
  (define_attr "type"
!   "other,multi,alu1,negnot,alu,icmp,test,imov,imovx,lea,incdec,ishift,imul,idiv,ibr,setcc,push,pop,call,callv,icmov,fmov,fop,fop1,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,str,cld,sse,mmx,fistp"
    (const_string "other"))
  
  ;; Main data type used by the insn
! (define_attr "mode" "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI"
    (const_string "unknown"))
  
! ;; Set for i387 operations.
! (define_attr "i387" ""
!   (if_then_else (eq_attr "type" "fmov,fop,fop1,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")
!     (const_int 1)
!     (const_int 0)))
  
  ;; The (bounding maximum) length of an instruction immediate.
  (define_attr "length_immediate" ""
!   (cond [(eq_attr "type" "incdec,setcc,icmov,ibr,str,cld,lea,other,multi,idiv,sse,mmx")
  	   (const_int 0)
! 	 (eq_attr "i387" "1")
  	   (const_int 0)
  	 (eq_attr "type" "alu1,negnot,alu,icmp,imovx,ishift,imul,push,pop")
  	   (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
--- 116,143 ----
  ;; A basic instruction type.  Refinements due to arguments to be
  ;; provided in other attributes.
  (define_attr "type"
!   "other,multi,alu1,negnot,alu,icmp,test,imov,imovx,lea,incdec,ishift,imul,idiv,ibr,setcc,push,pop,call,callv,icmov,fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,str,cld,sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul,fistp"
    (const_string "other"))
  
  ;; Main data type used by the insn
! (define_attr "mode" "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI,V4SF,V2DF,V2SF"
    (const_string "unknown"))
  
! ;; The CPU unit operations uses.
! (define_attr "unit" "integer,i387,sse,mmx,unknown"
!   (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")
! 	   (const_string "i387")
! 	 (eq_attr "type" "sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog")
! 	   (const_string "sse")
! 	 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul")
! 	   (const_string "mmx")]
! 	 (const_string "integer")))
  
  ;; The (bounding maximum) length of an instruction immediate.
  (define_attr "length_immediate" ""
!   (cond [(eq_attr "type" "incdec,setcc,icmov,ibr,str,cld,lea,other,multi,idiv")
  	   (const_int 0)
! 	 (eq_attr "unit" "i387,sse,mmx")
  	   (const_int 0)
  	 (eq_attr "type" "alu1,negnot,alu,icmp,imovx,ishift,imul,push,pop")
  	   (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
***************
*** 172,187 ****
  
  ;; Set when length prefix is used.
  (define_attr "prefix_data16" ""
!   (if_then_else (eq_attr "mode" "HI")
      (const_int 1)
      (const_int 0)))
  
  ;; Set when string REP prefix is used.
! (define_attr "prefix_rep" "" (const_int 0))
  
  ;; Set when 0f opcode prefix is used.
  (define_attr "prefix_0f" ""
!   (if_then_else (eq_attr "type" "imovx,setcc,icmov,sse,mmx")
      (const_int 1)
      (const_int 0)))
  
--- 176,195 ----
  
  ;; Set when length prefix is used.
  (define_attr "prefix_data16" ""
!   (if_then_else (ior (eq_attr "mode" "HI")
! 		     (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF")))
      (const_int 1)
      (const_int 0)))
  
  ;; Set when string REP prefix is used.
! (define_attr "prefix_rep" "" 
!   (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
!     (const_int 1)
!     (const_int 0)))
  
  ;; Set when 0f opcode prefix is used.
  (define_attr "prefix_0f" ""
!   (if_then_else (eq_attr "type" "imovx,setcc,icmov,sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul")
      (const_int 1)
      (const_int 0)))
  
***************
*** 189,195 ****
  (define_attr "modrm" ""
    (cond [(eq_attr "type" "str,cld")
  	   (const_int 0)
! 	 (eq_attr "i387" "1")
  	   (const_int 0)
           (and (eq_attr "type" "incdec")
  	      (ior (match_operand:SI 1 "register_operand" "")
--- 197,203 ----
  (define_attr "modrm" ""
    (cond [(eq_attr "type" "str,cld")
  	   (const_int 0)
! 	 (eq_attr "unit" "i387")
  	   (const_int 0)
           (and (eq_attr "type" "incdec")
  	      (ior (match_operand:SI 1 "register_operand" "")
***************
*** 214,224 ****
  (define_attr "length" ""
    (cond [(eq_attr "type" "other,multi,fistp")
  	   (const_int 16)
! 	 ]
  	 (plus (plus (attr "modrm")
  		     (plus (attr "prefix_0f")
! 			   (plus (attr "i387")
! 				 (const_int 1))))
  	       (plus (attr "prefix_rep")
  		     (plus (attr "prefix_data16")
  			   (plus (attr "length_immediate")
--- 222,234 ----
  (define_attr "length" ""
    (cond [(eq_attr "type" "other,multi,fistp")
  	   (const_int 16)
! 	 (eq_attr "unit" "i387")
! 	   (plus (const_int 2)
! 		 (plus (attr "prefix_data16")
! 		       (attr "length_address")))]
  	 (plus (plus (attr "modrm")
  		     (plus (attr "prefix_0f")
! 			   (const_int 1)))
  	       (plus (attr "prefix_rep")
  		     (plus (attr "prefix_data16")
  			   (plus (attr "length_immediate")
***************
*** 270,276 ****
  	   (const_string "store")
  	 (match_operand 1 "memory_operand" "")
  	   (const_string "load")
! 	 (and (eq_attr "type" "!icmp,test,alu1,negnot,fop1,fsgn,imov,imovx,fmov,fcmp,sse,mmx")
  	      (match_operand 2 "memory_operand" ""))
  	   (const_string "load")
  	 (and (eq_attr "type" "icmov")
--- 280,286 ----
  	   (const_string "store")
  	 (match_operand 1 "memory_operand" "")
  	   (const_string "load")
! 	 (and (eq_attr "type" "!icmp,test,alu1,negnot,fsgn,imov,imovx,fmov,fcmp,sse,mmx,ssemov,mmxmov,ssecvt,mmxcvt")
  	      (match_operand 2 "memory_operand" ""))
  	   (const_string "load")
  	 (and (eq_attr "type" "icmov")
***************
*** 518,526 ****
  ; integer instructions, because of the inpaired fxch instruction.
  (define_function_unit "pent_np" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fmov,fop,fop1,fsgn,fmul,fpspc,fcmov,fcmp,fistp"))
    2 2
!   [(eq_attr "type" "!fmov,fop,fop1,fsgn,fmul,fpspc,fcmov,fcmp,fistp")])
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
--- 792,800 ----
  ; integer instructions, because of the inpaired fxch instruction.
  (define_function_unit "pent_np" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fmov,fop,fsgn,fmul,fpspc,fcmov,fcmp,fistp"))
    2 2
!   [(eq_attr "type" "!fmov,fop,fsgn,fmul,fpspc,fcmov,fcmp,fistp")])
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
***************
*** 531,537 ****
  ; ??? Trivial fp operations such as fabs or fchs takes only one cycle.
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fop,fop1,fistp"))
    3 1)
  
  ; Multiplication takes 3 cycles and is only half pipelined.
--- 805,811 ----
  ; ??? Trivial fp operations such as fabs or fchs takes only one cycle.
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fop,fistp"))
    3 1)
  
  ; Multiplication takes 3 cycles and is only half pipelined.
***************
*** 629,635 ****
  
  (define_function_unit "ppro_p0" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fop1,fsgn,fistp"))
    3 1)
  
  (define_function_unit "ppro_p0" 1 0
--- 904,910 ----
  
  (define_function_unit "ppro_p0" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fsgn,fistp"))
    3 1)
  
  (define_function_unit "ppro_p0" 1 0
***************
*** 682,688 ****
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fop1,fsgn,fmov,fcmp,fcmov,fistp"))
    1 1)
  
  (define_function_unit "fpu" 1 0
--- 957,963 ----
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fsgn,fmov,fcmp,fcmov,fistp"))
    1 1)
  
  (define_function_unit "fpu" 1 0
***************
*** 785,791 ****
  
  (define_function_unit "k6_fpu" 1 1
    (and (eq_attr "cpu" "k6")
!        (eq_attr "type" "fop,fop1,fmov,fcmp,fistp"))
    2 2)
  
  (define_function_unit "k6_fpu" 1 1
--- 1060,1066 ----
  
  (define_function_unit "k6_fpu" 1 1
    (and (eq_attr "cpu" "k6")
!        (eq_attr "type" "fop,fmov,fcmp,fistp"))
    2 2)
  
  (define_function_unit "k6_fpu" 1 1
***************
*** 897,903 ****
    42 42)
  
  (define_attr "athlon_fpunits" "none,store,mul,add,muladd,any"
!   (cond [(eq_attr "type" "fop,fop1,fcmp,fistp")
  	   (const_string "add")
           (eq_attr "type" "fmul,fdiv,fpspc,fsgn,fcmov")
  	   (const_string "mul")
--- 1509,1515 ----
    42 42)
  
  (define_attr "athlon_fpunits" "none,store,mul,add,muladd,any"
!   (cond [(eq_attr "type" "fop,fcmp,fistp")
  	   (const_string "add")
           (eq_attr "type" "fmul,fdiv,fpspc,fsgn,fcmov")
  	   (const_string "mul")
***************
*** 932,938 ****
  
  (define_function_unit "athlon_fp" 3 0
    (and (eq_attr "cpu" "athlon")
!        (eq_attr "type" "fop,fop1,fmul,fistp"))
    4 1)
  
  ;; XFmode loads are slow.
--- 1544,1550 ----
  
  (define_function_unit "athlon_fp" 3 0
    (and (eq_attr "cpu" "athlon")
!        (eq_attr "type" "fop,fmul,fistp"))
    4 1)
  
  ;; XFmode loads are slow.
***************
*** 1552,1558 ****
    "fnstsw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "SI")
!    (set_attr "i387" "1")
     (set_attr "ppro_uops" "few")])
  
  ;; FP compares, step 3
--- 2164,2170 ----
    "fnstsw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "SI")
!    (set_attr "unit" "i387")
     (set_attr "ppro_uops" "few")])
  
  ;; FP compares, step 3
***************
*** 1591,1597 ****
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "fcmp,sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
--- 2203,2209 ----
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "fcmp,ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
***************
*** 1602,1608 ****
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
--- 2214,2220 ----
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
***************
*** 1627,1633 ****
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "fcmp,sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
--- 2239,2245 ----
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "fcmp,ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
***************
*** 1638,1644 ****
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  \f
--- 2250,2256 ----
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  \f
***************
*** 1759,1767 ****
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "4,5")
! 	      (const_string "mmx")
  	    (eq_attr "alternative" "6,7,8")
! 	      (const_string "sse")
  	    (and (ne (symbol_ref "flag_pic") (const_int 0))
  		 (match_operand:SI 1 "symbolic_operand" ""))
  	      (const_string "lea")
--- 2371,2379 ----
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "4,5")
! 	      (const_string "mmxmov")
  	    (eq_attr "alternative" "6,7,8")
! 	      (const_string "ssemov")
  	    (and (ne (symbol_ref "flag_pic") (const_int 0))
  		 (match_operand:SI 1 "symbolic_operand" ""))
  	      (const_string "lea")
***************
*** 2472,2478 ****
     movq\t{%1, %0|%0, %1}
     movdqa\t{%1, %0|%0, %1}
     movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,mmx,mmx,sse,sse,sse")
     (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
  
  (define_split
--- 3084,3090 ----
     movq\t{%1, %0|%0, %1}
     movdqa\t{%1, %0|%0, %1}
     movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,mmx,mmx,ssemov,ssemov,ssemov")
     (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
  
  (define_split
***************
*** 2525,2533 ****
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "5,6")
! 	      (const_string "mmx")
  	    (eq_attr "alternative" "7,8")
! 	      (const_string "sse")
  	    (eq_attr "alternative" "4")
  	      (const_string "multi")
   	    (and (ne (symbol_ref "flag_pic") (const_int 0))
--- 3137,3145 ----
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "5,6")
! 	      (const_string "mmxmov")
  	    (eq_attr "alternative" "7,8")
! 	      (const_string "ssemov")
  	    (eq_attr "alternative" "4")
  	      (const_string "multi")
   	    (and (ne (symbol_ref "flag_pic") (const_int 0))
***************
*** 2770,2776 ****
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,imov,imov,sse,sse,sse,sse,mmx,mmx")
     (set_attr "mode" "SF,SF,SF,SI,SI,TI,SF,SF,SF,SI,SI")])
  
  (define_insn "*swapsf"
--- 3382,3388 ----
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov")
     (set_attr "mode" "SF,SF,SF,SI,SI,TI,SF,SF,SF,SI,SI")])
  
  (define_insn "*swapsf"
***************
*** 2946,2952 ****
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,sse,sse,sse,sse")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_insn "*movdf_integer"
--- 3558,3564 ----
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_insn "*movdf_integer"
***************
*** 3005,3011 ****
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,sse,sse,sse,sse")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_split
--- 3617,3623 ----
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_split
***************
*** 4069,4075 ****
        abort ();
      }
  }
!   [(set_attr "type" "fmov,fmov,sse")
     (set_attr "mode" "SF,XF,DF")])
  
  (define_insn "*extendsfdf2_1_sse_only"
--- 4681,4687 ----
        abort ();
      }
  }
!   [(set_attr "type" "fmov,fmov,ssecvt")
     (set_attr "mode" "SF,XF,DF")])
  
  (define_insn "*extendsfdf2_1_sse_only"
***************
*** 4078,4084 ****
    "!TARGET_80387 && TARGET_SSE2
     && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
    "cvtss2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  
  (define_expand "extendsfxf2"
--- 4690,4696 ----
    "!TARGET_80387 && TARGET_SSE2
     && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
    "cvtss2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")])
  
  (define_expand "extendsfxf2"
***************
*** 4308,4314 ****
        abort ();
      }
  }
!   [(set_attr "type" "fmov,multi,multi,multi,sse")
     (set_attr "mode" "SF,SF,SF,SF,DF")])
  
  (define_insn "*truncdfsf2_2"
--- 4920,4926 ----
        abort ();
      }
  }
!   [(set_attr "type" "fmov,multi,multi,multi,ssecvt")
     (set_attr "mode" "SF,SF,SF,SF,DF")])
  
  (define_insn "*truncdfsf2_2"
***************
*** 4331,4337 ****
        abort ();
      }
  }
!   [(set_attr "type" "sse,fmov")
     (set_attr "mode" "DF,SF")])
  
  (define_insn "truncdfsf2_3"
--- 4943,4949 ----
        abort ();
      }
  }
!   [(set_attr "type" "ssecvt,fmov")
     (set_attr "mode" "DF,SF")])
  
  (define_insn "truncdfsf2_3"
***************
*** 4354,4360 ****
  	 (match_operand:DF 1 "nonimmediate_operand" "mY")))]
    "!TARGET_80387 && TARGET_SSE2"
    "cvtsd2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  
  (define_split
--- 4966,4972 ----
  	 (match_operand:DF 1 "nonimmediate_operand" "mY")))]
    "!TARGET_80387 && TARGET_SSE2"
    "cvtsd2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")])
  
  (define_split
***************
*** 4771,4784 ****
  	(fix:DI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvttss2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "fix_truncdfdi_sse"
    [(set (match_operand:DI 0 "register_operand" "=r")
  	(fix:DI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_64BIT && TARGET_SSE2"
    "cvttsd2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; Signed conversion to SImode.
  
--- 5383,5396 ----
  	(fix:DI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvttss2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  (define_insn "fix_truncdfdi_sse"
    [(set (match_operand:DI 0 "register_operand" "=r")
  	(fix:DI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_64BIT && TARGET_SSE2"
    "cvttsd2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  ;; Signed conversion to SImode.
  
***************
*** 4879,4892 ****
  	(fix:SI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "fix_truncdfsi_sse"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(fix:SI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "cvttsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_split 
    [(set (match_operand:SI 0 "register_operand" "")
--- 5491,5504 ----
  	(fix:SI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  (define_insn "fix_truncdfsi_sse"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(fix:SI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "cvttsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  (define_split 
    [(set (match_operand:SI 0 "register_operand" "")
***************
*** 5022,5028 ****
    "fnstcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "i387" "1")
     (set_attr "ppro_uops" "few")])
  
  (define_insn "x86_fldcw_1"
--- 5634,5640 ----
    "fnstcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "unit" "i387")
     (set_attr "ppro_uops" "few")])
  
  (define_insn "x86_fldcw_1"
***************
*** 5032,5038 ****
    "fldcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "i387" "1")
     (set_attr "athlon_decode" "vector")
     (set_attr "ppro_uops" "few")])
  \f
--- 5644,5650 ----
    "fldcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "unit" "i387")
     (set_attr "athlon_decode" "vector")
     (set_attr "ppro_uops" "few")])
  \f
***************
*** 5066,5072 ****
     fild%z1\t%1
     #
     cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5678,5684 ----
     fild%z1\t%1
     #
     cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5075,5081 ****
  	(float:SF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE"
    "cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5687,5693 ----
  	(float:SF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE"
    "cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5104,5110 ****
     fild%z1\t%1
     #
     cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5716,5722 ----
     fild%z1\t%1
     #
     cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5113,5119 ****
  	(float:SF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5725,5731 ----
  	(float:SF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5142,5148 ****
     fild%z1\t%1
     #
     cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5754,5760 ----
     fild%z1\t%1
     #
     cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5151,5157 ****
  	(float:DF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5763,5769 ----
  	(float:DF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5180,5186 ****
     fild%z1\t%1
     #
     cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5792,5798 ----
     fild%z1\t%1
     #
     cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5189,5195 ****
  	(float:DF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5801,5807 ----
  	(float:DF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 12639,12645 ****
  	   (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
    "TARGET_SSE && reload_completed"
    "cmp%D1ss\t{%3, %0|%0, %3}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")])
  
  (define_insn "*sse_setccdf"
--- 13251,13257 ----
  	   (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
    "TARGET_SSE && reload_completed"
    "cmp%D1ss\t{%3, %0|%0, %3}"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "SF")])
  
  (define_insn "*sse_setccdf"
***************
*** 12649,12655 ****
  	   (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
    "TARGET_SSE2 && reload_completed"
    "cmp%D1sd\t{%3, %0|%0, %3}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  \f
  ;; Basic conditional jump instructions.
--- 13261,13267 ----
  	   (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
    "TARGET_SSE2 && reload_completed"
    "cmp%D1sd\t{%3, %0|%0, %3}"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "DF")])
  \f
  ;; Basic conditional jump instructions.
***************
*** 13879,13885 ****
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
!            (const_string "sse")
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
--- 14491,14499 ----
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
! 	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	      (const_string "ssemul")
! 	      (const_string "sseadd"))
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
***************
*** 13892,13898 ****
  			 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
    "TARGET_SSE_MATH && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")])
  
  (define_insn "*fop_df_comm_nosse"
--- 14506,14515 ----
  			 (match_operand:SF 2 "nonimmediate_operand" "xm")]))]
    "TARGET_SSE_MATH && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set (attr "type") 
!         (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	   (const_string "ssemul")
! 	   (const_string "sseadd")))
     (set_attr "mode" "SF")])
  
  (define_insn "*fop_df_comm_nosse"
***************
*** 13919,13925 ****
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
!            (const_string "sse")
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
--- 14536,14544 ----
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
! 	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	      (const_string "ssemul")
! 	      (const_string "sseadd"))
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
***************
*** 13933,13939 ****
    "TARGET_SSE2 && TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  
  (define_insn "*fop_xf_comm"
--- 14552,14561 ----
    "TARGET_SSE2 && TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set (attr "type") 
!         (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	   (const_string "ssemul")
! 	   (const_string "sseadd")))
     (set_attr "mode" "DF")])
  
  (define_insn "*fop_xf_comm"
***************
*** 13991,13998 ****
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(eq_attr "alternative" "2")
!                  (const_string "sse")
  	       (match_operand:SF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:SF 3 "div_operator" "") 
--- 14613,14626 ----
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "mult_operator" ""))
!                  (const_string "ssemul")
! 	       (and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "div_operator" ""))
!                  (const_string "ssediv")
! 	       (eq_attr "alternative" "2")
!                  (const_string "sseadd")
  	       (match_operand:SF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:SF 3 "div_operator" "") 
***************
*** 14009,14015 ****
    "TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")])
  
  ;; ??? Add SSE splitters for these!
--- 14637,14649 ----
    "TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set (attr "type") 
!         (cond [(match_operand:SF 3 "mult_operator" "")
!                  (const_string "ssemul")
! 	       (match_operand:SF 3 "div_operator" "")
!                  (const_string "ssediv")
!               ]
!               (const_string "sseadd")))
     (set_attr "mode" "SF")])
  
  ;; ??? Add SSE splitters for these!
***************
*** 14061,14067 ****
    [(set (attr "type") 
          (cond [(match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
!                (match_operand:DF 3 "div_operator" "") 
                   (const_string "fdiv")
                ]
                (const_string "fop")))
--- 14695,14701 ----
    [(set (attr "type") 
          (cond [(match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
!                (match_operand:DF 3 "div_operator" "")
                   (const_string "fdiv")
                ]
                (const_string "fop")))
***************
*** 14078,14085 ****
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(eq_attr "alternative" "2")
!                  (const_string "sse")
  	       (match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:DF 3 "div_operator" "") 
--- 14712,14725 ----
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "mult_operator" ""))
!                  (const_string "ssemul")
! 	       (and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "div_operator" ""))
!                  (const_string "ssediv")
! 	       (eq_attr "alternative" "2")
!                  (const_string "sseadd")
  	       (match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:DF 3 "div_operator" "") 
***************
*** 14096,14102 ****
    "TARGET_SSE2 && TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")])
  
  ;; ??? Add SSE splitters for these!
  (define_insn "*fop_df_2"
--- 14736,14749 ----
    "TARGET_SSE2 && TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "mode" "DF")
!    (set (attr "type") 
!         (cond [(match_operand:SF 3 "mult_operator" "")
!                  (const_string "ssemul")
! 	       (match_operand:SF 3 "div_operator" "")
!                  (const_string "ssediv")
!               ]
!               (const_string "sseadd")))])
  
  ;; ??? Add SSE splitters for these!
  (define_insn "*fop_df_2"
***************
*** 17693,17699 ****
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "movv4si_internal"
    [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,m")
--- 18340,18347 ----
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "movv4si_internal"
    [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,m")
***************
*** 17701,17735 ****
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "movv8qi_internal"
    [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V8QI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "movv4hi_internal"
    [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V4HI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "movv2si_internal"
    [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V2SI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "movv2sf_internal"
    [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,m")
          (match_operand:V2SF 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_3DNOW"
    "movq\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_expand "movti"
    [(set (match_operand:TI 0 "general_operand" "")
--- 18349,18388 ----
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "movv8qi_internal"
    [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V8QI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxmov")
!    (set_attr "mode" "DI")])
  
  (define_insn "movv4hi_internal"
    [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V4HI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxmov")
!    (set_attr "mode" "DI")])
  
  (define_insn "movv2si_internal"
    [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V2SI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "movv2sf_internal"
    [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,m")
          (match_operand:V2SF 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_3DNOW"
    "movq\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_expand "movti"
    [(set (match_operand:TI 0 "general_operand" "")
***************
*** 17806,17812 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:TI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv4sf"
    [(set (match_operand:V4SF 0 "push_operand" "=<")
--- 18459,18465 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:TI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv4sf"
    [(set (match_operand:V4SF 0 "push_operand" "=<")
***************
*** 17817,17823 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SF (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv4si"
    [(set (match_operand:V4SI 0 "push_operand" "=<")
--- 18470,18476 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SF (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv4si"
    [(set (match_operand:V4SI 0 "push_operand" "=<")
***************
*** 17828,17834 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv2si"
    [(set (match_operand:V2SI 0 "push_operand" "=<")
--- 18481,18487 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv2si"
    [(set (match_operand:V2SI 0 "push_operand" "=<")
***************
*** 17882,17888 ****
     xorps\t%0, %0
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*movti_rex64"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,mx,x")
--- 18535,18542 ----
     xorps\t%0, %0
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov,ssemov,ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*movti_rex64"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,mx,x")
***************
*** 17895,17902 ****
     xorps\t%0, %0
     movaps\\t{%1, %0|%0, %1}
     movaps\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,sse,sse,sse")
!    (set_attr "mode" "TI")])
  
  (define_split
    [(set (match_operand:TI 0 "nonimmediate_operand" "")
--- 18549,18556 ----
     xorps\t%0, %0
     movaps\\t{%1, %0|%0, %1}
     movaps\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_split
    [(set (match_operand:TI 0 "nonimmediate_operand" "")
***************
*** 17916,17922 ****
    "@
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movups"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
--- 18570,18577 ----
    "@
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov,ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movups"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
***************
*** 17926,17932 ****
    "@
     movups\t{%1, %0|%0, %1}
     movups\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE Strange Moves.
--- 18581,18588 ----
    "@
     movups\t{%1, %0|%0, %1}
     movups\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt,ssecvt")
!    (set_attr "mode" "V4SF")])
  
  
  ;; SSE Strange Moves.
***************
*** 17936,17949 ****
  	(unspec:SI [(match_operand:V4SF 1 "register_operand" "x")] 33))]
    "TARGET_SSE"
    "movmskps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_pmovmskb"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(unspec:SI [(match_operand:V8QI 1 "register_operand" "y")] 33))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmovmskb\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_maskmovq"
    [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
--- 18592,18608 ----
  	(unspec:SI [(match_operand:V4SF 1 "register_operand" "x")] 33))]
    "TARGET_SSE"
    "movmskps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "mmx_pmovmskb"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(unspec:SI [(match_operand:V8QI 1 "register_operand" "y")] 33))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmovmskb\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
! 
  
  (define_insn "mmx_maskmovq"
    [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
***************
*** 17952,17972 ****
    "TARGET_SSE || TARGET_3DNOW_A"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovq\t{%2, %1|%1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movntv4sf"
    [(set (match_operand:V4SF 0 "memory_operand" "=m")
  	(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")] 34))]
    "TARGET_SSE"
    "movntps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movntdi"
    [(set (match_operand:DI 0 "memory_operand" "=m")
  	(unspec:DI [(match_operand:DI 1 "register_operand" "y")] 34))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "movntq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movhlps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18611,18634 ----
    "TARGET_SSE || TARGET_3DNOW_A"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovq\t{%2, %1|%1, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "sse_movntv4sf"
    [(set (match_operand:V4SF 0 "memory_operand" "=m")
  	(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")] 34))]
    "TARGET_SSE"
    "movntps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movntdi"
    [(set (match_operand:DI 0 "memory_operand" "=m")
  	(unspec:DI [(match_operand:DI 1 "register_operand" "y")] 34))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "movntq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxmov")
!    (set_attr "mode" "DI")])
  
  (define_insn "sse_movhlps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 17980,17986 ****
  	 (const_int 3)))]
    "TARGET_SSE"
    "movhlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movlhps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18642,18649 ----
  	 (const_int 3)))]
    "TARGET_SSE"
    "movhlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movlhps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 17994,18000 ****
  	 (const_int 12)))]
    "TARGET_SSE"
    "movlhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movhps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
--- 18657,18664 ----
  	 (const_int 12)))]
    "TARGET_SSE"
    "movlhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movhps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
***************
*** 18005,18011 ****
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movlps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
--- 18669,18676 ----
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movlps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
***************
*** 18016,18022 ****
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_loadss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18681,18688 ----
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_loadss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18026,18032 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18692,18699 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_movss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18036,18042 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_storess"
    [(set (match_operand:SF 0 "memory_operand" "=m")
--- 18703,18710 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_storess"
    [(set (match_operand:SF 0 "memory_operand" "=m")
***************
*** 18045,18051 ****
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_shufps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18713,18720 ----
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_shufps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18055,18061 ****
    "TARGET_SSE"
    ;; @@@ check operand order for intel/nonintel syntax
    "shufps\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE arithmetic
--- 18724,18731 ----
    "TARGET_SSE"
    ;; @@@ check operand order for intel/nonintel syntax
    "shufps\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  
  ;; SSE arithmetic
***************
*** 18066,18072 ****
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "addps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmaddv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18736,18743 ----
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "addps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmaddv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18077,18083 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "addss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "subv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18748,18755 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "addss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "SF")])
  
  (define_insn "subv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18085,18091 ****
  		    (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "subps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsubv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18757,18764 ----
  		    (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "subps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsubv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18096,18102 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "subss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18769,18776 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "subss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "SF")])
  
  (define_insn "mulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18104,18110 ****
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "mulps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18778,18785 ----
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "mulps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemul")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmmulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18115,18121 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "mulss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "divv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18790,18797 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "mulss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemul")
!    (set_attr "mode" "SF")])
  
  (define_insn "divv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18123,18129 ****
  	          (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "divps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmdivv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18799,18806 ----
  	          (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "divps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssediv")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmdivv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18134,18140 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "divss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE square root/reciprocal
--- 18811,18818 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "divss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssediv")
!    (set_attr "mode" "SF")])
  
  
  ;; SSE square root/reciprocal
***************
*** 18145,18151 ****
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 42))]
    "TARGET_SSE"
    "rcpps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmrcpv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18823,18830 ----
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 42))]
    "TARGET_SSE"
    "rcpps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmrcpv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18155,18161 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "rcpss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "rsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18834,18841 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "rcpss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  (define_insn "rsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18163,18169 ****
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 43))]
    "TARGET_SSE"
    "rsqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmrsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18843,18850 ----
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 43))]
    "TARGET_SSE"
    "rsqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmrsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18173,18186 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "rsqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
          (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "sqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18854,18869 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "rsqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  (define_insn "sqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
          (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "sqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18190,18196 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "sqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; SSE logical operations.
  
--- 18873,18880 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "sqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  ;; SSE logical operations.
  
***************
*** 18205,18211 ****
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_andti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18889,18896 ----
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_andti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18213,18219 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_andti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18898,18905 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_andti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18221,18227 ****
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_andti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18907,18914 ----
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_andti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18229,18235 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_andti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18916,18923 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_andti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18237,18243 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_andti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18925,18932 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_andti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18245,18251 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_nandti3_df"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18934,18941 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "TI")])
  
  (define_insn "*sse_nandti3_df"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18253,18259 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andnpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_nandti3_sf"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18943,18950 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andnpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_nandti3_sf"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18261,18267 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_nandti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18952,18959 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_nandti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18269,18275 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_nandti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18961,18968 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_nandti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18277,18283 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pnand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18970,18977 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pnand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "TI")])
  
  (define_insn "*sse_iorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18285,18291 ****
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18979,18986 ----
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_iorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18293,18299 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18988,18995 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_iorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18301,18307 ****
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18997,19004 ----
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_iorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18309,18315 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_iorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 19006,19013 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_iorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18317,18323 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 19015,19022 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_iorti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18325,18331 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 19024,19031 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "TI")])
  
  (define_insn "*sse_xorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18333,18339 ****
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 19033,19040 ----
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_xorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18341,18347 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 19042,19049 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_xorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18349,18355 ****
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 19051,19058 ----
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_xorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18357,18363 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_xorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 19060,19067 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_xorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18365,18371 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 19069,19076 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_xorti3_sse2"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18373,18379 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; Use xor, but don't show input operands so they aren't live before
  ;; this insn.
--- 19078,19085 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "TI")])
  
  ;; Use xor, but don't show input operands so they aren't live before
  ;; this insn.
***************
*** 18382,18389 ****
          (unspec:V4SF [(const_int 0)] 45))]
    "TARGET_SSE"
    "xorps\t{%0, %0|%0, %0}"
!   [(set_attr "type" "sse")
!    (set_attr "memory" "none")])
  
  ;; SSE mask-generating compares
  
--- 19088,19095 ----
          (unspec:V4SF [(const_int 0)] 45))]
    "TARGET_SSE"
    "xorps\t{%0, %0|%0, %0}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  ;; SSE mask-generating compares
  
***************
*** 18394,18400 ****
  		 (match_operand:V4SF 2 "register_operand" "x")]))]
    "TARGET_SSE"
    "cmp%D3ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "maskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 19100,19107 ----
  		 (match_operand:V4SF 2 "register_operand" "x")]))]
    "TARGET_SSE"
    "cmp%D3ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "maskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 18409,18415 ****
    else
      return "cmpn%D3ps\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmaskcmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 19116,19123 ----
    else
      return "cmpn%D3ps\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmmaskcmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 18421,18427 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "cmp%D3ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmaskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 19129,19136 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "cmp%D3ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  (define_insn "vmmaskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 18439,18445 ****
    else
      return "cmpn%D3ss\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_comi"
    [(set (reg:CCFP 17)
--- 19148,19155 ----
    else
      return "cmpn%D3ss\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_comi"
    [(set (reg:CCFP 17)
***************
*** 18452,18458 ****
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "comiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_ucomi"
    [(set (reg:CCFPU 17)
--- 19162,19169 ----
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "comiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_ucomi"
    [(set (reg:CCFPU 17)
***************
*** 18465,18471 ****
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "ucomiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE unpack
--- 19176,19183 ----
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "ucomiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  
  ;; SSE unpack
***************
*** 18486,18492 ****
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpckhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_unpcklps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 19198,19205 ----
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpckhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_unpcklps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18504,18510 ****
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpcklps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE min/max
--- 19217,19224 ----
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpcklps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  
  ;; SSE min/max
***************
*** 18515,18521 ****
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "maxps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsmaxv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 19229,19236 ----
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "maxps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsmaxv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18526,18532 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "maxss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 19241,19248 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "maxss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  (define_insn "sminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18534,18540 ****
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "minps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 19250,19257 ----
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "minps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18545,18551 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "minss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE <-> integer/MMX conversions
--- 19262,19269 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "minss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  
  ;; SSE <-> integer/MMX conversions
***************
*** 18559,18565 ****
  	 (const_int 12)))]
    "TARGET_SSE"
    "cvtpi2ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19277,19284 ----
  	 (const_int 12)))]
    "TARGET_SSE"
    "cvtpi2ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "cvtps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18568,18574 ****
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvtps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19287,19294 ----
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvtps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "cvttps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18577,18583 ****
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvttps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtsi2ss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 19297,19304 ----
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvttps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  (define_insn "cvtsi2ss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18588,18594 ****
  	 (const_int 14)))]
    "TARGET_SSE"
    "cvtsi2ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 19309,19316 ----
  	 (const_int 14)))]
    "TARGET_SSE"
    "cvtsi2ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  (define_insn "cvtss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 18597,18603 ****
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvtss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 19319,19326 ----
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvtss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  (define_insn "cvttss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 18606,18612 ****
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX insns
--- 19329,19336 ----
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  
  ;; MMX insns
***************
*** 18619,18625 ****
  	           (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "addv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19343,19350 ----
  	           (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "addv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18627,18633 ****
  	           (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "addv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19352,19359 ----
  	           (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "addv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18635,18641 ****
  	           (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ssaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19361,19368 ----
  	           (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ssaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18643,18649 ****
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ssaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19370,19377 ----
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ssaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18651,18657 ****
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "usaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19379,19386 ----
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "usaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18659,18665 ****
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "usaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19388,19395 ----
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "usaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18667,18673 ****
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19397,19404 ----
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "subv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18675,18681 ****
  		    (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19406,19413 ----
  		    (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "subv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18683,18689 ****
  		    (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19415,19422 ----
  		    (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "subv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18691,18697 ****
  		    (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "sssubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19424,19431 ----
  		    (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "sssubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18699,18705 ****
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "sssubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19433,19440 ----
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "sssubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18707,18713 ****
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ussubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19442,19449 ----
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ussubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18715,18721 ****
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ussubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19451,19458 ----
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ussubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18723,18729 ****
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mulv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19460,19467 ----
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "mulv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18731,18737 ****
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pmullw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "smulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19469,19476 ----
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pmullw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  (define_insn "smulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18744,18750 ****
  	  (const_int 16))))]
    "TARGET_MMX"
    "pmulhw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "umulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19483,19490 ----
  	  (const_int 16))))]
    "TARGET_MMX"
    "pmulhw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  (define_insn "umulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18757,18763 ****
  	  (const_int 16))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmulhuw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_pmaddwd"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19497,19504 ----
  	  (const_int 16))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmulhuw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_pmaddwd"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18778,18784 ****
  							(const_int 3)]))))))]
    "TARGET_MMX"
    "pmaddwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX logical operations
--- 19519,19526 ----
  							(const_int 3)]))))))]
    "TARGET_MMX"
    "pmaddwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX logical operations
***************
*** 18792,18798 ****
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_xordi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
--- 19534,19541 ----
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_xordi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
***************
*** 18801,18807 ****
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
     (set_attr "memory" "none")])
  
  ;; Same as pxor, but don't show input operands so that we don't think
--- 19544,19551 ----
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")
     (set_attr "memory" "none")])
  
  ;; Same as pxor, but don't show input operands so that we don't think
***************
*** 18811,18817 ****
          (unspec:DI [(const_int 0)] 45))]
    "TARGET_MMX"
    "pxor\t{%0, %0|%0, %0}"
!   [(set_attr "type" "mmx")
     (set_attr "memory" "none")])
  
  (define_insn "mmx_anddi3"
--- 19555,19562 ----
          (unspec:DI [(const_int 0)] 45))]
    "TARGET_MMX"
    "pxor\t{%0, %0|%0, %0}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")
     (set_attr "memory" "none")])
  
  (define_insn "mmx_anddi3"
***************
*** 18821,18827 ****
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_nanddi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
--- 19566,19573 ----
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_nanddi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
***************
*** 18830,18836 ****
  			  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pandn\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX unsigned averages/sum of absolute differences
--- 19576,19583 ----
  			  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pandn\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX unsigned averages/sum of absolute differences
***************
*** 18852,18858 ****
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_uavgv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19599,19606 ----
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_uavgv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18867,18873 ****
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_psadbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19615,19622 ----
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_psadbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18875,18881 ****
  			      (match_operand:V8QI 2 "nonimmediate_operand" "ym"))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "psadbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX insert/extract/shuffle
--- 19624,19631 ----
  			      (match_operand:V8QI 2 "nonimmediate_operand" "ym"))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "psadbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX insert/extract/shuffle
***************
*** 18888,18894 ****
  			(match_operand:SI 3 "immediate_operand" "i")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pinsrw\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_pextrw"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 19638,19645 ----
  			(match_operand:SI 3 "immediate_operand" "i")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pinsrw\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_pextrw"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 18897,18903 ****
  					[(match_operand:SI 2 "immediate_operand" "i")]))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pextrw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_pshufw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19648,19655 ----
  					[(match_operand:SI 2 "immediate_operand" "i")]))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pextrw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_pshufw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18905,18911 ****
  		      (match_operand:SI 2 "immediate_operand" "i")] 41))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pshufw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX mask-generating comparisons
--- 19657,19664 ----
  		      (match_operand:SI 2 "immediate_operand" "i")] 41))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pshufw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX mask-generating comparisons
***************
*** 18916,18922 ****
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "eqv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19669,19676 ----
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "eqv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18924,18930 ****
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "eqv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19678,19685 ----
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "eqv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18932,18938 ****
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19687,19694 ----
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "gtv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18940,18946 ****
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19696,19703 ----
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "gtv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18948,18954 ****
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19705,19712 ----
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "gtv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18956,18962 ****
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX max/min insns
--- 19714,19721 ----
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX max/min insns
***************
*** 18967,18973 ****
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "smaxv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19726,19733 ----
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "smaxv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18975,18981 ****
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "uminv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19735,19742 ----
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "uminv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18983,18989 ****
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sminv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19744,19751 ----
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "sminv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18991,18997 ****
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX shifts
--- 19753,19760 ----
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX shifts
***************
*** 19002,19008 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psraw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ashrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19765,19772 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psraw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "ashrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19010,19016 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrad\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "lshrv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19774,19781 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrad\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "lshrv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19018,19024 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrlw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "lshrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19783,19790 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrlw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "lshrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19026,19032 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_lshrdi3"
--- 19792,19799 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_lshrdi3"
***************
*** 19036,19042 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psrlq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ashlv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19803,19810 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psrlq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "ashlv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19044,19050 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psllw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ashlv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19812,19819 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psllw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "ashlv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19052,19058 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "pslld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_ashldi3"
--- 19821,19828 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "pslld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_ashldi3"
***************
*** 19062,19068 ****
  		     (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psllq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX pack/unpack insns.
--- 19832,19839 ----
  		     (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psllq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX pack/unpack insns.
***************
*** 19074,19080 ****
  	 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packsswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_packssdw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19845,19852 ----
  	 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packsswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_packssdw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19083,19089 ****
  	 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packssdw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_packuswb"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19855,19862 ----
  	 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packssdw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_packuswb"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19092,19098 ****
  	 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packuswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckhbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19865,19872 ----
  	 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packuswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckhbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19118,19124 ****
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpckhbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckhwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19892,19899 ----
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpckhbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckhwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19136,19142 ****
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpckhwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckhdq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19911,19918 ----
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpckhwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckhdq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19150,19156 ****
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckhdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpcklbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19926,19933 ----
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckhdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpcklbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19176,19182 ****
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpcklbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpcklwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19953,19960 ----
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpcklbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpcklwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19194,19200 ****
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpcklwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckldq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19972,19979 ----
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpcklwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckldq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19208,19214 ****
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; Miscellaneous stuff
--- 19987,19994 ----
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  
  ;; Miscellaneous stuff
***************
*** 19337,19343 ****
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfadd\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20117,20124 ----
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfadd\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "subv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19345,19351 ****
  		    (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfsub\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subrv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20126,20133 ----
  		    (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfsub\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "subrv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19353,19359 ****
                      (match_operand:V2SF 1 "register_operand" "0")))]
    "TARGET_3DNOW"
    "pfsubr\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 20135,20142 ----
                      (match_operand:V2SF 1 "register_operand" "0")))]
    "TARGET_3DNOW"
    "pfsubr\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "gtv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19361,19367 ****
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
   "TARGET_3DNOW"
    "pfcmpgt\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gev2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 20144,20151 ----
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
   "TARGET_3DNOW"
    "pfcmpgt\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "gev2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19369,19375 ****
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpge\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "eqv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 20153,20160 ----
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpge\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "eqv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19377,19383 ****
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpeq\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfmaxv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20162,20169 ----
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpeq\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfmaxv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19385,19391 ****
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmax\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfminv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20171,20178 ----
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmax\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfminv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19393,19399 ****
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmin\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mulv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20180,20187 ----
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmin\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "mulv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19401,19407 ****
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmul\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "femms"
    [(unspec_volatile [(const_int 0)] 46)
--- 20189,20196 ----
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmul\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "femms"
    [(unspec_volatile [(const_int 0)] 46)
***************
*** 19430,19436 ****
  	(fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pf2id\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pf2iw"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 20219,20226 ----
  	(fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pf2id\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pf2iw"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19439,19445 ****
  	      (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
    "TARGET_3DNOW_A"
    "pf2iw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20229,20236 ----
  	      (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
    "TARGET_3DNOW_A"
    "pf2iw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19456,19462 ****
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW"
    "pfacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20247,20254 ----
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW"
    "pfacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19473,19479 ****
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfpnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20265,20272 ----
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfpnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19490,19496 ****
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfpnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pi2fw"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20283,20290 ----
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfpnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pi2fw"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19506,19519 ****
  				   (parallel [(const_int  1)])))))))]
    "TARGET_3DNOW_A"
    "pi2fw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "floatv2si2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pi2fd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  ;; This insn is identical to pavgb in operation, but the opcode is
  ;; different.  To avoid accidentally matching pavgb, use an unspec.
--- 20300,20315 ----
  				   (parallel [(const_int  1)])))))))]
    "TARGET_3DNOW_A"
    "pi2fw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "floatv2si2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pi2fd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  ;; This insn is identical to pavgb in operation, but the opcode is
  ;; different.  To avoid accidentally matching pavgb, use an unspec.
***************
*** 19525,19531 ****
             (match_operand:V8QI 2 "nonimmediate_operand" "ym")] 49))]
    "TARGET_3DNOW"
    "pavgusb\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  ;; 3DNow reciprical and sqrt
   
--- 20321,20328 ----
             (match_operand:V8QI 2 "nonimmediate_operand" "ym")] 49))]
    "TARGET_3DNOW"
    "pavgusb\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "TI")])
  
  ;; 3DNow reciprical and sqrt
   
***************
*** 19534,19540 ****
          (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 50))]
    "TARGET_3DNOW"
    "pfrcp\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfrcpit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20331,20338 ----
          (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 50))]
    "TARGET_3DNOW"
    "pfrcp\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pfrcpit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19542,19548 ****
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 51))]
    "TARGET_3DNOW"
    "pfrcpit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfrcpit2v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20340,20347 ----
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 51))]
    "TARGET_3DNOW"
    "pfrcpit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pfrcpit2v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19550,19563 ****
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 52))]
    "TARGET_3DNOW"
    "pfrcpit2\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfrsqrtv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 53))]
    "TARGET_3DNOW"
!    "pfrsqrt\\t{%1, %0|%0, %1}"
!    [(set_attr "type" "mmx")])
  		
  (define_insn "pfrsqit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20349,20364 ----
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 52))]
    "TARGET_3DNOW"
    "pfrcpit2\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pfrsqrtv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 53))]
    "TARGET_3DNOW"
!   "pfrsqrt\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  		
  (define_insn "pfrsqit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19565,19571 ****
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 54))]
    "TARGET_3DNOW"
    "pfrsqit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pmulhrwv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 20366,20373 ----
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 54))]
    "TARGET_3DNOW"
    "pfrsqit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pmulhrwv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19585,19591 ****
  	   (const_int 16))))]
    "TARGET_3DNOW"
    "pmulhrw\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pswapdv2si2"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 20387,20394 ----
  	   (const_int 16))))]
    "TARGET_3DNOW"
    "pmulhrw\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "TI")])
  
  (define_insn "pswapdv2si2"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19593,19599 ****
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pswapdv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20396,20403 ----
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "pswapdv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19601,19607 ****
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_expand "prefetch"
    [(prefetch (match_operand:SI 0 "address_operand" "")
--- 20405,20412 ----
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "TI")])
  
  (define_expand "prefetch"
    [(prefetch (match_operand:SI 0 "address_operand" "")
***************
*** 19643,19649 ****
  
    return patterns[locality];  
  }
!   [(set_attr "type" "sse")])
  
  (define_insn "*prefetch_3dnow"
    [(prefetch (match_operand:SI 0 "address_operand" "p")
--- 20448,20455 ----
  
    return patterns[locality];  
  }
!   [(set_attr "type" "sse")
!    (set_attr "memory" "none")])
  
  (define_insn "*prefetch_3dnow"
    [(prefetch (match_operand:SI 0 "address_operand" "p")
***************
*** 19656,19659 ****
    else
      return "prefetchw\t%a0";
  }
!   [(set_attr "type" "mmx")])
--- 20462,20466 ----
    else
      return "prefetchw\t%a0";
  }
!   [(set_attr "type" "mmx")
!    (set_attr "memory" "none")])

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Fix attributes for SSE/MMX instructions
  2002-04-27 16:15 Fix attributes for SSE/MMX instructions Jan Hubicka
@ 2002-04-29 15:19 ` Richard Henderson
  2002-04-30 10:29   ` Jan Hubicka
       [not found]   ` <20020430160511.GK18000@atrey.karlin.mff.cuni.cz>
  0 siblings, 2 replies; 33+ messages in thread
From: Richard Henderson @ 2002-04-29 15:19 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches, patches

General idea looks fine.  I didn't proofread all the lines.
Worse, Bernd committed a bunch of sse2 stuff this past weekend,
so you'll have to update the patch.

I'll go ahead and pre-approve the thing.  If there are any
typos, we should be able to work that out fairly quickly.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Fix attributes for SSE/MMX instructions
  2002-04-29 15:19 ` Richard Henderson
@ 2002-04-30 10:29   ` Jan Hubicka
       [not found]   ` <20020430160511.GK18000@atrey.karlin.mff.cuni.cz>
  1 sibling, 0 replies; 33+ messages in thread
From: Jan Hubicka @ 2002-04-30 10:29 UTC (permalink / raw)
  To: Richard Henderson, Jan Hubicka, gcc-patches, patches

> General idea looks fine.  I didn't proofread all the lines.

Well, there is not much ideas, just boring work :(

> Worse, Bernd committed a bunch of sse2 stuff this past weekend,
> so you'll have to update the patch.

Good timing, Bernd.
> 
> I'll go ahead and pre-approve the thing.  If there are any
> typos, we should be able to work that out fairly quickly.

Thanks.  The exact patch I've commited is:

Index: i386.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.349
diff -c -3 -p -r1.349 i386.md
*** i386.md	29 Apr 2002 18:40:47 -0000	1.349
--- i386.md	30 Apr 2002 17:18:41 -0000
***************
*** 122,145 ****
  ;; A basic instruction type.  Refinements due to arguments to be
  ;; provided in other attributes.
  (define_attr "type"
!   "other,multi,alu1,negnot,alu,icmp,test,imov,imovx,lea,incdec,ishift,imul,idiv,ibr,setcc,push,pop,call,callv,icmov,fmov,fop,fop1,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,str,cld,sse,mmx,fistp"
    (const_string "other"))
  
  ;; Main data type used by the insn
! (define_attr "mode" "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI"
    (const_string "unknown"))
  
! ;; Set for i387 operations.
! (define_attr "i387" ""
!   (if_then_else (eq_attr "type" "fmov,fop,fop1,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")
!     (const_int 1)
!     (const_int 0)))
  
  ;; The (bounding maximum) length of an instruction immediate.
  (define_attr "length_immediate" ""
!   (cond [(eq_attr "type" "incdec,setcc,icmov,ibr,str,cld,lea,other,multi,idiv,sse,mmx")
  	   (const_int 0)
! 	 (eq_attr "i387" "1")
  	   (const_int 0)
  	 (eq_attr "type" "alu1,negnot,alu,icmp,imovx,ishift,imul,push,pop")
  	   (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
--- 122,149 ----
  ;; A basic instruction type.  Refinements due to arguments to be
  ;; provided in other attributes.
  (define_attr "type"
!   "other,multi,alu1,negnot,alu,icmp,test,imov,imovx,lea,incdec,ishift,imul,idiv,ibr,setcc,push,pop,call,callv,icmov,fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,str,cld,sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,sseiadd,sseishft,sseimul,mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul,fistp"
    (const_string "other"))
  
  ;; Main data type used by the insn
! (define_attr "mode" "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI,V4SF,V2DF,V2SF"
    (const_string "unknown"))
  
! ;; The CPU unit operations uses.
! (define_attr "unit" "integer,i387,sse,mmx,unknown"
!   (cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")
! 	   (const_string "i387")
! 	 (eq_attr "type" "sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,sseiadd,sseishft,sseimul")
! 	   (const_string "sse")
! 	 (eq_attr "type" "mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul")
! 	   (const_string "mmx")]
! 	 (const_string "integer")))
  
  ;; The (bounding maximum) length of an instruction immediate.
  (define_attr "length_immediate" ""
!   (cond [(eq_attr "type" "incdec,setcc,icmov,ibr,str,cld,lea,other,multi,idiv")
  	   (const_int 0)
! 	 (eq_attr "unit" "i387,sse,mmx")
  	   (const_int 0)
  	 (eq_attr "type" "alu1,negnot,alu,icmp,imovx,ishift,imul,push,pop")
  	   (symbol_ref "ix86_attr_length_immediate_default(insn,1)")
***************
*** 178,193 ****
  
  ;; Set when length prefix is used.
  (define_attr "prefix_data16" ""
!   (if_then_else (eq_attr "mode" "HI")
      (const_int 1)
      (const_int 0)))
  
  ;; Set when string REP prefix is used.
! (define_attr "prefix_rep" "" (const_int 0))
  
  ;; Set when 0f opcode prefix is used.
  (define_attr "prefix_0f" ""
!   (if_then_else (eq_attr "type" "imovx,setcc,icmov,sse,mmx")
      (const_int 1)
      (const_int 0)))
  
--- 182,201 ----
  
  ;; Set when length prefix is used.
  (define_attr "prefix_data16" ""
!   (if_then_else (ior (eq_attr "mode" "HI")
! 		     (and (eq_attr "unit" "sse") (eq_attr "mode" "V2DF")))
      (const_int 1)
      (const_int 0)))
  
  ;; Set when string REP prefix is used.
! (define_attr "prefix_rep" "" 
!   (if_then_else (and (eq_attr "unit" "sse") (eq_attr "mode" "SF,DF"))
!     (const_int 1)
!     (const_int 0)))
  
  ;; Set when 0f opcode prefix is used.
  (define_attr "prefix_0f" ""
!   (if_then_else (eq_attr "type" "imovx,setcc,icmov,sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,sseiadd,sseishft,sseimul,mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul")
      (const_int 1)
      (const_int 0)))
  
***************
*** 195,201 ****
  (define_attr "modrm" ""
    (cond [(eq_attr "type" "str,cld")
  	   (const_int 0)
! 	 (eq_attr "i387" "1")
  	   (const_int 0)
           (and (eq_attr "type" "incdec")
  	      (ior (match_operand:SI 1 "register_operand" "")
--- 203,209 ----
  (define_attr "modrm" ""
    (cond [(eq_attr "type" "str,cld")
  	   (const_int 0)
! 	 (eq_attr "unit" "i387")
  	   (const_int 0)
           (and (eq_attr "type" "incdec")
  	      (ior (match_operand:SI 1 "register_operand" "")
***************
*** 220,230 ****
  (define_attr "length" ""
    (cond [(eq_attr "type" "other,multi,fistp")
  	   (const_int 16)
! 	 ]
  	 (plus (plus (attr "modrm")
  		     (plus (attr "prefix_0f")
! 			   (plus (attr "i387")
! 				 (const_int 1))))
  	       (plus (attr "prefix_rep")
  		     (plus (attr "prefix_data16")
  			   (plus (attr "length_immediate")
--- 228,240 ----
  (define_attr "length" ""
    (cond [(eq_attr "type" "other,multi,fistp")
  	   (const_int 16)
! 	 (eq_attr "unit" "i387")
! 	   (plus (const_int 2)
! 		 (plus (attr "prefix_data16")
! 		       (attr "length_address")))]
  	 (plus (plus (attr "modrm")
  		     (plus (attr "prefix_0f")
! 			   (const_int 1)))
  	       (plus (attr "prefix_rep")
  		     (plus (attr "prefix_data16")
  			   (plus (attr "length_immediate")
***************
*** 276,282 ****
  	   (const_string "store")
  	 (match_operand 1 "memory_operand" "")
  	   (const_string "load")
! 	 (and (eq_attr "type" "!icmp,test,alu1,negnot,fop1,fsgn,imov,imovx,fmov,fcmp,sse,mmx")
  	      (match_operand 2 "memory_operand" ""))
  	   (const_string "load")
  	 (and (eq_attr "type" "icmov")
--- 286,292 ----
  	   (const_string "store")
  	 (match_operand 1 "memory_operand" "")
  	   (const_string "load")
! 	 (and (eq_attr "type" "!icmp,test,alu1,negnot,fsgn,imov,imovx,fmov,fcmp,sse,mmx,ssemov,mmxmov,ssecvt,mmxcvt")
  	      (match_operand 2 "memory_operand" ""))
  	   (const_string "load")
  	 (and (eq_attr "type" "icmov")
***************
*** 524,532 ****
  ; integer instructions, because of the inpaired fxch instruction.
  (define_function_unit "pent_np" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fmov,fop,fop1,fsgn,fmul,fpspc,fcmov,fcmp,fistp"))
    2 2
!   [(eq_attr "type" "!fmov,fop,fop1,fsgn,fmul,fpspc,fcmov,fcmp,fistp")])
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
--- 534,542 ----
  ; integer instructions, because of the inpaired fxch instruction.
  (define_function_unit "pent_np" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fmov,fop,fsgn,fmul,fpspc,fcmov,fcmp,fistp"))
    2 2
!   [(eq_attr "type" "!fmov,fop,fsgn,fmul,fpspc,fcmov,fcmp,fistp")])
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
***************
*** 537,543 ****
  ; ??? Trivial fp operations such as fabs or fchs takes only one cycle.
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fop,fop1,fistp"))
    3 1)
  
  ; Multiplication takes 3 cycles and is only half pipelined.
--- 547,553 ----
  ; ??? Trivial fp operations such as fabs or fchs takes only one cycle.
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentium")
!        (eq_attr "type" "fop,fistp"))
    3 1)
  
  ; Multiplication takes 3 cycles and is only half pipelined.
***************
*** 635,641 ****
  
  (define_function_unit "ppro_p0" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fop1,fsgn,fistp"))
    3 1)
  
  (define_function_unit "ppro_p0" 1 0
--- 645,651 ----
  
  (define_function_unit "ppro_p0" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fsgn,fistp"))
    3 1)
  
  (define_function_unit "ppro_p0" 1 0
***************
*** 688,694 ****
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fop1,fsgn,fmov,fcmp,fcmov,fistp"))
    1 1)
  
  (define_function_unit "fpu" 1 0
--- 698,704 ----
  
  (define_function_unit "fpu" 1 0
    (and (eq_attr "cpu" "pentiumpro")
!        (eq_attr "type" "fop,fsgn,fmov,fcmp,fcmov,fistp"))
    1 1)
  
  (define_function_unit "fpu" 1 0
***************
*** 791,797 ****
  
  (define_function_unit "k6_fpu" 1 1
    (and (eq_attr "cpu" "k6")
!        (eq_attr "type" "fop,fop1,fmov,fcmp,fistp"))
    2 2)
  
  (define_function_unit "k6_fpu" 1 1
--- 801,807 ----
  
  (define_function_unit "k6_fpu" 1 1
    (and (eq_attr "cpu" "k6")
!        (eq_attr "type" "fop,fmov,fcmp,fistp"))
    2 2)
  
  (define_function_unit "k6_fpu" 1 1
***************
*** 903,909 ****
    42 42)
  
  (define_attr "athlon_fpunits" "none,store,mul,add,muladd,any"
!   (cond [(eq_attr "type" "fop,fop1,fcmp,fistp")
  	   (const_string "add")
           (eq_attr "type" "fmul,fdiv,fpspc,fsgn,fcmov")
  	   (const_string "mul")
--- 913,919 ----
    42 42)
  
  (define_attr "athlon_fpunits" "none,store,mul,add,muladd,any"
!   (cond [(eq_attr "type" "fop,fcmp,fistp")
  	   (const_string "add")
           (eq_attr "type" "fmul,fdiv,fpspc,fsgn,fcmov")
  	   (const_string "mul")
***************
*** 938,944 ****
  
  (define_function_unit "athlon_fp" 3 0
    (and (eq_attr "cpu" "athlon")
!        (eq_attr "type" "fop,fop1,fmul,fistp"))
    4 1)
  
  ;; XFmode loads are slow.
--- 948,954 ----
  
  (define_function_unit "athlon_fp" 3 0
    (and (eq_attr "cpu" "athlon")
!        (eq_attr "type" "fop,fmul,fistp"))
    4 1)
  
  ;; XFmode loads are slow.
***************
*** 1558,1564 ****
    "fnstsw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "SI")
!    (set_attr "i387" "1")
     (set_attr "ppro_uops" "few")])
  
  ;; FP compares, step 3
--- 1568,1574 ----
    "fnstsw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "SI")
!    (set_attr "unit" "i387")
     (set_attr "ppro_uops" "few")])
  
  ;; FP compares, step 3
***************
*** 1597,1603 ****
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "fcmp,sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
--- 1607,1613 ----
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "fcmp,ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
***************
*** 1608,1614 ****
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
--- 1618,1624 ----
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[0])"
    "* return output_fp_compare (insn, operands, 1, 0);"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
***************
*** 1633,1639 ****
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "fcmp,sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
--- 1643,1649 ----
     && SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "fcmp,ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  
***************
*** 1644,1650 ****
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  \f
--- 1654,1660 ----
    "SSE_FLOAT_MODE_P (GET_MODE (operands[0]))
     && GET_MODE (operands[0]) == GET_MODE (operands[1])"
    "* return output_fp_compare (insn, operands, 1, 1);"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "unknownfp")
     (set_attr "athlon_decode" "vector")])
  \f
***************
*** 1772,1780 ****
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "4,5,6")
! 	      (const_string "mmx")
  	    (eq_attr "alternative" "7,8,9")
! 	      (const_string "sse")
  	    (and (ne (symbol_ref "flag_pic") (const_int 0))
  		 (match_operand:SI 1 "symbolic_operand" ""))
  	      (const_string "lea")
--- 1782,1790 ----
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "4,5,6")
! 	      (const_string "mmxmov")
  	    (eq_attr "alternative" "7,8,9")
! 	      (const_string "ssemov")
  	    (and (ne (symbol_ref "flag_pic") (const_int 0))
  		 (match_operand:SI 1 "symbolic_operand" ""))
  	      (const_string "lea")
***************
*** 2490,2496 ****
     movq\t{%1, %0|%0, %1}
     movdqa\t{%1, %0|%0, %1}
     movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,mmx,mmx,sse,sse,sse")
     (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
  
  (define_split
--- 2500,2506 ----
     movq\t{%1, %0|%0, %1}
     movdqa\t{%1, %0|%0, %1}
     movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,mmx,mmx,ssemov,ssemov,ssemov")
     (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI")])
  
  (define_split
***************
*** 2543,2551 ****
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "5,6")
! 	      (const_string "mmx")
  	    (eq_attr "alternative" "7,8")
! 	      (const_string "sse")
  	    (eq_attr "alternative" "4")
  	      (const_string "multi")
   	    (and (ne (symbol_ref "flag_pic") (const_int 0))
--- 2553,2561 ----
  }
    [(set (attr "type")
       (cond [(eq_attr "alternative" "5,6")
! 	      (const_string "mmxmov")
  	    (eq_attr "alternative" "7,8")
! 	      (const_string "ssemov")
  	    (eq_attr "alternative" "4")
  	      (const_string "multi")
   	    (and (ne (symbol_ref "flag_pic") (const_int 0))
***************
*** 2794,2800 ****
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,imov,imov,sse,sse,sse,sse,mmx,mmx,mmx")
     (set_attr "mode" "SF,SF,SF,SI,SI,TI,SF,SF,SF,SI,SI,DI")])
  
  (define_insn "*swapsf"
--- 2804,2810 ----
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,imov,imov,ssemov,ssemov,ssemov,ssemov,mmxmov,mmxmov,mmxmov")
     (set_attr "mode" "SF,SF,SF,SI,SI,TI,SF,SF,SF,SI,SI,DI")])
  
  (define_insn "*swapsf"
***************
*** 2970,2976 ****
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,sse,sse,sse,sse")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_insn "*movdf_integer"
--- 2980,2986 ----
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_insn "*movdf_integer"
***************
*** 3029,3035 ****
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,sse,sse,sse,sse")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_split
--- 3039,3045 ----
        abort();
      }
  }
!   [(set_attr "type" "fmov,fmov,fmov,multi,multi,ssemov,ssemov,ssemov,ssemov")
     (set_attr "mode" "DF,DF,DF,SI,SI,TI,DF,DF,DF")])
  
  (define_split
***************
*** 4093,4099 ****
        abort ();
      }
  }
!   [(set_attr "type" "fmov,fmov,sse")
     (set_attr "mode" "SF,XF,DF")])
  
  (define_insn "*extendsfdf2_1_sse_only"
--- 4103,4109 ----
        abort ();
      }
  }
!   [(set_attr "type" "fmov,fmov,ssecvt")
     (set_attr "mode" "SF,XF,DF")])
  
  (define_insn "*extendsfdf2_1_sse_only"
***************
*** 4102,4108 ****
    "!TARGET_80387 && TARGET_SSE2
     && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
    "cvtss2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  
  (define_expand "extendsfxf2"
--- 4112,4118 ----
    "!TARGET_80387 && TARGET_SSE2
     && (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM)"
    "cvtss2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")])
  
  (define_expand "extendsfxf2"
***************
*** 4332,4338 ****
        abort ();
      }
  }
!   [(set_attr "type" "fmov,multi,multi,multi,sse")
     (set_attr "mode" "SF,SF,SF,SF,DF")])
  
  (define_insn "*truncdfsf2_2"
--- 4342,4348 ----
        abort ();
      }
  }
!   [(set_attr "type" "fmov,multi,multi,multi,ssecvt")
     (set_attr "mode" "SF,SF,SF,SF,DF")])
  
  (define_insn "*truncdfsf2_2"
***************
*** 4355,4361 ****
        abort ();
      }
  }
!   [(set_attr "type" "sse,fmov")
     (set_attr "mode" "DF,SF")])
  
  (define_insn "truncdfsf2_3"
--- 4365,4371 ----
        abort ();
      }
  }
!   [(set_attr "type" "ssecvt,fmov")
     (set_attr "mode" "DF,SF")])
  
  (define_insn "truncdfsf2_3"
***************
*** 4378,4384 ****
  	 (match_operand:DF 1 "nonimmediate_operand" "mY")))]
    "!TARGET_80387 && TARGET_SSE2"
    "cvtsd2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  
  (define_split
--- 4388,4394 ----
  	 (match_operand:DF 1 "nonimmediate_operand" "mY")))]
    "!TARGET_80387 && TARGET_SSE2"
    "cvtsd2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")])
  
  (define_split
***************
*** 4795,4808 ****
  	(fix:DI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvttss2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "fix_truncdfdi_sse"
    [(set (match_operand:DI 0 "register_operand" "=r")
  	(fix:DI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_64BIT && TARGET_SSE2"
    "cvttsd2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; Signed conversion to SImode.
  
--- 4805,4818 ----
  	(fix:DI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvttss2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  (define_insn "fix_truncdfdi_sse"
    [(set (match_operand:DI 0 "register_operand" "=r")
  	(fix:DI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_64BIT && TARGET_SSE2"
    "cvttsd2si{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  ;; Signed conversion to SImode.
  
***************
*** 4903,4916 ****
  	(fix:SI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "fix_truncdfsi_sse"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(fix:SI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "cvttsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_split 
    [(set (match_operand:SI 0 "register_operand" "")
--- 4913,4926 ----
  	(fix:SI (match_operand:SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  (define_insn "fix_truncdfsi_sse"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(fix:SI (match_operand:DF 1 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "cvttsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")])
  
  (define_split 
    [(set (match_operand:SI 0 "register_operand" "")
***************
*** 5046,5052 ****
    "fnstcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "i387" "1")
     (set_attr "ppro_uops" "few")])
  
  (define_insn "x86_fldcw_1"
--- 5056,5062 ----
    "fnstcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "unit" "i387")
     (set_attr "ppro_uops" "few")])
  
  (define_insn "x86_fldcw_1"
***************
*** 5056,5062 ****
    "fldcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "i387" "1")
     (set_attr "athlon_decode" "vector")
     (set_attr "ppro_uops" "few")])
  \f
--- 5066,5072 ----
    "fldcw\t%0"
    [(set_attr "length" "2")
     (set_attr "mode" "HI")
!    (set_attr "unit" "i387")
     (set_attr "athlon_decode" "vector")
     (set_attr "ppro_uops" "few")])
  \f
***************
*** 5090,5096 ****
     fild%z1\t%1
     #
     cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5100,5106 ----
     fild%z1\t%1
     #
     cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5099,5105 ****
  	(float:SF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE"
    "cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5109,5115 ----
  	(float:SF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE"
    "cvtsi2ss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5128,5134 ****
     fild%z1\t%1
     #
     cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5138,5144 ----
     fild%z1\t%1
     #
     cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5137,5143 ****
  	(float:SF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
--- 5147,5153 ----
  	(float:SF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_64BIT && TARGET_SSE"
    "cvtsi2ss{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "SF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5166,5172 ****
     fild%z1\t%1
     #
     cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5176,5182 ----
     fild%z1\t%1
     #
     cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5175,5181 ****
  	(float:DF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5185,5191 ----
  	(float:DF (match_operand:SI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5204,5210 ****
     fild%z1\t%1
     #
     cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5214,5220 ----
     fild%z1\t%1
     #
     cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "fmov,multi,ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 5213,5219 ****
  	(float:DF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
--- 5223,5229 ----
  	(float:DF (match_operand:DI 1 "nonimmediate_operand" "mr")))]
    "TARGET_SSE2"
    "cvtsi2sd{q}\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
     (set_attr "mode" "DF")
     (set_attr "fp_int_src" "true")])
  
***************
*** 12788,12794 ****
  	   (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
    "TARGET_SSE && reload_completed"
    "cmp%D1ss\t{%3, %0|%0, %3}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")])
  
  (define_insn "*sse_setccdf"
--- 12798,12804 ----
  	   (match_operand:SF 3 "nonimmediate_operand" "xm")]))]
    "TARGET_SSE && reload_completed"
    "cmp%D1ss\t{%3, %0|%0, %3}"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "SF")])
  
  (define_insn "*sse_setccdf"
***************
*** 12798,12804 ****
  	   (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
    "TARGET_SSE2 && reload_completed"
    "cmp%D1sd\t{%3, %0|%0, %3}"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  \f
  ;; Basic conditional jump instructions.
--- 12808,12814 ----
  	   (match_operand:DF 3 "nonimmediate_operand" "Ym")]))]
    "TARGET_SSE2 && reload_completed"
    "cmp%D1sd\t{%3, %0|%0, %3}"
!   [(set_attr "type" "ssecmp")
     (set_attr "mode" "DF")])
  \f
  ;; Basic conditional jump instructions.
***************
*** 14030,14036 ****
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
!            (const_string "sse")
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
--- 14040,14048 ----
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
! 	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	      (const_string "ssemul")
! 	      (const_string "sseadd"))
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
***************
*** 14044,14050 ****
    "TARGET_SSE_MATH && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")])
  
  (define_insn "*fop_df_comm_nosse"
--- 14056,14065 ----
    "TARGET_SSE_MATH && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
!   [(set (attr "type") 
!         (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	   (const_string "ssemul")
! 	   (const_string "sseadd")))
     (set_attr "mode" "SF")])
  
  (define_insn "*fop_df_comm_nosse"
***************
*** 14073,14079 ****
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
!            (const_string "sse")
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
--- 14088,14096 ----
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
  	(if_then_else (eq_attr "alternative" "1")
! 	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	      (const_string "ssemul")
! 	      (const_string "sseadd"))
  	   (if_then_else (match_operand:SF 3 "mult_operator" "") 
  	      (const_string "fmul")
  	      (const_string "fop"))))
***************
*** 14088,14094 ****
     && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "DF")])
  
  (define_insn "*fop_xf_comm"
--- 14105,14114 ----
     && GET_RTX_CLASS (GET_CODE (operands[3])) == 'c'
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
!   [(set (attr "type") 
!         (if_then_else (match_operand:SF 3 "mult_operator" "") 
! 	   (const_string "ssemul")
! 	   (const_string "sseadd")))
     (set_attr "mode" "DF")])
  
  (define_insn "*fop_xf_comm"
***************
*** 14146,14153 ****
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(eq_attr "alternative" "2")
!                  (const_string "sse")
  	       (match_operand:SF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:SF 3 "div_operator" "") 
--- 14166,14179 ----
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "mult_operator" ""))
!                  (const_string "ssemul")
! 	       (and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "div_operator" ""))
!                  (const_string "ssediv")
! 	       (eq_attr "alternative" "2")
!                  (const_string "sseadd")
  	       (match_operand:SF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:SF 3 "div_operator" "") 
***************
*** 14164,14170 ****
    "TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")
     (set_attr "mode" "SF")])
  
  ;; ??? Add SSE splitters for these!
--- 14190,14202 ----
    "TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set (attr "type") 
!         (cond [(match_operand:SF 3 "mult_operator" "")
!                  (const_string "ssemul")
! 	       (match_operand:SF 3 "div_operator" "")
!                  (const_string "ssediv")
!               ]
!               (const_string "sseadd")))
     (set_attr "mode" "SF")])
  
  ;; ??? Add SSE splitters for these!
***************
*** 14216,14222 ****
    [(set (attr "type") 
          (cond [(match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
!                (match_operand:DF 3 "div_operator" "") 
                   (const_string "fdiv")
                ]
                (const_string "fop")))
--- 14248,14254 ----
    [(set (attr "type") 
          (cond [(match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
!                (match_operand:DF 3 "div_operator" "")
                   (const_string "fdiv")
                ]
                (const_string "fop")))
***************
*** 14233,14240 ****
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(eq_attr "alternative" "2")
!                  (const_string "sse")
  	       (match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:DF 3 "div_operator" "") 
--- 14265,14278 ----
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "* return output_387_binary_op (insn, operands);"
    [(set (attr "type") 
!         (cond [(and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "mult_operator" ""))
!                  (const_string "ssemul")
! 	       (and (eq_attr "alternative" "2")
! 	            (match_operand:SF 3 "div_operator" ""))
!                  (const_string "ssediv")
! 	       (eq_attr "alternative" "2")
!                  (const_string "sseadd")
  	       (match_operand:DF 3 "mult_operator" "") 
                   (const_string "fmul")
                 (match_operand:DF 3 "div_operator" "") 
***************
*** 14251,14257 ****
    "TARGET_SSE2 && TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "type" "sse")])
  
  ;; ??? Add SSE splitters for these!
  (define_insn "*fop_df_2"
--- 14289,14302 ----
    "TARGET_SSE2 && TARGET_SSE_MATH
     && GET_RTX_CLASS (GET_CODE (operands[3])) != 'c'"
    "* return output_387_binary_op (insn, operands);"
!   [(set_attr "mode" "DF")
!    (set (attr "type") 
!         (cond [(match_operand:SF 3 "mult_operator" "")
!                  (const_string "ssemul")
! 	       (match_operand:SF 3 "div_operator" "")
!                  (const_string "ssediv")
!               ]
!               (const_string "sseadd")))])
  
  ;; ??? Add SSE splitters for these!
  (define_insn "*fop_df_2"
***************
*** 17852,17858 ****
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "movv4si_internal"
    [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,m")
--- 17897,17904 ----
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "movv4si_internal"
    [(set (match_operand:V4SI 0 "nonimmediate_operand" "=x,m")
***************
*** 17860,17894 ****
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "movv8qi_internal"
    [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V8QI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "movv4hi_internal"
    [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V4HI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "movv2si_internal"
    [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V2SI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "movv2sf_internal"
    [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,m")
          (match_operand:V2SF 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_3DNOW"
    "movq\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_expand "movti"
    [(set (match_operand:TI 0 "general_operand" "")
--- 17906,17945 ----
    "TARGET_SSE"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "movv8qi_internal"
    [(set (match_operand:V8QI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V8QI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxmov")
!    (set_attr "mode" "DI")])
  
  (define_insn "movv4hi_internal"
    [(set (match_operand:V4HI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V4HI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxmov")
!    (set_attr "mode" "DI")])
  
  (define_insn "movv2si_internal"
    [(set (match_operand:V2SI 0 "nonimmediate_operand" "=y,m")
  	(match_operand:V2SI 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_MMX"
    "movq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "movv2sf_internal"
    [(set (match_operand:V2SF 0 "nonimmediate_operand" "=y,m")
          (match_operand:V2SF 1 "nonimmediate_operand" "ym,y"))]
    "TARGET_3DNOW"
    "movq\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_expand "movti"
    [(set (match_operand:TI 0 "general_operand" "")
***************
*** 17908,17914 ****
    "TARGET_SSE2"
    ;; @@@ let's try to use movaps here.
    "movapd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "movv8hi_internal"
    [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
--- 17959,17966 ----
    "TARGET_SSE2"
    ;; @@@ let's try to use movaps here.
    "movapd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "movv8hi_internal"
    [(set (match_operand:V8HI 0 "nonimmediate_operand" "=x,m")
***************
*** 17916,17922 ****
    "TARGET_SSE2"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "movv16qi_internal"
    [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
--- 17968,17975 ----
    "TARGET_SSE2"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "movv16qi_internal"
    [(set (match_operand:V16QI 0 "nonimmediate_operand" "=x,m")
***************
*** 17924,17930 ****
    "TARGET_SSE2"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_expand "movv2df"
    [(set (match_operand:V2DF 0 "general_operand" "")
--- 17977,17984 ----
    "TARGET_SSE2"
    ;; @@@ let's try to use movaps here.
    "movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_expand "movv2df"
    [(set (match_operand:V2DF 0 "general_operand" "")
***************
*** 18016,18022 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:TI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv2df"
    [(set (match_operand:V2DF 0 "push_operand" "=<")
--- 18070,18076 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:TI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv2df"
    [(set (match_operand:V2DF 0 "push_operand" "=<")
***************
*** 18027,18033 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V2DF (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv8hi"
    [(set (match_operand:V8HI 0 "push_operand" "=<")
--- 18081,18087 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V2DF (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv8hi"
    [(set (match_operand:V8HI 0 "push_operand" "=<")
***************
*** 18038,18044 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V8HI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv16qi"
    [(set (match_operand:V16QI 0 "push_operand" "=<")
--- 18092,18098 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V8HI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv16qi"
    [(set (match_operand:V16QI 0 "push_operand" "=<")
***************
*** 18049,18055 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V16QI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv4sf"
    [(set (match_operand:V4SF 0 "push_operand" "=<")
--- 18103,18109 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V16QI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv4sf"
    [(set (match_operand:V4SF 0 "push_operand" "=<")
***************
*** 18060,18066 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SF (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv4si"
    [(set (match_operand:V4SI 0 "push_operand" "=<")
--- 18114,18120 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SF (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv4si"
    [(set (match_operand:V4SI 0 "push_operand" "=<")
***************
*** 18071,18077 ****
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "sse")])
  
  (define_insn_and_split "*pushv2si"
    [(set (match_operand:V2SI 0 "push_operand" "=<")
--- 18125,18131 ----
    [(set (reg:SI 7) (plus:SI (reg:SI 7) (const_int -16)))
     (set (mem:V4SI (reg:SI 7)) (match_dup 1))]
    ""
!   [(set_attr "type" "multi")])
  
  (define_insn_and_split "*pushv2si"
    [(set (match_operand:V2SI 0 "push_operand" "=<")
***************
*** 18125,18131 ****
     xorps\t%0, %0
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*movti_rex64"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,mx,x")
--- 18179,18186 ----
     xorps\t%0, %0
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov,ssemov,ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*movti_rex64"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o,x,mx,x")
***************
*** 18138,18145 ****
     xorps\t%0, %0
     movaps\\t{%1, %0|%0, %1}
     movaps\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,sse,sse,sse")
!    (set_attr "mode" "TI")])
  
  (define_split
    [(set (match_operand:TI 0 "nonimmediate_operand" "")
--- 18193,18200 ----
     xorps\t%0, %0
     movaps\\t{%1, %0|%0, %1}
     movaps\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "*,*,ssemov,ssemov,ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_split
    [(set (match_operand:TI 0 "nonimmediate_operand" "")
***************
*** 18159,18165 ****
    "@
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movups"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
--- 18214,18221 ----
    "@
     movaps\t{%1, %0|%0, %1}
     movaps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov,ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movups"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
***************
*** 18169,18175 ****
    "@
     movups\t{%1, %0|%0, %1}
     movups\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE Strange Moves.
--- 18225,18232 ----
    "@
     movups\t{%1, %0|%0, %1}
     movups\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt,ssecvt")
!    (set_attr "mode" "V4SF")])
  
  
  ;; SSE Strange Moves.
***************
*** 18179,18192 ****
  	(unspec:SI [(match_operand:V4SF 1 "register_operand" "x")] 33))]
    "TARGET_SSE"
    "movmskps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_pmovmskb"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(unspec:SI [(match_operand:V8QI 1 "register_operand" "y")] 33))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmovmskb\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_maskmovq"
    [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
--- 18236,18252 ----
  	(unspec:SI [(match_operand:V4SF 1 "register_operand" "x")] 33))]
    "TARGET_SSE"
    "movmskps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "mmx_pmovmskb"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(unspec:SI [(match_operand:V8QI 1 "register_operand" "y")] 33))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmovmskb\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
! 
  
  (define_insn "mmx_maskmovq"
    [(set (mem:V8QI (match_operand:SI 0 "register_operand" "D"))
***************
*** 18195,18201 ****
    "(TARGET_SSE || TARGET_3DNOW_A) && !TARGET_64BIT"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovq\t{%2, %1|%1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_maskmovq_rex"
    [(set (mem:V8QI (match_operand:DI 0 "register_operand" "D"))
--- 18255,18262 ----
    "(TARGET_SSE || TARGET_3DNOW_A) && !TARGET_64BIT"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovq\t{%2, %1|%1, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_maskmovq_rex"
    [(set (mem:V8QI (match_operand:DI 0 "register_operand" "D"))
***************
*** 18204,18224 ****
    "(TARGET_SSE || TARGET_3DNOW_A) && TARGET_64BIT"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovq\t{%2, %1|%1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movntv4sf"
    [(set (match_operand:V4SF 0 "memory_operand" "=m")
  	(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")] 34))]
    "TARGET_SSE"
    "movntps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movntdi"
    [(set (match_operand:DI 0 "memory_operand" "=m")
  	(unspec:DI [(match_operand:DI 1 "register_operand" "y")] 34))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "movntq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movhlps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18265,18288 ----
    "(TARGET_SSE || TARGET_3DNOW_A) && TARGET_64BIT"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovq\t{%2, %1|%1, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "sse_movntv4sf"
    [(set (match_operand:V4SF 0 "memory_operand" "=m")
  	(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "x")] 34))]
    "TARGET_SSE"
    "movntps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movntdi"
    [(set (match_operand:DI 0 "memory_operand" "=m")
  	(unspec:DI [(match_operand:DI 1 "register_operand" "y")] 34))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "movntq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxmov")
!    (set_attr "mode" "DI")])
  
  (define_insn "sse_movhlps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18232,18238 ****
  	 (const_int 3)))]
    "TARGET_SSE"
    "movhlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movlhps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18296,18303 ----
  	 (const_int 3)))]
    "TARGET_SSE"
    "movhlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movlhps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18246,18252 ****
  	 (const_int 12)))]
    "TARGET_SSE"
    "movlhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movhps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
--- 18311,18318 ----
  	 (const_int 12)))]
    "TARGET_SSE"
    "movlhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movhps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
***************
*** 18257,18263 ****
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movlps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
--- 18323,18330 ----
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_movlps"
    [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,m")
***************
*** 18268,18274 ****
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_loadss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18335,18342 ----
    "TARGET_SSE
     && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movlps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_loadss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18278,18284 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_movss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18346,18353 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_movss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18288,18294 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_storess"
    [(set (match_operand:SF 0 "memory_operand" "=m")
--- 18357,18364 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "movss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_storess"
    [(set (match_operand:SF 0 "memory_operand" "=m")
***************
*** 18297,18303 ****
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_shufps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18367,18374 ----
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "movss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_shufps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18307,18313 ****
    "TARGET_SSE"
    ;; @@@ check operand order for intel/nonintel syntax
    "shufps\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE arithmetic
--- 18378,18385 ----
    "TARGET_SSE"
    ;; @@@ check operand order for intel/nonintel syntax
    "shufps\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  
  ;; SSE arithmetic
***************
*** 18318,18324 ****
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "addps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmaddv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18390,18397 ----
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "addps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmaddv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18329,18335 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "addss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "subv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18402,18409 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "addss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "SF")])
  
  (define_insn "subv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18337,18343 ****
  		    (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "subps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsubv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18411,18418 ----
  		    (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "subps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsubv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18348,18354 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "subss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18423,18430 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "subss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "SF")])
  
  (define_insn "mulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18356,18362 ****
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "mulps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18432,18439 ----
  	           (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "mulps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemul")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmmulv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18367,18373 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "mulss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "divv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18444,18451 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "mulss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemul")
!    (set_attr "mode" "SF")])
  
  (define_insn "divv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18375,18381 ****
  	          (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "divps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmdivv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18453,18460 ----
  	          (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "divps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssediv")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmdivv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18386,18392 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "divss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE square root/reciprocal
--- 18465,18472 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "divss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssediv")
!    (set_attr "mode" "SF")])
  
  
  ;; SSE square root/reciprocal
***************
*** 18397,18403 ****
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 42))]
    "TARGET_SSE"
    "rcpps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmrcpv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18477,18484 ----
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 42))]
    "TARGET_SSE"
    "rcpps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmrcpv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18407,18413 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "rcpss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "rsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18488,18495 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "rcpss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  (define_insn "rsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18415,18421 ****
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 43))]
    "TARGET_SSE"
    "rsqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmrsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18497,18504 ----
  	 [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 43))]
    "TARGET_SSE"
    "rsqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmrsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18425,18438 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "rsqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
          (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "sqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18508,18523 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "rsqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  (define_insn "sqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
          (sqrt:V4SF (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "sqrtps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsqrtv4sf2"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18442,18448 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "sqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; SSE logical operations.
  
--- 18527,18534 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "sqrtss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  ;; SSE logical operations.
  
***************
*** 18457,18463 ****
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_andti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18543,18550 ----
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_andti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18465,18471 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_andti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18552,18559 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_andti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18473,18479 ****
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_andti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18561,18568 ----
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_andti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18481,18487 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_andti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18570,18577 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_andti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18490,18496 ****
    "TARGET_SSE && !TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_andti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18580,18587 ----
    "TARGET_SSE && !TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "andps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse2_andti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18499,18505 ****
    "TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_nandti3_df"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18590,18597 ----
    "TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "TI")])
  
  (define_insn "*sse_nandti3_df"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18507,18513 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andnpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_nandti3_sf"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18599,18606 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "andnpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_nandti3_sf"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18515,18521 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_nandti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18608,18615 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_nandti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18523,18529 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_nandti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18617,18624 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE && !TARGET_SSE2"
    "andnps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse2_nandti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18531,18537 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pandn\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18626,18632 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pandn\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")])
  
  (define_insn "*sse_iorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18539,18545 ****
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18634,18641 ----
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_iorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18547,18553 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18643,18650 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_iorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18555,18561 ****
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_iorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18652,18659 ----
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_iorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18563,18569 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_iorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18661,18668 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_iorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18572,18578 ****
    "TARGET_SSE && !TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_iorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18671,18678 ----
    "TARGET_SSE && !TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "orps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse2_iorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18581,18587 ****
    "TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18681,18688 ----
    "TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "TI")])
  
  (define_insn "*sse_xorti3_df_1"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18589,18595 ****
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
--- 18690,18697 ----
  		(subreg:TI (match_operand:DF 2 "register_operand" "Y") 0)))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_xorti3_df_2"
    [(set (subreg:TI (match_operand:DF 0 "register_operand" "=Y") 0)
***************
*** 18597,18603 ****
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18699,18706 ----
  		(match_operand:TI 2 "nonimmediate_operand" "Ym")))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "*sse_xorti3_sf_1"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18605,18611 ****
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "*sse_xorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
--- 18708,18715 ----
  		(subreg:TI (match_operand:SF 2 "register_operand" "x") 0)))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "*sse_xorti3_sf_2"
    [(set (subreg:TI (match_operand:SF 0 "register_operand" "=x") 0)
***************
*** 18613,18619 ****
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_xorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18717,18724 ----
  		(match_operand:TI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_xorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18622,18628 ****
    "TARGET_SSE && !TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_xorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 18727,18734 ----
    "TARGET_SSE && !TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "xorps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse2_xorti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 18631,18637 ****
    "TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; Use xor, but don't show input operands so they aren't live before
  ;; this insn.
--- 18737,18744 ----
    "TARGET_SSE2
     && (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != MEM)"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "TI")])
  
  ;; Use xor, but don't show input operands so they aren't live before
  ;; this insn.
***************
*** 18640,18647 ****
          (unspec:V4SF [(const_int 0)] 45))]
    "TARGET_SSE"
    "xorps\t{%0, %0|%0, %0}"
!   [(set_attr "type" "sse")
!    (set_attr "memory" "none")])
  
  ;; SSE mask-generating compares
  
--- 18747,18754 ----
          (unspec:V4SF [(const_int 0)] 45))]
    "TARGET_SSE"
    "xorps\t{%0, %0|%0, %0}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V4SF")])
  
  ;; SSE mask-generating compares
  
***************
*** 18652,18658 ****
  		 (match_operand:V4SF 2 "register_operand" "x")]))]
    "TARGET_SSE"
    "cmp%D3ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "maskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 18759,18766 ----
  		 (match_operand:V4SF 2 "register_operand" "x")]))]
    "TARGET_SSE"
    "cmp%D3ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "maskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 18667,18673 ****
    else
      return "cmpn%D3ps\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmaskcmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 18775,18782 ----
    else
      return "cmpn%D3ps\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmmaskcmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 18679,18685 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "cmp%D3ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmaskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 18788,18795 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "cmp%D3ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  (define_insn "vmmaskncmpv4sf3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 18697,18703 ****
    else
      return "cmpn%D3ss\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_comi"
    [(set (reg:CCFP 17)
--- 18807,18814 ----
    else
      return "cmpn%D3ss\t{%2, %0|%0, %2}";
  }
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_comi"
    [(set (reg:CCFP 17)
***************
*** 18710,18716 ****
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "comiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_ucomi"
    [(set (reg:CCFPU 17)
--- 18821,18828 ----
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "comiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  (define_insn "sse_ucomi"
    [(set (reg:CCFPU 17)
***************
*** 18723,18729 ****
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "ucomiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE unpack
--- 18835,18842 ----
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE"
    "ucomiss\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "SF")])
  
  
  ;; SSE unpack
***************
*** 18744,18750 ****
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpckhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse_unpcklps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18857,18864 ----
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpckhps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "sse_unpcklps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18762,18768 ****
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpcklps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE min/max
--- 18876,18883 ----
  	 (const_int 5)))]
    "TARGET_SSE"
    "unpcklps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  
  ;; SSE min/max
***************
*** 18773,18779 ****
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "maxps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsmaxv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18888,18895 ----
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "maxps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsmaxv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18784,18790 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "maxss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18900,18907 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "maxss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  (define_insn "sminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18792,18798 ****
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "minps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18909,18916 ----
  		   (match_operand:V4SF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE"
    "minps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "vmsminv4sf3"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18803,18809 ****
  	 (const_int 1)))]
    "TARGET_SSE"
    "minss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; SSE <-> integer/MMX conversions
--- 18921,18928 ----
  	 (const_int 1)))]
    "TARGET_SSE"
    "minss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  
  ;; SSE <-> integer/MMX conversions
***************
*** 18817,18823 ****
  	 (const_int 12)))]
    "TARGET_SSE"
    "cvtpi2ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 18936,18943 ----
  	 (const_int 12)))]
    "TARGET_SSE"
    "cvtpi2ps\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "cvtps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18826,18832 ****
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvtps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 18946,18953 ----
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvtps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "cvttps2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18835,18841 ****
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvttps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtsi2ss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 18956,18963 ----
  	 (parallel [(const_int 0) (const_int 1)])))]
    "TARGET_SSE"
    "cvttps2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  (define_insn "cvtsi2ss"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 18846,18852 ****
  	 (const_int 14)))]
    "TARGET_SSE"
    "cvtsi2ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 18968,18975 ----
  	 (const_int 14)))]
    "TARGET_SSE"
    "cvtsi2ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  (define_insn "cvtss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 18855,18861 ****
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvtss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 18978,18985 ----
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvtss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  (define_insn "cvttss2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 18864,18870 ****
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX insns
--- 18988,18995 ----
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE"
    "cvttss2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  
  ;; MMX insns
***************
*** 18877,18883 ****
  	           (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "addv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19002,19009 ----
  	           (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "addv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18885,18891 ****
  	           (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "addv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19011,19018 ----
  	           (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "addv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18893,18899 ****
  	           (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ssaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19020,19027 ----
  	           (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ssaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18901,18907 ****
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ssaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19029,19036 ----
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ssaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18909,18915 ****
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "usaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19038,19045 ----
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "usaddv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18917,18923 ****
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "usaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19047,19054 ----
  		      (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "usaddv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18925,18931 ****
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19056,19063 ----
  		      (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "paddusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "subv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18933,18939 ****
  		    (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19065,19072 ----
  		    (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "subv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18941,18947 ****
  		    (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19074,19081 ----
  		    (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "subv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 18949,18955 ****
  		    (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "sssubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19083,19090 ----
  		    (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "sssubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18957,18963 ****
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "sssubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19092,19099 ----
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "sssubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18965,18971 ****
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ussubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19101,19108 ----
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ussubv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 18973,18979 ****
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ussubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19110,19117 ----
  		       (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "ussubv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18981,18987 ****
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mulv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19119,19126 ----
  		       (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "psubusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "mulv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 18989,18995 ****
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pmullw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "smulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19128,19135 ----
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pmullw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  (define_insn "smulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19002,19008 ****
  	  (const_int 16))))]
    "TARGET_MMX"
    "pmulhw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "umulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19142,19149 ----
  	  (const_int 16))))]
    "TARGET_MMX"
    "pmulhw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  (define_insn "umulv4hi3_highpart"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19015,19021 ****
  	  (const_int 16))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmulhuw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_pmaddwd"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19156,19163 ----
  	  (const_int 16))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmulhuw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_pmaddwd"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19036,19042 ****
  							(const_int 3)]))))))]
    "TARGET_MMX"
    "pmaddwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX logical operations
--- 19178,19185 ----
  							(const_int 3)]))))))]
    "TARGET_MMX"
    "pmaddwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX logical operations
***************
*** 19050,19056 ****
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_xordi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
--- 19193,19200 ----
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "por\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_xordi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
***************
*** 19059,19065 ****
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
     (set_attr "memory" "none")])
  
  ;; Same as pxor, but don't show input operands so that we don't think
--- 19203,19210 ----
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pxor\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")
     (set_attr "memory" "none")])
  
  ;; Same as pxor, but don't show input operands so that we don't think
***************
*** 19069,19075 ****
          (unspec:DI [(const_int 0)] 45))]
    "TARGET_MMX"
    "pxor\t{%0, %0|%0, %0}"
!   [(set_attr "type" "mmx")
     (set_attr "memory" "none")])
  
  (define_insn "mmx_anddi3"
--- 19214,19221 ----
          (unspec:DI [(const_int 0)] 45))]
    "TARGET_MMX"
    "pxor\t{%0, %0|%0, %0}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")
     (set_attr "memory" "none")])
  
  (define_insn "mmx_anddi3"
***************
*** 19079,19085 ****
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_nanddi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
--- 19225,19232 ----
  		  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pand\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_nanddi3"
    [(set (match_operand:DI 0 "register_operand" "=y")
***************
*** 19088,19094 ****
  			  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pandn\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX unsigned averages/sum of absolute differences
--- 19235,19242 ----
  			  (match_operand:DI 2 "nonimmediate_operand" "ym"))] 45))]
    "TARGET_MMX"
    "pandn\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX unsigned averages/sum of absolute differences
***************
*** 19110,19116 ****
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_uavgv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19258,19265 ----
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_uavgv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19125,19131 ****
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_psadbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19274,19281 ----
  	 (const_int 1)))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pavgw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_psadbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19133,19139 ****
  			      (match_operand:V8QI 2 "nonimmediate_operand" "ym"))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "psadbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX insert/extract/shuffle
--- 19283,19290 ----
  			      (match_operand:V8QI 2 "nonimmediate_operand" "ym"))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "psadbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX insert/extract/shuffle
***************
*** 19146,19152 ****
  			(match_operand:SI 3 "immediate_operand" "i")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pinsrw\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_pextrw"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 19297,19304 ----
  			(match_operand:SI 3 "immediate_operand" "i")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pinsrw\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_pextrw"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 19155,19161 ****
  					[(match_operand:SI 2 "immediate_operand" "i")]))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pextrw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mmx_pshufw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19307,19314 ----
  					[(match_operand:SI 2 "immediate_operand" "i")]))))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pextrw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_pshufw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19163,19169 ****
  		      (match_operand:SI 2 "immediate_operand" "i")] 41))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pshufw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX mask-generating comparisons
--- 19316,19323 ----
  		      (match_operand:SI 2 "immediate_operand" "i")] 41))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pshufw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX mask-generating comparisons
***************
*** 19174,19180 ****
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "eqv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19328,19335 ----
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "eqv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19182,19188 ****
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "eqv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19337,19344 ----
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "eqv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19190,19196 ****
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19346,19353 ----
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpeqd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "gtv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19198,19204 ****
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19355,19362 ----
  		 (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "gtv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19206,19212 ****
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19364,19371 ----
  		 (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  (define_insn "gtv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19214,19220 ****
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX max/min insns
--- 19373,19380 ----
  		 (match_operand:V2SI 2 "nonimmediate_operand" "ym")))]
    "TARGET_MMX"
    "pcmpgtd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX max/min insns
***************
*** 19225,19231 ****
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "smaxv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19385,19392 ----
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "smaxv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19233,19239 ****
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "uminv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19394,19401 ----
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pmaxsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "uminv8qi3"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19241,19247 ****
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sminv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19403,19410 ----
  		   (match_operand:V8QI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  (define_insn "sminv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19249,19255 ****
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX shifts
--- 19412,19419 ----
  		   (match_operand:V4HI 2 "nonimmediate_operand" "ym")))]
    "TARGET_SSE || TARGET_3DNOW_A"
    "pminsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX shifts
***************
*** 19260,19266 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psraw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ashrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19424,19431 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psraw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "ashrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19268,19274 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrad\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "lshrv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19433,19440 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrad\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "lshrv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19276,19282 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrlw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "lshrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19442,19449 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrlw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "lshrv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19284,19290 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_lshrdi3"
--- 19451,19458 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psrld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_lshrdi3"
***************
*** 19294,19300 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psrlq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ashlv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19462,19469 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psrlq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "ashlv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19302,19308 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psllw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "ashlv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19471,19478 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "psllw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "ashlv2si3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19310,19316 ****
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "pslld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_ashldi3"
--- 19480,19487 ----
  		       (match_operand:DI 2 "nonmemory_operand" "yi")))]
    "TARGET_MMX"
    "pslld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  ;; See logical MMX insns.
  (define_insn "mmx_ashldi3"
***************
*** 19320,19326 ****
  		     (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psllq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; MMX pack/unpack insns.
--- 19491,19498 ----
  		     (match_operand:DI 2 "nonmemory_operand" "yi"))] 45))]
    "TARGET_MMX"
    "psllq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  
  ;; MMX pack/unpack insns.
***************
*** 19332,19338 ****
  	 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packsswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_packssdw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19504,19511 ----
  	 (ss_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packsswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_packssdw"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19341,19347 ****
  	 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packssdw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_packuswb"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19514,19521 ----
  	 (ss_truncate:V2HI (match_operand:V2SI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packssdw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_packuswb"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19350,19356 ****
  	 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packuswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckhbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19524,19531 ----
  	 (us_truncate:V4QI (match_operand:V4HI 2 "register_operand" "y"))))]
    "TARGET_MMX"
    "packuswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckhbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19376,19382 ****
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpckhbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckhwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19551,19558 ----
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpckhbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckhwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19394,19400 ****
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpckhwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckhdq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19570,19577 ----
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpckhwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckhdq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19408,19414 ****
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckhdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpcklbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
--- 19585,19592 ----
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckhdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpcklbw"
    [(set (match_operand:V8QI 0 "register_operand" "=y")
***************
*** 19434,19440 ****
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpcklbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpcklwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 19612,19619 ----
  	 (const_int 85)))]
    "TARGET_MMX"
    "punpcklbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpcklwd"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19452,19458 ****
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpcklwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mmx_punpckldq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19631,19638 ----
  	 (const_int 5)))]
    "TARGET_MMX"
    "punpcklwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  (define_insn "mmx_punpckldq"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19466,19472 ****
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  
  ;; Miscellaneous stuff
--- 19646,19653 ----
  	 (const_int 1)))]
    "TARGET_MMX"
    "punpckldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "DI")])
  
  
  ;; Miscellaneous stuff
***************
*** 19595,19601 ****
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfadd\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19776,19783 ----
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfadd\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "subv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19603,19609 ****
  		    (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfsub\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "subrv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19785,19792 ----
  		    (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfsub\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "subrv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19611,19617 ****
                      (match_operand:V2SF 1 "register_operand" "0")))]
    "TARGET_3DNOW"
    "pfsubr\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gtv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19794,19801 ----
                      (match_operand:V2SF 1 "register_operand" "0")))]
    "TARGET_3DNOW"
    "pfsubr\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "gtv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19619,19625 ****
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
   "TARGET_3DNOW"
    "pfcmpgt\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "gev2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19803,19810 ----
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
   "TARGET_3DNOW"
    "pfcmpgt\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "gev2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19627,19633 ****
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpge\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "eqv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19812,19819 ----
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpge\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "eqv2sf3"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19635,19641 ****
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpeq\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfmaxv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19821,19828 ----
  		 (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfcmpeq\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxcmp")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfmaxv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19643,19649 ****
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmax\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfminv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19830,19837 ----
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmax\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfminv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19651,19657 ****
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmin\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "mulv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19839,19846 ----
                     (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmin\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "mulv2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19659,19665 ****
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmul\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "femms"
    [(unspec_volatile [(const_int 0)] 46)
--- 19848,19855 ----
  		   (match_operand:V2SF 2 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pfmul\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "femms"
    [(unspec_volatile [(const_int 0)] 46)
***************
*** 19688,19694 ****
  	(fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pf2id\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pf2iw"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 19878,19885 ----
  	(fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pf2id\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pf2iw"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19697,19703 ****
  	      (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
    "TARGET_3DNOW_A"
    "pf2iw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19888,19895 ----
  	      (fix:V2SI (match_operand:V2SF 1 "nonimmediate_operand" "ym")))))]
    "TARGET_3DNOW_A"
    "pf2iw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19714,19720 ****
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW"
    "pfacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19906,19913 ----
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW"
    "pfacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19731,19737 ****
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfpnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19924,19931 ----
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pfpnacc"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19748,19754 ****
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfpnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pi2fw"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19942,19949 ----
  			     (parallel [(const_int 1)])))))]
    "TARGET_3DNOW_A"
    "pfpnacc\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxadd")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "pi2fw"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19764,19777 ****
  				   (parallel [(const_int  1)])))))))]
    "TARGET_3DNOW_A"
    "pi2fw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "floatv2si2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pi2fd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  ;; This insn is identical to pavgb in operation, but the opcode is
  ;; different.  To avoid accidentally matching pavgb, use an unspec.
--- 19959,19974 ----
  				   (parallel [(const_int  1)])))))))]
    "TARGET_3DNOW_A"
    "pi2fw\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  (define_insn "floatv2si2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(float:V2SF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
    "TARGET_3DNOW"
    "pi2fd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "V2SF")])
  
  ;; This insn is identical to pavgb in operation, but the opcode is
  ;; different.  To avoid accidentally matching pavgb, use an unspec.
***************
*** 19783,19789 ****
             (match_operand:V8QI 2 "nonimmediate_operand" "ym")] 49))]
    "TARGET_3DNOW"
    "pavgusb\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  ;; 3DNow reciprical and sqrt
   
--- 19980,19987 ----
             (match_operand:V8QI 2 "nonimmediate_operand" "ym")] 49))]
    "TARGET_3DNOW"
    "pavgusb\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxshft")
!    (set_attr "mode" "TI")])
  
  ;; 3DNow reciprical and sqrt
   
***************
*** 19792,19798 ****
          (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 50))]
    "TARGET_3DNOW"
    "pfrcp\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfrcpit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19990,19997 ----
          (unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 50))]
    "TARGET_3DNOW"
    "pfrcp\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pfrcpit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19800,19806 ****
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 51))]
    "TARGET_3DNOW"
    "pfrcpit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfrcpit2v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 19999,20006 ----
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 51))]
    "TARGET_3DNOW"
    "pfrcpit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pfrcpit2v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19808,19821 ****
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 52))]
    "TARGET_3DNOW"
    "pfrcpit2\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pfrsqrtv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 53))]
    "TARGET_3DNOW"
!    "pfrsqrt\\t{%1, %0|%0, %1}"
!    [(set_attr "type" "mmx")])
  		
  (define_insn "pfrsqit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20008,20023 ----
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 52))]
    "TARGET_3DNOW"
    "pfrcpit2\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pfrsqrtv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
  	(unspec:V2SF [(match_operand:V2SF 1 "nonimmediate_operand" "ym")] 53))]
    "TARGET_3DNOW"
!   "pfrsqrt\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  		
  (define_insn "pfrsqit1v2sf3"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19823,19829 ****
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 54))]
    "TARGET_3DNOW"
    "pfrsqit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pmulhrwv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
--- 20025,20032 ----
  		      (match_operand:V2SF 2 "nonimmediate_operand" "ym")] 54))]
    "TARGET_3DNOW"
    "pfrsqit1\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")
!    (set_attr "mode" "TI")])
  
  (define_insn "pmulhrwv4hi3"
    [(set (match_operand:V4HI 0 "register_operand" "=y")
***************
*** 19842,19848 ****
  	      (const_int 16))))]
    "TARGET_3DNOW"
    "pmulhrw\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pswapdv2si2"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
--- 20045,20052 ----
  	      (const_int 16))))]
    "TARGET_3DNOW"
    "pmulhrw\\t{%2, %0|%0, %2}"
!   [(set_attr "type" "mmxmul")
!    (set_attr "mode" "TI")])
  
  (define_insn "pswapdv2si2"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
***************
*** 19850,19856 ****
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_insn "pswapdv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
--- 20054,20061 ----
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "pswapdv2sf2"
    [(set (match_operand:V2SF 0 "register_operand" "=y")
***************
*** 19858,19864 ****
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmx")])
  
  (define_expand "prefetch"
    [(prefetch (match_operand:SI 0 "address_operand" "")
--- 20063,20070 ----
  			 (parallel [(const_int 1) (const_int 0)])))]
    "TARGET_3DNOW_A"
    "pswapd\\t{%1, %0|%0, %1}"
!   [(set_attr "type" "mmxcvt")
!    (set_attr "mode" "TI")])
  
  (define_expand "prefetch"
    [(prefetch (match_operand:SI 0 "address_operand" "")
***************
*** 19900,19906 ****
  
    return patterns[locality];  
  }
!   [(set_attr "type" "sse")])
  
  (define_insn "*prefetch_3dnow"
    [(prefetch (match_operand:SI 0 "address_operand" "p")
--- 20106,20113 ----
  
    return patterns[locality];  
  }
!   [(set_attr "type" "sse")
!    (set_attr "memory" "none")])
  
  (define_insn "*prefetch_3dnow"
    [(prefetch (match_operand:SI 0 "address_operand" "p")
***************
*** 19913,19919 ****
    else
      return "prefetchw\t%a0";
  }
!   [(set_attr "type" "mmx")])
  
  ;; SSE2 support
  
--- 20120,20127 ----
    else
      return "prefetchw\t%a0";
  }
!   [(set_attr "type" "mmx")
!    (set_attr "memory" "none")])
  
  ;; SSE2 support
  
***************
*** 19923,19929 ****
  	           (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "addpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmaddv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20131,20138 ----
  	           (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "addpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmaddv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 19933,19939 ****
  			(const_int 1)))]
    "TARGET_SSE2"
    "addsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "subv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20142,20149 ----
  			(const_int 1)))]
    "TARGET_SSE2"
    "addsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "DF")])
  
  (define_insn "subv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 19941,19947 ****
  	           (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "subpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsubv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20151,20158 ----
  	           (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "subpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmsubv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 19951,19957 ****
  			(const_int 1)))]
    "TARGET_SSE2"
    "subsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mulv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20162,20169 ----
  			(const_int 1)))]
    "TARGET_SSE2"
    "subsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "DF")])
  
  (define_insn "mulv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 19959,19965 ****
  	           (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "mulpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmulv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20171,20178 ----
  	           (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "mulpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemul")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmmulv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 19969,19975 ****
  			(const_int 1)))]
    "TARGET_SSE2"
    "mulsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "divv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20182,20189 ----
  			(const_int 1)))]
    "TARGET_SSE2"
    "mulsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssemul")
!    (set_attr "mode" "DF")])
  
  (define_insn "divv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 19977,19983 ****
  	          (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "divpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmdivv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20191,20198 ----
  	          (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "divpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssediv")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmdivv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 19987,19993 ****
  			(const_int 1)))]
    "TARGET_SSE2"
    "divsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; SSE min/max
  
--- 20202,20209 ----
  			(const_int 1)))]
    "TARGET_SSE2"
    "divsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssediv")
!    (set_attr "mode" "DF")])
  
  ;; SSE min/max
  
***************
*** 19997,20003 ****
  		   (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "maxpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsmaxv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20213,20220 ----
  		   (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "maxpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmsmaxv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20007,20013 ****
  			(const_int 1)))]
    "TARGET_SSE2"
    "maxsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sminv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20224,20231 ----
  			(const_int 1)))]
    "TARGET_SSE2"
    "maxsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "DF")])
  
  (define_insn "sminv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20015,20021 ****
  		   (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "minpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsminv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20233,20240 ----
  		   (match_operand:V2DF 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "minpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmsminv2df3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20025,20031 ****
  			(const_int 1)))]
    "TARGET_SSE2"
    "minsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_anddf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20244,20251 ----
  			(const_int 1)))]
    "TARGET_SSE2"
    "minsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseadd")
!    (set_attr "mode" "DF")])
  
  (define_insn "sse2_anddf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20033,20039 ****
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_nanddf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20253,20260 ----
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "andpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_nanddf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20041,20047 ****
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "andnpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_iordf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20262,20269 ----
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "andnpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_iordf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20049,20055 ****
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_xordf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20271,20278 ----
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "orpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_xordf3"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20057,20063 ****
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  ;; SSE2 square root.  There doesn't appear to be an extension for the
  ;; reciprocal/rsqrt instructions if the Intel manual is to be believed.
  
--- 20280,20287 ----
  			     (subreg:TI (match_operand:TI 2 "nonimmediate_operand" "xm") 0)) 0))]
    "TARGET_SSE2"
    "xorpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sselog")
!    (set_attr "mode" "V2DF")])
  ;; SSE2 square root.  There doesn't appear to be an extension for the
  ;; reciprocal/rsqrt instructions if the Intel manual is to be believed.
  
***************
*** 20066,20072 ****
          (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm")))]
    "TARGET_SSE2"
    "sqrtpd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmsqrtv2df2"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20290,20297 ----
          (sqrt:V2DF (match_operand:V2DF 1 "register_operand" "xm")))]
    "TARGET_SSE2"
    "sqrtpd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmsqrtv2df2"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20075,20081 ****
  			(const_int 1)))]
    "TARGET_SSE2"
    "sqrtsd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; SSE mask-generating compares
  
--- 20300,20307 ----
  			(const_int 1)))]
    "TARGET_SSE2"
    "sqrtsd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")
!    (set_attr "mode" "SF")])
  
  ;; SSE mask-generating compares
  
***************
*** 20086,20092 ****
  			      (match_operand:V2DF 2 "nonimmediate_operand" "x")]))]
    "TARGET_SSE2"
    "cmp%D3pd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "maskncmpv2df3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
--- 20312,20319 ----
  			      (match_operand:V2DF 2 "nonimmediate_operand" "x")]))]
    "TARGET_SSE2"
    "cmp%D3pd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "maskncmpv2df3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
***************
*** 20096,20102 ****
  			       (match_operand:V2DF 2 "nonimmediate_operand" "x")])))]
    "TARGET_SSE2"
    "cmpn%D3pd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmaskcmpv2df3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
--- 20323,20330 ----
  			       (match_operand:V2DF 2 "nonimmediate_operand" "x")])))]
    "TARGET_SSE2"
    "cmpn%D3pd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "vmmaskcmpv2df3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
***************
*** 20108,20114 ****
  	 (const_int 1)))]
    "TARGET_SSE2"
    "cmp%D3sd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "vmmaskncmpv2df3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
--- 20336,20343 ----
  	 (const_int 1)))]
    "TARGET_SSE2"
    "cmp%D3sd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "DF")])
  
  (define_insn "vmmaskncmpv2df3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
***************
*** 20121,20127 ****
  	 (const_int 1)))]
    "TARGET_SSE2"
    "cmp%D3sd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_comi"
    [(set (reg:CCFP 17)
--- 20350,20357 ----
  	 (const_int 1)))]
    "TARGET_SSE2"
    "cmp%D3sd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "DF")])
  
  (define_insn "sse2_comi"
    [(set (reg:CCFP 17)
***************
*** 20134,20140 ****
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE2"
    "comisd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_ucomi"
    [(set (reg:CCFPU 17)
--- 20364,20371 ----
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE2"
    "comisd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "DF")])
  
  (define_insn "sse2_ucomi"
    [(set (reg:CCFPU 17)
***************
*** 20147,20153 ****
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE2"
    "ucomisd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; SSE Strange Moves.
  
--- 20378,20385 ----
  			  (parallel [(const_int 0)]))]))]
    "TARGET_SSE2"
    "ucomisd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "DF")])
  
  ;; SSE Strange Moves.
  
***************
*** 20156,20169 ****
  	(unspec:SI [(match_operand:V2DF 1 "register_operand" "x")] 33))]
    "TARGET_SSE2"
    "movmskpd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_pmovmskb"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(unspec:SI [(match_operand:V16QI 1 "register_operand" "x")] 33))]
    "TARGET_SSE2"
    "pmovmskb\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_maskmovdqu"
    [(set (mem:V16QI (match_operand:SI 0 "register_operand" "D"))
--- 20388,20403 ----
  	(unspec:SI [(match_operand:V2DF 1 "register_operand" "x")] 33))]
    "TARGET_SSE2"
    "movmskpd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_pmovmskb"
    [(set (match_operand:SI 0 "register_operand" "=r")
  	(unspec:SI [(match_operand:V16QI 1 "register_operand" "x")] 33))]
    "TARGET_SSE2"
    "pmovmskb\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_maskmovdqu"
    [(set (mem:V16QI (match_operand:SI 0 "register_operand" "D"))
***************
*** 20172,20199 ****
    "TARGET_SSE2"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovdqu\t{%2, %1|%1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movntv2df"
    [(set (match_operand:V2DF 0 "memory_operand" "=m")
  	(unspec:V2DF [(match_operand:V2DF 1 "register_operand" "x")] 34))]
    "TARGET_SSE2"
    "movntpd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movntti"
    [(set (match_operand:TI 0 "memory_operand" "=m")
  	(unspec:TI [(match_operand:TI 1 "register_operand" "x")] 34))]
    "TARGET_SSE2"
    "movntdq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movntsi"
    [(set (match_operand:SI 0 "memory_operand" "=m")
  	(unspec:SI [(match_operand:SI 1 "register_operand" "r")] 34))]
    "TARGET_SSE2"
    "movnti\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; SSE <-> integer/MMX conversions
  
--- 20406,20437 ----
    "TARGET_SSE2"
    ;; @@@ check ordering of operands in intel/nonintel syntax
    "maskmovdqu\t{%2, %1|%1, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_movntv2df"
    [(set (match_operand:V2DF 0 "memory_operand" "=m")
  	(unspec:V2DF [(match_operand:V2DF 1 "register_operand" "x")] 34))]
    "TARGET_SSE2"
    "movntpd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_movntti"
    [(set (match_operand:TI 0 "memory_operand" "=m")
  	(unspec:TI [(match_operand:TI 1 "register_operand" "x")] 34))]
    "TARGET_SSE2"
    "movntdq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_movntsi"
    [(set (match_operand:SI 0 "memory_operand" "=m")
  	(unspec:SI [(match_operand:SI 1 "register_operand" "r")] 34))]
    "TARGET_SSE2"
    "movnti\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  ;; SSE <-> integer/MMX conversions
  
***************
*** 20204,20224 ****
  	(float:V4SF (match_operand:V4SI 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "cvtdq2ps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtps2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
  	(fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "cvtps2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttps2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
  	(unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 30))]
    "TARGET_SSE2"
    "cvttps2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; Conversions between SI and DF
  
--- 20442,20465 ----
  	(float:V4SF (match_operand:V4SI 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "cvtdq2ps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "cvtps2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
  	(fix:V4SI (match_operand:V4SF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "cvtps2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "cvttps2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
  	(unspec:V4SI [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] 30))]
    "TARGET_SSE2"
    "cvttps2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  ;; Conversions between SI and DF
  
***************
*** 20231,20237 ****
  		       (const_int 1)]))))]
    "TARGET_SSE2"
    "cvtdq2pd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtpd2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20472,20479 ----
  		       (const_int 1)]))))]
    "TARGET_SSE2"
    "cvtdq2pd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "cvtpd2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20240,20246 ****
  	 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
    "TARGET_SSE2"
    "cvtpd2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttpd2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20482,20489 ----
  	 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
    "TARGET_SSE2"
    "cvtpd2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "cvttpd2dq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20249,20276 ****
  	 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
    "TARGET_SSE2"
    "cvttpd2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtpd2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
  	(fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "cvtpd2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttpd2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
  	(unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")] 30))]
    "TARGET_SSE2"
    "cvttpd2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtpi2pd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
  	(float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
    "TARGET_SSE2"
    "cvtpi2pd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; Conversions between SI and DF
  
--- 20492,20523 ----
  	 (const_vector:V2SI [(const_int 0) (const_int 0)])))]
    "TARGET_SSE2"
    "cvttpd2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "cvtpd2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
  	(fix:V2SI (match_operand:V2DF 1 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "cvtpd2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "cvttpd2pi"
    [(set (match_operand:V2SI 0 "register_operand" "=y")
  	(unspec:V2SI [(match_operand:V2DF 1 "nonimmediate_operand" "xm")] 30))]
    "TARGET_SSE2"
    "cvttpd2pi\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "cvtpi2pd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
  	(float:V2DF (match_operand:V2SI 1 "nonimmediate_operand" "ym")))]
    "TARGET_SSE2"
    "cvtpi2pd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  ;; Conversions between SI and DF
  
***************
*** 20280,20286 ****
  			       (parallel [(const_int 0)]))))]
    "TARGET_SSE2"
    "cvtsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvttsd2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 20527,20534 ----
  			       (parallel [(const_int 0)]))))]
    "TARGET_SSE2"
    "cvtsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SI")])
  
  (define_insn "cvttsd2si"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 20288,20294 ****
  				   (parallel [(const_int 0)]))] 30))]
    "TARGET_SSE2"
    "cvttsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtsi2sd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20536,20543 ----
  				   (parallel [(const_int 0)]))] 30))]
    "TARGET_SSE2"
    "cvttsd2si\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SI")])
  
  (define_insn "cvtsi2sd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20299,20305 ****
  			(const_int 2)))]
    "TARGET_SSE2"
    "cvtsd2si\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; Conversions between SF and DF
  
--- 20548,20555 ----
  			(const_int 2)))]
    "TARGET_SSE2"
    "cvtsd2si\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "DF")])
  
  ;; Conversions between SF and DF
  
***************
*** 20312,20318 ****
  			(const_int 14)))]
    "TARGET_SSE2"
    "cvtsd2ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtss2sd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20562,20569 ----
  			(const_int 14)))]
    "TARGET_SSE2"
    "cvtsd2ss\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "SF")])
  
  (define_insn "cvtss2sd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20325,20331 ****
  			(const_int 2)))]
    "TARGET_SSE2"
    "cvtss2sd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtpd2ps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
--- 20576,20583 ----
  			(const_int 2)))]
    "TARGET_SSE2"
    "cvtss2sd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "DF")])
  
  (define_insn "cvtpd2ps"
    [(set (match_operand:V4SF 0 "register_operand" "=x")
***************
*** 20336,20342 ****
  	    (const_vector:V2SI [(const_int 0) (const_int 0)])) 0))]
    "TARGET_SSE2"
    "cvtpd2ps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "cvtps2pd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 20588,20595 ----
  	    (const_vector:V2SI [(const_int 0) (const_int 0)])) 0))]
    "TARGET_SSE2"
    "cvtpd2ps\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V4SF")])
  
  (define_insn "cvtps2pd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20346,20352 ****
  				      (const_int 1)]))))]
    "TARGET_SSE2"
    "cvtps2pd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  ;; SSE2 variants of MMX insns
  
--- 20599,20606 ----
  				      (const_int 1)]))))]
    "TARGET_SSE2"
    "cvtps2pd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  ;; SSE2 variants of MMX insns
  
***************
*** 20358,20364 ****
  		    (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "addv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20612,20619 ----
  		    (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "addv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20366,20372 ****
  	           (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "addv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20621,20628 ----
  	           (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "addv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20374,20380 ****
  	           (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "addv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
--- 20630,20637 ----
  	           (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "addv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
***************
*** 20382,20388 ****
  	           (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "ssaddv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 20639,20646 ----
  	           (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "ssaddv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20390,20396 ****
  		       (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "ssaddv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20648,20655 ----
  		       (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "ssaddv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20398,20404 ****
  		      (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "usaddv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 20657,20664 ----
  		      (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "usaddv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20406,20412 ****
  		       (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "usaddv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20666,20673 ----
  		       (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "usaddv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20414,20420 ****
  		      (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "subv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 20675,20682 ----
  		      (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "paddusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "subv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20422,20428 ****
  		     (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "subv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20684,20691 ----
  		     (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "subv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20430,20436 ****
  		    (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "subv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20693,20700 ----
  		    (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "subv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20438,20444 ****
  		    (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "subv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
--- 20702,20709 ----
  		    (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "subv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
***************
*** 20446,20452 ****
  		    (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sssubv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 20711,20718 ----
  		    (match_operand:V2DI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "sssubv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20454,20460 ****
  			(match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sssubv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20720,20727 ----
  			(match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubsb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "sssubv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20462,20468 ****
  		       (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "ussubv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 20729,20736 ----
  		       (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "ussubv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20470,20476 ****
  			(match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "ussubv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20738,20745 ----
  			(match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubusb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "ussubv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20478,20484 ****
  		       (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "mulv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20747,20754 ----
  		       (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "psubusw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "mulv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20486,20492 ****
  		   (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pmullw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "smulv8hi3_highpart"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20756,20763 ----
  		   (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pmullw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseimul")
!    (set_attr "mode" "TI")])
  
  (define_insn "smulv8hi3_highpart"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20497,20503 ****
  	  (const_int 16))))]
    "TARGET_SSE2"
    "pmulhw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "umulv8hi3_highpart"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20768,20775 ----
  	  (const_int 16))))]
    "TARGET_SSE2"
    "pmulhw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseimul")
!    (set_attr "mode" "TI")])
  
  (define_insn "umulv8hi3_highpart"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20508,20514 ****
  	  (const_int 16))))]
    "TARGET_SSE2"
    "pmulhuw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; See the MMX logical operations for the reason for the unspec
  (define_insn "sse2_umulsidi3"
--- 20780,20787 ----
  	  (const_int 16))))]
    "TARGET_SSE2"
    "pmulhuw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseimul")
!    (set_attr "mode" "TI")])
  
  ;; See the MMX logical operations for the reason for the unspec
  (define_insn "sse2_umulsidi3"
***************
*** 20517,20523 ****
  			     (zero_extend:DI (match_operand:DI 2 "nonimmediate_operand" "ym")))] 45))]
    "TARGET_SSE2"
    "pmuludq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_umulv2siv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=y")
--- 20790,20797 ----
  			     (zero_extend:DI (match_operand:DI 2 "nonimmediate_operand" "ym")))] 45))]
    "TARGET_SSE2"
    "pmuludq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseimul")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_umulv2siv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=y")
***************
*** 20531,20537 ****
  		       (parallel [(const_int 0) (const_int 2)])))))]
    "TARGET_SSE2"
    "pmuludq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_pmaddwd"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20805,20812 ----
  		       (parallel [(const_int 0) (const_int 2)])))))]
    "TARGET_SSE2"
    "pmuludq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseimul")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_pmaddwd"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20560,20566 ****
  							(const_int 7)]))))))]
    "TARGET_SSE2"
    "pmaddwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; Same as pxor, but don't show input operands so that we don't think
  ;; they are live.
--- 20835,20842 ----
  							(const_int 7)]))))))]
    "TARGET_SSE2"
    "pmaddwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  ;; Same as pxor, but don't show input operands so that we don't think
  ;; they are live.
***************
*** 20568,20574 ****
    [(set (match_operand:TI 0 "register_operand" "=x") (const_int 0))]
    "TARGET_SSE2"
    "pxor\t{%0, %0|%0, %0}"
!   [(set_attr "type" "sse")])
  
  ;; MMX unsigned averages/sum of absolute differences
  
--- 20844,20851 ----
    [(set (match_operand:TI 0 "register_operand" "=x") (const_int 0))]
    "TARGET_SSE2"
    "pxor\t{%0, %0|%0, %0}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  ;; MMX unsigned averages/sum of absolute differences
  
***************
*** 20589,20595 ****
  	 (const_int 1)))]
    "TARGET_SSE2"
    "pavgb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_uavgv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20866,20873 ----
  	 (const_int 1)))]
    "TARGET_SSE2"
    "pavgb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_uavgv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20604,20610 ****
  	 (const_int 1)))]
    "TARGET_SSE2"
    "pavgw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; @@@ this isn't the right representation.
  (define_insn "sse2_psadbw"
--- 20882,20889 ----
  	 (const_int 1)))]
    "TARGET_SSE2"
    "pavgw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  ;; @@@ this isn't the right representation.
  (define_insn "sse2_psadbw"
***************
*** 20613,20619 ****
  				(match_operand:V16QI 2 "nonimmediate_operand" "ym"))))]
    "TARGET_SSE2"
    "psadbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX insert/extract/shuffle
--- 20892,20899 ----
  				(match_operand:V16QI 2 "nonimmediate_operand" "ym"))))]
    "TARGET_SSE2"
    "psadbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  
  ;; MMX insert/extract/shuffle
***************
*** 20626,20632 ****
  			(match_operand:SI 3 "immediate_operand" "i")))]
    "TARGET_SSE2"
    "pinsrw\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_pextrw"
    [(set (match_operand:SI 0 "register_operand" "=r")
--- 20906,20913 ----
  			(match_operand:SI 3 "immediate_operand" "i")))]
    "TARGET_SSE2"
    "pinsrw\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_pextrw"
    [(set (match_operand:SI 0 "register_operand" "=r")
***************
*** 20636,20642 ****
  			  [(match_operand:SI 2 "immediate_operand" "i")]))))]
    "TARGET_SSE2"
    "pextrw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_pshufd"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20917,20924 ----
  			  [(match_operand:SI 2 "immediate_operand" "i")]))))]
    "TARGET_SSE2"
    "pextrw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_pshufd"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20644,20650 ****
  		      (match_operand:SI 2 "immediate_operand" "i")] 41))]
    "TARGET_SSE2"
    "pshufd\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_pshuflw"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20926,20933 ----
  		      (match_operand:SI 2 "immediate_operand" "i")] 41))]
    "TARGET_SSE2"
    "pshufd\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_pshuflw"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20652,20658 ****
  		      (match_operand:SI 2 "immediate_operand" "i")] 55))]
    "TARGET_SSE2"
    "pshuflw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_pshufhw"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20935,20942 ----
  		      (match_operand:SI 2 "immediate_operand" "i")] 55))]
    "TARGET_SSE2"
    "pshuflw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_pshufhw"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20660,20666 ****
  		      (match_operand:SI 2 "immediate_operand" "i")] 56))]
    "TARGET_SSE2"
    "pshufhw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "sse")])
  
  ;; MMX mask-generating comparisons
  
--- 20944,20951 ----
  		      (match_operand:SI 2 "immediate_operand" "i")] 56))]
    "TARGET_SSE2"
    "pshufhw\t{%2, %1, %0|%0, %1, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  ;; MMX mask-generating comparisons
  
***************
*** 20670,20676 ****
  		 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpeqb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "eqv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20955,20962 ----
  		 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpeqb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "TI")])
  
  (define_insn "eqv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20678,20684 ****
  		 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpeqw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "eqv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20964,20971 ----
  		 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpeqw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "TI")])
  
  (define_insn "eqv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20686,20692 ****
  		 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpeqd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "gtv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 20973,20980 ----
  		 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpeqd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "TI")])
  
  (define_insn "gtv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20694,20700 ****
  		 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpgtb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "gtv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 20982,20989 ----
  		 (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpgtb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "TI")])
  
  (define_insn "gtv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20702,20708 ****
  		 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpgtw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "gtv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 20991,20998 ----
  		 (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpgtw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "TI")])
  
  (define_insn "gtv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20710,20716 ****
  		 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpgtd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX max/min insns
--- 21000,21007 ----
  		 (match_operand:V4SI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pcmpgtd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecmp")
!    (set_attr "mode" "TI")])
  
  
  ;; MMX max/min insns
***************
*** 20721,20727 ****
  		   (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pmaxub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "smaxv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 21012,21019 ----
  		   (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pmaxub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "smaxv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20729,20735 ****
  		   (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pmaxsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "uminv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 21021,21028 ----
  		   (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pmaxsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "uminv16qi3"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20737,20743 ****
  		   (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pminub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sminv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 21030,21037 ----
  		   (match_operand:V16QI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pminub\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  (define_insn "sminv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20745,20751 ****
  		   (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pminsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  
  ;; MMX shifts
--- 21039,21046 ----
  		   (match_operand:V8HI 2 "nonimmediate_operand" "xm")))]
    "TARGET_SSE2"
    "pminsw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseiadd")
!    (set_attr "mode" "TI")])
  
  
  ;; MMX shifts
***************
*** 20756,20762 ****
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psraw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "ashrv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 21051,21058 ----
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psraw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "ashrv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20764,20770 ****
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrad\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "lshrv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 21060,21067 ----
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrad\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "lshrv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20772,20778 ****
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrlw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "lshrv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 21069,21076 ----
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrlw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "lshrv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20780,20786 ****
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_lshrv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
--- 21078,21085 ----
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_lshrv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
***************
*** 20788,20794 ****
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrlq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "ashlv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 21087,21094 ----
  		       (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psrlq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "ashlv8hi3"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20796,20802 ****
  		     (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psllw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "ashlv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 21096,21103 ----
  		     (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psllw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "ashlv4si3"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20804,20810 ****
  		     (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "pslld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_ashlv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
--- 21105,21112 ----
  		     (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "pslld\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_ashlv2di3"
    [(set (match_operand:V2DI 0 "register_operand" "=x")
***************
*** 20812,20818 ****
  		     (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psllq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; See logical MMX insns for the reason for the unspec.  Strictly speaking
  ;; we wouldn't need here it since we never generate TImode arithmetic.
--- 21114,21121 ----
  		     (match_operand:TI 2 "nonmemory_operand" "xi")))]
    "TARGET_SSE2"
    "psllq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  ;; See logical MMX insns for the reason for the unspec.  Strictly speaking
  ;; we wouldn't need here it since we never generate TImode arithmetic.
***************
*** 20826,20832 ****
  			       (const_int 8)))] 30))]
    "TARGET_SSE2"
    "pslldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_lshrti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
--- 21129,21136 ----
  			       (const_int 8)))] 30))]
    "TARGET_SSE2"
    "pslldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_lshrti3"
    [(set (match_operand:TI 0 "register_operand" "=x")
***************
*** 20836,20842 ****
  				(const_int 8)))] 30))]
    "TARGET_SSE2"
    "pslrdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; SSE unpack
  
--- 21140,21147 ----
  				(const_int 8)))] 30))]
    "TARGET_SSE2"
    "pslrdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sseishft")
!    (set_attr "mode" "TI")])
  
  ;; SSE unpack
  
***************
*** 20849,20855 ****
  			  (parallel [(const_int 0)]))))]
    "TARGET_SSE2"
    "unpckhpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_unpcklpd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 21154,21161 ----
  			  (parallel [(const_int 0)]))))]
    "TARGET_SSE2"
    "unpckhpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_unpcklpd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 20860,20866 ****
  			  (parallel [(const_int 1)]))))]
    "TARGET_SSE2"
    "unpcklpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; MMX pack/unpack insns.
  
--- 21166,21173 ----
  			  (parallel [(const_int 1)]))))]
    "TARGET_SSE2"
    "unpcklpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  ;; MMX pack/unpack insns.
  
***************
*** 20871,20877 ****
  	 (ss_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
    "TARGET_SSE2"
    "packsswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_packssdw"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 21178,21185 ----
  	 (ss_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
    "TARGET_SSE2"
    "packsswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_packssdw"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20880,20886 ****
  	 (ss_truncate:V4HI (match_operand:V4SI 2 "register_operand" "x"))))]
    "TARGET_SSE2"
    "packssdw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_packuswb"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 21188,21195 ----
  	 (ss_truncate:V4HI (match_operand:V4SI 2 "register_operand" "x"))))]
    "TARGET_SSE2"
    "packssdw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_packuswb"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20889,20895 ****
  	 (us_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
    "TARGET_SSE2"
    "packuswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_punpckhbw"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 21198,21205 ----
  	 (us_truncate:V8QI (match_operand:V8HI 2 "register_operand" "x"))))]
    "TARGET_SSE2"
    "packuswb\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_punpckhbw"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20915,20921 ****
  	 (const_int 21845)))]
    "TARGET_SSE2"
    "punpckhbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_punpckhwd"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 21225,21232 ----
  	 (const_int 21845)))]
    "TARGET_SSE2"
    "punpckhbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_punpckhwd"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20933,20939 ****
  	 (const_int 85)))]
    "TARGET_SSE2"
    "punpckhwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_punpckhdq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 21244,21251 ----
  	 (const_int 85)))]
    "TARGET_SSE2"
    "punpckhwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_punpckhdq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 20947,20953 ****
  	 (const_int 5)))]
    "TARGET_SSE2"
    "punpckhdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_punpcklbw"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
--- 21259,21266 ----
  	 (const_int 5)))]
    "TARGET_SSE2"
    "punpckhdq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_punpcklbw"
    [(set (match_operand:V16QI 0 "register_operand" "=x")
***************
*** 20973,20979 ****
  	 (const_int 21845)))]
    "TARGET_SSE2"
    "punpcklbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_punpcklwd"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
--- 21286,21293 ----
  	 (const_int 21845)))]
    "TARGET_SSE2"
    "punpcklbw\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_punpcklwd"
    [(set (match_operand:V8HI 0 "register_operand" "=x")
***************
*** 20991,20997 ****
  	 (const_int 85)))]
    "TARGET_SSE2"
    "punpcklwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_punpckldq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
--- 21305,21312 ----
  	 (const_int 85)))]
    "TARGET_SSE2"
    "punpcklwd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_punpckldq"
    [(set (match_operand:V4SI 0 "register_operand" "=x")
***************
*** 21005,21011 ****
  	 (const_int 5)))]
    "TARGET_SSE2"
    "punpckldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  ;; SSE2 moves
  
--- 21320,21327 ----
  	 (const_int 5)))]
    "TARGET_SSE2"
    "punpckldq\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  ;; SSE2 moves
  
***************
*** 21016,21022 ****
    "@
     movapd\t{%1, %0|%0, %1}
     movapd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movupd"
    [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
--- 21332,21339 ----
    "@
     movapd\t{%1, %0|%0, %1}
     movapd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_movupd"
    [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
***************
*** 21025,21031 ****
    "@
     movupd\t{%1, %0|%0, %1}
     movupd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movdqa"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=x,m")
--- 21342,21349 ----
    "@
     movupd\t{%1, %0|%0, %1}
     movupd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_movdqa"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=x,m")
***************
*** 21034,21040 ****
    "@
     movdqa\t{%1, %0|%0, %1}
     movdqa\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movdqu"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=x,m")
--- 21352,21359 ----
    "@
     movdqa\t{%1, %0|%0, %1}
     movdqa\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssemov")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_movdqu"
    [(set (match_operand:TI 0 "nonimmediate_operand" "=x,m")
***************
*** 21043,21049 ****
    "@
     movdqu\t{%1, %0|%0, %1}
     movdqu\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movdq2q"
    [(set (match_operand:DI 0 "nonimmediate_operand" "=y")
--- 21362,21369 ----
    "@
     movdqu\t{%1, %0|%0, %1}
     movdqu\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_movdq2q"
    [(set (match_operand:DI 0 "nonimmediate_operand" "=y")
***************
*** 21051,21057 ****
  		       (parallel [(const_int 0)])))]
    "TARGET_SSE2"
    "movdq2q\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movq2dq"
    [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x")
--- 21371,21378 ----
  		       (parallel [(const_int 0)])))]
    "TARGET_SSE2"
    "movdq2q\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_movq2dq"
    [(set (match_operand:V2DI 0 "nonimmediate_operand" "=x")
***************
*** 21059,21065 ****
  			 (const_vector:DI [(const_int 0)])))]
    "TARGET_SSE2"
    "movq2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movhpd"
    [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
--- 21380,21387 ----
  			 (const_vector:DI [(const_int 0)])))]
    "TARGET_SSE2"
    "movq2dq\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "TI")])
  
  (define_insn "sse2_movhpd"
    [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
***************
*** 21069,21075 ****
  	 (const_int 2)))]
    "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movhpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movlpd"
    [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
--- 21391,21398 ----
  	 (const_int 2)))]
    "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movhpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_movlpd"
    [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,m")
***************
*** 21079,21085 ****
  	 (const_int 1)))]
    "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movlpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_loadsd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 21402,21409 ----
  	 (const_int 1)))]
    "TARGET_SSE2 && (GET_CODE (operands[1]) == MEM || GET_CODE (operands[2]) == MEM)"
    "movlpd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_loadsd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 21089,21095 ****
  	 (const_int 1)))]
    "TARGET_SSE2"
    "movsd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_movsd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 21413,21420 ----
  	 (const_int 1)))]
    "TARGET_SSE2"
    "movsd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "DF")])
  
  (define_insn "sse2_movsd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 21099,21105 ****
  	 (const_int 1)))]
    "TARGET_SSE2"
    "movsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_storesd"
    [(set (match_operand:DF 0 "memory_operand" "=m")
--- 21424,21431 ----
  	 (const_int 1)))]
    "TARGET_SSE2"
    "movsd\t{%2, %0|%0, %2}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "DF")])
  
  (define_insn "sse2_storesd"
    [(set (match_operand:DF 0 "memory_operand" "=m")
***************
*** 21108,21114 ****
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE2"
    "movsd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_shufpd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
--- 21434,21441 ----
  	 (parallel [(const_int 0)])))]
    "TARGET_SSE2"
    "movsd\t{%1, %0|%0, %1}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "DF")])
  
  (define_insn "sse2_shufpd"
    [(set (match_operand:V2DF 0 "register_operand" "=x")
***************
*** 21118,21130 ****
    "TARGET_SSE2"
    ;; @@@ check operand order for intel/nonintel syntax
    "shufpd\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "sse")])
  
  (define_insn "sse2_clflush"
    [(unspec_volatile [(match_operand:SI 0 "address_operand" "p")] 57)]
    "TARGET_SSE2"
    "clflush %0"
!   [(set_attr "type" "sse")])
  
  (define_expand "sse2_mfence"
    [(set (match_dup 0)
--- 21445,21459 ----
    "TARGET_SSE2"
    ;; @@@ check operand order for intel/nonintel syntax
    "shufpd\t{%3, %2, %0|%0, %2, %3}"
!   [(set_attr "type" "ssecvt")
!    (set_attr "mode" "V2DF")])
  
  (define_insn "sse2_clflush"
    [(unspec_volatile [(match_operand:SI 0 "address_operand" "p")] 57)]
    "TARGET_SSE2"
    "clflush %0"
!   [(set_attr "type" "sse")
!    (set_attr "memory" "unknown")])
  
  (define_expand "sse2_mfence"
    [(set (match_dup 0)

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re-enable crossjumping before bb-reorder
       [not found]                 ` <20020501153524.A4237@redhat.com>
@ 2002-05-02  9:33                   ` Jan Hubicka
  2002-05-02 10:34                     ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Jan Hubicka @ 2002-05-02  9:33 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-patches

> > That brings me to the question what happends to your testcase if you
> > add some float there so crossjumping gets called from reg-stack?
> 
> I didn't try.

Oops, reg-stack no longer calls crossjumping itself, instead relies on
the prebb-reorder crossjumping to cleanup.
Since it is not done, we lose quite a bit of code space in fp intensive
programs.
I am attaching the patch I would definitly like to see on the trunk/branch
after 3.1.0.  I am not sure if it is good idea to risc the 3.1.0 change
at the moment.

The patch to disable crossjumping is also not safe when the tablejump
is killed for diferent purpose - dead code is eliminated for instance.

Thu May  2 18:21:51 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* cfgrtl.c (try_redirect_by_replacing_jump): Do not kill computed jumps
	post reload.
	* toplev.c (rest_of_compilation): Revert Richard's patch.

Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cfgrtl.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 cfgrtl.c
*** cfgrtl.c	27 Apr 2002 06:41:38 -0000	1.40
--- cfgrtl.c	2 May 2002 16:21:47 -0000
*************** try_redirect_by_replacing_jump (e, targe
*** 713,719 ****
    basic_block src = e->src;
    rtx insn = src->end, kill_from;
    edge tmp;
!   rtx set;
    int fallthru = 0;
  
    /* Verify that all targets will be TARGET.  */
--- 713,719 ----
    basic_block src = e->src;
    rtx insn = src->end, kill_from;
    edge tmp;
!   rtx set, table;
    int fallthru = 0;
  
    /* Verify that all targets will be TARGET.  */
*************** try_redirect_by_replacing_jump (e, targe
*** 722,727 ****
--- 722,733 ----
        break;
  
    if (tmp || !onlyjump_p (insn))
+     return false;
+   if (reload_completed && JUMP_LABEL (insn)
+       && (table = NEXT_INSN (JUMP_LABEL (insn))) != NULL_RTX
+       && GET_CODE (table) == JUMP_INSN
+       && (GET_CODE (PATTERN (table)) == ADDR_VEC
+ 	  || GET_CODE (PATTERN (table)) == ADDR_DIFF_VEC))
      return false;
  
    /* Avoid removing branch with side effects.  */
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.618
diff -c -3 -p -r1.618 toplev.c
*** toplev.c	30 Apr 2002 23:13:34 -0000	1.618
--- toplev.c	2 May 2002 16:21:48 -0000
*************** rest_of_compilation (decl)
*** 3313,3319 ****
  	 splitting possibly introduced more crossjumping oppurtuntities.
  	 Except that we can't actually run crossjumping without running 
  	 another DCE pass, which we can't do after reg-stack.  */
!       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK);
        if (flag_reorder_blocks)
  	{
  	  reorder_basic_blocks ();
--- 3313,3320 ----
  	 splitting possibly introduced more crossjumping oppurtuntities.
  	 Except that we can't actually run crossjumping without running 
  	 another DCE pass, which we can't do after reg-stack.  */
!       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
! 		   | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
        if (flag_reorder_blocks)
  	{
  	  reorder_basic_blocks ();

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Re-enable crossjumping before bb-reorder
  2002-05-02  9:33                   ` Re-enable crossjumping before bb-reorder Jan Hubicka
@ 2002-05-02 10:34                     ` Richard Henderson
  2002-05-02 10:39                       ` Jan Hubicka
  0 siblings, 1 reply; 33+ messages in thread
From: Richard Henderson @ 2002-05-02 10:34 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On Thu, May 02, 2002 at 06:33:43PM +0200, Jan Hubicka wrote:
> The patch to disable crossjumping is also not safe when the tablejump
> is killed for diferent purpose - dead code is eliminated for instance.

If dead code is eliminated, then the DCE pass will also delete
the tablejump address load, which is fine.

> 	* cfgrtl.c (try_redirect_by_replacing_jump): Do not kill computed jumps
> 	post reload.
> 	* toplev.c (rest_of_compilation): Revert Richard's patch.

I think we'd be better off having reg-stack do a specialized form 
in which the contents of the edge insertions are compared.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Re-enable crossjumping before bb-reorder
  2002-05-02 10:34                     ` Richard Henderson
@ 2002-05-02 10:39                       ` Jan Hubicka
  2002-05-02 10:42                         ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Jan Hubicka @ 2002-05-02 10:39 UTC (permalink / raw)
  To: Richard Henderson, Jan Hubicka, gcc-patches

> On Thu, May 02, 2002 at 06:33:43PM +0200, Jan Hubicka wrote:
> > The patch to disable crossjumping is also not safe when the tablejump
> > is killed for diferent purpose - dead code is eliminated for instance.
> 
> If dead code is eliminated, then the DCE pass will also delete
> the tablejump address load, which is fine.

When the tablejump address load gets hoisted out of the loop and spilled
to the stack, it won't be elliminated., so I think it is really not
safe to remove tablejump postreload.
> 
> > 	* cfgrtl.c (try_redirect_by_replacing_jump): Do not kill computed jumps
> > 	post reload.
> > 	* toplev.c (rest_of_compilation): Revert Richard's patch.
> 
> I think we'd be better off having reg-stack do a specialized form 
> in which the contents of the edge insertions are compared.

As I've mentioned in the privately this won't catch scenarios where the same
instruction is emitted to the end of basic block, that is relatively common.
Even w/o floats the last crossjumping run hits some cases.

Honza
> 
> 
> r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Re-enable crossjumping before bb-reorder
  2002-05-02 10:39                       ` Jan Hubicka
@ 2002-05-02 10:42                         ` Richard Henderson
  0 siblings, 0 replies; 33+ messages in thread
From: Richard Henderson @ 2002-05-02 10:42 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On Thu, May 02, 2002 at 07:39:28PM +0200, Jan Hubicka wrote:
> When the tablejump address load gets hoisted out of the loop and spilled
> to the stack, it won't be elliminated., so I think it is really not
> safe to remove tablejump postreload.

Hum.  Didn't think of that.  I guess the patch is ok then.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
       [not found]             ` <20020515151110.GA24680@atrey.karlin.mff.cuni.cz>
@ 2002-05-15 17:00               ` Richard Henderson
  2002-05-15 23:48                 ` Zdenek Dvorak
  0 siblings, 1 reply; 33+ messages in thread
From: Richard Henderson @ 2002-05-15 17:00 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Wed, May 15, 2002 at 05:11:10PM +0200, Zdenek Dvorak wrote:
> + expunge_block (b)
> +      basic_block b;
> + {
>   
> !   unlink_block (b);

Careful with the extra whitespace.

> ! /*      fprintf (file, "prev %d, next %d, ",
> ! 	       bb->prev_bb->sindex, bb->next_bb->sindex);*/

Don't leave stuff like this.

> !   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
>       {
>   
>         for (e = bb->succ; e; e = e->succ_next)

Again.  I'll quit mentioning it for this patch.  But there's quite
a few others.

>     /* Allocate the tree.  */
> !   dfst = (struct dfst_node *) xcalloc (last_basic_block,
>   				       sizeof (struct dfst_node));
>   
> !   memset (dfst, 0, last_basic_block * sizeof (struct dfst_node));

You added this memset.  Why?

> ! 	  if (e->src->index > e2->src->index)
> ! 	    continue;
>   
>   	  if (try_crossjump_to_edge (mode, e, e2))
>   	    {
> --- 1547,1555 ----
>   	     checks of crossjump(A,B).  In order to prevent redundant
>   	     checks of crossjump(B,A), require that A be the block
>   	     with the lowest index.  */
> ! 	  for (foll = e->src; foll && foll != e2->src; foll = foll->next_bb);
> !           if (!foll)
> !             continue;

First, the trailing semicolon is extremely hard to read.  Especially
with the if mis-indented.  Write things like this as

	for (...)
	  continue;

Second, this test exists only to cut down the number of redundant
tests.  Thus we are not interested in the actual ordering of the
blocks, only that every block has a unique index.  Thus the original
test is still correct.

> *************** back_edge_of_syntactic_loop_p (bb1, bb2)
> +   for (bb = bb1; bb && bb != bb2; bb = bb->next_bb);

Again with the continue.

>     ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
> !   sbitmap_vector_zero (ae_kill, last_basic_block);

These should all be consistent and use n_blocks.

> !   for (block_num = 0; block_num < n_basic_blocks; )
> !     {
> !       basic_block bb = BASIC_BLOCK (block_num);
> !       if (find_if_header (bb))
> ! 	block_num = bb->index;
> !       else 
> ! 	block_num++;
> !     }
> --- 2690,2704 ----
> !   FOR_ALL_BB (bb)
> !     find_if_header (bb);

Not the same.  The replacement would be

	for (bb = ENTRY_BLOCK_PTR->next_bb; bb != EXIT_BLOCK_PTR ;)
	  if (! find_if_header (bb))
	    bb = bb->next_bb;

or

	FOR_ALL_BB (bb)
	  while (find_if_header (bb))
	    continue;


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-15 17:00               ` Basic block renumbering removal Richard Henderson
@ 2002-05-15 23:48                 ` Zdenek Dvorak
  2002-05-16 10:41                   ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-15 23:48 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2786 bytes --]

Hello.

> > + expunge_block (b)
> > +      basic_block b;
> > + {
> >   
> > !   unlink_block (b);
> 
> Careful with the extra whitespace.

I have removed as much as I found (but surely some of them remains;
I really am not able to find all in 16000 lines of patch, sorry).

> > ! /*      fprintf (file, "prev %d, next %d, ",
> > ! 	       bb->prev_bb->sindex, bb->next_bb->sindex);*/
> 
> Don't leave stuff like this.

OK.

> >     /* Allocate the tree.  */
> > !   dfst = (struct dfst_node *) xcalloc (last_basic_block,
> >   				       sizeof (struct dfst_node));
> >   
> > !   memset (dfst, 0, last_basic_block * sizeof (struct dfst_node));
> 
> You added this memset.  Why?

Probably some artefact from merging. I've removed it.

> > ! 	  if (e->src->index > e2->src->index)
> > ! 	    continue;
> >   
> >   	  if (try_crossjump_to_edge (mode, e, e2))
> >   	    {
> > --- 1547,1555 ----
> >   	     checks of crossjump(A,B).  In order to prevent redundant
> >   	     checks of crossjump(B,A), require that A be the block
> >   	     with the lowest index.  */
> > ! 	  for (foll = e->src; foll && foll != e2->src; foll = foll->next_bb);
> > !           if (!foll)
> > !             continue;
> 
> First, the trailing semicolon is extremely hard to read.  Especially
> with the if mis-indented.  Write things like this as
> 
> 	for (...)
> 	  continue;

OK.

> Second, this test exists only to cut down the number of redundant
> tests.  Thus we are not interested in the actual ordering of the
> blocks, only that every block has a unique index.  Thus the original
> test is still correct.

I had two reasons for this:
1) I wanted to keep semantics the same as before, in order to make bughunting
easier.
2) It did not work other way (in cfg-branch; I didn't check this after adapting
the patch for mainline).

> > *************** back_edge_of_syntactic_loop_p (bb1, bb2)
> > +   for (bb = bb1; bb && bb != bb2; bb = bb->next_bb);
> 
> Again with the continue.

OK.

> >     ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
> > !   sbitmap_vector_zero (ae_kill, last_basic_block);
> 
> These should all be consistent and use n_blocks.

OK.

> > !   for (block_num = 0; block_num < n_basic_blocks; )
> > !     {
> > !       basic_block bb = BASIC_BLOCK (block_num);
> > !       if (find_if_header (bb))
> > ! 	block_num = bb->index;
> > !       else 
> > ! 	block_num++;
> > !     }
> > --- 2690,2704 ----
> > !   FOR_ALL_BB (bb)
> > !     find_if_header (bb);
> 
> Not the same.  The replacement would be
> 
> 	for (bb = ENTRY_BLOCK_PTR->next_bb; bb != EXIT_BLOCK_PTR ;)
> 	  if (! find_if_header (bb))
> 	    bb = bb->next_bb;
> 
> or
> 
> 	FOR_ALL_BB (bb)
> 	  while (find_if_header (bb))
> 	    continue;

OK.

Here is the patch with proposed changes.

Zdenek

[-- Attachment #2: diff_noren_head.diff.bz2 --]
[-- Type: application/octet-stream, Size: 68625 bytes --]

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-15 23:48                 ` Zdenek Dvorak
@ 2002-05-16 10:41                   ` Richard Henderson
  2002-05-16 11:42                     ` Zdenek Dvorak
                                       ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Richard Henderson @ 2002-05-16 10:41 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Thu, May 16, 2002 at 08:24:36AM +0200, Zdenek Dvorak wrote:
> I have removed as much as I found (but surely some of them remains;
> I really am not able to find all in 16000 lines of patch, sorry).

Thanks.

> > Second, this test exists only to cut down the number of redundant
> > tests.  Thus we are not interested in the actual ordering of the
> > blocks, only that every block has a unique index.  Thus the original
> > test is still correct.
> 
> I had two reasons for this:
> 1) I wanted to keep semantics the same as before, in order to make bughunting
> easier.
> 2) It did not work other way (in cfg-branch; I didn't check this after
> adapting the patch for mainline).

Hum.  I guess we can leave this for now, but I'm certain this
will turn into a quadratic performance problem with some test
case.  Please figure out how to address this.

I suspect that both here and in back_edge_of_syntactic_loop_p
you can arrange for the block indicies to be monotonicaly 
increasing.

Anyway:

> ! compact_blocks ()
>   {
> !   basic_block *bbs = xcalloc (num_basic_blocks, sizeof (basic_block));
> !   int i;
> !   basic_block bb;
> !  
> !   i = 0;
> !   FOR_ALL_BB (bb)
> !     bbs[i++] = bb;
> ! 
> !   if (i != num_basic_blocks)
> !     abort ();
>   
> !   for (i = 0; i < num_basic_blocks; i++)
>       {
> !       bbs[i]->sindex = i;
> !       BASIC_BLOCK (i) = bbs[i];
>       }
> +   last_basic_block = num_basic_blocks;
> + 
> +   free (bbs);

You don't need to allocate extra memory here.

	VARRAY_GROW (basic_block_info, num_basic_blocks);

	i = 0;
	FOR_ALL_BB (bb)
	  {
	    BASIC_BLOCK (i) = bb;
	    bb->sindex = i++;
	  }
	if (i != num_basic_blocks)
	  abort ();

> ! 	  for (foll = e->src; foll && foll != e2->src; foll = foll->next_bb)
> ! 	    {
> ! 	    }

I really did mean "continue;", as that is the common idiom, but whatever.

> !   /* Place the new block to the end.  */
> !   VARRAY_GROW (basic_block_info, last_basic_block);

Probably VARRAY_BB_PUSH would be better, since that expands
the array geometricly rather than linearly.

> *************** alloc_rd_mem (n_blocks, n_insns)
>     rd_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
> !   sbitmap_vector_zero (rd_kill, last_basic_block);

You didn't change these like I asked.

> *************** alloc_avail_expr_mem (n_blocks, n_exprs)
>     ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
> !   sbitmap_vector_zero (ae_kill, n_blocks);

Oh, sorry, you did.  But there's another function that
wants the same treatment.

>   #define BB_TO_GCOV_INDEX(bb)  ((bb) == ENTRY_BLOCK_PTR ? 0		\
>   			       : ((bb) == EXIT_BLOCK_PTR		\
> ! 				  ? last_basic_block + 1 : (bb)->sindex + 1))

I didn't notice a compact_blocks before profile?  If I didn't just
miss it, seems like it would be a Good Idea, since last_basic_block
will then affect the size of the data in the object file.

Since I don't want to read through a patch of this size again,
and none of the points above is critical to correctness, I've
committed the patch as-is.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-16 10:41                   ` Richard Henderson
@ 2002-05-16 11:42                     ` Zdenek Dvorak
  2002-05-16 13:00                     ` Zdenek Dvorak
  2002-05-17  4:53                     ` Jan Hubicka
  2 siblings, 0 replies; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-16 11:42 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

> > > Second, this test exists only to cut down the number of redundant
> > > tests.  Thus we are not interested in the actual ordering of the
> > > blocks, only that every block has a unique index.  Thus the original
> > > test is still correct.
> > 
> > I had two reasons for this:
> > 1) I wanted to keep semantics the same as before, in order to make bughunting
> > easier.
> > 2) It did not work other way (in cfg-branch; I didn't check this after
> > adapting the patch for mainline).
> 
> Hum.  I guess we can leave this for now, but I'm certain this
> will turn into a quadratic performance problem with some test
> case.  Please figure out how to address this.
> 
> I suspect that both here and in back_edge_of_syntactic_loop_p
> you can arrange for the block indicies to be monotonicaly 
> increasing.

I will look on this.

> Anyway:
> 
> > ! compact_blocks ()
> >   {
> > !   basic_block *bbs = xcalloc (num_basic_blocks, sizeof (basic_block));
> > !   int i;
> > !   basic_block bb;
> > !  
> > !   i = 0;
> > !   FOR_ALL_BB (bb)
> > !     bbs[i++] = bb;
> > ! 
> > !   if (i != num_basic_blocks)
> > !     abort ();
> >   
> > !   for (i = 0; i < num_basic_blocks; i++)
> >       {
> > !       bbs[i]->sindex = i;
> > !       BASIC_BLOCK (i) = bbs[i];
> >       }
> > +   last_basic_block = num_basic_blocks;
> > + 
> > +   free (bbs);
> 
> You don't need to allocate extra memory here.
> 
> 	VARRAY_GROW (basic_block_info, num_basic_blocks);
> 
> 	i = 0;
> 	FOR_ALL_BB (bb)
> 	  {
> 	    BASIC_BLOCK (i) = bb;
> 	    bb->sindex = i++;
> 	  }
> 	if (i != num_basic_blocks)
> 	  abort ();

Right.

> > !   /* Place the new block to the end.  */
> > !   VARRAY_GROW (basic_block_info, last_basic_block);
> 
> Probably VARRAY_BB_PUSH would be better, since that expands
> the array geometricly rather than linearly.

OK.

> > *************** alloc_rd_mem (n_blocks, n_insns)
> >     rd_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
> > !   sbitmap_vector_zero (rd_kill, last_basic_block);
> 
> You didn't change these like I asked.
> 
> > *************** alloc_avail_expr_mem (n_blocks, n_exprs)
> >     ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
> > !   sbitmap_vector_zero (ae_kill, n_blocks);
> 
> Oh, sorry, you did.  But there's another function that
> wants the same treatment.

OK.

> >   #define BB_TO_GCOV_INDEX(bb)  ((bb) == ENTRY_BLOCK_PTR ? 0		\
> >   			       : ((bb) == EXIT_BLOCK_PTR		\
> > ! 				  ? last_basic_block + 1 : (bb)->sindex + 1))
> 
> I didn't notice a compact_blocks before profile?  If I didn't just
> miss it, seems like it would be a Good Idea, since last_basic_block
> will then affect the size of the data in the object file.

compact_blocks is run in every cfg_cleanup (and cfg_cleanup is run before
branch_prob); but cfg_cleanup then can make some changes, so you're right
in that we should rerun it again immediatelly before.

Zdenek

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-16 10:41                   ` Richard Henderson
  2002-05-16 11:42                     ` Zdenek Dvorak
@ 2002-05-16 13:00                     ` Zdenek Dvorak
  2002-05-16 15:30                       ` Richard Henderson
  2002-05-17  4:53                     ` Jan Hubicka
  2 siblings, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-16 13:00 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

> Since I don't want to read through a patch of this size again,
> and none of the points above is critical to correctness, I've
> committed the patch as-is.

Sorry; I haven't tried to compile objc. I've seen the problem before (iterative
dataflow does not have to terminate for some initial solutions, but without my
patch gcc somehow (not quite sure how) avoids them), but I hoped I fixed it
already).  I will try to fix it asap, but it might be better to revert the
patch for now.

Zdenek

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-16 13:00                     ` Zdenek Dvorak
@ 2002-05-16 15:30                       ` Richard Henderson
  2002-05-16 15:38                         ` Zdenek Dvorak
  2002-05-17  5:10                         ` Jan Hubicka
  0 siblings, 2 replies; 33+ messages in thread
From: Richard Henderson @ 2002-05-16 15:30 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Thu, May 16, 2002 at 09:41:02PM +0200, Zdenek Dvorak wrote:
> Sorry; I haven't tried to compile objc.

Arg!  I thought submission of the patch meant that it worked.

> (iterative dataflow does not have to terminate for some initial
> solutions, but without my patch gcc somehow (not quite sure how)
> avoids them), but I hoped I fixed it already). 

Point me at the problem?


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-16 15:30                       ` Richard Henderson
@ 2002-05-16 15:38                         ` Zdenek Dvorak
  2002-05-17  5:10                         ` Jan Hubicka
  1 sibling, 0 replies; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-16 15:38 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

> > Sorry; I haven't tried to compile objc.
> 
> Arg!  I thought submission of the patch meant that it worked.

I only bootstrapped it with c/c++; my fault, I will test it more next time :-(

> > (iterative dataflow does not have to terminate for some initial
> > solutions, but without my patch gcc somehow (not quite sure how)
> > avoids them), but I hoped I fixed it already). 
> 
> Point me at the problem?

(it loops infinitely in calculate_global_regs_live):

stage1/xgcc -Bstage1/ -B/maat/heart/tbox/objs/i686-pc-linux-gnu/bin/ -c -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes   -DHAVE_CONFIG_H    -I. -Ijava -I/maat/heart/tbox/cvs-gcc/gcc/gcc -I/maat/heart/tbox/cvs-gcc/gcc/gcc/java -I/maat/heart/tbox/cvs-gcc/gcc/gcc/config -I/maat/heart/tbox/cvs-gcc/gcc/gcc/../include /maat/heart/tbox/cvs-gcc/gcc/gcc/java/jv-scan.c -o java/jv-scan.o
rm -f jv-scan
stage1/xgcc -Bstage1/ -B/maat/heart/tbox/objs/i686-pc-linux-gnu/bin/ -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H  -o jv-scan java/parse-scan.o java/jv-scan.o version.o    ../libiberty/libiberty.a
stage1/xgcc -Bstage1/ -B/maat/heart/tbox/objs/i686-pc-linux-gnu/bin/ -c -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes   -DHAVE_CONFIG_H    -I. -Ijava -I/maat/heart/tbox/cvs-gcc/gcc/gcc -I/maat/heart/tbox/cvs-gcc/gcc/gcc/java -I/maat/heart/tbox/cvs-gcc/gcc/gcc/config -I/maat/heart/tbox/cvs-gcc/gcc/gcc/../include /maat/heart/tbox/cvs-gcc/gcc/gcc/java/jcf-dump.c -o java/jcf-dump.o
rm -f jcf-dump
stage1/xgcc -Bstage1/ -B/maat/heart/tbox/objs/i686-pc-linux-gnu/bin/ -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H  -o jcf-dump java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o java/zextract.o errors.o version.o mkdeps.o -L../zlib -lz   ../libiberty/libiberty.a
stage1/xgcc -Bstage1/ -B/maat/heart/tbox/objs/i686-pc-linux-gnu/bin/ -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I/maat/heart/tbox/cvs-gcc/gcc/gcc -I/maat/heart/tbox/cvs-gcc/gcc/gcc/. -I/maat/heart/tbox/cvs-gcc/gcc/gcc/config -I/maat/heart/tbox/cvs-gcc/gcc/gcc/../include -I/maat/heart/tbox/cvs-gcc/gcc/gcc/objc \
-c /maat/heart/tbox/cvs-gcc/gcc/gcc/objc/objc-lang.c -o objc-lang.o
stage1/xgcc -Bstage1/ -B/maat/heart/tbox/objs/i686-pc-linux-gnu/bin/ -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I/maat/heart/tbox/cvs-gcc/gcc/gcc -I/maat/heart/tbox/cvs-gcc/gcc/gcc/. -I/maat/heart/tbox/cvs-gcc/gcc/gcc/config -I/maat/heart/tbox/cvs-gcc/gcc/gcc/../include -I/maat/heart/tbox/cvs-gcc/gcc/gcc/objc \
-c /maat/heart/tbox/cvs-gcc/gcc/gcc/objc/objc-parse.c -o objc-parse.o
stage1/xgcc -Bstage1/ -B/maat/heart/tbox/objs/i686-pc-linux-gnu/bin/ -DIN_GCC    -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long  -DHAVE_CONFIG_H    -I. -I. -I/maat/heart/tbox/cvs-gcc/gcc/gcc -I/maat/heart/tbox/cvs-gcc/gcc/gcc/. -I/maat/heart/tbox/cvs-gcc/gcc/gcc/config -I/maat/heart/tbox/cvs-gcc/gcc/gcc/../include -I/maat/heart/tbox/cvs-gcc/gcc/gcc/objc \
-c /maat/heart/tbox/cvs-gcc/gcc/gcc/objc/objc-act.c
virtual memory exhausted: Cannot allocate memory
make[2]: *** [objc-act.o] Error 1
make[2]: Leaving directory `/maat/heart/tbox/native/build/gcc'
make[1]: *** [stage2_build] Error 2
make[1]: Leaving directory `/maat/heart/tbox/native/build/gcc'
make: *** [bootstrap] Error 2
+ '[' -s gcc/.bad_compare ']'
+ exit 1

I have already sent patch to solve this problem.

Zdenek

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-16 10:41                   ` Richard Henderson
  2002-05-16 11:42                     ` Zdenek Dvorak
  2002-05-16 13:00                     ` Zdenek Dvorak
@ 2002-05-17  4:53                     ` Jan Hubicka
  2002-05-19 14:40                       ` Zdenek Dvorak
  2 siblings, 1 reply; 33+ messages in thread
From: Jan Hubicka @ 2002-05-17  4:53 UTC (permalink / raw)
  To: Richard Henderson, Jan Hubicka, gcc-pdo, gcc-patches

> On Thu, May 16, 2002 at 08:24:36AM +0200, Zdenek Dvorak wrote:
> > I have removed as much as I found (but surely some of them remains;
> > I really am not able to find all in 16000 lines of patch, sorry).
> 
> Thanks.
> 
> > > Second, this test exists only to cut down the number of redundant
> > > tests.  Thus we are not interested in the actual ordering of the
> > > blocks, only that every block has a unique index.  Thus the original
> > > test is still correct.
> > 
> > I had two reasons for this:
> > 1) I wanted to keep semantics the same as before, in order to make bughunting
> > easier.
> > 2) It did not work other way (in cfg-branch; I didn't check this after
> > adapting the patch for mainline).
> 
> Hum.  I guess we can leave this for now, but I'm certain this
> will turn into a quadratic performance problem with some test
> case.  Please figure out how to address this.
> 
> I suspect that both here and in back_edge_of_syntactic_loop_p
> you can arrange for the block indicies to be monotonicaly 
> increasing.

I am happy to address these issues by incremental patch later.
I plan to do couple of similar fixes/cleanups and tweeks for
different part.
> Since I don't want to read through a patch of this size again,
> and none of the points above is critical to correctness, I've
> committed the patch as-is.

Great :)

Honza
> 
> 
> r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-16 15:30                       ` Richard Henderson
  2002-05-16 15:38                         ` Zdenek Dvorak
@ 2002-05-17  5:10                         ` Jan Hubicka
  1 sibling, 0 replies; 33+ messages in thread
From: Jan Hubicka @ 2002-05-17  5:10 UTC (permalink / raw)
  To: Richard Henderson, Jan Hubicka, gcc-pdo, gcc-patches

> On Thu, May 16, 2002 at 09:41:02PM +0200, Zdenek Dvorak wrote:
> > Sorry; I haven't tried to compile objc.
> 
> Arg!  I thought submission of the patch meant that it worked.

Oops, in cfg-branch development I required bootstrap of C compiler and was
fixing the bugs appearing in other bootstraps myself to speedup development.
Zdenek, for official tree, we need to follow the protocol exactly, see the
contributors WWW page.  I forgot to mention this, my fault.
> 
> > (iterative dataflow does not have to terminate for some initial
> > solutions, but without my patch gcc somehow (not quite sure how)
> > avoids them), but I hoped I fixed it already). 
> 
> Point me at the problem?

The iterative dataflow as it is used currently to update flow info is not
guarantered to terminate.  It is only for cases where the input sollution is
monotonically smaller than the final one, otherwise it can keep iterating.  I
was by hand going trought the transofrmation done in 3.1/3.2 tree at the time
we noticed the problem and suceeded to explain myself that all of them are
safe. (ie the input sollution is special case iteration will handle correctly).

I believe only case we run into loop (or may run) currently is disconnected
graph, so delete_unreachable_blocks will fix the problem.

However the infinite loop happends from time to time on cfg branch in updating
the GCSE liveness (thats why I didn't posted patch for mainline yet).  I was
reading trought the iterative dataflow papers and it looks like there is no way
to update the info exactly (ie find the optimal sollution this way), but it may
be possible (and easy) to detect the cycle by counting the number of set bits
for each pseudo and clean liveness of offending register when cycle apepars.
Then we will always terminate and find conservative sollution that may be
sollution for us.

I am not very faimilar with dataflow algorithms still, so I wanted to take
closer look after the finals before crying out false assumptions.

Honza
> 
> 
> r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-17  4:53                     ` Jan Hubicka
@ 2002-05-19 14:40                       ` Zdenek Dvorak
  2002-05-19 14:48                         ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-19 14:40 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Richard Henderson, gcc-pdo, gcc-patches

Hello.

This patch creates and keeps double linked list of basic blocks (without
using it for anything).

Bootstrapped/regtested on i686.

Zdenek Dvorak

Changelog:
	* basic_block.h (struct basic_block_def): Added prev_bb and next_bb fields.
	(FOR_BB_BETWEEN, FOR_ALL_BB, FOR_ALL_BB_REVERSE): New macros for
	traversing basic block chain.
	(create_basic_block_structure, create_basic_block): Declaration changed.
	(link_block, unlink_block): Declare.
	* cfg.c (entry_exit_blocks): Initialize new fields.
	(link_block, unlink_block): New.
	(expunge_block_nocompact): Unlink basic block.
	(dump_flow_info): Print prev_bb/next_bb fields.
	* cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Modified.
	* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Modified.
	* cfglayout.c (fixup_reorder_chain, cfg_layout_duplicate_bb): Modified.
	* cfgrtl.c (create_basic_block_structure, create_basic_block,
	split_block, force_nonfallthru_and_redirect, split_edge): Modified.
	(verify_flow_info): Check that list agrees with numbering.

Index: basic-block.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.143
diff -c -3 -p -r1.143 basic-block.h
*** basic-block.h	17 May 2002 02:31:26 -0000	1.143
--- basic-block.h	19 May 2002 20:13:00 -0000
*************** typedef struct basic_block_def {
*** 206,211 ****
--- 206,214 ----
    /* The index of this block.  */
    int index;
  
+   /* Previous and next blocks in the chain.  */
+   struct basic_block_def *prev_bb, *next_bb;
+ 
    /* The loop depth of this block.  */
    int loop_depth;
  
*************** extern varray_type basic_block_info;
*** 240,245 ****
--- 243,258 ----
  
  #define BASIC_BLOCK(N)  (VARRAY_BB (basic_block_info, (N)))
  
+ /* For iterating over basic blocks.  */
+ #define FOR_BB_BETWEEN(BB, FROM, TO, DIR) \
+   for (BB = FROM; BB != TO; BB = BB->DIR)
+ 
+ #define FOR_EACH_BB(BB) \
+   FOR_BB_BETWEEN (BB, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR, next_bb)
+ 
+ #define FOR_EACH_BB_REVERSE(BB) \
+   FOR_BB_BETWEEN (BB, EXIT_BLOCK_PTR->prev_bb, ENTRY_BLOCK_PTR, prev_bb)
+ 
  /* What registers are live at the setjmp call.  */
  
  extern regset regs_live_at_setjmp;
*************** extern void remove_edge			PARAMS ((edge)
*** 314,321 ****
  extern void redirect_edge_succ		PARAMS ((edge, basic_block));
  extern edge redirect_edge_succ_nodup	PARAMS ((edge, basic_block));
  extern void redirect_edge_pred		PARAMS ((edge, basic_block));
! extern basic_block create_basic_block_structure PARAMS ((int, rtx, rtx, rtx));
! extern basic_block create_basic_block	PARAMS ((int, rtx, rtx));
  extern int flow_delete_block		PARAMS ((basic_block));
  extern int flow_delete_block_noexpunge	PARAMS ((basic_block));
  extern void clear_bb_flags		PARAMS ((void));
--- 327,334 ----
  extern void redirect_edge_succ		PARAMS ((edge, basic_block));
  extern edge redirect_edge_succ_nodup	PARAMS ((edge, basic_block));
  extern void redirect_edge_pred		PARAMS ((edge, basic_block));
! extern basic_block create_basic_block_structure PARAMS ((int, rtx, rtx, rtx, basic_block));
! extern basic_block create_basic_block	PARAMS ((rtx, rtx, basic_block));
  extern int flow_delete_block		PARAMS ((basic_block));
  extern int flow_delete_block_noexpunge	PARAMS ((basic_block));
  extern void clear_bb_flags		PARAMS ((void));
*************** extern void debug_regset		PARAMS ((regse
*** 644,649 ****
--- 657,664 ----
  extern void allocate_reg_life_data      PARAMS ((void));
  extern void allocate_bb_life_data	PARAMS ((void));
  extern void expunge_block		PARAMS ((basic_block));
+ extern void link_block			PARAMS ((basic_block, basic_block));
+ extern void unlink_block		PARAMS ((basic_block));
  extern void expunge_block_nocompact	PARAMS ((basic_block));
  extern basic_block alloc_block		PARAMS ((void));
  extern void find_unreachable_blocks	PARAMS ((void));
Index: cfg.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 cfg.c
*** cfg.c	17 May 2002 02:31:27 -0000	1.26
--- cfg.c	19 May 2002 20:13:00 -0000
*************** struct basic_block_def entry_exit_blocks
*** 93,98 ****
--- 93,100 ----
      NULL,			/* global_live_at_end */
      NULL,			/* aux */
      ENTRY_BLOCK,		/* index */
+     NULL,			/* prev_bb */
+     EXIT_BLOCK_PTR,		/* next_bb */
      0,				/* loop_depth */
      0,				/* count */
      0,				/* frequency */
*************** struct basic_block_def entry_exit_blocks
*** 111,116 ****
--- 113,120 ----
      NULL,			/* global_live_at_end */
      NULL,			/* aux */
      EXIT_BLOCK,			/* index */
+     ENTRY_BLOCK_PTR,		/* prev_bb */
+     NULL,			/* next_bb */
      0,				/* loop_depth */
      0,				/* count */
      0,				/* frequency */
*************** alloc_block ()
*** 220,231 ****
--- 224,258 ----
    return bb;
  }
  
+ /* Link block B to chain after AFTER.  */
+ void
+ link_block (b, after)
+      basic_block b, after;
+ {
+   b->next_bb = after->next_bb;
+   b->prev_bb = after;
+   after->next_bb = b;
+   b->next_bb->prev_bb = b;
+ }
+   
+ /* Unlink block B from chain.  */
+ void
+ unlink_block (b)
+      basic_block b;
+ {
+   b->next_bb->prev_bb = b->prev_bb;
+   b->prev_bb->next_bb = b->next_bb;
+ }
+   
+ 
  /* Remove block B from the basic block array and compact behind it.  */
  
  void
  expunge_block_nocompact (b)
       basic_block b;
  {
+   unlink_block (b);
+ 
    /* Invalidate data to make bughunting easier.  */
    memset (b, 0, sizeof *b);
    b->index = -3;
*************** dump_flow_info (file)
*** 521,526 ****
--- 548,555 ----
  
        fprintf (file, "\nBasic block %d: first insn %d, last %d, ",
  	       i, INSN_UID (bb->head), INSN_UID (bb->end));
+       fprintf (file, "prev %d, next %d, ",
+ 	       bb->prev_bb->index, bb->next_bb->index);
        fprintf (file, "loop_depth %d, count ", bb->loop_depth);
        fprintf (file, HOST_WIDEST_INT_PRINT_DEC, bb->count);
        fprintf (file, ", freq %i.\n", bb->frequency);
Index: cfgbuild.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 cfgbuild.c
*** cfgbuild.c	17 May 2002 02:31:27 -0000	1.15
--- cfgbuild.c	19 May 2002 20:13:00 -0000
*************** find_basic_blocks_1 (f)
*** 476,481 ****
--- 476,482 ----
    rtx trll = NULL_RTX;
    rtx head = NULL_RTX;
    rtx end = NULL_RTX;
+   basic_block prev = ENTRY_BLOCK_PTR;
  
    /* We process the instructions in a slightly different way than we did
       previously.  This is so that we see a NOTE_BASIC_BLOCK after we have
*************** find_basic_blocks_1 (f)
*** 492,498 ****
        if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER)
  	  && head)
  	{
! 	  create_basic_block_structure (i++, head, end, bb_note);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
--- 493,499 ----
        if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER)
  	  && head)
  	{
! 	  prev = create_basic_block_structure (i++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
*************** find_basic_blocks_1 (f)
*** 506,512 ****
  
        if (head && control_flow_insn_p (insn))
  	{
! 	  create_basic_block_structure (i++, head, end, bb_note);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
--- 507,513 ----
  
        if (head && control_flow_insn_p (insn))
  	{
! 	  prev = create_basic_block_structure (i++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
*************** find_basic_blocks_1 (f)
*** 588,594 ****
      }
  
    if (head != NULL_RTX)
!     create_basic_block_structure (i++, head, end, bb_note);
    else if (bb_note)
      delete_insn (bb_note);
  
--- 589,595 ----
      }
  
    if (head != NULL_RTX)
!     create_basic_block_structure (i++, head, end, bb_note, prev);
    else if (bb_note)
      delete_insn (bb_note);
  
*************** find_basic_blocks (f, nregs, file)
*** 633,638 ****
--- 634,641 ----
      }
  
    n_basic_blocks = count_basic_blocks (f);
+   ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
+   EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
  
    /* Size the basic block table.  The actual structures will be allocated
       by find_basic_blocks_1, since we want to keep the structure pointers
Index: cfgcleanup.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.55
diff -c -3 -p -r1.55 cfgcleanup.c
*** cfgcleanup.c	17 May 2002 02:31:28 -0000	1.55
--- cfgcleanup.c	19 May 2002 20:13:00 -0000
*************** merge_blocks_move_predecessor_nojumps (a
*** 723,728 ****
--- 723,731 ----
    a->index = b->index;
    b->index = index;
  
+   unlink_block (a);
+   link_block (a, b->prev_bb);
+ 
    /* Now blocks A and B are contiguous.  Merge them.  */
    merge_blocks_nomove (a, b);
  }
Index: cfglayout.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 cfglayout.c
*** cfglayout.c	17 May 2002 02:31:28 -0000	1.13
--- cfglayout.c	19 May 2002 20:13:00 -0000
*************** scope_to_insns_finalize ()
*** 357,363 ****
  static void
  fixup_reorder_chain ()
  {
!   basic_block bb;
    int index;
    rtx insn = NULL;
  
--- 357,363 ----
  static void
  fixup_reorder_chain ()
  {
!   basic_block bb, prev_bb;
    int index;
    rtx insn = NULL;
  
*************** fixup_reorder_chain ()
*** 541,551 ****
  	}
      }
  
!   for (bb = BASIC_BLOCK (0), index = 0; bb; bb = RBI (bb)->next, index ++)
      {
        bb->index = index;
        BASIC_BLOCK (index) = bb;
      }
  }
  \f
  /* Perform sanity checks on the insn chain.
--- 541,560 ----
  	}
      }
  
!   prev_bb = ENTRY_BLOCK_PTR;
!   bb = BASIC_BLOCK (0);
!   index = 0;
! 
!   for (; bb; prev_bb = bb, bb = RBI (bb)->next, index ++)
      {
        bb->index = index;
        BASIC_BLOCK (index) = bb;
+ 
+       bb->prev_bb = prev_bb;
+       prev_bb->next_bb = bb;
      }
+   prev_bb->next_bb = EXIT_BLOCK_PTR;
+   EXIT_BLOCK_PTR->prev_bb = prev_bb;
  }
  \f
  /* Perform sanity checks on the insn chain.
*************** cfg_layout_duplicate_bb (bb, e)
*** 871,878 ****
  #endif
  
    insn = duplicate_insn_chain (bb->head, bb->end);
!   new_bb = create_basic_block (n_basic_blocks, insn,
! 		 	       insn ? get_last_insn () : NULL);
    alloc_aux_for_block (new_bb, sizeof (struct reorder_block_def));
  
    if (RBI (bb)->header)
--- 880,888 ----
  #endif
  
    insn = duplicate_insn_chain (bb->head, bb->end);
!   new_bb = create_basic_block (insn,
! 		 	       insn ? get_last_insn () : NULL,
! 			       EXIT_BLOCK_PTR->prev_bb);
    alloc_aux_for_block (new_bb, sizeof (struct reorder_block_def));
  
    if (RBI (bb)->header)
Index: cfgrtl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 cfgrtl.c
*** cfgrtl.c	17 May 2002 02:31:28 -0000	1.47
--- cfgrtl.c	19 May 2002 20:13:01 -0000
*************** delete_insn_chain_and_edges (first, last
*** 248,259 ****
     the note and basic block struct in BB_NOTE, if any and do not grow
     BASIC_BLOCK chain and should be used directly only by CFG construction code.
     END can be NULL in to create new empty basic block before HEAD.  Both END
!    and HEAD can be NULL to create basic block at the end of INSN chain.  */
  
  basic_block
! create_basic_block_structure (index, head, end, bb_note)
       int index;
       rtx head, end, bb_note;
  {
    basic_block bb;
  
--- 248,261 ----
     the note and basic block struct in BB_NOTE, if any and do not grow
     BASIC_BLOCK chain and should be used directly only by CFG construction code.
     END can be NULL in to create new empty basic block before HEAD.  Both END
!    and HEAD can be NULL to create basic block at the end of INSN chain.
!    AFTER is the basic block we should be put after.  */
  
  basic_block
! create_basic_block_structure (index, head, end, bb_note, after)
       int index;
       rtx head, end, bb_note;
+      basic_block after;
  {
    basic_block bb;
  
*************** create_basic_block_structure (index, hea
*** 311,316 ****
--- 313,319 ----
    bb->end = end;
    bb->index = index;
    bb->flags = BB_NEW;
+   link_block (bb, after);
    BASIC_BLOCK (index) = bb;
    if (basic_block_for_insn)
      update_bb_for_insn (bb);
*************** create_basic_block_structure (index, hea
*** 323,339 ****
  }
  
  /* Create new basic block consisting of instructions in between HEAD and END
!    and place it to the BB chain at position INDEX.  END can be NULL in to
     create new empty basic block before HEAD.  Both END and HEAD can be NULL to
     create basic block at the end of INSN chain.  */
  
  basic_block
! create_basic_block (index, head, end)
!      int index;
       rtx head, end;
  {
    basic_block bb;
    int i;
  
    /* Place the new block just after the block being split.  */
    VARRAY_GROW (basic_block_info, ++n_basic_blocks);
--- 326,343 ----
  }
  
  /* Create new basic block consisting of instructions in between HEAD and END
!    and place it to the BB chain after block AFTER.  END can be NULL in to
     create new empty basic block before HEAD.  Both END and HEAD can be NULL to
     create basic block at the end of INSN chain.  */
  
  basic_block
! create_basic_block (head, end, after)
       rtx head, end;
+      basic_block after;
  {
    basic_block bb;
    int i;
+   int index = after->index + 1;
  
    /* Place the new block just after the block being split.  */
    VARRAY_GROW (basic_block_info, ++n_basic_blocks);
*************** create_basic_block (index, head, end)
*** 349,355 ****
        tmp->index = i;
      }
  
!   bb = create_basic_block_structure (index, head, end, NULL);
    bb->aux = NULL;
    return bb;
  }
--- 353,359 ----
        tmp->index = i;
      }
  
!   bb = create_basic_block_structure (index, head, end, NULL, after);
    bb->aux = NULL;
    return bb;
  }
*************** split_block (bb, insn)
*** 537,543 ****
      return 0;
  
    /* Create the new basic block.  */
!   new_bb = create_basic_block (bb->index + 1, NEXT_INSN (insn), bb->end);
    new_bb->count = bb->count;
    new_bb->frequency = bb->frequency;
    new_bb->loop_depth = bb->loop_depth;
--- 541,547 ----
      return 0;
  
    /* Create the new basic block.  */
!   new_bb = create_basic_block (NEXT_INSN (insn), bb->end, bb);
    new_bb->count = bb->count;
    new_bb->frequency = bb->frequency;
    new_bb->loop_depth = bb->loop_depth;
*************** force_nonfallthru_and_redirect (e, targe
*** 998,1004 ****
        /* We can't redirect the entry block.  Create an empty block at the
           start of the function which we use to add the new jump.  */
        edge *pe1;
!       basic_block bb = create_basic_block (0, e->dest->head, NULL);
  
        /* Change the existing edge's source to be the new block, and add
  	 a new edge from the entry block to the new block.  */
--- 1002,1008 ----
        /* We can't redirect the entry block.  Create an empty block at the
           start of the function which we use to add the new jump.  */
        edge *pe1;
!       basic_block bb = create_basic_block (e->dest->head, NULL, ENTRY_BLOCK_PTR);
  
        /* Change the existing edge's source to be the new block, and add
  	 a new edge from the entry block to the new block.  */
*************** force_nonfallthru_and_redirect (e, targe
*** 1019,1025 ****
        /* Create the new structures.  */
        note = last_loop_beg_note (e->src->end);
        jump_block
! 	= create_basic_block (e->src->index + 1, NEXT_INSN (note), NULL);
        jump_block->count = e->count;
        jump_block->frequency = EDGE_FREQUENCY (e);
        jump_block->loop_depth = target->loop_depth;
--- 1023,1029 ----
        /* Create the new structures.  */
        note = last_loop_beg_note (e->src->end);
        jump_block
! 	= create_basic_block (NEXT_INSN (note), NULL, e->src);
        jump_block->count = e->count;
        jump_block->frequency = EDGE_FREQUENCY (e);
        jump_block->loop_depth = target->loop_depth;
*************** split_edge (edge_in)
*** 1286,1293 ****
    else
      before = NULL_RTX;
  
!   bb = create_basic_block (edge_in->dest == EXIT_BLOCK_PTR ? n_basic_blocks
! 			   : edge_in->dest->index, before, NULL);
    bb->count = edge_in->count;
    bb->frequency = EDGE_FREQUENCY (edge_in);
  
--- 1290,1296 ----
    else
      before = NULL_RTX;
  
!   bb = create_basic_block (before, NULL, edge_in->dest->prev_bb);
    bb->count = edge_in->count;
    bb->frequency = EDGE_FREQUENCY (edge_in);
  
*************** verify_flow_info ()
*** 1719,1729 ****
--- 1722,1769 ----
    size_t *edge_checksum;
    rtx x;
    int i, last_bb_num_seen, num_bb_notes, err = 0;
+   basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
    last_visited = (basic_block *) xcalloc (n_basic_blocks + 2,
  					  sizeof (basic_block));
    edge_checksum = (size_t *) xcalloc (n_basic_blocks + 2, sizeof (size_t));
+ 
+   /* Check bb chain & numbers.  */
+   last_bb_seen = ENTRY_BLOCK_PTR;
+   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb, NULL, next_bb)
+     {
+       if (bb != EXIT_BLOCK_PTR
+ 	  && bb != BASIC_BLOCK (bb->index))
+ 	{
+ 	  error ("bb %d on wrong place", bb->index);
+ 	  err = 1;
+ 	}
+ 
+       if (bb->prev_bb != last_bb_seen)
+ 	{
+ 	  error ("prev_bb of %d should be %d, not %d",
+ 		 bb->index, last_bb_seen->index, bb->prev_bb->index);
+ 	  err = 1;
+ 	}
+ 
+       /* For now, also check that we didn't change the order.  */
+       if (bb != EXIT_BLOCK_PTR && bb->index != last_bb_seen->index + 1)
+ 	{
+ 	  error ("Wrong order of blocks %d and %d",
+ 		 last_bb_seen->index, bb->index);
+ 	  err = 1;
+ 	}
+ 
+       if (bb == EXIT_BLOCK_PTR && last_bb_seen->index != n_basic_blocks - 1)
+ 	{
+ 	  error ("Only %d of %d blocks in chain",
+ 		 last_bb_seen->index + 1, n_basic_blocks);
+ 	  err = 1;
+ 	}
+ 
+       last_bb_seen = bb;
+     }
  
    for (i = n_basic_blocks - 1; i >= 0; i--)
      {

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-19 14:40                       ` Zdenek Dvorak
@ 2002-05-19 14:48                         ` Richard Henderson
  2002-05-19 15:13                           ` Zdenek Dvorak
  0 siblings, 1 reply; 33+ messages in thread
From: Richard Henderson @ 2002-05-19 14:48 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Sun, May 19, 2002 at 11:33:05PM +0200, Zdenek Dvorak wrote:
> 	* basic_block.h (struct basic_block_def): Added prev_bb and next_bb fields.
> 	(FOR_BB_BETWEEN, FOR_ALL_BB, FOR_ALL_BB_REVERSE): New macros for
> 	traversing basic block chain.
> 	(create_basic_block_structure, create_basic_block): Declaration changed.
> 	(link_block, unlink_block): Declare.
> 	* cfg.c (entry_exit_blocks): Initialize new fields.
> 	(link_block, unlink_block): New.
> 	(expunge_block_nocompact): Unlink basic block.
> 	(dump_flow_info): Print prev_bb/next_bb fields.
> 	* cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Modified.
> 	* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Modified.
> 	* cfglayout.c (fixup_reorder_chain, cfg_layout_duplicate_bb): Modified.
> 	* cfgrtl.c (create_basic_block_structure, create_basic_block,
> 	split_block, force_nonfallthru_and_redirect, split_edge): Modified.
> 	(verify_flow_info): Check that list agrees with numbering.

Ok.

Thanks for splitting this up.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-19 14:48                         ` Richard Henderson
@ 2002-05-19 15:13                           ` Zdenek Dvorak
  2002-05-19 16:56                             ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-19 15:13 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

GRRR...  I have regtested wrong gcc; if you didn't already, do not commit this.

Zdenek

> > 	* basic_block.h (struct basic_block_def): Added prev_bb and next_bb fields.
> > 	(FOR_BB_BETWEEN, FOR_ALL_BB, FOR_ALL_BB_REVERSE): New macros for
> > 	traversing basic block chain.
> > 	(create_basic_block_structure, create_basic_block): Declaration changed.
> > 	(link_block, unlink_block): Declare.
> > 	* cfg.c (entry_exit_blocks): Initialize new fields.
> > 	(link_block, unlink_block): New.
> > 	(expunge_block_nocompact): Unlink basic block.
> > 	(dump_flow_info): Print prev_bb/next_bb fields.
> > 	* cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Modified.
> > 	* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Modified.
> > 	* cfglayout.c (fixup_reorder_chain, cfg_layout_duplicate_bb): Modified.
> > 	* cfgrtl.c (create_basic_block_structure, create_basic_block,
> > 	split_block, force_nonfallthru_and_redirect, split_edge): Modified.
> > 	(verify_flow_info): Check that list agrees with numbering.
> 
> Ok.
> 
> Thanks for splitting this up.
> 
> 
> r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal
  2002-05-19 15:13                           ` Zdenek Dvorak
@ 2002-05-19 16:56                             ` Richard Henderson
  2002-05-19 18:50                               ` Basic block renumbering removal, part 2 Zdenek Dvorak
  0 siblings, 1 reply; 33+ messages in thread
From: Richard Henderson @ 2002-05-19 16:56 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Mon, May 20, 2002 at 12:00:21AM +0200, Zdenek Dvorak wrote:
> GRRR...  I have regtested wrong gcc;

Oops.

> if you didn't already, do not commit this.

I wasn't going to.  You have write-access now after all.  ;-)


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Basic block renumbering removal, part 2
  2002-05-19 16:56                             ` Richard Henderson
@ 2002-05-19 18:50                               ` Zdenek Dvorak
  2002-05-20 20:10                                 ` Richard Henderson
  2002-05-22 13:43                                 ` Basic block renumbering removal, part 3 Zdenek Dvorak
  0 siblings, 2 replies; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-19 18:50 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

This patch makes us to
 * use prev_bb/next_bb to get to neighbouring basic blocks
 * use ENTRY_BLOCK_PTR->next_bb instead of BASIC_BLOCK (0)
 * use EXIT_BLOCK_PTR->prev_bb instead of BASIC_BLOCK (n_basic_blocks - 1)

Bootstrapped/regtested on i686.

Zdenek Dvorak

Changelog:
	* bb-reorder.c (make_reorder_chain_1): Modified.
	* cfganal.c (can_fallthru, flow_call_edges_add,
	flow_preorder_transversal_compute): Modified.
	* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
	find_sub_basic_blocks): Modified.
	* cfgcleanup.c (try_simplify_condjump, try_optimize_cfg): Modified.
	* cfglayout.c (skip_insns_after_block, fixup_reorder_chain,
	fixup_fallthru_exit_predecessor, cfg_layout_redirect_edge): Modified.
	* cfgrtl.c (tidy_fallthru_edges, verify_flow_info): Modified.
	* combine.c (this_basic_block): Type changed to basic_block.
	(combine_instructions, set_nonzero_bits_and_sign_copies, try_combine,
	nonzero_bits, num_sign_bit_copies, get_last_value_validate,
	get_last_value, distribute_notes, distribute_links): Modified.
	* final.c (compute_alignments): Modified.
	* flow.c (regno_uninitialized, regno_clobbered_at_setjmp): Modified.
	* function.c (thread_prologue_and_epilogue_insns): Modified.
	* gcse.c (compute_code_hoist_vbeinout): Modified.
	* global.c (build_insn_chain): Modified.
	* ifcvt.c (find_if_block, find_cond_trap): Modified.
	* predict.c (last_basic_block_p, note_prediction_to_br_prob): Modified.
	* regmove.c (regmove_optimize): Modified.
	* resource.c (find_basic_block): Modified.
	* sched-ebb.c (schedule_ebbs): Modified.
	* ssa-dce.c (find_control_dependence, find_pdom): Modified.

Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.46
diff -c -3 -p -r1.46 bb-reorder.c
*** bb-reorder.c	17 May 2002 02:31:27 -0000	1.46
--- bb-reorder.c	20 May 2002 00:45:11 -0000
*************** make_reorder_chain_1 (bb, prev)
*** 158,164 ****
   restart:
        RBI (prev)->next = bb;
  
!       if (rtl_dump_file && prev->index + 1 != bb->index)
  	fprintf (rtl_dump_file, "Reordering block %d after %d\n",
  		 bb->index, prev->index);
      }
--- 158,164 ----
   restart:
        RBI (prev)->next = bb;
  
!       if (rtl_dump_file && prev->next_bb != bb)
  	fprintf (rtl_dump_file, "Reordering block %d after %d\n",
  		 bb->index, prev->index);
      }
*************** make_reorder_chain_1 (bb, prev)
*** 214,220 ****
    if (! next)
      {
        for (e = bb->succ; e ; e = e->succ_next)
! 	if (e->dest->index == bb->index + 1)
  	  {
  	    if ((e->flags & EDGE_FALLTHRU)
  	        || (e->dest->succ
--- 214,220 ----
    if (! next)
      {
        for (e = bb->succ; e ; e = e->succ_next)
! 	if (e->dest == bb->next_bb)
  	  {
  	    if ((e->flags & EDGE_FALLTHRU)
  	        || (e->dest->succ
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 cfganal.c
*** cfganal.c	17 May 2002 02:31:27 -0000	1.20
--- cfganal.c	20 May 2002 00:45:12 -0000
*************** can_fallthru (src, target)
*** 87,93 ****
    rtx insn = src->end;
    rtx insn2 = target->head;
  
!   if (src->index + 1 != target->index)
      return 0;
  
    if (!active_insn_p (insn2))
--- 87,93 ----
    rtx insn = src->end;
    rtx insn2 = target->head;
  
!   if (src->next_bb != target)
      return 0;
  
    if (!active_insn_p (insn2))
*************** flow_call_edges_add (blocks)
*** 296,302 ****
       Handle this by adding a dummy instruction in a new last basic block.  */
    if (check_last_block)
      {
!       basic_block bb = BASIC_BLOCK (n_basic_blocks - 1);
        rtx insn = bb->end;
  
        /* Back up past insns that must be kept in the same block as a call.  */
--- 296,302 ----
       Handle this by adding a dummy instruction in a new last basic block.  */
    if (check_last_block)
      {
!       basic_block bb = EXIT_BLOCK_PTR->prev_bb;
        rtx insn = bb->end;
  
        /* Back up past insns that must be kept in the same block as a call.  */
*************** flow_preorder_transversal_compute (pot_o
*** 1088,1094 ****
       walking the tree from right to left.  */
  
    i = 0;
!   node = &dfst[0];
    pot_order[i++] = 0;
  
    while (node)
--- 1088,1094 ----
       walking the tree from right to left.  */
  
    i = 0;
!   node = &dfst[ENTRY_BLOCK_PTR->next_bb->index];
    pot_order[i++] = 0;
  
    while (node)
Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 cfgbuild.c
*** cfgbuild.c	19 May 2002 22:25:48 -0000	1.16
--- cfgbuild.c	20 May 2002 00:45:12 -0000
*************** Software Foundation, 59 Temple Place - S
*** 50,56 ****
  static int count_basic_blocks		PARAMS ((rtx));
  static void find_basic_blocks_1		PARAMS ((rtx));
  static rtx find_label_refs		PARAMS ((rtx, rtx));
! static void make_edges			PARAMS ((rtx, int, int, int));
  static void make_label_edge		PARAMS ((sbitmap *, basic_block,
  						 rtx, int));
  static void make_eh_edge		PARAMS ((sbitmap *, basic_block, rtx));
--- 50,57 ----
  static int count_basic_blocks		PARAMS ((rtx));
  static void find_basic_blocks_1		PARAMS ((rtx));
  static rtx find_label_refs		PARAMS ((rtx, rtx));
! static void make_edges			PARAMS ((rtx, basic_block,
! 						 basic_block, int));
  static void make_label_edge		PARAMS ((sbitmap *, basic_block,
  						 rtx, int));
  static void make_eh_edge		PARAMS ((sbitmap *, basic_block, rtx));
*************** make_eh_edge (edge_cache, src, insn)
*** 280,286 ****
  static void
  make_edges (label_value_list, min, max, update_p)
       rtx label_value_list;
!      int min, max, update_p;
  {
    int i;
    sbitmap *edge_cache = NULL;
--- 281,288 ----
  static void
  make_edges (label_value_list, min, max, update_p)
       rtx label_value_list;
!      basic_block min, max;
!      int update_p;
  {
    int i;
    sbitmap *edge_cache = NULL;
*************** make_edges (label_value_list, min, max, 
*** 297,303 ****
        sbitmap_vector_zero (edge_cache, n_basic_blocks);
  
        if (update_p)
! 	for (i = min; i <= max; ++i)
  	  {
  	    edge e;
  
--- 299,305 ----
        sbitmap_vector_zero (edge_cache, n_basic_blocks);
  
        if (update_p)
! 	for (i = min->index; i <= max->index; ++i)
  	  {
  	    edge e;
  
*************** make_edges (label_value_list, min, max, 
*** 308,318 ****
      }
  
    /* By nature of the way these get numbered, block 0 is always the entry.  */
!   if (min == 0)
!     cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, BASIC_BLOCK (0),
  		      EDGE_FALLTHRU);
  
!   for (i = min; i <= max; ++i)
      {
        basic_block bb = BASIC_BLOCK (i);
        rtx insn, x;
--- 310,320 ----
      }
  
    /* By nature of the way these get numbered, block 0 is always the entry.  */
!   if (min == ENTRY_BLOCK_PTR->next_bb)
!     cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min,
  		      EDGE_FALLTHRU);
  
!   for (i = min->index; i <= max->index; ++i)
      {
        basic_block bb = BASIC_BLOCK (i);
        rtx insn, x;
*************** make_edges (label_value_list, min, max, 
*** 443,458 ****
  
        /* Find out if we can drop through to the next block.  */
        insn = next_nonnote_insn (insn);
!       if (!insn || (i + 1 == n_basic_blocks && force_fallthru))
  	cached_make_edge (edge_cache, bb, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
!       else if (i + 1 < n_basic_blocks)
  	{
! 	  rtx tmp = BLOCK_HEAD (i + 1);
  	  if (GET_CODE (tmp) == NOTE)
  	    tmp = next_nonnote_insn (tmp);
  	  if (force_fallthru || insn == tmp)
! 	    cached_make_edge (edge_cache, bb, BASIC_BLOCK (i + 1),
! 			      EDGE_FALLTHRU);
  	}
      }
  
--- 445,459 ----
  
        /* Find out if we can drop through to the next block.  */
        insn = next_nonnote_insn (insn);
!       if (!insn || (bb->next_bb == EXIT_BLOCK_PTR && force_fallthru))
  	cached_make_edge (edge_cache, bb, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
!       else if (bb->next_bb != EXIT_BLOCK_PTR)
  	{
! 	  rtx tmp = bb->next_bb->head;
  	  if (GET_CODE (tmp) == NOTE)
  	    tmp = next_nonnote_insn (tmp);
  	  if (force_fallthru || insn == tmp)
! 	    cached_make_edge (edge_cache, bb, bb->next_bb, EDGE_FALLTHRU);
  	}
      }
  
*************** find_basic_blocks (f, nregs, file)
*** 664,670 ****
    compute_bb_for_insn (max_uid);
  
    /* Discover the edges of our cfg.  */
!   make_edges (label_value_list, 0, n_basic_blocks - 1, 0);
  
    /* Do very simple cleanup now, for the benefit of code that runs between
       here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns.  */
--- 665,671 ----
    compute_bb_for_insn (max_uid);
  
    /* Discover the edges of our cfg.  */
!   make_edges (label_value_list, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR->prev_bb, 0);
  
    /* Do very simple cleanup now, for the benefit of code that runs between
       here and cleanup_cfg, e.g. thread_prologue_and_epilogue_insns.  */
*************** find_many_sub_basic_blocks (blocks)
*** 815,821 ****
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, min, max, 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
--- 816,822 ----
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
*************** find_sub_basic_blocks (bb)
*** 852,867 ****
  {
    int i;
    int min, max;
!   basic_block next = (bb->index == n_basic_blocks - 1
! 		      ? NULL : BASIC_BLOCK (bb->index + 1));
  
    min = bb->index;
    find_bb_boundaries (bb);
!   max = (next ? next->index : n_basic_blocks) - 1;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, min, max, 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
--- 853,867 ----
  {
    int i;
    int min, max;
!   basic_block next = bb->next_bb;
  
    min = bb->index;
    find_bb_boundaries (bb);
!   max = next->prev_bb->index;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.56
diff -c -3 -p -r1.56 cfgcleanup.c
*** cfgcleanup.c	19 May 2002 22:25:48 -0000	1.56
--- cfgcleanup.c	20 May 2002 00:45:12 -0000
*************** try_simplify_condjump (cbranch_block)
*** 147,153 ****
       unconditional jump.  */
    jump_block = cbranch_fallthru_edge->dest;
    if (jump_block->pred->pred_next
!       || jump_block->index == n_basic_blocks - 1
        || !FORWARDER_BLOCK_P (jump_block))
      return false;
    jump_dest_block = jump_block->succ->dest;
--- 147,153 ----
       unconditional jump.  */
    jump_block = cbranch_fallthru_edge->dest;
    if (jump_block->pred->pred_next
!       || jump_block->next_bb == EXIT_BLOCK_PTR
        || !FORWARDER_BLOCK_P (jump_block))
      return false;
    jump_dest_block = jump_block->succ->dest;
*************** try_optimize_cfg (mode)
*** 1615,1621 ****
  	      /* Delete trivially dead basic blocks.  */
  	      while (b->pred == NULL)
  		{
! 		  c = BASIC_BLOCK (b->index - 1);
  		  if (rtl_dump_file)
  		    fprintf (rtl_dump_file, "Deleting block %i.\n",
  			     b->index);
--- 1615,1621 ----
  	      /* Delete trivially dead basic blocks.  */
  	      while (b->pred == NULL)
  		{
! 		  c = b->prev_bb;
  		  if (rtl_dump_file)
  		    fprintf (rtl_dump_file, "Deleting block %i.\n",
  			     b->index);
*************** try_optimize_cfg (mode)
*** 1669,1675 ****
  			     "Deleting fallthru block %i.\n",
  			     b->index);
  
! 		  c = BASIC_BLOCK (b->index ? b->index - 1 : 1);
  		  redirect_edge_succ_nodup (b->pred, b->succ->dest);
  		  flow_delete_block (b);
  		  changed = true;
--- 1669,1675 ----
  			     "Deleting fallthru block %i.\n",
  			     b->index);
  
! 		  c = b->prev_bb == ENTRY_BLOCK_PTR ? b->next_bb : b->prev_bb;
  		  redirect_edge_succ_nodup (b->pred, b->succ->dest);
  		  flow_delete_block (b);
  		  changed = true;
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.14
diff -c -3 -p -r1.14 cfglayout.c
*** cfglayout.c	19 May 2002 22:25:49 -0000	1.14
--- cfglayout.c	20 May 2002 00:45:12 -0000
*************** skip_insns_after_block (bb)
*** 86,93 ****
    rtx insn, last_insn, next_head, prev;
  
    next_head = NULL_RTX;
!   if (bb->index + 1 != n_basic_blocks)
!     next_head = BASIC_BLOCK (bb->index + 1)->head;
  
    for (last_insn = insn = bb->end; (insn = NEXT_INSN (insn)) != 0; )
      {
--- 86,93 ----
    rtx insn, last_insn, next_head, prev;
  
    next_head = NULL_RTX;
!   if (bb->next_bb != EXIT_BLOCK_PTR)
!     next_head = bb->next_bb->head;
  
    for (last_insn = insn = bb->end; (insn = NEXT_INSN (insn)) != 0; )
      {
*************** fixup_reorder_chain ()
*** 364,370 ****
    /* First do the bulk reordering -- rechain the blocks without regard to
       the needed changes to jumps and labels.  */
  
!   for (bb = BASIC_BLOCK (0), index = 0;
         bb != 0;
         bb = RBI (bb)->next, index++)
      {
--- 364,370 ----
    /* First do the bulk reordering -- rechain the blocks without regard to
       the needed changes to jumps and labels.  */
  
!   for (bb = ENTRY_BLOCK_PTR->next_bb, index = 0;
         bb != 0;
         bb = RBI (bb)->next, index++)
      {
*************** fixup_reorder_chain ()
*** 412,418 ****
    /* Now add jumps and labels as needed to match the blocks new
       outgoing edges.  */
  
!   for (bb = BASIC_BLOCK (0); bb ; bb = RBI (bb)->next)
      {
        edge e_fall, e_taken, e;
        rtx bb_end_insn;
--- 412,418 ----
    /* Now add jumps and labels as needed to match the blocks new
       outgoing edges.  */
  
!   for (bb = ENTRY_BLOCK_PTR->next_bb; bb ; bb = RBI (bb)->next)
      {
        edge e_fall, e_taken, e;
        rtx bb_end_insn;
*************** fixup_reorder_chain ()
*** 527,533 ****
    if (rtl_dump_file)
      {
        fprintf (rtl_dump_file, "Reordered sequence:\n");
!       for (bb = BASIC_BLOCK (0), index = 0; bb; bb = RBI (bb)->next, index ++)
  	{
  	  fprintf (rtl_dump_file, " %i ", index);
  	  if (RBI (bb)->original)
--- 527,533 ----
    if (rtl_dump_file)
      {
        fprintf (rtl_dump_file, "Reordered sequence:\n");
!       for (bb = ENTRY_BLOCK_PTR->next_bb, index = 0; bb; bb = RBI (bb)->next, index ++)
  	{
  	  fprintf (rtl_dump_file, " %i ", index);
  	  if (RBI (bb)->original)
*************** fixup_reorder_chain ()
*** 542,548 ****
      }
  
    prev_bb = ENTRY_BLOCK_PTR;
!   bb = BASIC_BLOCK (0);
    index = 0;
  
    for (; bb; prev_bb = bb, bb = RBI (bb)->next, index ++)
--- 542,548 ----
      }
  
    prev_bb = ENTRY_BLOCK_PTR;
!   bb = ENTRY_BLOCK_PTR->next_bb;
    index = 0;
  
    for (; bb; prev_bb = bb, bb = RBI (bb)->next, index ++)
*************** cleanup_unconditional_jumps ()
*** 611,617 ****
  	  rtx insn;
  	  if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb) && i)
  	    {
! 	      basic_block prev = BASIC_BLOCK (--i);
  
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
--- 611,619 ----
  	  rtx insn;
  	  if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb) && i)
  	    {
! 	      basic_block prev = bb->prev_bb;
! 
! 	      i--;
  
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
*************** fixup_fallthru_exit_predecessor ()
*** 672,678 ****
  
    if (bb && RBI (bb)->next)
      {
!       basic_block c = BASIC_BLOCK (0);
  
        while (RBI (c)->next != bb)
  	c = RBI (c)->next;
--- 674,680 ----
  
    if (bb && RBI (bb)->next)
      {
!       basic_block c = ENTRY_BLOCK_PTR->next_bb;
  
        while (RBI (c)->next != bb)
  	c = RBI (c)->next;
*************** cfg_layout_redirect_edge (e, dest)
*** 822,835 ****
       edge e;
       basic_block dest;
  {
-   int old_index = dest->index;
    basic_block src = e->src;
  
    /* Redirect_edge_and_branch may decide to turn branch into fallthru edge
       in the case the basic block appears to be in sequence.  Avoid this
       transformation.  */
  
!   dest->index = n_basic_blocks + 1;
    if (e->flags & EDGE_FALLTHRU)
      {
        /* In case we are redirecting fallthru edge to the branch edge
--- 824,837 ----
       edge e;
       basic_block dest;
  {
    basic_block src = e->src;
+   basic_block old_next_bb = src->next_bb;
  
    /* Redirect_edge_and_branch may decide to turn branch into fallthru edge
       in the case the basic block appears to be in sequence.  Avoid this
       transformation.  */
  
!   src->next_bb = NULL;
    if (e->flags & EDGE_FALLTHRU)
      {
        /* In case we are redirecting fallthru edge to the branch edge
*************** cfg_layout_redirect_edge (e, dest)
*** 855,861 ****
        delete_barrier (NEXT_INSN (src->end));
        src->succ->flags |= EDGE_FALLTHRU;
      }
!   dest->index = old_index;
  }
  
  /* Create an duplicate of the basic block BB and redirect edge E into it.  */
--- 857,863 ----
        delete_barrier (NEXT_INSN (src->end));
        src->succ->flags |= EDGE_FALLTHRU;
      }
!   src->next_bb = old_next_bb;
  }
  
  /* Create an duplicate of the basic block BB and redirect edge E into it.  */
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 cfgrtl.c
*** cfgrtl.c	19 May 2002 22:25:49 -0000	1.48
--- cfgrtl.c	20 May 2002 00:45:12 -0000
*************** tidy_fallthru_edges ()
*** 1172,1179 ****
  
    for (i = 1; i < n_basic_blocks; i++)
      {
-       basic_block b = BASIC_BLOCK (i - 1);
        basic_block c = BASIC_BLOCK (i);
        edge s;
  
        /* We care about simple conditional or unconditional jumps with
--- 1172,1179 ----
  
    for (i = 1; i < n_basic_blocks; i++)
      {
        basic_block c = BASIC_BLOCK (i);
+       basic_block b = c->prev_bb;
        edge s;
  
        /* We care about simple conditional or unconditional jumps with
*************** verify_flow_info ()
*** 1887,1893 ****
  	    {
  	      rtx insn;
  
! 	      if (e->src->index + 1 != e->dest->index)
  		{
  		  error
  		    ("verify_flow_info: Incorrect blocks for fallthru %i->%i",
--- 1887,1893 ----
  	    {
  	      rtx insn;
  
! 	      if (e->src->next_bb != e->dest)
  		{
  		  error
  		    ("verify_flow_info: Incorrect blocks for fallthru %i->%i",
*************** verify_flow_info ()
*** 1952,1958 ****
  	  err = 1;
  	}
        if (n_branch != 1 && any_condjump_p (bb->end)
! 	  && JUMP_LABEL (bb->end) != BASIC_BLOCK (bb->index + 1)->head)
  	{
  	  error ("Wrong amount of branch edges after conditional jump %i", bb->index);
  	  err = 1;
--- 1952,1958 ----
  	  err = 1;
  	}
        if (n_branch != 1 && any_condjump_p (bb->end)
! 	  && JUMP_LABEL (bb->end) != bb->next_bb->head)
  	{
  	  error ("Wrong amount of branch edges after conditional jump %i", bb->index);
  	  err = 1;
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.288
diff -c -3 -p -r1.288 combine.c
*** combine.c	17 May 2002 02:31:29 -0000	1.288
--- combine.c	20 May 2002 00:45:13 -0000
*************** static HARD_REG_SET newpat_used_regs;
*** 192,199 ****
  
  static rtx added_links_insn;
  
! /* Basic block number of the block in which we are performing combines.  */
! static int this_basic_block;
  
  /* A bitmap indicating which blocks had registers go dead at entry.
     After combine, we'll need to re-do global life analysis with
--- 192,199 ----
  
  static rtx added_links_insn;
  
! /* Basic block in which we are performing combines.  */
! static basic_block this_basic_block;
  
  /* A bitmap indicating which blocks had registers go dead at entry.
     After combine, we'll need to re-do global life analysis with
*************** combine_instructions (f, nregs)
*** 610,616 ****
  
    /* Now scan all the insns in forward order.  */
  
!   this_basic_block = -1;
    label_tick = 1;
    last_call_cuid = 0;
    mem_last_set = 0;
--- 610,616 ----
  
    /* Now scan all the insns in forward order.  */
  
!   this_basic_block = ENTRY_BLOCK_PTR;
    label_tick = 1;
    last_call_cuid = 0;
    mem_last_set = 0;
*************** combine_instructions (f, nregs)
*** 622,630 ****
        next = 0;
  
        /* If INSN starts a new basic block, update our basic block number.  */
!       if (this_basic_block + 1 < n_basic_blocks
! 	  && BLOCK_HEAD (this_basic_block + 1) == insn)
! 	this_basic_block++;
  
        if (GET_CODE (insn) == CODE_LABEL)
  	label_tick++;
--- 622,630 ----
        next = 0;
  
        /* If INSN starts a new basic block, update our basic block number.  */
!       if (this_basic_block->next_bb != EXIT_BLOCK_PTR
! 	  && this_basic_block->next_bb->head == insn)
! 	this_basic_block = this_basic_block->next_bb;
  
        if (GET_CODE (insn) == CODE_LABEL)
  	label_tick++;
*************** combine_instructions (f, nregs)
*** 741,748 ****
      }
    clear_bb_flags ();
  
!   EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, this_basic_block,
! 			     BASIC_BLOCK (this_basic_block)->flags |= BB_DIRTY);
    new_direct_jump_p |= purge_all_dead_edges (0);
    delete_noop_moves (f);
  
--- 741,748 ----
      }
    clear_bb_flags ();
  
!   EXECUTE_IF_SET_IN_SBITMAP (refresh_blocks, 0, i,
! 			     BASIC_BLOCK (i)->flags |= BB_DIRTY);
    new_direct_jump_p |= purge_all_dead_edges (0);
    delete_noop_moves (f);
  
*************** set_nonzero_bits_and_sign_copies (x, set
*** 860,866 ****
        && REGNO (x) >= FIRST_PSEUDO_REGISTER
        /* If this register is undefined at the start of the file, we can't
  	 say what its contents were.  */
!       && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, REGNO (x))
        && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT)
      {
        if (set == 0 || GET_CODE (set) == CLOBBER)
--- 860,866 ----
        && REGNO (x) >= FIRST_PSEUDO_REGISTER
        /* If this register is undefined at the start of the file, we can't
  	 say what its contents were.  */
!       && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, REGNO (x))
        && GET_MODE_BITSIZE (GET_MODE (x)) <= HOST_BITS_PER_WIDE_INT)
      {
        if (set == 0 || GET_CODE (set) == CLOBBER)
*************** try_combine (i3, i2, i1, new_direct_jump
*** 2390,2397 ****
  	     which we know will be a NOTE.  */
  
  	  for (insn = NEXT_INSN (i3);
! 	       insn && (this_basic_block == n_basic_blocks - 1
! 			|| insn != BLOCK_HEAD (this_basic_block + 1));
  	       insn = NEXT_INSN (insn))
  	    {
  	      if (INSN_P (insn) && reg_referenced_p (ni2dest, PATTERN (insn)))
--- 2390,2397 ----
  	     which we know will be a NOTE.  */
  
  	  for (insn = NEXT_INSN (i3);
! 	       insn && (this_basic_block->next_bb == EXIT_BLOCK_PTR
! 			|| insn != this_basic_block->next_bb->head);
  	       insn = NEXT_INSN (insn))
  	    {
  	      if (INSN_P (insn) && reg_referenced_p (ni2dest, PATTERN (insn)))
*************** try_combine (i3, i2, i1, new_direct_jump
*** 2608,2615 ****
  	      && ! find_reg_note (i2, REG_UNUSED,
  				  SET_DEST (XVECEXP (PATTERN (i2), 0, i))))
  	    for (temp = NEXT_INSN (i2);
! 		 temp && (this_basic_block == n_basic_blocks - 1
! 			  || BLOCK_HEAD (this_basic_block) != temp);
  		 temp = NEXT_INSN (temp))
  	      if (temp != i3 && INSN_P (temp))
  		for (link = LOG_LINKS (temp); link; link = XEXP (link, 1))
--- 2608,2615 ----
  	      && ! find_reg_note (i2, REG_UNUSED,
  				  SET_DEST (XVECEXP (PATTERN (i2), 0, i))))
  	    for (temp = NEXT_INSN (i2);
! 		 temp && (this_basic_block->next_bb == EXIT_BLOCK_PTR
! 			  || this_basic_block->head != temp);
  		 temp = NEXT_INSN (temp))
  	      if (temp != i3 && INSN_P (temp))
  		for (link = LOG_LINKS (temp); link; link = XEXP (link, 1))
*************** nonzero_bits (x, mode)
*** 8070,8076 ****
  	  && (reg_last_set_label[REGNO (x)] == label_tick
  	      || (REGNO (x) >= FIRST_PSEUDO_REGISTER
  		  && REG_N_SETS (REGNO (x)) == 1
! 		  && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start,
  					REGNO (x))))
  	  && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
  	return reg_last_set_nonzero_bits[REGNO (x)] & nonzero;
--- 8070,8076 ----
  	  && (reg_last_set_label[REGNO (x)] == label_tick
  	      || (REGNO (x) >= FIRST_PSEUDO_REGISTER
  		  && REG_N_SETS (REGNO (x)) == 1
! 		  && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start,
  					REGNO (x))))
  	  && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
  	return reg_last_set_nonzero_bits[REGNO (x)] & nonzero;
*************** num_sign_bit_copies (x, mode)
*** 8485,8491 ****
  	  && (reg_last_set_label[REGNO (x)] == label_tick
  	      || (REGNO (x) >= FIRST_PSEUDO_REGISTER
  		  && REG_N_SETS (REGNO (x)) == 1
! 		  && ! REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start,
  					REGNO (x))))
  	  && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
  	return reg_last_set_sign_bit_copies[REGNO (x)];
--- 8485,8491 ----
  	  && (reg_last_set_label[REGNO (x)] == label_tick
  	      || (REGNO (x) >= FIRST_PSEUDO_REGISTER
  		  && REG_N_SETS (REGNO (x)) == 1
! 		  && ! REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start,
  					REGNO (x))))
  	  && INSN_CUID (reg_last_set[REGNO (x)]) < subst_low_cuid)
  	return reg_last_set_sign_bit_copies[REGNO (x)];
*************** get_last_value_validate (loc, insn, tick
*** 11494,11500 ****
  	    || (! (regno >= FIRST_PSEUDO_REGISTER
  		   && REG_N_SETS (regno) == 1
  		   && (! REGNO_REG_SET_P
! 		       (BASIC_BLOCK (0)->global_live_at_start, regno)))
  		&& reg_last_set_label[j] > tick))
  	  {
  	    if (replace)
--- 11494,11500 ----
  	    || (! (regno >= FIRST_PSEUDO_REGISTER
  		   && REG_N_SETS (regno) == 1
  		   && (! REGNO_REG_SET_P
! 		       (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno)))
  		&& reg_last_set_label[j] > tick))
  	  {
  	    if (replace)
*************** get_last_value (x)
*** 11568,11574 ****
  	  && (regno < FIRST_PSEUDO_REGISTER
  	      || REG_N_SETS (regno) != 1
  	      || (REGNO_REG_SET_P
! 		  (BASIC_BLOCK (0)->global_live_at_start, regno)))))
      return 0;
  
    /* If the value was set in a later insn than the ones we are processing,
--- 11568,11574 ----
  	  && (regno < FIRST_PSEUDO_REGISTER
  	      || REG_N_SETS (regno) != 1
  	      || (REGNO_REG_SET_P
! 		  (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno)))))
      return 0;
  
    /* If the value was set in a later insn than the ones we are processing,
*************** distribute_notes (notes, from_insn, i3, 
*** 12377,12383 ****
  
  	  if (place == 0)
  	    {
! 	      basic_block bb = BASIC_BLOCK (this_basic_block);
  
  	      for (tem = PREV_INSN (i3); place == 0; tem = PREV_INSN (tem))
  		{
--- 12377,12383 ----
  
  	  if (place == 0)
  	    {
! 	      basic_block bb = this_basic_block;
  
  	      for (tem = PREV_INSN (i3); place == 0; tem = PREV_INSN (tem))
  		{
*************** distribute_notes (notes, from_insn, i3, 
*** 12521,12527 ****
  		  && REGNO_REG_SET_P (bb->global_live_at_start,
  				      REGNO (XEXP (note, 0))))
  		{
! 		  SET_BIT (refresh_blocks, this_basic_block);
  		  need_refresh = 1;
  		}
  	    }
--- 12521,12527 ----
  		  && REGNO_REG_SET_P (bb->global_live_at_start,
  				      REGNO (XEXP (note, 0))))
  		{
! 		  SET_BIT (refresh_blocks, this_basic_block->index);
  		  need_refresh = 1;
  		}
  	    }
*************** distribute_notes (notes, from_insn, i3, 
*** 12541,12547 ****
  		 after we remove them in delete_noop_moves.  */
  	      if (noop_move_p (place))
  		{
! 		  SET_BIT (refresh_blocks, this_basic_block);
  		  need_refresh = 1;
  		}
  
--- 12541,12547 ----
  		 after we remove them in delete_noop_moves.  */
  	      if (noop_move_p (place))
  		{
! 		  SET_BIT (refresh_blocks, this_basic_block->index);
  		  need_refresh = 1;
  		}
  
*************** distribute_notes (notes, from_insn, i3, 
*** 12591,12597 ****
  			   i += HARD_REGNO_NREGS (i, reg_raw_mode[i]))
  			{
  			  rtx piece = gen_rtx_REG (reg_raw_mode[i], i);
! 			  basic_block bb = BASIC_BLOCK (this_basic_block);
  
  			  if (! dead_or_set_p (place, piece)
  			      && ! reg_bitfield_target_p (piece,
--- 12591,12597 ----
  			   i += HARD_REGNO_NREGS (i, reg_raw_mode[i]))
  			{
  			  rtx piece = gen_rtx_REG (reg_raw_mode[i], i);
! 			  basic_block bb = this_basic_block;
  
  			  if (! dead_or_set_p (place, piece)
  			      && ! reg_bitfield_target_p (piece,
*************** distribute_notes (notes, from_insn, i3, 
*** 12614,12620 ****
  				    if (tem == bb->head)
  				      {
  					SET_BIT (refresh_blocks,
! 						 this_basic_block);
  					need_refresh = 1;
  					break;
  				      }
--- 12614,12620 ----
  				    if (tem == bb->head)
  				      {
  					SET_BIT (refresh_blocks,
! 						 this_basic_block->index);
  					need_refresh = 1;
  					break;
  				      }
*************** distribute_links (links)
*** 12719,12726 ****
  	 since most links don't point very far away.  */
  
        for (insn = NEXT_INSN (XEXP (link, 0));
! 	   (insn && (this_basic_block == n_basic_blocks - 1
! 		     || BLOCK_HEAD (this_basic_block + 1) != insn));
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn) && reg_overlap_mentioned_p (reg, PATTERN (insn)))
  	  {
--- 12719,12726 ----
  	 since most links don't point very far away.  */
  
        for (insn = NEXT_INSN (XEXP (link, 0));
! 	   (insn && (this_basic_block->next_bb == EXIT_BLOCK_PTR
! 		     || this_basic_block->next_bb->head != insn));
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn) && reg_overlap_mentioned_p (reg, PATTERN (insn)))
  	  {
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.254
diff -c -3 -p -r1.254 final.c
*** final.c	18 May 2002 19:27:41 -0000	1.254
--- final.c	20 May 2002 00:45:14 -0000
*************** compute_alignments ()
*** 984,991 ****
  
        if (!has_fallthru
  	  && (branch_frequency > BB_FREQ_MAX / 10
! 	      || (bb->frequency > BASIC_BLOCK (i - 1)->frequency * 10
! 		  && (BASIC_BLOCK (i - 1)->frequency
  		      <= ENTRY_BLOCK_PTR->frequency / 2))))
  	{
  	  log = JUMP_ALIGN (label);
--- 984,991 ----
  
        if (!has_fallthru
  	  && (branch_frequency > BB_FREQ_MAX / 10
! 	      || (bb->frequency > bb->prev_bb->frequency * 10
! 		  && (bb->prev_bb->frequency
  		      <= ENTRY_BLOCK_PTR->frequency / 2))))
  	{
  	  log = JUMP_ALIGN (label);
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.520
diff -c -3 -p -r1.520 flow.c
*** flow.c	17 May 2002 18:06:59 -0000	1.520
--- flow.c	20 May 2002 00:45:14 -0000
*************** regno_uninitialized (regno)
*** 2349,2355 ****
  	      || FUNCTION_ARG_REGNO_P (regno))))
      return 0;
  
!   return REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno);
  }
  
  /* 1 if register REGNO was alive at a place where `setjmp' was called
--- 2349,2355 ----
  	      || FUNCTION_ARG_REGNO_P (regno))))
      return 0;
  
!   return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno);
  }
  
  /* 1 if register REGNO was alive at a place where `setjmp' was called
*************** regno_clobbered_at_setjmp (regno)
*** 2364,2370 ****
      return 0;
  
    return ((REG_N_SETS (regno) > 1
! 	   || REGNO_REG_SET_P (BASIC_BLOCK (0)->global_live_at_start, regno))
  	  && REGNO_REG_SET_P (regs_live_at_setjmp, regno));
  }
  \f
--- 2364,2370 ----
      return 0;
  
    return ((REG_N_SETS (regno) > 1
! 	   || REGNO_REG_SET_P (ENTRY_BLOCK_PTR->next_bb->global_live_at_start, regno))
  	  && REGNO_REG_SET_P (regs_live_at_setjmp, regno));
  }
  \f
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.367
diff -c -3 -p -r1.367 function.c
*** function.c	17 May 2002 18:07:01 -0000	1.367
--- function.c	20 May 2002 00:45:14 -0000
*************** epilogue_done:
*** 7817,7823 ****
  	}
  
        /* Find the last line number note in the first block.  */
!       for (insn = BASIC_BLOCK (0)->end;
  	   insn != prologue_end && insn;
  	   insn = PREV_INSN (insn))
  	if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
--- 7817,7823 ----
  	}
  
        /* Find the last line number note in the first block.  */
!       for (insn = ENTRY_BLOCK_PTR->next_bb->end;
  	   insn != prologue_end && insn;
  	   insn = PREV_INSN (insn))
  	if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.187
diff -c -3 -p -r1.187 gcse.c
*** gcse.c	17 May 2002 02:31:34 -0000	1.187
--- gcse.c	20 May 2002 00:45:15 -0000
*************** compute_code_hoist_vbeinout ()
*** 5586,5592 ****
  	{
  	  changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
  					      hoist_vbeout[bb], transp[bb]);
! 	  if (bb != n_basic_blocks - 1)
  	    sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
  	}
  
--- 5586,5592 ----
  	{
  	  changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
  					      hoist_vbeout[bb], transp[bb]);
! 	  if (BASIC_BLOCK (bb)->next_bb != EXIT_BLOCK_PTR)
  	    sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
  	}
  
Index: global.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/global.c,v
retrieving revision 1.79
diff -c -3 -p -r1.79 global.c
*** global.c	17 May 2002 02:31:34 -0000	1.79
--- global.c	20 May 2002 00:45:15 -0000
*************** build_insn_chain (first)
*** 1794,1800 ****
  {
    struct insn_chain **p = &reload_insn_chain;
    struct insn_chain *prev = 0;
!   int b = 0;
    regset_head live_relevant_regs_head;
  
    live_relevant_regs = INITIALIZE_REG_SET (live_relevant_regs_head);
--- 1794,1800 ----
  {
    struct insn_chain **p = &reload_insn_chain;
    struct insn_chain *prev = 0;
!   basic_block b = ENTRY_BLOCK_PTR->next_bb;
    regset_head live_relevant_regs_head;
  
    live_relevant_regs = INITIALIZE_REG_SET (live_relevant_regs_head);
*************** build_insn_chain (first)
*** 1803,1816 ****
      {
        struct insn_chain *c;
  
!       if (first == BLOCK_HEAD (b))
  	{
  	  int i;
  
  	  CLEAR_REG_SET (live_relevant_regs);
  
  	  EXECUTE_IF_SET_IN_BITMAP
! 	    (BASIC_BLOCK (b)->global_live_at_start, 0, i,
  	     {
  	       if (i < FIRST_PSEUDO_REGISTER
  		   ? ! TEST_HARD_REG_BIT (eliminable_regset, i)
--- 1803,1816 ----
      {
        struct insn_chain *c;
  
!       if (first == b->head)
  	{
  	  int i;
  
  	  CLEAR_REG_SET (live_relevant_regs);
  
  	  EXECUTE_IF_SET_IN_BITMAP
! 	    (b->global_live_at_start, 0, i,
  	     {
  	       if (i < FIRST_PSEUDO_REGISTER
  		   ? ! TEST_HARD_REG_BIT (eliminable_regset, i)
*************** build_insn_chain (first)
*** 1827,1833 ****
  	  *p = c;
  	  p = &c->next;
  	  c->insn = first;
! 	  c->block = b;
  
  	  if (INSN_P (first))
  	    {
--- 1827,1833 ----
  	  *p = c;
  	  p = &c->next;
  	  c->insn = first;
! 	  c->block = b->index;
  
  	  if (INSN_P (first))
  	    {
*************** build_insn_chain (first)
*** 1865,1872 ****
  	    }
  	}
  
!       if (first == BLOCK_END (b))
! 	b++;
  
        /* Stop after we pass the end of the last basic block.  Verify that
  	 no real insns are after the end of the last basic block.
--- 1865,1872 ----
  	    }
  	}
  
!       if (first == b->end)
! 	b = b->next_bb;
  
        /* Stop after we pass the end of the last basic block.  Verify that
  	 no real insns are after the end of the last basic block.
*************** build_insn_chain (first)
*** 1874,1880 ****
  	 We may want to reorganize the loop somewhat since this test should
  	 always be the right exit test.  Allow an ADDR_VEC or ADDR_DIF_VEC if
  	 the previous real insn is a JUMP_INSN.  */
!       if (b == n_basic_blocks)
  	{
  	  for (first = NEXT_INSN (first) ; first; first = NEXT_INSN (first))
  	    if (INSN_P (first)
--- 1874,1880 ----
  	 We may want to reorganize the loop somewhat since this test should
  	 always be the right exit test.  Allow an ADDR_VEC or ADDR_DIF_VEC if
  	 the previous real insn is a JUMP_INSN.  */
!       if (b == EXIT_BLOCK_PTR)
  	{
  	  for (first = NEXT_INSN (first) ; first; first = NEXT_INSN (first))
  	    if (INSN_P (first)
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.89
diff -c -3 -p -r1.89 ifcvt.c
*** ifcvt.c	17 May 2002 02:31:36 -0000	1.89
--- ifcvt.c	20 May 2002 00:45:15 -0000
*************** find_if_block (test_bb, then_edge, else_
*** 1973,1979 ****
    basic_block join_bb = NULL_BLOCK;
    edge then_succ = then_bb->succ;
    edge else_succ = else_bb->succ;
!   int next_index;
  
    /* The THEN block of an IF-THEN combo must have exactly one predecessor.  */
    if (then_bb->pred->pred_next != NULL_EDGE)
--- 1973,1979 ----
    basic_block join_bb = NULL_BLOCK;
    edge then_succ = then_bb->succ;
    edge else_succ = else_bb->succ;
!   basic_block next;
  
    /* The THEN block of an IF-THEN combo must have exactly one predecessor.  */
    if (then_bb->pred->pred_next != NULL_EDGE)
*************** find_if_block (test_bb, then_edge, else_
*** 2057,2066 ****
    /* ??? As an enhancement, move the ELSE block.  Have to deal with
       BLOCK notes, if by no other means than aborting the merge if they
       exist.  Sticky enough I don't want to think about it now.  */
!   next_index = then_bb->index;
!   if (else_bb && ++next_index != else_bb->index)
      return FALSE;
!   if (++next_index != join_bb->index && join_bb->index != EXIT_BLOCK)
      {
        if (else_bb)
  	join_bb = NULL;
--- 2057,2066 ----
    /* ??? As an enhancement, move the ELSE block.  Have to deal with
       BLOCK notes, if by no other means than aborting the merge if they
       exist.  Sticky enough I don't want to think about it now.  */
!   next = then_bb;
!   if (else_bb && (next = next->next_bb) != else_bb)
      return FALSE;
!   if ((next = next->next_bb) != join_bb && join_bb != EXIT_BLOCK_PTR)
      {
        if (else_bb)
  	join_bb = NULL;
*************** find_cond_trap (test_bb, then_edge, else
*** 2146,2152 ****
  
    /* If the non-trap block and the test are now adjacent, merge them.
       Otherwise we must insert a direct branch.  */
!   if (test_bb->index + 1 == other_bb->index)
      {
        delete_insn (jump);
        merge_if_block (test_bb, NULL, NULL, other_bb);
--- 2146,2152 ----
  
    /* If the non-trap block and the test are now adjacent, merge them.
       Otherwise we must insert a direct branch.  */
!   if (test_bb->next_bb == other_bb)
      {
        delete_insn (jump);
        merge_if_block (test_bb, NULL, NULL, other_bb);
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.65
diff -c -3 -p -r1.65 predict.c
*** predict.c	17 May 2002 02:31:42 -0000	1.65
--- predict.c	20 May 2002 00:45:15 -0000
*************** static bool
*** 695,704 ****
  last_basic_block_p (bb)
       basic_block bb;
  {
!   return (bb->index == n_basic_blocks - 1
! 	  || (bb->index == n_basic_blocks - 2
  	      && bb->succ && !bb->succ->succ_next
! 	      && bb->succ->dest->index == n_basic_blocks - 1));
  }
  
  /* Sets branch probabilities according to PREDiction and FLAGS. HEADS[bb->index]
--- 695,707 ----
  last_basic_block_p (bb)
       basic_block bb;
  {
!   if (bb == EXIT_BLOCK_PTR)
!     return false;
! 
!   return (bb->next_bb == EXIT_BLOCK_PTR
! 	  || (bb->next_bb->next_bb == EXIT_BLOCK_PTR
  	      && bb->succ && !bb->succ->succ_next
! 	      && bb->succ->dest->next_bb == EXIT_BLOCK_PTR));
  }
  
  /* Sets branch probabilities according to PREDiction and FLAGS. HEADS[bb->index]
*************** note_prediction_to_br_prob ()
*** 847,853 ****
  
    heads = xmalloc (sizeof (int) * n_basic_blocks);
    memset (heads, -1, sizeof (int) * n_basic_blocks);
!   heads[0] = n_basic_blocks;
  
    /* Process all prediction notes.  */
  
--- 850,856 ----
  
    heads = xmalloc (sizeof (int) * n_basic_blocks);
    memset (heads, -1, sizeof (int) * n_basic_blocks);
!   heads[ENTRY_BLOCK_PTR->next_bb->index] = n_basic_blocks;
  
    /* Process all prediction notes.  */
  
Index: regmove.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regmove.c,v
retrieving revision 1.128
diff -c -3 -p -r1.128 regmove.c
*** regmove.c	17 May 2002 02:31:51 -0000	1.128
--- regmove.c	20 May 2002 00:45:15 -0000
*************** regmove_optimize (f, nregs, regmove_dump
*** 1506,1518 ****
       ends.  Fix that here.  */
    for (i = 0; i < n_basic_blocks; i++)
      {
!       rtx end = BLOCK_END (i);
        rtx new = end;
        rtx next = NEXT_INSN (new);
        while (next != 0 && INSN_UID (next) >= old_max_uid
! 	     && (i == n_basic_blocks - 1 || BLOCK_HEAD (i + 1) != next))
  	new = next, next = NEXT_INSN (new);
!       BLOCK_END (i) = new;
      }
  
   done:
--- 1506,1519 ----
       ends.  Fix that here.  */
    for (i = 0; i < n_basic_blocks; i++)
      {
!       basic_block bb = BASIC_BLOCK (i);
!       rtx end = bb->end;
        rtx new = end;
        rtx next = NEXT_INSN (new);
        while (next != 0 && INSN_UID (next) >= old_max_uid
! 	     && (bb->next_bb == EXIT_BLOCK_PTR || bb->next_bb->head != next))
  	new = next, next = NEXT_INSN (new);
!       bb->end = new;
      }
  
   done:
Index: resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/resource.c,v
retrieving revision 1.55
diff -c -3 -p -r1.55 resource.c
*** resource.c	17 May 2002 02:31:55 -0000	1.55
--- resource.c	20 May 2002 00:45:15 -0000
*************** find_basic_block (insn, search_limit)
*** 146,154 ****
    if (search_limit == 0)
      return -1;
  
!   /* The start of the function is basic block zero.  */
    else if (insn == 0)
!     return 0;
  
    /* See if any of the upcoming CODE_LABELs start a basic block.  If we reach
       anything other than a CODE_LABEL or note, we can't find this code.  */
--- 146,154 ----
    if (search_limit == 0)
      return -1;
  
!   /* The start of the function.  */
    else if (insn == 0)
!     return ENTRY_BLOCK_PTR->next_bb->index;
  
    /* See if any of the upcoming CODE_LABELs start a basic block.  If we reach
       anything other than a CODE_LABEL or note, we can't find this code.  */
Index: sched-ebb.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-ebb.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 sched-ebb.c
*** sched-ebb.c	17 May 2002 02:31:55 -0000	1.12
--- sched-ebb.c	20 May 2002 00:45:15 -0000
*************** schedule_ebbs (dump_file)
*** 306,313 ****
  	  basic_block b = BASIC_BLOCK (i);
  	  edge e;
  	  tail = b->end;
! 	  if (i + 1 == n_basic_blocks
! 	      || GET_CODE (BLOCK_HEAD (i + 1)) == CODE_LABEL)
  	    break;
  	  for (e = b->succ; e; e = e->succ_next)
  	    if ((e->flags & EDGE_FALLTHRU) != 0)
--- 306,313 ----
  	  basic_block b = BASIC_BLOCK (i);
  	  edge e;
  	  tail = b->end;
! 	  if (b->next_bb == EXIT_BLOCK_PTR
! 	      || GET_CODE (b->next_bb->head) == CODE_LABEL)
  	    break;
  	  for (e = b->succ; e; e = e->succ_next)
  	    if ((e->flags & EDGE_FALLTHRU) != 0)
Index: ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa-dce.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 ssa-dce.c
*** ssa-dce.c	17 May 2002 02:31:55 -0000	1.15
--- ssa-dce.c	20 May 2002 00:45:15 -0000
*************** find_control_dependence (el, edge_index,
*** 247,253 ****
      abort ();
    ending_block =
      (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
!     ? BASIC_BLOCK (0)
      : find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index));
  
    for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index);
--- 247,253 ----
      abort ();
    ending_block =
      (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
!     ? ENTRY_BLOCK_PTR->next_bb
      : find_pdom (pdom, INDEX_EDGE_PRED_BB (el, edge_index));
  
    for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index);
*************** find_pdom (pdom, block)
*** 275,281 ****
      abort ();
  
    if (block == ENTRY_BLOCK_PTR)
!     return BASIC_BLOCK (0);
    else if (block == EXIT_BLOCK_PTR || pdom[block->index] == EXIT_BLOCK)
      return EXIT_BLOCK_PTR;
    else
--- 275,281 ----
      abort ();
  
    if (block == ENTRY_BLOCK_PTR)
!     return ENTRY_BLOCK_PTR->next_bb;
    else if (block == EXIT_BLOCK_PTR || pdom[block->index] == EXIT_BLOCK)
      return EXIT_BLOCK_PTR;
    else

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal, part 2
  2002-05-19 18:50                               ` Basic block renumbering removal, part 2 Zdenek Dvorak
@ 2002-05-20 20:10                                 ` Richard Henderson
  2002-05-20 23:09                                   ` Zdenek Dvorak
  2002-05-22 13:43                                 ` Basic block renumbering removal, part 3 Zdenek Dvorak
  1 sibling, 1 reply; 33+ messages in thread
From: Richard Henderson @ 2002-05-20 20:10 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Mon, May 20, 2002 at 02:59:55AM +0200, Zdenek Dvorak wrote:
> 	* bb-reorder.c (make_reorder_chain_1): Modified.
> 	* cfganal.c (can_fallthru, flow_call_edges_add,
> 	flow_preorder_transversal_compute): Modified.
> 	* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
> 	find_sub_basic_blocks): Modified.
> 	* cfgcleanup.c (try_simplify_condjump, try_optimize_cfg): Modified.
> 	* cfglayout.c (skip_insns_after_block, fixup_reorder_chain,
> 	fixup_fallthru_exit_predecessor, cfg_layout_redirect_edge): Modified.
> 	* cfgrtl.c (tidy_fallthru_edges, verify_flow_info): Modified.
> 	* combine.c (this_basic_block): Type changed to basic_block.
> 	(combine_instructions, set_nonzero_bits_and_sign_copies, try_combine,
> 	nonzero_bits, num_sign_bit_copies, get_last_value_validate,
> 	get_last_value, distribute_notes, distribute_links): Modified.
> 	* final.c (compute_alignments): Modified.
> 	* flow.c (regno_uninitialized, regno_clobbered_at_setjmp): Modified.
> 	* function.c (thread_prologue_and_epilogue_insns): Modified.
> 	* gcse.c (compute_code_hoist_vbeinout): Modified.
> 	* global.c (build_insn_chain): Modified.
> 	* ifcvt.c (find_if_block, find_cond_trap): Modified.
> 	* predict.c (last_basic_block_p, note_prediction_to_br_prob): Modified.
> 	* regmove.c (regmove_optimize): Modified.
> 	* resource.c (find_basic_block): Modified.
> 	* sched-ebb.c (schedule_ebbs): Modified.
> 	* ssa-dce.c (find_control_dependence, find_pdom): Modified.

Ok except

> *************** compute_code_hoist_vbeinout ()
> - 	  if (bb != n_basic_blocks - 1)
> + 	  if (BASIC_BLOCK (bb)->next_bb != EXIT_BLOCK_PTR)

Surely this should be

	bb != EXIT_BLOCK_PTR->prev_bb->index

as we want to get rid of BASIC_BLOCK (N) references?



r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal, part 2
  2002-05-20 20:10                                 ` Richard Henderson
@ 2002-05-20 23:09                                   ` Zdenek Dvorak
  2002-05-21  1:03                                     ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-20 23:09 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

> > 	* bb-reorder.c (make_reorder_chain_1): Modified.
> > 	* cfganal.c (can_fallthru, flow_call_edges_add,
> > 	flow_preorder_transversal_compute): Modified.
> > 	* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
> > 	find_sub_basic_blocks): Modified.
> > 	* cfgcleanup.c (try_simplify_condjump, try_optimize_cfg): Modified.
> > 	* cfglayout.c (skip_insns_after_block, fixup_reorder_chain,
> > 	fixup_fallthru_exit_predecessor, cfg_layout_redirect_edge): Modified.
> > 	* cfgrtl.c (tidy_fallthru_edges, verify_flow_info): Modified.
> > 	* combine.c (this_basic_block): Type changed to basic_block.
> > 	(combine_instructions, set_nonzero_bits_and_sign_copies, try_combine,
> > 	nonzero_bits, num_sign_bit_copies, get_last_value_validate,
> > 	get_last_value, distribute_notes, distribute_links): Modified.
> > 	* final.c (compute_alignments): Modified.
> > 	* flow.c (regno_uninitialized, regno_clobbered_at_setjmp): Modified.
> > 	* function.c (thread_prologue_and_epilogue_insns): Modified.
> > 	* gcse.c (compute_code_hoist_vbeinout): Modified.
> > 	* global.c (build_insn_chain): Modified.
> > 	* ifcvt.c (find_if_block, find_cond_trap): Modified.
> > 	* predict.c (last_basic_block_p, note_prediction_to_br_prob): Modified.
> > 	* regmove.c (regmove_optimize): Modified.
> > 	* resource.c (find_basic_block): Modified.
> > 	* sched-ebb.c (schedule_ebbs): Modified.
> > 	* ssa-dce.c (find_control_dependence, find_pdom): Modified.
> 
> Ok except
> 
> > *************** compute_code_hoist_vbeinout ()
> > - 	  if (bb != n_basic_blocks - 1)
> > + 	  if (BASIC_BLOCK (bb)->next_bb != EXIT_BLOCK_PTR)
> 
> Surely this should be
> 
> 	bb != EXIT_BLOCK_PTR->prev_bb->index
> 
> as we want to get rid of BASIC_BLOCK (N) references?

Would work too; but in fact I want to get rid of relying that (e.g.) last basic
block has number n_basic_blocks - 1, which both satisfy. It does not really
matter -- this will be changed in following (large :-( ) patch to remove
iterations over indices.

Zdenek

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal, part 2
  2002-05-20 23:09                                   ` Zdenek Dvorak
@ 2002-05-21  1:03                                     ` Richard Henderson
  0 siblings, 0 replies; 33+ messages in thread
From: Richard Henderson @ 2002-05-21  1:03 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Tue, May 21, 2002 at 07:49:32AM +0200, Zdenek Dvorak wrote:
> It does not really matter -- this will be changed in following
> patch to remove iterations over indices.

Ok then.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Basic block renumbering removal, part 3
  2002-05-19 18:50                               ` Basic block renumbering removal, part 2 Zdenek Dvorak
  2002-05-20 20:10                                 ` Richard Henderson
@ 2002-05-22 13:43                                 ` Zdenek Dvorak
  2002-05-23  1:18                                   ` Richard Henderson
  1 sibling, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-22 13:43 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

This replaces iteration over basic block indices -- like

for (i = 0; i < n_basic_blocks; i++)
  {
    bb = BASIC_BLOCK (i);
    ...
  }

with traversing the basic block list:

FOR_EACH_BB (bb)
  {
    ...
  }

I have bootstrapped it on i686 and SUN Ultra 60 and regtested on i686.

Zdenek Dvorak

The patch is loooong :-( but this should be the worst one :-)

Changelog:
	* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
	Use FOR_EACH_BB macros to iterate over basic block chain.
	* cfg.c (clear_edges, clear_bb_flags, dump_flow_info,
	alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges):
	Likewise.
	* cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add,
	find_unreachable_blocks, create_edge_list, verify_edge_list,
	remove_fake_edges, add_noreturn_fake_exit_edges,
	flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute):
	Likewise.
	* cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks,
	find_sub_basic_blocks): Likewise.
	* cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks):
	Likewise.
	* cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps):
	Likewise.
	* cfgloop.c (flow_loops_cfg_dump, flow_loops_find):
	Likewise.
	* cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges,
	commit_edge_insertions, commit_edge_insertions_watch_calls,
	print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise.
	* combine.c (combine_instructions, reg_dead_at_p): Likewise.
	* conflict.c (conflict_graph_compute): Likewise.
	* df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1,
	df_modified_p, df_refs_unlink, df_dump): Likewise.
	* dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise.
	* final.c (compute_alignments): Likewise.
	* flow.c (update_life_info, update_life_info_in_dirty_blocks,
	delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data,
	count_or_remove_death_notes): Likewise.
	* gcse.c (oprs_unchanged_p, record_last_reg_set_info,
	compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill,
	classic_gcse, compute_transp, cprop, compute_pre_data,
	compute_transpout, invalidate_nonnull_info,
	delete_null_pointer_checks_1, delete_null_pointer_checks,
	compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems,
	compute_store_table, build_store_vectors, store_motion): Likewise.
	* global.c (global_conflicts, mark_elimination): Likewise.
	* graph.c (print_rtl_graph_with_bb): Likewise.
	* haifa-sched.c (sched_init): Likewise.
	* ifcvt.c (if_convert): Likewise.
	* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
	compute_available, compute_nearerout, compute_rev_insert_delete,
	optimize_mode_switching): Likewise.
	* local-alloc.c (local_alloc, update_equiv_regs): Likewise.
	* predict.c (estimate_probability, note_prediction_to_br_prob,
	propagate_freq, counts_to_freqs, expensive_function_p,
	estimate_bb_frequencies): Likewise.
	* profile.c (instrument_edges, get_exec_counts,
	compute_branch_probabilities, compute_checksum, branch_prob,
	find_spanning_tree): Likewise.
	* recog.c (split_all_insns, peephole2_optimize): Likewise.
	* reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs):
	Likewise.
	* regclass.c (scan_one_insn, regclass): Likewise.
	* regmove.c (mark_flags_life_zones, regmove_optimize,
	record_stack_memrefs): Likewise.
	* regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise.
	* reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise.
	* resource.c (find_basic_block): Likewise.
	* sched-ebb.c (schedule_ebbs): Likewise.
	* sched-rgn.c (is_cfg_nonregular, build_control_flow,
	find_single_block_region, find_rgns, schedule_insns)
	* sibcall.c (optimize_sibling_and_tail_recursive_call)
	* ssa-ccp.c (optimize_unexecutable_edges,
	ssa_ccp_df_delete_unreachable_insns): Likewise.
	* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
	* ssa.c (find_evaluations, compute_dominance_frontiers_1,
	rename_block, convert_to_ssa, compute_conservative_reg_partition,
	compute_coalesced_reg_partition, rename_equivalent_regs,
	convert_from_ssa): Likewise.
	* config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue,
	process_for_unwind_directive): Likewise.

	* df.c (FOR_ALL_BBS): Removed.
	* gcse.c (struct null_pointer_info): Type of current_block field
	changed.
	(struct reg_avail_info): Type of last_bb field changed.
	* config/ia64/ia64.c (block_num): Removed.
	(need_copy_state): Type changed.
	(last_block): New.

Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 bb-reorder.c
*** bb-reorder.c	21 May 2002 20:37:36 -0000	1.47
--- bb-reorder.c	22 May 2002 17:04:27 -0000
*************** static void
*** 102,115 ****
  make_reorder_chain ()
  {
    basic_block prev = NULL;
!   int nbb_m1 = n_basic_blocks - 1;
!   basic_block next;
  
    /* Loop until we've placed every block.  */
    do
      {
-       int i;
- 
        next = NULL;
  
        /* Find the next unplaced block.  */
--- 102,112 ----
  make_reorder_chain ()
  {
    basic_block prev = NULL;
!   basic_block next, bb;
  
    /* Loop until we've placed every block.  */
    do
      {
        next = NULL;
  
        /* Find the next unplaced block.  */
*************** make_reorder_chain ()
*** 119,130 ****
  	 remove from the list as we place.  The head of that list is
  	 what we're looking for here.  */
  
!       for (i = 0; i <= nbb_m1 && !next; ++i)
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  if (! RBI (bb)->visited)
  	    next = bb;
! 	}
        if (next)
          prev = make_reorder_chain_1 (next, prev);
      }
--- 116,128 ----
  	 remove from the list as we place.  The head of that list is
  	 what we're looking for here.  */
  
!       FOR_EACH_BB (bb)
! 	if (! RBI (bb)->visited)
! 	  {
  	    next = bb;
! 	    break;
! 	  }
!       
        if (next)
          prev = make_reorder_chain_1 (next, prev);
      }
*************** make_reorder_chain_1 (bb, prev)
*** 164,170 ****
      }
    else
      {
!       if (bb->index != 0)
  	abort ();
      }
    RBI (bb)->visited = 1;
--- 162,168 ----
      }
    else
      {
!       if (bb->prev_bb != ENTRY_BLOCK_PTR)
  	abort ();
      }
    RBI (bb)->visited = 1;
Index: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.28
diff -c -3 -p -r1.28 cfg.c
*** cfg.c	22 May 2002 01:27:33 -0000	1.28
--- cfg.c	22 May 2002 17:04:28 -0000
*************** free_edge (e)
*** 167,178 ****
  void
  clear_edges ()
  {
!   int i;
    edge e;
  
!   for (i = 0; i < n_basic_blocks; ++i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e = bb->succ;
  
        while (e)
--- 167,177 ----
  void
  clear_edges ()
  {
!   basic_block bb;
    edge e;
  
!   FOR_EACH_BB (bb)
      {
        edge e = bb->succ;
  
        while (e)
*************** redirect_edge_pred (e, new_pred)
*** 480,490 ****
  void
  clear_bb_flags ()
  {
!   int i;
!   ENTRY_BLOCK_PTR->flags = 0;
!   EXIT_BLOCK_PTR->flags = 0;
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->flags = 0;
  }
  \f
  void
--- 479,488 ----
  void
  clear_bb_flags ()
  {
!   basic_block bb;
! 
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->flags = 0;
  }
  \f
  void
*************** dump_flow_info (file)
*** 492,497 ****
--- 490,496 ----
       FILE *file;
  {
    int i;
+   basic_block bb;
    static const char * const reg_class_names[] = REG_CLASS_NAMES;
  
    fprintf (file, "%d registers.\n", max_regno);
*************** dump_flow_info (file)
*** 539,547 ****
        }
  
    fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
        int sum;
        gcov_type lsum;
--- 538,545 ----
        }
  
    fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
!   FOR_EACH_BB (bb)
      {
        edge e;
        int sum;
        gcov_type lsum;
*************** alloc_aux_for_blocks (size)
*** 704,716 ****
    first_block_aux_obj = (char *) obstack_alloc (&block_aux_obstack, 0);
    if (size)
      {
!       int i;
! 
!       for (i = 0; i < n_basic_blocks; i++)
! 	alloc_aux_for_block (BASIC_BLOCK (i), size);
  
!       alloc_aux_for_block (ENTRY_BLOCK_PTR, size);
!       alloc_aux_for_block (EXIT_BLOCK_PTR, size);
      }
  }
  
--- 702,711 ----
    first_block_aux_obj = (char *) obstack_alloc (&block_aux_obstack, 0);
    if (size)
      {
!       basic_block bb;
  
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
! 	alloc_aux_for_block (bb, size);
      }
  }
  
*************** alloc_aux_for_blocks (size)
*** 719,731 ****
  void
  clear_aux_for_blocks ()
  {
!   int i;
! 
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->aux = NULL;
  
!   ENTRY_BLOCK_PTR->aux = NULL;
!   EXIT_BLOCK_PTR->aux = NULL;
  }
  
  /* Free data allocated in block_aux_obstack and clear AUX pointers
--- 714,723 ----
  void
  clear_aux_for_blocks ()
  {
!   basic_block bb;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->aux = NULL;
  }
  
  /* Free data allocated in block_aux_obstack and clear AUX pointers
*************** alloc_aux_for_edges (size)
*** 779,795 ****
    first_edge_aux_obj = (char *) obstack_alloc (&edge_aux_obstack, 0);
    if (size)
      {
!       int i;
!       for (i = -1; i < n_basic_blocks; i++)
  	{
- 	  basic_block bb;
  	  edge e;
  
- 	  if (i >= 0)
- 	    bb = BASIC_BLOCK (i);
- 	  else
- 	    bb = ENTRY_BLOCK_PTR;
- 
  	  for (e = bb->succ; e; e = e->succ_next)
  	    alloc_aux_for_edge (e, size);
  	}
--- 771,782 ----
    first_edge_aux_obj = (char *) obstack_alloc (&edge_aux_obstack, 0);
    if (size)
      {
!       basic_block bb;
! 
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
  	{
  	  edge e;
  
  	  for (e = bb->succ; e; e = e->succ_next)
  	    alloc_aux_for_edge (e, size);
  	}
*************** alloc_aux_for_edges (size)
*** 801,818 ****
  void
  clear_aux_for_edges ()
  {
!   int i;
  
!   for (i = -1; i < n_basic_blocks; i++)
      {
-       basic_block bb;
-       edge e;
- 
-       if (i >= 0)
- 	bb = BASIC_BLOCK (i);
-       else
- 	bb = ENTRY_BLOCK_PTR;
- 
        for (e = bb->succ; e; e = e->succ_next)
  	e->aux = NULL;
      }
--- 788,798 ----
  void
  clear_aux_for_edges ()
  {
!   basic_block bb;
!   edge e;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        for (e = bb->succ; e; e = e->succ_next)
  	e->aux = NULL;
      }
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 cfganal.c
*** cfganal.c	21 May 2002 20:37:36 -0000	1.21
--- cfganal.c	22 May 2002 17:04:28 -0000
*************** mark_dfs_back_edges ()
*** 194,203 ****
  void
  set_edge_can_fallthru_flag ()
  {
!   int i;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
  
        /* The FALLTHRU edge is also CAN_FALLTHRU edge.  */
--- 194,203 ----
  void
  set_edge_can_fallthru_flag ()
  {
!   basic_block bb;
! 
!   FOR_EACH_BB (bb)
      {
        edge e;
  
        /* The FALLTHRU edge is also CAN_FALLTHRU edge.  */
*************** flow_call_edges_add (blocks)
*** 259,265 ****
    int i;
    int blocks_split = 0;
    int bb_num = 0;
!   basic_block *bbs;
    bool check_last_block = false;
  
    /* Map bb indices into basic block pointers since split_block
--- 259,265 ----
    int i;
    int blocks_split = 0;
    int bb_num = 0;
!   basic_block *bbs, bb;
    bool check_last_block = false;
  
    /* Map bb indices into basic block pointers since split_block
*************** flow_call_edges_add (blocks)
*** 269,276 ****
  
    if (! blocks)
      {
!       for (i = 0; i < n_basic_blocks; i++)
! 	bbs[bb_num++] = BASIC_BLOCK (i);
  
        check_last_block = true;
      }
--- 269,276 ----
  
    if (! blocks)
      {
!       FOR_EACH_BB (bb)
! 	bbs[bb_num++] = bb;
  
        check_last_block = true;
      }
*************** void
*** 386,401 ****
  find_unreachable_blocks ()
  {
    edge e;
!   int i, n;
!   basic_block *tos, *worklist;
  
!   n = n_basic_blocks;
!   tos = worklist = (basic_block *) xmalloc (sizeof (basic_block) * n);
  
    /* Clear all the reachability flags.  */
  
!   for (i = 0; i < n; ++i)
!     BASIC_BLOCK (i)->flags &= ~BB_REACHABLE;
  
    /* Add our starting points to the worklist.  Almost always there will
       be only one.  It isn't inconceivable that we might one day directly
--- 386,400 ----
  find_unreachable_blocks ()
  {
    edge e;
!   basic_block *tos, *worklist, bb;
  
!   tos = worklist =
! 	(basic_block *) xmalloc (sizeof (basic_block) * n_basic_blocks);
  
    /* Clear all the reachability flags.  */
  
!   FOR_EACH_BB (bb)
!     bb->flags &= ~BB_REACHABLE;
  
    /* Add our starting points to the worklist.  Almost always there will
       be only one.  It isn't inconceivable that we might one day directly
*************** create_edge_list ()
*** 445,452 ****
    struct edge_list *elist;
    edge e;
    int num_edges;
-   int x;
    int block_count;
  
    block_count = n_basic_blocks + 2;   /* Include the entry and exit blocks.  */
  
--- 444,451 ----
    struct edge_list *elist;
    edge e;
    int num_edges;
    int block_count;
+   basic_block bb;
  
    block_count = n_basic_blocks + 2;   /* Include the entry and exit blocks.  */
  
*************** create_edge_list ()
*** 454,471 ****
  
    /* Determine the number of edges in the flow graph by counting successor
       edges on each basic block.  */
!   for (x = 0; x < n_basic_blocks; x++)
      {
-       basic_block bb = BASIC_BLOCK (x);
- 
        for (e = bb->succ; e; e = e->succ_next)
  	num_edges++;
      }
  
-   /* Don't forget successors of the entry block.  */
-   for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
-     num_edges++;
- 
    elist = (struct edge_list *) xmalloc (sizeof (struct edge_list));
    elist->num_blocks = block_count;
    elist->num_edges = num_edges;
--- 453,464 ----
  
    /* Determine the number of edges in the flow graph by counting successor
       edges on each basic block.  */
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        for (e = bb->succ; e; e = e->succ_next)
  	num_edges++;
      }
  
    elist = (struct edge_list *) xmalloc (sizeof (struct edge_list));
    elist->num_blocks = block_count;
    elist->num_edges = num_edges;
*************** create_edge_list ()
*** 473,490 ****
  
    num_edges = 0;
  
!   /* Follow successors of the entry block, and register these edges.  */
!   for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
!     elist->index_to_edge[num_edges++] = e;
! 
!   for (x = 0; x < n_basic_blocks; x++)
!     {
!       basic_block bb = BASIC_BLOCK (x);
! 
!       /* Follow all successors of blocks, and register these edges.  */
!       for (e = bb->succ; e; e = e->succ_next)
! 	elist->index_to_edge[num_edges++] = e;
!     }
  
    return elist;
  }
--- 466,475 ----
  
    num_edges = 0;
  
!   /* Follow successors of blocks, and register these edges.  */
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
!     for (e = bb->succ; e; e = e->succ_next)
!       elist->index_to_edge[num_edges++] = e;
  
    return elist;
  }
*************** verify_edge_list (f, elist)
*** 538,550 ****
       FILE *f;
       struct edge_list *elist;
  {
!   int x, pred, succ, index;
    edge e;
  
!   for (x = 0; x < n_basic_blocks; x++)
      {
-       basic_block bb = BASIC_BLOCK (x);
- 
        for (e = bb->succ; e; e = e->succ_next)
  	{
  	  pred = e->src->index;
--- 523,534 ----
       FILE *f;
       struct edge_list *elist;
  {
!   int pred, succ, index;
    edge e;
+   basic_block bb, p, s;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        for (e = bb->succ; e; e = e->succ_next)
  	{
  	  pred = e->src->index;
*************** verify_edge_list (f, elist)
*** 565,597 ****
  	}
      }
  
!   for (e = ENTRY_BLOCK_PTR->succ; e; e = e->succ_next)
!     {
!       pred = e->src->index;
!       succ = e->dest->index;
!       index = EDGE_INDEX (elist, e->src, e->dest);
!       if (index == EDGE_INDEX_NO_EDGE)
! 	{
! 	  fprintf (f, "*p* No index for edge from %d to %d\n", pred, succ);
! 	  continue;
! 	}
! 
!       if (INDEX_EDGE_PRED_BB (elist, index)->index != pred)
! 	fprintf (f, "*p* Pred for index %d should be %d not %d\n",
! 		 index, pred, INDEX_EDGE_PRED_BB (elist, index)->index);
!       if (INDEX_EDGE_SUCC_BB (elist, index)->index != succ)
! 	fprintf (f, "*p* Succ for index %d should be %d not %d\n",
! 		 index, succ, INDEX_EDGE_SUCC_BB (elist, index)->index);
!     }
! 
!   /* We've verified that all the edges are in the list, no lets make sure
       there are no spurious edges in the list.  */
  
!   for (pred = 0; pred < n_basic_blocks; pred++)
!     for (succ = 0; succ < n_basic_blocks; succ++)
        {
- 	basic_block p = BASIC_BLOCK (pred);
- 	basic_block s = BASIC_BLOCK (succ);
  	int found_edge = 0;
  
  	for (e = p->succ; e; e = e->succ_next)
--- 549,560 ----
  	}
      }
  
!   /* We've verified that all the edges are in the list, now lets make sure
       there are no spurious edges in the list.  */
  
!   FOR_BB_BETWEEN (p, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
!     FOR_BB_BETWEEN (s, ENTRY_BLOCK_PTR->next_bb, NULL, next_bb)
        {
  	int found_edge = 0;
  
  	for (e = p->succ; e; e = e->succ_next)
*************** verify_edge_list (f, elist)
*** 608,685 ****
  	      break;
  	    }
  
! 	if (EDGE_INDEX (elist, BASIC_BLOCK (pred), BASIC_BLOCK (succ))
  	    == EDGE_INDEX_NO_EDGE && found_edge != 0)
  	  fprintf (f, "*** Edge (%d, %d) appears to not have an index\n",
! 		   pred, succ);
! 	if (EDGE_INDEX (elist, BASIC_BLOCK (pred), BASIC_BLOCK (succ))
  	    != EDGE_INDEX_NO_EDGE && found_edge == 0)
  	  fprintf (f, "*** Edge (%d, %d) has index %d, but there is no edge\n",
! 		   pred, succ, EDGE_INDEX (elist, BASIC_BLOCK (pred),
! 					   BASIC_BLOCK (succ)));
        }
- 
-   for (succ = 0; succ < n_basic_blocks; succ++)
-     {
-       basic_block p = ENTRY_BLOCK_PTR;
-       basic_block s = BASIC_BLOCK (succ);
-       int found_edge = 0;
- 
-       for (e = p->succ; e; e = e->succ_next)
- 	if (e->dest == s)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       for (e = s->pred; e; e = e->pred_next)
- 	if (e->src == p)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       if (EDGE_INDEX (elist, ENTRY_BLOCK_PTR, BASIC_BLOCK (succ))
- 	  == EDGE_INDEX_NO_EDGE && found_edge != 0)
- 	fprintf (f, "*** Edge (entry, %d) appears to not have an index\n",
- 		 succ);
-       if (EDGE_INDEX (elist, ENTRY_BLOCK_PTR, BASIC_BLOCK (succ))
- 	  != EDGE_INDEX_NO_EDGE && found_edge == 0)
- 	fprintf (f, "*** Edge (entry, %d) has index %d, but no edge exists\n",
- 		 succ, EDGE_INDEX (elist, ENTRY_BLOCK_PTR,
- 				   BASIC_BLOCK (succ)));
-     }
- 
-   for (pred = 0; pred < n_basic_blocks; pred++)
-     {
-       basic_block p = BASIC_BLOCK (pred);
-       basic_block s = EXIT_BLOCK_PTR;
-       int found_edge = 0;
- 
-       for (e = p->succ; e; e = e->succ_next)
- 	if (e->dest == s)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       for (e = s->pred; e; e = e->pred_next)
- 	if (e->src == p)
- 	  {
- 	    found_edge = 1;
- 	    break;
- 	  }
- 
-       if (EDGE_INDEX (elist, BASIC_BLOCK (pred), EXIT_BLOCK_PTR)
- 	  == EDGE_INDEX_NO_EDGE && found_edge != 0)
- 	fprintf (f, "*** Edge (%d, exit) appears to not have an index\n",
- 		 pred);
-       if (EDGE_INDEX (elist, BASIC_BLOCK (pred), EXIT_BLOCK_PTR)
- 	  != EDGE_INDEX_NO_EDGE && found_edge == 0)
- 	fprintf (f, "*** Edge (%d, exit) has index %d, but no edge exists\n",
- 		 pred, EDGE_INDEX (elist, BASIC_BLOCK (pred),
- 				   EXIT_BLOCK_PTR));
-     }
  }
  
  /* This routine will determine what, if any, edge there is between
--- 571,585 ----
  	      break;
  	    }
  
! 	if (EDGE_INDEX (elist, p, s)
  	    == EDGE_INDEX_NO_EDGE && found_edge != 0)
  	  fprintf (f, "*** Edge (%d, %d) appears to not have an index\n",
! 		   p->index, s->index);
! 	if (EDGE_INDEX (elist, p, s)
  	    != EDGE_INDEX_NO_EDGE && found_edge == 0)
  	  fprintf (f, "*** Edge (%d, %d) has index %d, but there is no edge\n",
! 		   p->index, s->index, EDGE_INDEX (elist, p, s));
        }
  }
  
  /* This routine will determine what, if any, edge there is between
*************** remove_fake_successors (bb)
*** 768,780 ****
  void
  remove_fake_edges ()
  {
!   int x;
! 
!   for (x = 0; x < n_basic_blocks; x++)
!     remove_fake_successors (BASIC_BLOCK (x));
  
!   /* We've handled all successors except the entry block's.  */
!   remove_fake_successors (ENTRY_BLOCK_PTR);
  }
  
  /* This function will add a fake edge between any block which has no
--- 668,677 ----
  void
  remove_fake_edges ()
  {
!   basic_block bb;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
!     remove_fake_successors (bb);
  }
  
  /* This function will add a fake edge between any block which has no
*************** remove_fake_edges ()
*** 784,794 ****
  void
  add_noreturn_fake_exit_edges ()
  {
!   int x;
  
!   for (x = 0; x < n_basic_blocks; x++)
!     if (BASIC_BLOCK (x)->succ == NULL)
!       make_single_succ_edge (BASIC_BLOCK (x), EXIT_BLOCK_PTR, EDGE_FAKE);
  }
  
  /* This function adds a fake edge between any infinite loops to the
--- 681,691 ----
  void
  add_noreturn_fake_exit_edges ()
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     if (bb->succ == NULL)
!       make_single_succ_edge (bb, EXIT_BLOCK_PTR, EDGE_FAKE);
  }
  
  /* This function adds a fake edge between any infinite loops to the
*************** flow_preorder_transversal_compute (pot_o
*** 1014,1019 ****
--- 911,917 ----
    sbitmap visited;
    struct dfst_node *node;
    struct dfst_node *dfst;
+   basic_block bb;
  
    /* Allocate stack for back-tracking up CFG.  */
    stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge));
*************** flow_preorder_transversal_compute (pot_o
*** 1023,1032 ****
    dfst = (struct dfst_node *) xcalloc (n_basic_blocks,
  				       sizeof (struct dfst_node));
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
        max_successors = 0;
!       for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  	max_successors++;
  
        dfst[i].node
--- 921,930 ----
    dfst = (struct dfst_node *) xcalloc (n_basic_blocks,
  				       sizeof (struct dfst_node));
  
!   FOR_EACH_BB (bb)
      {
        max_successors = 0;
!       for (e = bb->succ; e; e = e->succ_next)
  	max_successors++;
  
        dfst[i].node
*************** flow_dfs_compute_reverse_execute (data)
*** 1183,1189 ****
  {
    basic_block bb;
    edge e;
-   int i;
  
    while (data->sp > 0)
      {
--- 1081,1086 ----
*************** flow_dfs_compute_reverse_execute (data)
*** 1197,1205 ****
      }
  
    /* Determine if there are unvisited basic blocks.  */
!   for (i = n_basic_blocks - (INVALID_BLOCK + 1); --i >= 0; )
!     if (!TEST_BIT (data->visited_blocks, i))
!       return BASIC_BLOCK (i + (INVALID_BLOCK + 1));
  
    return NULL;
  }
--- 1094,1102 ----
      }
  
    /* Determine if there are unvisited basic blocks.  */
!   FOR_BB_BETWEEN (bb, EXIT_BLOCK_PTR, NULL, prev_bb)
!     if (!TEST_BIT (data->visited_blocks, bb->index - (INVALID_BLOCK + 1)))
!       return bb;
  
    return NULL;
  }
Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.18
diff -c -3 -p -r1.18 cfgbuild.c
*** cfgbuild.c	22 May 2002 01:27:33 -0000	1.18
--- cfgbuild.c	22 May 2002 17:04:28 -0000
*************** make_edges (label_value_list, min, max, 
*** 284,290 ****
       basic_block min, max;
       int update_p;
  {
!   int i;
    sbitmap *edge_cache = NULL;
  
    /* Assume no computed jump; revise as we create edges.  */
--- 284,290 ----
       basic_block min, max;
       int update_p;
  {
!   basic_block bb;
    sbitmap *edge_cache = NULL;
  
    /* Assume no computed jump; revise as we create edges.  */
*************** make_edges (label_value_list, min, max, 
*** 299,322 ****
        sbitmap_vector_zero (edge_cache, n_basic_blocks);
  
        if (update_p)
! 	for (i = min->index; i <= max->index; ++i)
  	  {
  	    edge e;
  
! 	    for (e = BASIC_BLOCK (i)->succ; e ; e = e->succ_next)
  	      if (e->dest != EXIT_BLOCK_PTR)
! 		SET_BIT (edge_cache[i], e->dest->index);
  	  }
      }
  
!   /* By nature of the way these get numbered, block 0 is always the entry.  */
    if (min == ENTRY_BLOCK_PTR->next_bb)
      cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min,
  		      EDGE_FALLTHRU);
  
!   for (i = min->index; i <= max->index; ++i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn, x;
        enum rtx_code code;
        int force_fallthru = 0;
--- 299,322 ----
        sbitmap_vector_zero (edge_cache, n_basic_blocks);
  
        if (update_p)
!         FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
  	  {
  	    edge e;
  
! 	    for (e = bb->succ; e ; e = e->succ_next)
  	      if (e->dest != EXIT_BLOCK_PTR)
! 		SET_BIT (edge_cache[bb->index], e->dest->index);
  	  }
      }
  
!   /* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block
!      is always the entry.  */
    if (min == ENTRY_BLOCK_PTR->next_bb)
      cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min,
  		      EDGE_FALLTHRU);
  
!   FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
      {
        rtx insn, x;
        enum rtx_code code;
        int force_fallthru = 0;
*************** find_basic_blocks (f, nregs, file)
*** 614,619 ****
--- 614,621 ----
       FILE *file ATTRIBUTE_UNUSED;
  {
    int max_uid;
+   basic_block bb;
+ 
    timevar_push (TV_CFG);
  
    basic_block_for_insn = 0;
*************** find_basic_blocks (f, nregs, file)
*** 621,635 ****
    /* Flush out existing data.  */
    if (basic_block_info != NULL)
      {
-       int i;
- 
        clear_edges ();
  
        /* Clear bb->aux on all extant basic blocks.  We'll use this as a
  	 tag for reuse during create_basic_block, just in case some pass
  	 copies around basic block notes improperly.  */
!       for (i = 0; i < n_basic_blocks; ++i)
! 	BASIC_BLOCK (i)->aux = NULL;
  
        VARRAY_FREE (basic_block_info);
      }
--- 623,635 ----
    /* Flush out existing data.  */
    if (basic_block_info != NULL)
      {
        clear_edges ();
  
        /* Clear bb->aux on all extant basic blocks.  We'll use this as a
  	 tag for reuse during create_basic_block, just in case some pass
  	 copies around basic block notes improperly.  */
!       FOR_EACH_BB (bb)
!  	bb->aux = NULL;
  
        VARRAY_FREE (basic_block_info);
      }
*************** void
*** 794,848 ****
  find_many_sub_basic_blocks (blocks)
       sbitmap blocks;
  {
!   int i;
!   int min, max;
  
!   for (i = 0; i < n_basic_blocks; i++)
!     SET_STATE (BASIC_BLOCK (i),
! 	       TEST_BIT (blocks, i) ? BLOCK_TO_SPLIT : BLOCK_ORIGINAL);
! 
!   for (i = 0; i < n_basic_blocks; i++)
!     if (STATE (BASIC_BLOCK (i)) == BLOCK_TO_SPLIT)
!       find_bb_boundaries (BASIC_BLOCK (i));
  
!   for (i = 0; i < n_basic_blocks; i++)
!     if (STATE (BASIC_BLOCK (i)) != BLOCK_ORIGINAL)
        break;
  
!   min = max = i;
!   for (; i < n_basic_blocks; i++)
!     if (STATE (BASIC_BLOCK (i)) != BLOCK_ORIGINAL)
!       max = i;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   for (i = min; i <= max; i++)
      {
        edge e;
-       basic_block b = BASIC_BLOCK (i);
  
!       if (STATE (b) == BLOCK_ORIGINAL)
  	continue;
!       if (STATE (b) == BLOCK_NEW)
  	{
! 	  b->count = 0;
! 	  b->frequency = 0;
! 	  for (e = b->pred; e; e=e->pred_next)
  	    {
! 	      b->count += e->count;
! 	      b->frequency += EDGE_FREQUENCY (e);
  	    }
  	}
  
!       compute_outgoing_frequencies (b);
      }
  
!   for (i = 0; i < n_basic_blocks; i++)
!     SET_STATE (BASIC_BLOCK (i), 0);
  }
  
  /* Like above but for single basic block only.  */
--- 794,846 ----
  find_many_sub_basic_blocks (blocks)
       sbitmap blocks;
  {
!   basic_block bb, min, max;
  
!   FOR_EACH_BB (bb)
!     SET_STATE (bb,
! 	       TEST_BIT (blocks, bb->index) ? BLOCK_TO_SPLIT : BLOCK_ORIGINAL);
! 
!   FOR_EACH_BB (bb)
!     if (STATE (bb) == BLOCK_TO_SPLIT)
!       find_bb_boundaries (bb);
  
!   FOR_EACH_BB (bb)
!     if (STATE (bb) != BLOCK_ORIGINAL)
        break;
  
!   min = max = bb;
!   for (; bb != EXIT_BLOCK_PTR; bb = bb->next_bb)
!     if (STATE (bb) != BLOCK_ORIGINAL)
!       max = bb;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, min, max, 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
      {
        edge e;
  
!       if (STATE (bb) == BLOCK_ORIGINAL)
  	continue;
!       if (STATE (bb) == BLOCK_NEW)
  	{
! 	  bb->count = 0;
! 	  bb->frequency = 0;
! 	  for (e = bb->pred; e; e=e->pred_next)
  	    {
! 	      bb->count += e->count;
! 	      bb->frequency += EDGE_FREQUENCY (e);
  	    }
  	}
  
!       compute_outgoing_frequencies (bb);
      }
  
!   FOR_EACH_BB (bb)
!     SET_STATE (bb, 0);
  }
  
  /* Like above but for single basic block only.  */
*************** void
*** 851,876 ****
  find_sub_basic_blocks (bb)
       basic_block bb;
  {
!   int i;
!   int min, max;
    basic_block next = bb->next_bb;
  
!   min = bb->index;
    find_bb_boundaries (bb);
!   max = next->prev_bb->index;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, BASIC_BLOCK (min), BASIC_BLOCK (max), 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   for (i = min; i <= max; i++)
      {
        edge e;
-       basic_block b = BASIC_BLOCK (i);
  
!       if (i != min)
  	{
  	  b->count = 0;
  	  b->frequency = 0;
--- 849,872 ----
  find_sub_basic_blocks (bb)
       basic_block bb;
  {
!   basic_block min, max, b;
    basic_block next = bb->next_bb;
  
!   min = bb;
    find_bb_boundaries (bb);
!   max = next->prev_bb;
  
    /* Now re-scan and wire in all edges.  This expect simple (conditional)
       jumps at the end of each new basic blocks.  */
!   make_edges (NULL, min, max, 1);
  
    /* Update branch probabilities.  Expect only (un)conditional jumps
       to be created with only the forward edges.  */
!   FOR_BB_BETWEEN (b, min, max->next_bb, next_bb)
      {
        edge e;
  
!       if (b != min)
  	{
  	  b->count = 0;
  	  b->frequency = 0;
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.58
diff -c -3 -p -r1.58 cfgcleanup.c
*** cfgcleanup.c	22 May 2002 01:27:33 -0000	1.58
--- cfgcleanup.c	22 May 2002 17:04:28 -0000
*************** static bool
*** 1577,1592 ****
  try_optimize_cfg (mode)
       int mode;
  {
-   int i;
    bool changed_overall = false;
    bool changed;
    int iterations = 0;
  
    if (mode & CLEANUP_CROSSJUMP)
      add_noreturn_fake_exit_edges ();
  
!   for (i = 0; i < n_basic_blocks; i++)
!     update_forwarder_flag (BASIC_BLOCK (i));
  
    if (mode & CLEANUP_UPDATE_LIFE)
      clear_bb_flags ();
--- 1577,1592 ----
  try_optimize_cfg (mode)
       int mode;
  {
    bool changed_overall = false;
    bool changed;
    int iterations = 0;
+   basic_block bb, b;
  
    if (mode & CLEANUP_CROSSJUMP)
      add_noreturn_fake_exit_edges ();
  
!   FOR_EACH_BB (bb)
!     update_forwarder_flag (bb);
  
    if (mode & CLEANUP_UPDATE_LIFE)
      clear_bb_flags ();
*************** try_optimize_cfg (mode)
*** 1606,1614 ****
  		     "\n\ntry_optimize_cfg iteration %i\n\n",
  		     iterations);
  
! 	  for (i = 0; i < n_basic_blocks;)
  	    {
! 	      basic_block c, b = BASIC_BLOCK (i);
  	      edge s;
  	      bool changed_here = false;
  
--- 1606,1614 ----
  		     "\n\ntry_optimize_cfg iteration %i\n\n",
  		     iterations);
  
! 	  for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR;)
  	    {
! 	      basic_block c;
  	      edge s;
  	      bool changed_here = false;
  
*************** try_optimize_cfg (mode)
*** 1721,1727 ****
  	      /* Don't get confused by the index shift caused by
  		 deleting blocks.  */
  	      if (!changed_here)
! 		i = b->index + 1;
  	      else
  		changed = true;
  	    }
--- 1721,1727 ----
  	      /* Don't get confused by the index shift caused by
  		 deleting blocks.  */
  	      if (!changed_here)
! 		b = b->next_bb;
  	      else
  		changed = true;
  	    }
*************** try_optimize_cfg (mode)
*** 1753,1760 ****
  bool
  delete_unreachable_blocks ()
  {
-   int i, j;
    bool changed = false;
  
    find_unreachable_blocks ();
  
--- 1753,1761 ----
  bool
  delete_unreachable_blocks ()
  {
    bool changed = false;
+   basic_block b, next_bb;
+   int j = 0;
  
    find_unreachable_blocks ();
  
*************** delete_unreachable_blocks ()
*** 1762,1770 ****
       as otherwise we can wind up with O(N^2) behaviour here when we
       have oodles of dead code.  */
  
!   for (i = j = 0; i < n_basic_blocks; ++i)
      {
!       basic_block b = BASIC_BLOCK (i);
  
        if (!(b->flags & BB_REACHABLE))
  	{
--- 1763,1771 ----
       as otherwise we can wind up with O(N^2) behaviour here when we
       have oodles of dead code.  */
  
!   for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
      {
!       next_bb = b->next_bb;
  
        if (!(b->flags & BB_REACHABLE))
  	{
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 cfglayout.c
*** cfglayout.c	22 May 2002 01:27:33 -0000	1.16
--- cfglayout.c	22 May 2002 17:04:28 -0000
*************** static void
*** 191,201 ****
  record_effective_endpoints ()
  {
    rtx next_insn = get_insns ();
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx end;
  
        if (PREV_INSN (bb->head) && next_insn != bb->head)
--- 191,200 ----
  record_effective_endpoints ()
  {
    rtx next_insn = get_insns ();
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        rtx end;
  
        if (PREV_INSN (bb->head) && next_insn != bb->head)
*************** verify_insn_chain ()
*** 597,607 ****
  static void
  cleanup_unconditional_jumps ()
  {
!   int i;
!   for (i = 0; i < n_basic_blocks; i++)
!     {
!       basic_block bb = BASIC_BLOCK (i);
  
        if (!bb->succ)
  	continue;
        if (bb->succ->flags & EDGE_FALLTHRU)
--- 596,605 ----
  static void
  cleanup_unconditional_jumps ()
  {
!   basic_block bb;
  
+   FOR_EACH_BB (bb)
+     {
        if (!bb->succ)
  	continue;
        if (bb->succ->flags & EDGE_FALLTHRU)
*************** cleanup_unconditional_jumps ()
*** 609,619 ****
        if (!bb->succ->succ_next)
  	{
  	  rtx insn;
! 	  if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb) && i)
  	    {
  	      basic_block prev = bb->prev_bb;
- 
- 	      i--;
  
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
--- 607,616 ----
        if (!bb->succ->succ_next)
  	{
  	  rtx insn;
! 	  if (GET_CODE (bb->head) != CODE_LABEL && forwarder_block_p (bb)
! 	      && bb->prev_bb != ENTRY_BLOCK_PTR)
  	    {
  	      basic_block prev = bb->prev_bb;
  
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
Index: cfgloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 cfgloop.c
*** cfgloop.c	22 May 2002 01:27:34 -0000	1.9
--- cfgloop.c	22 May 2002 17:04:28 -0000
*************** flow_loops_cfg_dump (loops, file)
*** 50,65 ****
       FILE *file;
  {
    int i;
  
    if (! loops->num || ! file || ! loops->cfg.dom)
      return;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
        edge succ;
  
!       fprintf (file, ";; %d succs { ", i);
!       for (succ = BASIC_BLOCK (i)->succ; succ; succ = succ->succ_next)
  	fprintf (file, "%d ", succ->dest->index);
        flow_nodes_print ("} dom", loops->cfg.dom[i], file);
      }
--- 50,66 ----
       FILE *file;
  {
    int i;
+   basic_block bb;
  
    if (! loops->num || ! file || ! loops->cfg.dom)
      return;
  
!   FOR_EACH_BB (bb)
      {
        edge succ;
  
!       fprintf (file, ";; %d succs { ", bb->index);
!       for (succ = bb->succ; succ; succ = succ->succ_next)
  	fprintf (file, "%d ", succ->dest->index);
        flow_nodes_print ("} dom", loops->cfg.dom[i], file);
      }
*************** flow_loops_find (loops, flags)
*** 643,648 ****
--- 644,650 ----
    sbitmap *dom;
    int *dfs_order;
    int *rc_order;
+   basic_block header;
  
    /* This function cannot be repeatedly called with different
       flags to build up the loop information.  The loop tree
*************** flow_loops_find (loops, flags)
*** 667,677 ****
    /* Count the number of loop edges (back edges).  This should be the
       same as the number of natural loops.  */
    num_loops = 0;
!   for (b = 0; b < n_basic_blocks; b++)
      {
-       basic_block header;
- 
-       header = BASIC_BLOCK (b);
        header->loop_depth = 0;
  
        for (e = header->pred; e; e = e->pred_next)
--- 669,676 ----
    /* Count the number of loop edges (back edges).  This should be the
       same as the number of natural loops.  */
    num_loops = 0;
!   FOR_EACH_BB (header)
      {
        header->loop_depth = 0;
  
        for (e = header->pred; e; e = e->pred_next)
*************** flow_loops_find (loops, flags)
*** 684,693 ****
  	     loop.  It also has single back edge to the header
  	     from a latch node.  Note that multiple natural loops
  	     may share the same header.  */
! 	  if (b != header->index)
! 	    abort ();
! 
! 	  if (latch != ENTRY_BLOCK_PTR && TEST_BIT (dom[latch->index], b))
  	    num_loops++;
  	}
      }
--- 683,689 ----
  	     loop.  It also has single back edge to the header
  	     from a latch node.  Note that multiple natural loops
  	     may share the same header.  */
! 	  if (latch != ENTRY_BLOCK_PTR && TEST_BIT (dom[latch->index], header->index))
  	    num_loops++;
  	}
      }
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.50
diff -c -3 -p -r1.50 cfgrtl.c
*** cfgrtl.c	22 May 2002 01:27:34 -0000	1.50
--- cfgrtl.c	22 May 2002 17:04:28 -0000
*************** void
*** 448,463 ****
  compute_bb_for_insn (max)
       int max;
  {
!   int i;
  
    if (basic_block_for_insn)
      VARRAY_FREE (basic_block_for_insn);
  
    VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
  
!   for (i = 0; i < n_basic_blocks; ++i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx end = bb->end;
        rtx insn;
  
--- 448,462 ----
  compute_bb_for_insn (max)
       int max;
  {
!   basic_block bb;
  
    if (basic_block_for_insn)
      VARRAY_FREE (basic_block_for_insn);
  
    VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
  
!   FOR_EACH_BB (bb)
      {
        rtx end = bb->end;
        rtx insn;
  
*************** tidy_fallthru_edge (e, b, c)
*** 1168,1181 ****
  void
  tidy_fallthru_edges ()
  {
!   int i;
  
!   for (i = 1; i < n_basic_blocks; i++)
      {
-       basic_block c = BASIC_BLOCK (i);
-       basic_block b = c->prev_bb;
        edge s;
  
        /* We care about simple conditional or unconditional jumps with
  	 a single successor.
  
--- 1167,1183 ----
  void
  tidy_fallthru_edges ()
  {
!   basic_block b, c;
! 
!   if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
!     return;
  
!   FOR_BB_BETWEEN (b, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR->prev_bb, next_bb)
      {
        edge s;
  
+       c = b->next_bb;
+ 
        /* We care about simple conditional or unconditional jumps with
  	 a single successor.
  
*************** commit_one_edge_insertion (e, watch_call
*** 1476,1491 ****
  void
  commit_edge_insertions ()
  {
-   int i;
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   i = -1;
!   bb = ENTRY_BLOCK_PTR;
!   while (1)
      {
        edge e, next;
  
--- 1478,1490 ----
  void
  commit_edge_insertions ()
  {
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        edge e, next;
  
*************** commit_edge_insertions ()
*** 1495,1504 ****
  	  if (e->insns)
  	    commit_one_edge_insertion (e, false);
  	}
- 
-       if (++i >= n_basic_blocks)
- 	break;
-       bb = BASIC_BLOCK (i);
      }
  }
  \f
--- 1494,1499 ----
*************** commit_edge_insertions ()
*** 1508,1523 ****
  void
  commit_edge_insertions_watch_calls ()
  {
-   int i;
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   i = -1;
!   bb = ENTRY_BLOCK_PTR;
!   while (1)
      {
        edge e, next;
  
--- 1503,1515 ----
  void
  commit_edge_insertions_watch_calls ()
  {
    basic_block bb;
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
  #endif
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
      {
        edge e, next;
  
*************** commit_edge_insertions_watch_calls ()
*** 1527,1536 ****
  	  if (e->insns)
  	    commit_one_edge_insertion (e, true);
  	}
- 
-       if (++i >= n_basic_blocks)
- 	break;
-       bb = BASIC_BLOCK (i);
      }
  }
  \f
--- 1519,1524 ----
*************** print_rtl_with_bb (outf, rtx_first)
*** 1601,1607 ****
      fprintf (outf, "(nil)\n");
    else
      {
-       int i;
        enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
        int max_uid = get_max_uid ();
        basic_block *start
--- 1589,1594 ----
*************** print_rtl_with_bb (outf, rtx_first)
*** 1611,1619 ****
        enum bb_state *in_bb_p
  	= (enum bb_state *) xcalloc (max_uid, sizeof (enum bb_state));
  
!       for (i = n_basic_blocks - 1; i >= 0; i--)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  rtx x;
  
  	  start[INSN_UID (bb->head)] = bb;
--- 1598,1607 ----
        enum bb_state *in_bb_p
  	= (enum bb_state *) xcalloc (max_uid, sizeof (enum bb_state));
  
!       basic_block bb;
! 
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  rtx x;
  
  	  start[INSN_UID (bb->head)] = bb;
*************** print_rtl_with_bb (outf, rtx_first)
*** 1634,1640 ****
        for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
  	{
  	  int did_output;
- 	  basic_block bb;
  
  	  if ((bb = start[INSN_UID (tmp_rtx)]) != NULL)
  	    {
--- 1622,1627 ----
*************** verify_flow_info ()
*** 1721,1727 ****
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int i, last_bb_num_seen, num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
--- 1708,1714 ----
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int i, num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
*************** verify_flow_info ()
*** 1765,1773 ****
        last_bb_seen = bb;
      }
  
!   for (i = n_basic_blocks - 1; i >= 0; i--)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx head = bb->head;
        rtx end = bb->end;
  
--- 1752,1759 ----
        last_bb_seen = bb;
      }
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx head = bb->head;
        rtx end = bb->end;
  
*************** verify_flow_info ()
*** 1813,1821 ****
      }
  
    /* Now check the basic blocks (boundaries etc.) */
!   for (i = n_basic_blocks - 1; i >= 0; i--)
      {
-       basic_block bb = BASIC_BLOCK (i);
        int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0;
        edge e;
        rtx note;
--- 1799,1806 ----
      }
  
    /* Now check the basic blocks (boundaries etc.) */
!   FOR_EACH_BB_REVERSE (bb)
      {
        int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0;
        edge e;
        rtx note;
*************** verify_flow_info ()
*** 2087,2094 ****
  	err = 1;
        }
  
-   last_bb_num_seen = -1;
    num_bb_notes = 0;
    for (x = rtx_first; x; x = NEXT_INSN (x))
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
--- 2072,2080 ----
  	err = 1;
        }
  
    num_bb_notes = 0;
+   last_bb_seen = ENTRY_BLOCK_PTR;
+ 
    for (x = rtx_first; x; x = NEXT_INSN (x))
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
*************** verify_flow_info ()
*** 2096,2105 ****
  	  basic_block bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
! 	  if (bb->index != last_bb_num_seen + 1)
  	    internal_error ("basic blocks not numbered consecutively");
  
! 	  last_bb_num_seen = bb->index;
  	}
  
        if (!bb_info[INSN_UID (x)])
--- 2082,2091 ----
  	  basic_block bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
! 	  if (bb != last_bb_seen->next_bb)
  	    internal_error ("basic blocks not numbered consecutively");
  
! 	  last_bb_seen = bb;
  	}
  
        if (!bb_info[INSN_UID (x)])
*************** bool
*** 2325,2332 ****
  purge_all_dead_edges (update_life_p)
       int update_life_p;
  {
!   int i, purged = false;
    sbitmap blocks = 0;
  
    if (update_life_p)
      {
--- 2311,2319 ----
  purge_all_dead_edges (update_life_p)
       int update_life_p;
  {
!   int purged = false;
    sbitmap blocks = 0;
+   basic_block bb;
  
    if (update_life_p)
      {
*************** purge_all_dead_edges (update_life_p)
*** 2334,2346 ****
        sbitmap_zero (blocks);
      }
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       bool purged_here = purge_dead_edges (BASIC_BLOCK (i));
  
        purged |= purged_here;
        if (purged_here && update_life_p)
! 	SET_BIT (blocks, i);
      }
  
    if (update_life_p && purged)
--- 2321,2333 ----
        sbitmap_zero (blocks);
      }
  
!   FOR_EACH_BB (bb)
      {
!       bool purged_here = purge_dead_edges (bb);
  
        purged |= purged_here;
        if (purged_here && update_life_p)
! 	SET_BIT (blocks, bb->index);
      }
  
    if (update_life_p && purged)
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.290
diff -c -3 -p -r1.290 combine.c
*** combine.c	21 May 2002 20:37:38 -0000	1.290
--- combine.c	22 May 2002 17:04:32 -0000
*************** combine_instructions (f, nregs)
*** 610,742 ****
  
    /* Now scan all the insns in forward order.  */
  
-   this_basic_block = ENTRY_BLOCK_PTR;
    label_tick = 1;
    last_call_cuid = 0;
    mem_last_set = 0;
    init_reg_last_arrays ();
    setup_incoming_promotions ();
  
!   for (insn = f; insn; insn = next ? next : NEXT_INSN (insn))
      {
!       next = 0;
! 
!       /* If INSN starts a new basic block, update our basic block number.  */
!       if (this_basic_block->next_bb != EXIT_BLOCK_PTR
! 	  && this_basic_block->next_bb->head == insn)
! 	this_basic_block = this_basic_block->next_bb;
  
!       if (GET_CODE (insn) == CODE_LABEL)
! 	label_tick++;
  
!       else if (INSN_P (insn))
! 	{
! 	  /* See if we know about function return values before this
! 	     insn based upon SUBREG flags.  */
! 	  check_promoted_subreg (insn, PATTERN (insn));
  
! 	  /* Try this insn with each insn it links back to.  */
  
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    if ((next = try_combine (insn, XEXP (links, 0),
! 				     NULL_RTX, &new_direct_jump_p)) != 0)
! 	      goto retry;
  
! 	  /* Try each sequence of three linked insns ending with this one.  */
  
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    {
! 	      rtx link = XEXP (links, 0);
  
! 	      /* If the linked insn has been replaced by a note, then there
! 		 is no point in pursuing this chain any further.  */
! 	      if (GET_CODE (link) == NOTE)
! 		continue;
  
! 	      for (nextlinks = LOG_LINKS (link);
! 		   nextlinks;
! 		   nextlinks = XEXP (nextlinks, 1))
! 		if ((next = try_combine (insn, link,
! 					 XEXP (nextlinks, 0),
! 					 &new_direct_jump_p)) != 0)
! 		  goto retry;
! 	    }
  
! #ifdef HAVE_cc0
! 	  /* Try to combine a jump insn that uses CC0
! 	     with a preceding insn that sets CC0, and maybe with its
! 	     logical predecessor as well.
! 	     This is how we make decrement-and-branch insns.
! 	     We need this special code because data flow connections
! 	     via CC0 do not get entered in LOG_LINKS.  */
! 
! 	  if (GET_CODE (insn) == JUMP_INSN
! 	      && (prev = prev_nonnote_insn (insn)) != 0
! 	      && GET_CODE (prev) == INSN
! 	      && sets_cc0_p (PATTERN (prev)))
! 	    {
! 	      if ((next = try_combine (insn, prev,
! 				       NULL_RTX, &new_direct_jump_p)) != 0)
! 		goto retry;
! 
! 	      for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		   nextlinks = XEXP (nextlinks, 1))
! 		if ((next = try_combine (insn, prev,
! 					 XEXP (nextlinks, 0),
! 					 &new_direct_jump_p)) != 0)
! 		  goto retry;
! 	    }
  
! 	  /* Do the same for an insn that explicitly references CC0.  */
! 	  if (GET_CODE (insn) == INSN
! 	      && (prev = prev_nonnote_insn (insn)) != 0
! 	      && GET_CODE (prev) == INSN
! 	      && sets_cc0_p (PATTERN (prev))
! 	      && GET_CODE (PATTERN (insn)) == SET
! 	      && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn))))
! 	    {
! 	      if ((next = try_combine (insn, prev,
! 				       NULL_RTX, &new_direct_jump_p)) != 0)
! 		goto retry;
! 
! 	      for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		   nextlinks = XEXP (nextlinks, 1))
! 		if ((next = try_combine (insn, prev,
! 					 XEXP (nextlinks, 0),
! 					 &new_direct_jump_p)) != 0)
  		  goto retry;
! 	    }
  
! 	  /* Finally, see if any of the insns that this insn links to
! 	     explicitly references CC0.  If so, try this insn, that insn,
! 	     and its predecessor if it sets CC0.  */
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    if (GET_CODE (XEXP (links, 0)) == INSN
! 		&& GET_CODE (PATTERN (XEXP (links, 0))) == SET
! 		&& reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (XEXP (links, 0))))
! 		&& (prev = prev_nonnote_insn (XEXP (links, 0))) != 0
! 		&& GET_CODE (prev) == INSN
! 		&& sets_cc0_p (PATTERN (prev))
! 		&& (next = try_combine (insn, XEXP (links, 0),
! 					prev, &new_direct_jump_p)) != 0)
! 	      goto retry;
! #endif
! 
! 	  /* Try combining an insn with two different insns whose results it
! 	     uses.  */
! 	  for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 	    for (nextlinks = XEXP (links, 1); nextlinks;
! 		 nextlinks = XEXP (nextlinks, 1))
! 	      if ((next = try_combine (insn, XEXP (links, 0),
! 				       XEXP (nextlinks, 0),
! 				       &new_direct_jump_p)) != 0)
! 		goto retry;
  
! 	  if (GET_CODE (insn) != NOTE)
! 	    record_dead_and_set_regs (insn);
  
! 	retry:
! 	  ;
  	}
      }
    clear_bb_flags ();
--- 610,741 ----
  
    /* Now scan all the insns in forward order.  */
  
    label_tick = 1;
    last_call_cuid = 0;
    mem_last_set = 0;
    init_reg_last_arrays ();
    setup_incoming_promotions ();
  
!   FOR_EACH_BB (this_basic_block)
      {
!       for (insn = this_basic_block->head;
!            insn != NEXT_INSN (this_basic_block->end);
! 	   insn = next ? next : NEXT_INSN (insn))
! 	{
! 	  next = 0;
  
! 	  if (GET_CODE (insn) == CODE_LABEL)
! 	    label_tick++;
  
! 	  else if (INSN_P (insn))
! 	    {
! 	      /* See if we know about function return values before this
! 		 insn based upon SUBREG flags.  */
! 	      check_promoted_subreg (insn, PATTERN (insn));
  
! 	      /* Try this insn with each insn it links back to.  */
  
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		if ((next = try_combine (insn, XEXP (links, 0),
! 					 NULL_RTX, &new_direct_jump_p)) != 0)
! 		  goto retry;
  
! 	      /* Try each sequence of three linked insns ending with this one.  */
  
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		{
! 		  rtx link = XEXP (links, 0);
  
! 		  /* If the linked insn has been replaced by a note, then there
! 		     is no point in pursuing this chain any further.  */
! 		  if (GET_CODE (link) == NOTE)
! 		    continue;
! 
! 		  for (nextlinks = LOG_LINKS (link);
! 		       nextlinks;
! 		       nextlinks = XEXP (nextlinks, 1))
! 		    if ((next = try_combine (insn, link,
! 					     XEXP (nextlinks, 0),
! 					     &new_direct_jump_p)) != 0)
! 		      goto retry;
! 		}
  
!     #ifdef HAVE_cc0
! 	      /* Try to combine a jump insn that uses CC0
! 		 with a preceding insn that sets CC0, and maybe with its
! 		 logical predecessor as well.
! 		 This is how we make decrement-and-branch insns.
! 		 We need this special code because data flow connections
! 		 via CC0 do not get entered in LOG_LINKS.  */
! 
! 	      if (GET_CODE (insn) == JUMP_INSN
! 		  && (prev = prev_nonnote_insn (insn)) != 0
! 		  && GET_CODE (prev) == INSN
! 		  && sets_cc0_p (PATTERN (prev)))
! 		{
! 		  if ((next = try_combine (insn, prev,
! 					   NULL_RTX, &new_direct_jump_p)) != 0)
! 		    goto retry;
! 
! 		  for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		       nextlinks = XEXP (nextlinks, 1))
! 		    if ((next = try_combine (insn, prev,
! 					     XEXP (nextlinks, 0),
! 					     &new_direct_jump_p)) != 0)
! 		      goto retry;
! 		}
  
! 	      /* Do the same for an insn that explicitly references CC0.  */
! 	      if (GET_CODE (insn) == INSN
! 		  && (prev = prev_nonnote_insn (insn)) != 0
! 		  && GET_CODE (prev) == INSN
! 		  && sets_cc0_p (PATTERN (prev))
! 		  && GET_CODE (PATTERN (insn)) == SET
! 		  && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn))))
! 		{
! 		  if ((next = try_combine (insn, prev,
! 					   NULL_RTX, &new_direct_jump_p)) != 0)
! 		    goto retry;
! 
! 		  for (nextlinks = LOG_LINKS (prev); nextlinks;
! 		       nextlinks = XEXP (nextlinks, 1))
! 		    if ((next = try_combine (insn, prev,
! 					     XEXP (nextlinks, 0),
! 					     &new_direct_jump_p)) != 0)
! 		      goto retry;
! 		}
  
! 	      /* Finally, see if any of the insns that this insn links to
! 		 explicitly references CC0.  If so, try this insn, that insn,
! 		 and its predecessor if it sets CC0.  */
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		if (GET_CODE (XEXP (links, 0)) == INSN
! 		    && GET_CODE (PATTERN (XEXP (links, 0))) == SET
! 		    && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (XEXP (links, 0))))
! 		    && (prev = prev_nonnote_insn (XEXP (links, 0))) != 0
! 		    && GET_CODE (prev) == INSN
! 		    && sets_cc0_p (PATTERN (prev))
! 		    && (next = try_combine (insn, XEXP (links, 0),
! 					    prev, &new_direct_jump_p)) != 0)
  		  goto retry;
!     #endif
  
! 	      /* Try combining an insn with two different insns whose results it
! 		 uses.  */
! 	      for (links = LOG_LINKS (insn); links; links = XEXP (links, 1))
! 		for (nextlinks = XEXP (links, 1); nextlinks;
! 		     nextlinks = XEXP (nextlinks, 1))
! 		  if ((next = try_combine (insn, XEXP (links, 0),
! 					   XEXP (nextlinks, 0),
! 					   &new_direct_jump_p)) != 0)
! 		    goto retry;
  
! 	      if (GET_CODE (insn) != NOTE)
! 		record_dead_and_set_regs (insn);
  
! 	    retry:
! 	      ;
! 	    }
  	}
      }
    clear_bb_flags ();
*************** reg_dead_at_p (reg, insn)
*** 11685,11691 ****
       rtx reg;
       rtx insn;
  {
!   int block;
    unsigned int i;
  
    /* Set variables for reg_dead_at_p_1.  */
--- 11684,11690 ----
       rtx reg;
       rtx insn;
  {
!   basic_block block;
    unsigned int i;
  
    /* Set variables for reg_dead_at_p_1.  */
*************** reg_dead_at_p (reg, insn)
*** 11718,11738 ****
  	return 1;
      }
  
!   /* Get the basic block number that we were in.  */
    if (insn == 0)
!     block = 0;
    else
      {
!       for (block = 0; block < n_basic_blocks; block++)
! 	if (insn == BLOCK_HEAD (block))
  	  break;
  
!       if (block == n_basic_blocks)
  	return 0;
      }
  
    for (i = reg_dead_regno; i < reg_dead_endregno; i++)
!     if (REGNO_REG_SET_P (BASIC_BLOCK (block)->global_live_at_start, i))
        return 0;
  
    return 1;
--- 11717,11737 ----
  	return 1;
      }
  
!   /* Get the basic block that we were in.  */
    if (insn == 0)
!     block = ENTRY_BLOCK_PTR->next_bb;
    else
      {
!       FOR_EACH_BB (block)
! 	if (insn == block->head)
  	  break;
  
!       if (block == EXIT_BLOCK_PTR)
  	return 0;
      }
  
    for (i = reg_dead_regno; i < reg_dead_endregno; i++)
!     if (REGNO_REG_SET_P (block->global_live_at_start, i))
        return 0;
  
    return 1;
Index: conflict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/conflict.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 conflict.c
*** conflict.c	17 May 2002 02:31:30 -0000	1.13
--- conflict.c	22 May 2002 17:04:32 -0000
*************** conflict_graph_compute (regs, p)
*** 447,465 ****
       regset regs;
       partition p;
  {
-   int b;
    conflict_graph graph = conflict_graph_new (max_reg_num ());
    regset_head live_head;
    regset live = &live_head;
    regset_head born_head;
    regset born = &born_head;
  
    INIT_REG_SET (live);
    INIT_REG_SET (born);
  
!   for (b = n_basic_blocks; --b >= 0; )
      {
-       basic_block bb = BASIC_BLOCK (b);
        rtx insn;
        rtx head;
  
--- 447,464 ----
       regset regs;
       partition p;
  {
    conflict_graph graph = conflict_graph_new (max_reg_num ());
    regset_head live_head;
    regset live = &live_head;
    regset_head born_head;
    regset born = &born_head;
+   basic_block bb;
  
    INIT_REG_SET (live);
    INIT_REG_SET (born);
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx insn;
        rtx head;
  
Index: df.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/df.c,v
retrieving revision 1.29
diff -c -3 -p -r1.29 df.c
*** df.c	17 May 2002 02:31:30 -0000	1.29
--- df.c	22 May 2002 17:04:32 -0000
*************** Perhaps there should be a bitmap argumen
*** 171,182 ****
  #include "df.h"
  #include "fibheap.h"
  
- #define FOR_ALL_BBS(BB, CODE)					\
- do {								\
-   int node_;							\
-   for (node_ = 0; node_ < n_basic_blocks; node_++)		\
-     {(BB) = BASIC_BLOCK (node_); CODE;};} while (0)
- 
  #define FOR_EACH_BB_IN_BITMAP(BITMAP, MIN, BB, CODE)		\
  do {								\
    unsigned int node_;						\
--- 171,176 ----
*************** df_bitmaps_alloc (df, flags)
*** 406,413 ****
       struct df *df;
       int flags;
  {
-   unsigned int i;
    int dflags = 0;
  
    /* Free the bitmaps if they need resizing.  */
    if ((flags & DF_LR) && df->n_regs < (unsigned int)max_reg_num ())
--- 400,407 ----
       struct df *df;
       int flags;
  {
    int dflags = 0;
+   basic_block bb;
  
    /* Free the bitmaps if they need resizing.  */
    if ((flags & DF_LR) && df->n_regs < (unsigned int)max_reg_num ())
*************** df_bitmaps_alloc (df, flags)
*** 423,431 ****
    df->n_defs = df->def_id;
    df->n_uses = df->use_id;
  
!   for (i = 0; i < df->n_bbs; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (flags & DF_RD && ! bb_info->rd_in)
--- 417,424 ----
    df->n_defs = df->def_id;
    df->n_uses = df->use_id;
  
!   FOR_EACH_BB (bb)
      {
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (flags & DF_RD && ! bb_info->rd_in)
*************** df_bitmaps_free (df, flags)
*** 474,484 ****
       struct df *df ATTRIBUTE_UNUSED;
       int flags;
  {
!   unsigned int i;
  
!   for (i = 0; i < df->n_bbs; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (!bb_info)
--- 467,476 ----
       struct df *df ATTRIBUTE_UNUSED;
       int flags;
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
        if (!bb_info)
*************** df_alloc (df, n_regs)
*** 534,540 ****
       int n_regs;
  {
    int n_insns;
!   int i;
  
    gcc_obstack_init (&df_ref_obstack);
  
--- 526,532 ----
       int n_regs;
  {
    int n_insns;
!   basic_block bb;
  
    gcc_obstack_init (&df_ref_obstack);
  
*************** df_alloc (df, n_regs)
*** 572,579 ****
    df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info));
  
    df->all_blocks = BITMAP_XMALLOC ();
!   for (i = 0; i < n_basic_blocks; i++)
!     bitmap_set_bit (df->all_blocks, i);
  }
  
  
--- 564,571 ----
    df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info));
  
    df->all_blocks = BITMAP_XMALLOC ();
!   FOR_EACH_BB (bb)
!     bitmap_set_bit (df->all_blocks, bb->index);
  }
  
  
*************** df_analyse_1 (df, blocks, flags, update)
*** 1946,1951 ****
--- 1938,1945 ----
    int aflags;
    int dflags;
    int i;
+   basic_block bb;
+ 
    dflags = 0;
    aflags = flags;
    if (flags & DF_UD_CHAIN)
*************** df_analyse_1 (df, blocks, flags, update)
*** 2029,2045 ****
        /* Compute the sets of gens and kills for the defs of each bb.  */
        df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
        {
- 	int i;
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	for (i = 0; i < n_basic_blocks; i ++)
  	  {
! 	    in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_in;
! 	    out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_out;
! 	    gen[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_gen;
! 	    kill[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   FORWARD, UNION, df_rd_transfer_function,
--- 2023,2038 ----
        /* Compute the sets of gens and kills for the defs of each bb.  */
        df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
        {
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	FOR_EACH_BB (bb)
  	  {
! 	    in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
! 	    out[bb->index] = DF_BB_INFO (df, bb)->rd_out;
! 	    gen[bb->index] = DF_BB_INFO (df, bb)->rd_gen;
! 	    kill[bb->index] = DF_BB_INFO (df, bb)->rd_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   FORWARD, UNION, df_rd_transfer_function,
*************** df_analyse_1 (df, blocks, flags, update)
*** 2066,2082 ****
  	 uses in each bb.  */
        df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
        {
- 	int i;
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	for (i = 0; i < n_basic_blocks; i ++)
  	  {
! 	    in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_in;
! 	    out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_out;
! 	    gen[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_gen;
! 	    kill[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   BACKWARD, UNION, df_ru_transfer_function,
--- 2059,2074 ----
  	 uses in each bb.  */
        df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
        {
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	FOR_EACH_BB (bb)
  	  {
! 	    in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
! 	    out[bb->index] = DF_BB_INFO (df, bb)->ru_out;
! 	    gen[bb->index] = DF_BB_INFO (df, bb)->ru_gen;
! 	    kill[bb->index] = DF_BB_INFO (df, bb)->ru_kill;
  	  }
  	iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks,
  				   BACKWARD, UNION, df_ru_transfer_function,
*************** df_analyse_1 (df, blocks, flags, update)
*** 2106,2122 ****
        /* Compute the sets of defs and uses of live variables.  */
        df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
        {
- 	int i;
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *use = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *def = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	for (i = 0; i < n_basic_blocks; i ++)
  	  {
! 	    in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_in;
! 	    out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_out;
! 	    use[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_use;
! 	    def[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_def;
  	  }
  	iterative_dataflow_bitmap (in, out, use, def, df->all_blocks,
  				   BACKWARD, UNION, df_lr_transfer_function,
--- 2098,2113 ----
        /* Compute the sets of defs and uses of live variables.  */
        df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
        {
  	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *use = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	bitmap *def = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	FOR_EACH_BB (bb)
  	  {
! 	    in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
! 	    out[bb->index] = DF_BB_INFO (df, bb)->lr_out;
! 	    use[bb->index] = DF_BB_INFO (df, bb)->lr_use;
! 	    def[bb->index] = DF_BB_INFO (df, bb)->lr_def;
  	  }
  	iterative_dataflow_bitmap (in, out, use, def, df->all_blocks,
  				   BACKWARD, UNION, df_lr_transfer_function,
*************** df_modified_p (df, blocks)
*** 2270,2281 ****
       struct df *df;
       bitmap blocks;
  {
-   unsigned int j;
    int update = 0;
  
!   for (j = 0; j < df->n_bbs; j++)
!     if (bitmap_bit_p (df->bbs_modified, j)
! 	&& (! blocks || (blocks == (bitmap) -1) || bitmap_bit_p (blocks, j)))
      {
        update = 1;
        break;
--- 2261,2275 ----
       struct df *df;
       bitmap blocks;
  {
    int update = 0;
+   basic_block bb;
+ 
+   if (!df->n_bbs)
+     return 0;
  
!   FOR_EACH_BB (bb)
!     if (bitmap_bit_p (df->bbs_modified, bb->index)
! 	&& (! blocks || (blocks == (bitmap) -1) || bitmap_bit_p (blocks, bb->index)))
      {
        update = 1;
        break;
*************** df_refs_unlink (df, blocks)
*** 2408,2414 ****
      }
    else
      {
!       FOR_ALL_BBS (bb,
        {
  	df_bb_refs_unlink (df, bb);
        });
--- 2402,2408 ----
      }
    else
      {
!       FOR_EACH_BB (bb,
        {
  	df_bb_refs_unlink (df, bb);
        });
*************** df_dump (df, flags, file)
*** 3274,3281 ****
       int flags;
       FILE *file;
  {
-   unsigned int i;
    unsigned int j;
  
    if (! df || ! file)
      return;
--- 3268,3275 ----
       int flags;
       FILE *file;
  {
    unsigned int j;
+   basic_block bb;
  
    if (! df || ! file)
      return;
*************** df_dump (df, flags, file)
*** 3286,3307 ****
  
    if (flags & DF_RD)
      {
        fprintf (file, "Reaching defs:\n");
!       for (i = 0; i < df->n_bbs; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->rd_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", i);
  	  dump_bitmap (file, bb_info->rd_in);
! 	  fprintf (file, "bb %d gen \t", i);
  	  dump_bitmap (file, bb_info->rd_gen);
! 	  fprintf (file, "bb %d kill\t", i);
  	  dump_bitmap (file, bb_info->rd_kill);
! 	  fprintf (file, "bb %d out \t", i);
  	  dump_bitmap (file, bb_info->rd_out);
  	}
      }
--- 3280,3302 ----
  
    if (flags & DF_RD)
      {
+       basic_block bb;
+ 
        fprintf (file, "Reaching defs:\n");
!       FOR_EACH_BB (bb)
  	{
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->rd_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", bb->index);
  	  dump_bitmap (file, bb_info->rd_in);
! 	  fprintf (file, "bb %d gen \t", bb->index);
  	  dump_bitmap (file, bb_info->rd_gen);
! 	  fprintf (file, "bb %d kill\t", bb->index);
  	  dump_bitmap (file, bb_info->rd_kill);
! 	  fprintf (file, "bb %d out \t", bb->index);
  	  dump_bitmap (file, bb_info->rd_out);
  	}
      }
*************** df_dump (df, flags, file)
*** 3329,3349 ****
    if (flags & DF_RU)
      {
        fprintf (file, "Reaching uses:\n");
!       for (i = 0; i < df->n_bbs; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->ru_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", i);
  	  dump_bitmap (file, bb_info->ru_in);
! 	  fprintf (file, "bb %d gen \t", i);
  	  dump_bitmap (file, bb_info->ru_gen);
! 	  fprintf (file, "bb %d kill\t", i);
  	  dump_bitmap (file, bb_info->ru_kill);
! 	  fprintf (file, "bb %d out \t", i);
  	  dump_bitmap (file, bb_info->ru_out);
  	}
      }
--- 3324,3343 ----
    if (flags & DF_RU)
      {
        fprintf (file, "Reaching uses:\n");
!       FOR_EACH_BB (bb)
  	{
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->ru_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", bb->index);
  	  dump_bitmap (file, bb_info->ru_in);
! 	  fprintf (file, "bb %d gen \t", bb->index);
  	  dump_bitmap (file, bb_info->ru_gen);
! 	  fprintf (file, "bb %d kill\t", bb->index);
  	  dump_bitmap (file, bb_info->ru_kill);
! 	  fprintf (file, "bb %d out \t", bb->index);
  	  dump_bitmap (file, bb_info->ru_out);
  	}
      }
*************** df_dump (df, flags, file)
*** 3371,3391 ****
    if (flags & DF_LR)
      {
        fprintf (file, "Live regs:\n");
!       for (i = 0; i < df->n_bbs; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->lr_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", i);
  	  dump_bitmap (file, bb_info->lr_in);
! 	  fprintf (file, "bb %d use \t", i);
  	  dump_bitmap (file, bb_info->lr_use);
! 	  fprintf (file, "bb %d def \t", i);
  	  dump_bitmap (file, bb_info->lr_def);
! 	  fprintf (file, "bb %d out \t", i);
  	  dump_bitmap (file, bb_info->lr_out);
  	}
      }
--- 3365,3384 ----
    if (flags & DF_LR)
      {
        fprintf (file, "Live regs:\n");
!       FOR_EACH_BB (bb)
  	{
  	  struct bb_info *bb_info = DF_BB_INFO (df, bb);
  
  	  if (! bb_info->lr_in)
  	    continue;
  
! 	  fprintf (file, "bb %d in  \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_in);
! 	  fprintf (file, "bb %d use \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_use);
! 	  fprintf (file, "bb %d def \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_def);
! 	  fprintf (file, "bb %d out \t", bb->index);
  	  dump_bitmap (file, bb_info->lr_out);
  	}
      }
Index: dominance.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dominance.c,v
retrieving revision 1.8
diff -c -3 -p -r1.8 dominance.c
*** dominance.c	17 May 2002 02:31:31 -0000	1.8
--- dominance.c	22 May 2002 17:04:32 -0000
*************** calc_dfs_tree (di, reverse)
*** 326,335 ****
           They are reverse-unreachable.  In the dom-case we disallow such
           nodes, but in post-dom we have to deal with them, so we simply
           include them in the DFS tree which actually becomes a forest.  */
!       int i;
!       for (i = n_basic_blocks - 1; i >= 0; i--)
  	{
- 	  basic_block b = BASIC_BLOCK (i);
  	  if (di->dfs_order[b->index])
  	    continue;
  	  di->dfs_order[b->index] = di->dfsnum;
--- 326,334 ----
           They are reverse-unreachable.  In the dom-case we disallow such
           nodes, but in post-dom we have to deal with them, so we simply
           include them in the DFS tree which actually becomes a forest.  */
!       basic_block b;
!       FOR_EACH_BB_REVERSE (b)
  	{
  	  if (di->dfs_order[b->index])
  	    continue;
  	  di->dfs_order[b->index] = di->dfsnum;
*************** calculate_dominance_info (idom, doms, re
*** 604,620 ****
  
    if (idom)
      {
!       int i;
!       for (i = 0; i < n_basic_blocks; i++)
  	{
- 	  basic_block b = BASIC_BLOCK (i);
  	  TBB d = di.dom[di.dfs_order[b->index]];
  
  	  /* The old code didn't modify array elements of nodes having only
  	     itself as dominator (d==0) or only ENTRY_BLOCK (resp. EXIT_BLOCK)
  	     (d==1).  */
  	  if (d > 1)
! 	    idom[i] = di.dfs_to_bb[d]->index;
  	}
      }
    if (doms)
--- 603,619 ----
  
    if (idom)
      {
!       basic_block b;
! 
!       FOR_EACH_BB (b)
  	{
  	  TBB d = di.dom[di.dfs_order[b->index]];
  
  	  /* The old code didn't modify array elements of nodes having only
  	     itself as dominator (d==0) or only ENTRY_BLOCK (resp. EXIT_BLOCK)
  	     (d==1).  */
  	  if (d > 1)
! 	    idom[b->index] = di.dfs_to_bb[d]->index;
  	}
      }
    if (doms)
Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.255
diff -c -3 -p -r1.255 final.c
*** final.c	21 May 2002 20:37:40 -0000	1.255
--- final.c	22 May 2002 17:04:32 -0000
*************** insn_current_reference_address (branch)
*** 934,941 ****
  void
  compute_alignments ()
  {
-   int i;
    int log, max_skip, max_log;
  
    if (label_align)
      {
--- 934,941 ----
  void
  compute_alignments ()
  {
    int log, max_skip, max_log;
+   basic_block bb;
  
    if (label_align)
      {
*************** compute_alignments ()
*** 952,960 ****
    if (! optimize || optimize_size)
      return;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx label = bb->head;
        int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
        edge e;
--- 952,959 ----
    if (! optimize || optimize_size)
      return;
  
!   FOR_EACH_BB (bb)
      {
        rtx label = bb->head;
        int fallthru_frequency = 0, branch_frequency = 0, has_fallthru = 0;
        edge e;
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.522
diff -c -3 -p -r1.522 flow.c
*** flow.c	21 May 2002 22:35:04 -0000	1.522
--- flow.c	22 May 2002 17:04:33 -0000
*************** update_life_info (blocks, extent, prop_f
*** 637,642 ****
--- 637,643 ----
    regset_head tmp_head;
    int i;
    int stabilized_prop_flags = prop_flags;
+   basic_block bb;
  
    tmp = INITIALIZE_REG_SET (tmp_head);
    ndead = 0;
*************** update_life_info (blocks, extent, prop_f
*** 667,676 ****
  
  	  /* Removing dead code may allow the CFG to be simplified which
  	     in turn may allow for further dead code detection / removal.  */
! 	  for (i = n_basic_blocks - 1; i >= 0; --i)
  	    {
- 	      basic_block bb = BASIC_BLOCK (i);
- 
  	      COPY_REG_SET (tmp, bb->global_live_at_end);
  	      changed |= propagate_block (bb, tmp, NULL, NULL,
  				prop_flags & (PROP_SCAN_DEAD_CODE
--- 668,675 ----
  
  	  /* Removing dead code may allow the CFG to be simplified which
  	     in turn may allow for further dead code detection / removal.  */
! 	  FOR_EACH_BB_REVERSE (bb)
  	    {
  	      COPY_REG_SET (tmp, bb->global_live_at_end);
  	      changed |= propagate_block (bb, tmp, NULL, NULL,
  				prop_flags & (PROP_SCAN_DEAD_CODE
*************** update_life_info (blocks, extent, prop_f
*** 707,713 ****
      {
        EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
  	{
! 	  basic_block bb = BASIC_BLOCK (i);
  
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
--- 706,712 ----
      {
        EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
  	{
! 	  bb = BASIC_BLOCK (i);
  
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
*************** update_life_info (blocks, extent, prop_f
*** 718,727 ****
      }
    else
      {
!       for (i = n_basic_blocks - 1; i >= 0; --i)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
- 
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
--- 717,724 ----
      }
    else
      {
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  COPY_REG_SET (tmp, bb->global_live_at_end);
  
  	  propagate_block (bb, tmp, NULL, NULL, stabilized_prop_flags);
*************** update_life_info_in_dirty_blocks (extent
*** 776,790 ****
       int prop_flags;
  {
    sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks);
-   int block_num;
    int n = 0;
    int retval = 0;
  
    sbitmap_zero (update_life_blocks);
!   for (block_num = 0; block_num < n_basic_blocks; block_num++)
!     if (BASIC_BLOCK (block_num)->flags & BB_DIRTY)
        {
! 	SET_BIT (update_life_blocks, block_num);
  	n++;
        }
  
--- 773,787 ----
       int prop_flags;
  {
    sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks);
    int n = 0;
+   basic_block bb;
    int retval = 0;
  
    sbitmap_zero (update_life_blocks);
!   FOR_EACH_BB (bb)
!     if (bb->flags & BB_DIRTY)
        {
! 	SET_BIT (update_life_blocks, bb->index);
  	n++;
        }
  
*************** int
*** 825,838 ****
  delete_noop_moves (f)
       rtx f ATTRIBUTE_UNUSED;
  {
-   int i;
    rtx insn, next;
    basic_block bb;
    int nnoops = 0;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       bb = BASIC_BLOCK (i);
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = next)
  	{
  	  next = NEXT_INSN (insn);
--- 822,833 ----
  delete_noop_moves (f)
       rtx f ATTRIBUTE_UNUSED;
  {
    rtx insn, next;
    basic_block bb;
    int nnoops = 0;
  
!   FOR_EACH_BB (bb)
      {
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = next)
  	{
  	  next = NEXT_INSN (insn);
*************** calculate_global_regs_live (blocks_in, b
*** 1079,1085 ****
       sbitmap blocks_in, blocks_out;
       int flags;
  {
!   basic_block *queue, *qhead, *qtail, *qend;
    regset tmp, new_live_at_end, call_used;
    regset_head tmp_head, call_used_head;
    regset_head new_live_at_end_head;
--- 1074,1080 ----
       sbitmap blocks_in, blocks_out;
       int flags;
  {
!   basic_block *queue, *qhead, *qtail, *qend, bb;
    regset tmp, new_live_at_end, call_used;
    regset_head tmp_head, call_used_head;
    regset_head new_live_at_end_head;
*************** calculate_global_regs_live (blocks_in, b
*** 1088,1097 ****
    /* Some passes used to forget clear aux field of basic block causing
       sick behaviour here.  */
  #ifdef ENABLE_CHECKING
!   if (ENTRY_BLOCK_PTR->aux || EXIT_BLOCK_PTR->aux)
!     abort ();
!   for (i = 0; i < n_basic_blocks; i++)
!     if (BASIC_BLOCK (i)->aux)
        abort ();
  #endif
  
--- 1083,1090 ----
    /* Some passes used to forget clear aux field of basic block causing
       sick behaviour here.  */
  #ifdef ENABLE_CHECKING
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     if (bb->aux)
        abort ();
  #endif
  
*************** calculate_global_regs_live (blocks_in, b
*** 1116,1131 ****
       useful work.  We use AUX non-null to flag that the block is queued.  */
    if (blocks_in)
      {
!       /* Clear out the garbage that might be hanging out in bb->aux.  */
!       for (i = n_basic_blocks - 1; i >= 0; --i)
! 	BASIC_BLOCK (i)->aux = NULL;
! 
!       EXECUTE_IF_SET_IN_SBITMAP (blocks_in, 0, i,
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  *--qhead = bb;
! 	  bb->aux = bb;
! 	});
      }
    else
      {
--- 1109,1120 ----
       useful work.  We use AUX non-null to flag that the block is queued.  */
    if (blocks_in)
      {
!       FOR_EACH_BB (bb)
! 	if (TEST_BIT (blocks_in, bb->index))
! 	  {
! 	    *--qhead = bb;
! 	    bb->aux = bb;
! 	  }
      }
    else
      {
*************** calculate_global_regs_live (blocks_in, b
*** 1370,1378 ****
      }
    else
      {
!       for (i = n_basic_blocks - 1; i >= 0; --i)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  FREE_REG_SET (bb->local_set);
  	  FREE_REG_SET (bb->cond_local_set);
  	}
--- 1359,1366 ----
      }
    else
      {
!       FOR_EACH_BB (bb)
  	{
  	  FREE_REG_SET (bb->local_set);
  	  FREE_REG_SET (bb->cond_local_set);
  	}
*************** initialize_uninitialized_subregs ()
*** 1498,1518 ****
  void
  allocate_bb_life_data ()
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
- 
        bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
        bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
      }
  
-   ENTRY_BLOCK_PTR->global_live_at_end
-     = OBSTACK_ALLOC_REG_SET (&flow_obstack);
-   EXIT_BLOCK_PTR->global_live_at_start
-     = OBSTACK_ALLOC_REG_SET (&flow_obstack);
- 
    regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack);
  }
  
--- 1486,1499 ----
  void
  allocate_bb_life_data ()
  {
!   basic_block bb;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack);
        bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack);
      }
  
    regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack);
  }
  
*************** count_or_remove_death_notes (blocks, kil
*** 4246,4262 ****
       sbitmap blocks;
       int kill;
  {
!   int i, count = 0;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb;
        rtx insn;
  
!       if (blocks && ! TEST_BIT (blocks, i))
  	continue;
- 
-       bb = BASIC_BLOCK (i);
  
        for (insn = bb->head;; insn = NEXT_INSN (insn))
  	{
--- 4227,4241 ----
       sbitmap blocks;
       int kill;
  {
!   int count = 0;
!   basic_block bb;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx insn;
  
!       if (blocks && ! TEST_BIT (blocks, bb->index))
  	continue;
  
        for (insn = bb->head;; insn = NEXT_INSN (insn))
  	{
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.188
diff -c -3 -p -r1.188 gcse.c
*** gcse.c	21 May 2002 20:37:40 -0000	1.188
--- gcse.c	22 May 2002 17:04:33 -0000
*************** static sbitmap *ae_kill, *ae_gen, *ae_in
*** 541,547 ****
  struct null_pointer_info
  {
    /* The basic block being processed.  */
!   int current_block;
    /* The first register to be handled in this pass.  */
    unsigned int min_reg;
    /* One greater than the last register to be handled in this pass.  */
--- 541,547 ----
  struct null_pointer_info
  {
    /* The basic block being processed.  */
!   basic_block current_block;
    /* The first register to be handled in this pass.  */
    unsigned int min_reg;
    /* One greater than the last register to be handled in this pass.  */
*************** compute_sets (f)
*** 1292,1304 ****
  
  struct reg_avail_info
  {
!   int last_bb;
    int first_set;
    int last_set;
  };
  
  static struct reg_avail_info *reg_avail_info;
! static int current_bb;
  
  
  /* See whether X, the source of a set, is something we want to consider for
--- 1292,1304 ----
  
  struct reg_avail_info
  {
!   basic_block last_bb;
    int first_set;
    int last_set;
  };
  
  static struct reg_avail_info *reg_avail_info;
! static basic_block current_bb;
  
  
  /* See whether X, the source of a set, is something we want to consider for
*************** oprs_unchanged_p (x, insn, avail_p)
*** 1385,1391 ****
        }
  
      case MEM:
!       if (load_killed_in_block_p (BASIC_BLOCK (current_bb), INSN_CUID (insn),
  				  x, avail_p))
  	return 0;
        else
--- 1385,1391 ----
        }
  
      case MEM:
!       if (load_killed_in_block_p (current_bb, INSN_CUID (insn),
  				  x, avail_p))
  	return 0;
        else
*************** record_last_reg_set_info (insn, regno)
*** 2373,2379 ****
      {
        info->last_bb = current_bb;
        info->first_set = cuid;
!       SET_BIT (reg_set_in_block[current_bb], regno);
      }
  }
  
--- 2373,2379 ----
      {
        info->last_bb = current_bb;
        info->first_set = cuid;
!       SET_BIT (reg_set_in_block[current_bb->index], regno);
      }
  }
  
*************** compute_hash_table (set_p)
*** 2502,2510 ****
      gmalloc (max_gcse_regno * sizeof (struct reg_avail_info));
  
    for (i = 0; i < max_gcse_regno; ++i)
!     reg_avail_info[i].last_bb = NEVER_SET;
  
!   for (current_bb = 0; current_bb < n_basic_blocks; current_bb++)
      {
        rtx insn;
        unsigned int regno;
--- 2502,2510 ----
      gmalloc (max_gcse_regno * sizeof (struct reg_avail_info));
  
    for (i = 0; i < max_gcse_regno; ++i)
!     reg_avail_info[i].last_bb = NULL;
  
!   FOR_EACH_BB (current_bb)
      {
        rtx insn;
        unsigned int regno;
*************** compute_hash_table (set_p)
*** 2515,2522 ****
  	 ??? hard-reg reg_set_in_block computation
  	 could be moved to compute_sets since they currently don't change.  */
  
!       for (insn = BLOCK_HEAD (current_bb);
! 	   insn && insn != NEXT_INSN (BLOCK_END (current_bb));
  	   insn = NEXT_INSN (insn))
  	{
  	  if (! INSN_P (insn))
--- 2515,2522 ----
  	 ??? hard-reg reg_set_in_block computation
  	 could be moved to compute_sets since they currently don't change.  */
  
!       for (insn = current_bb->head;
! 	   insn && insn != NEXT_INSN (current_bb->end);
  	   insn = NEXT_INSN (insn))
  	{
  	  if (! INSN_P (insn))
*************** compute_hash_table (set_p)
*** 2544,2551 ****
  
        /* The next pass builds the hash table.  */
  
!       for (insn = BLOCK_HEAD (current_bb), in_libcall_block = 0;
! 	   insn && insn != NEXT_INSN (BLOCK_END (current_bb));
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
--- 2544,2551 ----
  
        /* The next pass builds the hash table.  */
  
!       for (insn = current_bb->head, in_libcall_block = 0;
! 	   insn && insn != NEXT_INSN (current_bb->end);
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
*************** handle_rd_kill_set (insn, regno, bb)
*** 2981,2989 ****
  static void
  compute_kill_rd ()
  {
!   int bb, cuid;
    unsigned int regno;
    int i;
  
    /* For each block
         For each set bit in `gen' of the block (i.e each insn which
--- 2981,2990 ----
  static void
  compute_kill_rd ()
  {
!   int cuid;
    unsigned int regno;
    int i;
+   basic_block bb;
  
    /* For each block
         For each set bit in `gen' of the block (i.e each insn which
*************** compute_kill_rd ()
*** 2993,3001 ****
  	 For each setting of regx in the linked list, which is not in
  	     this block
  	   Set the bit in `kill' corresponding to that insn.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      for (cuid = 0; cuid < max_cuid; cuid++)
!       if (TEST_BIT (rd_gen[bb], cuid))
  	{
  	  rtx insn = CUID_INSN (cuid);
  	  rtx pat = PATTERN (insn);
--- 2994,3002 ----
  	 For each setting of regx in the linked list, which is not in
  	     this block
  	   Set the bit in `kill' corresponding to that insn.  */
!   FOR_EACH_BB (bb)
      for (cuid = 0; cuid < max_cuid; cuid++)
!       if (TEST_BIT (rd_gen[bb->index], cuid))
  	{
  	  rtx insn = CUID_INSN (cuid);
  	  rtx pat = PATTERN (insn);
*************** compute_kill_rd ()
*** 3004,3010 ****
  	    {
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  handle_rd_kill_set (insn, regno, BASIC_BLOCK (bb));
  	    }
  
  	  if (GET_CODE (pat) == PARALLEL)
--- 3005,3011 ----
  	    {
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  handle_rd_kill_set (insn, regno, bb);
  	    }
  
  	  if (GET_CODE (pat) == PARALLEL)
*************** compute_kill_rd ()
*** 3017,3029 ****
  		      && GET_CODE (XEXP (XVECEXP (pat, 0, i), 0)) == REG)
  		    handle_rd_kill_set (insn,
  					REGNO (XEXP (XVECEXP (pat, 0, i), 0)),
! 					BASIC_BLOCK (bb));
  		}
  	    }
  	  else if (GET_CODE (pat) == SET && GET_CODE (SET_DEST (pat)) == REG)
  	    /* Each setting of this register outside of this block
  	       must be marked in the set of kills in this block.  */
! 	    handle_rd_kill_set (insn, REGNO (SET_DEST (pat)), BASIC_BLOCK (bb));
  	}
  }
  
--- 3018,3030 ----
  		      && GET_CODE (XEXP (XVECEXP (pat, 0, i), 0)) == REG)
  		    handle_rd_kill_set (insn,
  					REGNO (XEXP (XVECEXP (pat, 0, i), 0)),
! 					bb);
  		}
  	    }
  	  else if (GET_CODE (pat) == SET && GET_CODE (SET_DEST (pat)) == REG)
  	    /* Each setting of this register outside of this block
  	       must be marked in the set of kills in this block.  */
! 	    handle_rd_kill_set (insn, REGNO (SET_DEST (pat)), bb);
  	}
  }
  
*************** compute_kill_rd ()
*** 3035,3055 ****
  static void
  compute_rd ()
  {
!   int bb, changed, passes;
  
!   for (bb = 0; bb < n_basic_blocks; bb++)
!     sbitmap_copy (rd_out[bb] /*dst*/, rd_gen[bb] /*src*/);
  
    passes = 0;
    changed = 1;
    while (changed)
      {
        changed = 0;
!       for (bb = 0; bb < n_basic_blocks; bb++)
  	{
! 	  sbitmap_union_of_preds (reaching_defs[bb], rd_out, bb);
! 	  changed |= sbitmap_union_of_diff_cg (rd_out[bb], rd_gen[bb],
! 					       reaching_defs[bb], rd_kill[bb]);
  	}
        passes++;
      }
--- 3036,3057 ----
  static void
  compute_rd ()
  {
!   int changed, passes;
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     sbitmap_copy (rd_out[bb->index] /*dst*/, rd_gen[bb->index] /*src*/);
  
    passes = 0;
    changed = 1;
    while (changed)
      {
        changed = 0;
!       FOR_EACH_BB (bb)
  	{
! 	  sbitmap_union_of_preds (reaching_defs[bb->index], rd_out, bb->index);
! 	  changed |= sbitmap_union_of_diff_cg (rd_out[bb->index], rd_gen[bb->index],
! 					       reaching_defs[bb->index], rd_kill[bb->index]);
  	}
        passes++;
      }
*************** static void
*** 3176,3195 ****
  compute_ae_kill (ae_gen, ae_kill)
       sbitmap *ae_gen, *ae_kill;
  {
!   int bb;
    unsigned int i;
    struct expr *expr;
  
!   for (bb = 0; bb < n_basic_blocks; bb++)
      for (i = 0; i < expr_hash_table_size; i++)
        for (expr = expr_hash_table[i]; expr; expr = expr->next_same_hash)
  	{
  	  /* Skip EXPR if generated in this block.  */
! 	  if (TEST_BIT (ae_gen[bb], expr->bitmap_index))
  	    continue;
  
! 	  if (expr_killed_p (expr->expr, BASIC_BLOCK (bb)))
! 	    SET_BIT (ae_kill[bb], expr->bitmap_index);
  	}
  }
  \f
--- 3178,3197 ----
  compute_ae_kill (ae_gen, ae_kill)
       sbitmap *ae_gen, *ae_kill;
  {
!   basic_block bb;
    unsigned int i;
    struct expr *expr;
  
!   FOR_EACH_BB (bb)
      for (i = 0; i < expr_hash_table_size; i++)
        for (expr = expr_hash_table[i]; expr; expr = expr->next_same_hash)
  	{
  	  /* Skip EXPR if generated in this block.  */
! 	  if (TEST_BIT (ae_gen[bb->index], expr->bitmap_index))
  	    continue;
  
! 	  if (expr_killed_p (expr->expr, bb))
! 	    SET_BIT (ae_kill[bb->index], expr->bitmap_index);
  	}
  }
  \f
*************** handle_avail_expr (insn, expr)
*** 3605,3624 ****
  static int
  classic_gcse ()
  {
!   int bb, changed;
    rtx insn;
  
    /* Note we start at block 1.  */
  
    changed = 0;
!   for (bb = 1; bb < n_basic_blocks; bb++)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = BLOCK_HEAD (bb);
! 	   insn != NULL && insn != NEXT_INSN (BLOCK_END (bb));
  	   insn = NEXT_INSN (insn))
  	{
  	  /* Is insn of form (set (pseudo-reg) ...)?  */
--- 3607,3630 ----
  static int
  classic_gcse ()
  {
!   int changed;
    rtx insn;
+   basic_block bb;
  
    /* Note we start at block 1.  */
  
+   if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
+     return 0;
+ 
    changed = 0;
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, EXIT_BLOCK_PTR, next_bb)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = bb->head;
! 	   insn != NULL && insn != NEXT_INSN (bb->end);
  	   insn = NEXT_INSN (insn))
  	{
  	  /* Is insn of form (set (pseudo-reg) ...)?  */
*************** classic_gcse ()
*** 3636,3642 ****
  		  && ((expr = lookup_expr (src)) != NULL)
  		  /* Is the expression available [at the start of the
  		     block]?  */
! 		  && TEST_BIT (ae_in[bb], expr->bitmap_index)
  		  /* Are the operands unchanged since the start of the
  		     block?  */
  		  && oprs_not_set_p (src, insn))
--- 3642,3648 ----
  		  && ((expr = lookup_expr (src)) != NULL)
  		  /* Is the expression available [at the start of the
  		     block]?  */
! 		  && TEST_BIT (ae_in[bb->index], expr->bitmap_index)
  		  /* Are the operands unchanged since the start of the
  		     block?  */
  		  && oprs_not_set_p (src, insn))
*************** compute_transp (x, indx, bmap, set_p)
*** 3747,3753 ****
       sbitmap *bmap;
       int set_p;
  {
!   int bb, i, j;
    enum rtx_code code;
    reg_set *r;
    const char *fmt;
--- 3753,3760 ----
       sbitmap *bmap;
       int set_p;
  {
!   int i, j;
!   basic_block bb;
    enum rtx_code code;
    reg_set *r;
    const char *fmt;
*************** compute_transp (x, indx, bmap, set_p)
*** 3767,3775 ****
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      for (bb = 0; bb < n_basic_blocks; bb++)
! 		if (TEST_BIT (reg_set_in_block[bb], REGNO (x)))
! 		  SET_BIT (bmap[bb], indx);
  	    }
  	  else
  	    {
--- 3774,3782 ----
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      FOR_EACH_BB (bb)
! 		if (TEST_BIT (reg_set_in_block[bb->index], REGNO (x)))
! 		  SET_BIT (bmap[bb->index], indx);
  	    }
  	  else
  	    {
*************** compute_transp (x, indx, bmap, set_p)
*** 3781,3789 ****
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      for (bb = 0; bb < n_basic_blocks; bb++)
! 		if (TEST_BIT (reg_set_in_block[bb], REGNO (x)))
! 		  RESET_BIT (bmap[bb], indx);
  	    }
  	  else
  	    {
--- 3788,3796 ----
  	{
  	  if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	    {
! 	      FOR_EACH_BB (bb)
! 		if (TEST_BIT (reg_set_in_block[bb->index], REGNO (x)))
! 		  RESET_BIT (bmap[bb->index], indx);
  	    }
  	  else
  	    {
*************** compute_transp (x, indx, bmap, set_p)
*** 3795,3803 ****
        return;
  
      case MEM:
!       for (bb = 0; bb < n_basic_blocks; bb++)
  	{
! 	  rtx list_entry = canon_modify_mem_list[bb];
  
  	  while (list_entry)
  	    {
--- 3802,3810 ----
        return;
  
      case MEM:
!       FOR_EACH_BB (bb)
  	{
! 	  rtx list_entry = canon_modify_mem_list[bb->index];
  
  	  while (list_entry)
  	    {
*************** compute_transp (x, indx, bmap, set_p)
*** 3806,3814 ****
  	      if (GET_CODE (XEXP (list_entry, 0)) == CALL_INSN)
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb], indx);
  		  else
! 		    RESET_BIT (bmap[bb], indx);
  		  break;
  		}
  	      /* LIST_ENTRY must be an INSN of some kind that sets memory.
--- 3813,3821 ----
  	      if (GET_CODE (XEXP (list_entry, 0)) == CALL_INSN)
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb->index], indx);
  		  else
! 		    RESET_BIT (bmap[bb->index], indx);
  		  break;
  		}
  	      /* LIST_ENTRY must be an INSN of some kind that sets memory.
*************** compute_transp (x, indx, bmap, set_p)
*** 3822,3830 ****
  					 x, rtx_addr_varies_p))
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb], indx);
  		  else
! 		    RESET_BIT (bmap[bb], indx);
  		  break;
  		}
  	      list_entry = XEXP (list_entry, 1);
--- 3829,3837 ----
  					 x, rtx_addr_varies_p))
  		{
  		  if (set_p)
! 		    SET_BIT (bmap[bb->index], indx);
  		  else
! 		    RESET_BIT (bmap[bb->index], indx);
  		  break;
  		}
  	      list_entry = XEXP (list_entry, 1);
*************** static int
*** 4288,4311 ****
  cprop (alter_jumps)
       int alter_jumps;
  {
!   int bb, changed;
    rtx insn;
  
    /* Note we start at block 1.  */
  
    changed = 0;
!   for (bb = 1; bb < n_basic_blocks; bb++)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = BLOCK_HEAD (bb);
! 	   insn != NULL && insn != NEXT_INSN (BLOCK_END (bb));
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
! 	    changed |= cprop_insn (BASIC_BLOCK (bb), insn, alter_jumps);
  
  	    /* Keep track of everything modified by this insn.  */
  	    /* ??? Need to be careful w.r.t. mods done to INSN.  Don't
--- 4295,4325 ----
  cprop (alter_jumps)
       int alter_jumps;
  {
!   int changed;
!   basic_block bb;
    rtx insn;
  
    /* Note we start at block 1.  */
+   if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
+     {
+       if (gcse_file != NULL)
+ 	fprintf (gcse_file, "\n");
+       return 0;
+     }
  
    changed = 0;
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, EXIT_BLOCK_PTR, next_bb)
      {
        /* Reset tables used to keep track of what's still valid [since the
  	 start of the block].  */
        reset_opr_set_tables ();
  
!       for (insn = bb->head;
! 	   insn != NULL && insn != NEXT_INSN (bb->end);
  	   insn = NEXT_INSN (insn))
  	if (INSN_P (insn))
  	  {
! 	    changed |= cprop_insn (bb, insn, alter_jumps);
  
  	    /* Keep track of everything modified by this insn.  */
  	    /* ??? Need to be careful w.r.t. mods done to INSN.  Don't
*************** static void
*** 4452,4458 ****
  compute_pre_data ()
  {
    sbitmap trapping_expr;
!   int i;
    unsigned int ui;
  
    compute_local_properties (transp, comp, antloc, 0);
--- 4466,4472 ----
  compute_pre_data ()
  {
    sbitmap trapping_expr;
!   basic_block bb;
    unsigned int ui;
  
    compute_local_properties (transp, comp, antloc, 0);
*************** compute_pre_data ()
*** 4475,4481 ****
  
       This is significantly faster than compute_ae_kill.  */
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
        edge e;
  
--- 4489,4495 ----
  
       This is significantly faster than compute_ae_kill.  */
  
!   FOR_EACH_BB (bb)
      {
        edge e;
  
*************** compute_pre_data ()
*** 4483,4498 ****
  	 kill all trapping expressions because we won't be able to properly
  	 place the instruction on the edge.  So make them neither
  	 anticipatable nor transparent.  This is fairly conservative.  */
!       for (e = BASIC_BLOCK (i)->pred; e ; e = e->pred_next)
  	if (e->flags & EDGE_ABNORMAL)
  	  {
! 	    sbitmap_difference (antloc[i], antloc[i], trapping_expr);
! 	    sbitmap_difference (transp[i], transp[i], trapping_expr);
  	    break;
  	  }
  
!       sbitmap_a_or_b (ae_kill[i], transp[i], comp[i]);
!       sbitmap_not (ae_kill[i], ae_kill[i]);
      }
  
    edge_list = pre_edge_lcm (gcse_file, n_exprs, transp, comp, antloc,
--- 4497,4512 ----
  	 kill all trapping expressions because we won't be able to properly
  	 place the instruction on the edge.  So make them neither
  	 anticipatable nor transparent.  This is fairly conservative.  */
!       for (e = bb->pred; e ; e = e->pred_next)
  	if (e->flags & EDGE_ABNORMAL)
  	  {
! 	    sbitmap_difference (antloc[bb->index], antloc[bb->index], trapping_expr);
! 	    sbitmap_difference (transp[bb->index], transp[bb->index], trapping_expr);
  	    break;
  	  }
  
!       sbitmap_a_or_b (ae_kill[bb->index], transp[bb->index], comp[bb->index]);
!       sbitmap_not (ae_kill[bb->index], ae_kill[bb->index]);
      }
  
    edge_list = pre_edge_lcm (gcse_file, n_exprs, transp, comp, antloc,
*************** add_label_notes (x, insn)
*** 5179,5196 ****
  static void
  compute_transpout ()
  {
!   int bb;
    unsigned int i;
    struct expr *expr;
  
    sbitmap_vector_ones (transpout, n_basic_blocks);
  
!   for (bb = 0; bb < n_basic_blocks; ++bb)
      {
        /* Note that flow inserted a nop a the end of basic blocks that
  	 end in call instructions for reasons other than abnormal
  	 control flow.  */
!       if (GET_CODE (BLOCK_END (bb)) != CALL_INSN)
  	continue;
  
        for (i = 0; i < expr_hash_table_size; i++)
--- 5193,5210 ----
  static void
  compute_transpout ()
  {
!   basic_block bb;
    unsigned int i;
    struct expr *expr;
  
    sbitmap_vector_ones (transpout, n_basic_blocks);
  
!   FOR_EACH_BB (bb)
      {
        /* Note that flow inserted a nop a the end of basic blocks that
  	 end in call instructions for reasons other than abnormal
  	 control flow.  */
!       if (GET_CODE (bb->end) != CALL_INSN)
  	continue;
  
        for (i = 0; i < expr_hash_table_size; i++)
*************** compute_transpout ()
*** 5204,5210 ****
  	      /* ??? Optimally, we would use interprocedural alias
  		 analysis to determine if this mem is actually killed
  		 by this call.  */
! 	      RESET_BIT (transpout[bb], expr->bitmap_index);
  	    }
      }
  }
--- 5218,5224 ----
  	      /* ??? Optimally, we would use interprocedural alias
  		 analysis to determine if this mem is actually killed
  		 by this call.  */
! 	      RESET_BIT (transpout[bb->index], expr->bitmap_index);
  	    }
      }
  }
*************** invalidate_nonnull_info (x, setter, data
*** 5237,5244 ****
  
    regno = REGNO (x) - npi->min_reg;
  
!   RESET_BIT (npi->nonnull_local[npi->current_block], regno);
!   SET_BIT (npi->nonnull_killed[npi->current_block], regno);
  }
  
  /* Do null-pointer check elimination for the registers indicated in
--- 5251,5258 ----
  
    regno = REGNO (x) - npi->min_reg;
  
!   RESET_BIT (npi->nonnull_local[npi->current_block->index], regno);
!   SET_BIT (npi->nonnull_killed[npi->current_block->index], regno);
  }
  
  /* Do null-pointer check elimination for the registers indicated in
*************** delete_null_pointer_checks_1 (block_reg,
*** 5253,5260 ****
       sbitmap *nonnull_avout;
       struct null_pointer_info *npi;
  {
!   int bb;
!   int current_block;
    sbitmap *nonnull_local = npi->nonnull_local;
    sbitmap *nonnull_killed = npi->nonnull_killed;
    
--- 5267,5273 ----
       sbitmap *nonnull_avout;
       struct null_pointer_info *npi;
  {
!   basic_block bb, current_block;
    sbitmap *nonnull_local = npi->nonnull_local;
    sbitmap *nonnull_killed = npi->nonnull_killed;
    
*************** delete_null_pointer_checks_1 (block_reg,
*** 5269,5275 ****
    sbitmap_vector_zero (nonnull_local, n_basic_blocks);
    sbitmap_vector_zero (nonnull_killed, n_basic_blocks);
  
!   for (current_block = 0; current_block < n_basic_blocks; current_block++)
      {
        rtx insn, stop_insn;
  
--- 5282,5288 ----
    sbitmap_vector_zero (nonnull_local, n_basic_blocks);
    sbitmap_vector_zero (nonnull_killed, n_basic_blocks);
  
!   FOR_EACH_BB (current_block)
      {
        rtx insn, stop_insn;
  
*************** delete_null_pointer_checks_1 (block_reg,
*** 5278,5285 ****
  
        /* Scan each insn in the basic block looking for memory references and
  	 register sets.  */
!       stop_insn = NEXT_INSN (BLOCK_END (current_block));
!       for (insn = BLOCK_HEAD (current_block);
  	   insn != stop_insn;
  	   insn = NEXT_INSN (insn))
  	{
--- 5291,5298 ----
  
        /* Scan each insn in the basic block looking for memory references and
  	 register sets.  */
!       stop_insn = NEXT_INSN (current_block->end);
!       for (insn = current_block->head;
  	   insn != stop_insn;
  	   insn = NEXT_INSN (insn))
  	{
*************** delete_null_pointer_checks_1 (block_reg,
*** 5307,5313 ****
  	      && GET_CODE ((reg = XEXP (SET_SRC (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block],
  		     REGNO (reg) - npi->min_reg);
  
  	  /* Now invalidate stuff clobbered by this insn.  */
--- 5320,5326 ----
  	      && GET_CODE ((reg = XEXP (SET_SRC (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block->index],
  		     REGNO (reg) - npi->min_reg);
  
  	  /* Now invalidate stuff clobbered by this insn.  */
*************** delete_null_pointer_checks_1 (block_reg,
*** 5320,5326 ****
  	      && GET_CODE ((reg = XEXP (SET_DEST (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block],
  		     REGNO (reg) - npi->min_reg);
  	}
      }
--- 5333,5339 ----
  	      && GET_CODE ((reg = XEXP (SET_DEST (set), 0))) == REG
  	      && REGNO (reg) >= npi->min_reg
  	      && REGNO (reg) < npi->max_reg)
! 	    SET_BIT (nonnull_local[current_block->index],
  		     REGNO (reg) - npi->min_reg);
  	}
      }
*************** delete_null_pointer_checks_1 (block_reg,
*** 5332,5348 ****
  
    /* Now look at each bb and see if it ends with a compare of a value
       against zero.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       rtx last_insn = BLOCK_END (bb);
        rtx condition, earliest;
        int compare_and_branch;
  
        /* Since MIN_REG is always at least FIRST_PSEUDO_REGISTER, and
  	 since BLOCK_REG[BB] is zero if this block did not end with a
  	 comparison against zero, this condition works.  */
!       if (block_reg[bb] < npi->min_reg
! 	  || block_reg[bb] >= npi->max_reg)
  	continue;
  
        /* LAST_INSN is a conditional jump.  Get its condition.  */
--- 5345,5361 ----
  
    /* Now look at each bb and see if it ends with a compare of a value
       against zero.  */
!   FOR_EACH_BB (bb)
      {
!       rtx last_insn = bb->end;
        rtx condition, earliest;
        int compare_and_branch;
  
        /* Since MIN_REG is always at least FIRST_PSEUDO_REGISTER, and
  	 since BLOCK_REG[BB] is zero if this block did not end with a
  	 comparison against zero, this condition works.  */
!       if (block_reg[bb->index] < npi->min_reg
! 	  || block_reg[bb->index] >= npi->max_reg)
  	continue;
  
        /* LAST_INSN is a conditional jump.  Get its condition.  */
*************** delete_null_pointer_checks_1 (block_reg,
*** 5353,5359 ****
  	continue;
  
        /* Is the register known to have a nonzero value?  */
!       if (!TEST_BIT (nonnull_avout[bb], block_reg[bb] - npi->min_reg))
  	continue;
  
        /* Try to compute whether the compare/branch at the loop end is one or
--- 5366,5372 ----
  	continue;
  
        /* Is the register known to have a nonzero value?  */
!       if (!TEST_BIT (nonnull_avout[bb->index], block_reg[bb->index] - npi->min_reg))
  	continue;
  
        /* Try to compute whether the compare/branch at the loop end is one or
*************** delete_null_pointer_checks_1 (block_reg,
*** 5381,5392 ****
        delete_insn (last_insn);
        if (compare_and_branch == 2)
          delete_insn (earliest);
!       purge_dead_edges (BASIC_BLOCK (bb));
  
        /* Don't check this block again.  (Note that BLOCK_END is
  	 invalid here; we deleted the last instruction in the 
  	 block.)  */
!       block_reg[bb] = 0;
      }
  }
  
--- 5394,5405 ----
        delete_insn (last_insn);
        if (compare_and_branch == 2)
          delete_insn (earliest);
!       purge_dead_edges (bb);
  
        /* Don't check this block again.  (Note that BLOCK_END is
  	 invalid here; we deleted the last instruction in the 
  	 block.)  */
!       block_reg[bb->index] = 0;
      }
  }
  
*************** delete_null_pointer_checks (f)
*** 5420,5426 ****
  {
    sbitmap *nonnull_avin, *nonnull_avout;
    unsigned int *block_reg;
!   int bb;
    int reg;
    int regs_per_pass;
    int max_reg;
--- 5433,5439 ----
  {
    sbitmap *nonnull_avin, *nonnull_avout;
    unsigned int *block_reg;
!   basic_block bb;
    int reg;
    int regs_per_pass;
    int max_reg;
*************** delete_null_pointer_checks (f)
*** 5456,5464 ****
       ends with a conditional branch whose condition is a comparison
       against zero.  Record the register compared in BLOCK_REG.  */
    block_reg = (unsigned int *) xcalloc (n_basic_blocks, sizeof (int));
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       rtx last_insn = BLOCK_END (bb);
        rtx condition, earliest, reg;
  
        /* We only want conditional branches.  */
--- 5469,5477 ----
       ends with a conditional branch whose condition is a comparison
       against zero.  Record the register compared in BLOCK_REG.  */
    block_reg = (unsigned int *) xcalloc (n_basic_blocks, sizeof (int));
!   FOR_EACH_BB (bb)
      {
!       rtx last_insn = bb->end;
        rtx condition, earliest, reg;
  
        /* We only want conditional branches.  */
*************** delete_null_pointer_checks (f)
*** 5484,5490 ****
        if (GET_CODE (reg) != REG)
  	continue;
  
!       block_reg[bb] = REGNO (reg);
      }
  
    /* Go through the algorithm for each block of registers.  */
--- 5497,5503 ----
        if (GET_CODE (reg) != REG)
  	continue;
  
!       block_reg[bb->index] = REGNO (reg);
      }
  
    /* Go through the algorithm for each block of registers.  */
*************** free_code_hoist_mem ()
*** 5568,5574 ****
  static void
  compute_code_hoist_vbeinout ()
  {
!   int bb, changed, passes;
  
    sbitmap_vector_zero (hoist_vbeout, n_basic_blocks);
    sbitmap_vector_zero (hoist_vbein, n_basic_blocks);
--- 5581,5588 ----
  static void
  compute_code_hoist_vbeinout ()
  {
!   int changed, passes;
!   basic_block bb;
  
    sbitmap_vector_zero (hoist_vbeout, n_basic_blocks);
    sbitmap_vector_zero (hoist_vbein, n_basic_blocks);
*************** compute_code_hoist_vbeinout ()
*** 5582,5593 ****
  
        /* We scan the blocks in the reverse order to speed up
  	 the convergence.  */
!       for (bb = n_basic_blocks - 1; bb >= 0; bb--)
  	{
! 	  changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb], antloc[bb],
! 					      hoist_vbeout[bb], transp[bb]);
! 	  if (BASIC_BLOCK (bb)->next_bb != EXIT_BLOCK_PTR)
! 	    sbitmap_intersection_of_succs (hoist_vbeout[bb], hoist_vbein, bb);
  	}
  
        passes++;
--- 5596,5607 ----
  
        /* We scan the blocks in the reverse order to speed up
  	 the convergence.  */
!       FOR_EACH_BB_REVERSE (bb)
  	{
! 	  changed |= sbitmap_a_or_b_and_c_cg (hoist_vbein[bb->index], antloc[bb->index],
! 					      hoist_vbeout[bb->index], transp[bb->index]);
! 	  if (bb->next_bb != EXIT_BLOCK_PTR)
! 	    sbitmap_intersection_of_succs (hoist_vbeout[bb->index], hoist_vbein, bb->index);
  	}
  
        passes++;
*************** hoist_expr_reaches_here_p (expr_bb, expr
*** 5675,5681 ****
  static void
  hoist_code ()
  {
!   int bb, dominated;
    unsigned int i;
    struct expr **index_map;
    struct expr *expr;
--- 5689,5695 ----
  static void
  hoist_code ()
  {
!   basic_block bb, dominated;
    unsigned int i;
    struct expr **index_map;
    struct expr *expr;
*************** hoist_code ()
*** 5692,5724 ****
  
    /* Walk over each basic block looking for potentially hoistable
       expressions, nothing gets hoisted from the entry block.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
        int found = 0;
        int insn_inserted_p;
  
        /* Examine each expression that is very busy at the exit of this
  	 block.  These are the potentially hoistable expressions.  */
!       for (i = 0; i < hoist_vbeout[bb]->n_bits; i++)
  	{
  	  int hoistable = 0;
  
! 	  if (TEST_BIT (hoist_vbeout[bb], i) && TEST_BIT (transpout[bb], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      for (dominated = 0; dominated < n_basic_blocks; dominated++)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated], bb))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated], i))
  		    continue;
  
  		  /* Note if the expression would reach the dominated block
--- 5706,5738 ----
  
    /* Walk over each basic block looking for potentially hoistable
       expressions, nothing gets hoisted from the entry block.  */
!   FOR_EACH_BB (bb)
      {
        int found = 0;
        int insn_inserted_p;
  
        /* Examine each expression that is very busy at the exit of this
  	 block.  These are the potentially hoistable expressions.  */
!       for (i = 0; i < hoist_vbeout[bb->index]->n_bits; i++)
  	{
  	  int hoistable = 0;
  
! 	  if (TEST_BIT (hoist_vbeout[bb->index], i) && TEST_BIT (transpout[bb->index], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      FOR_EACH_BB (dominated)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated->index], bb->index))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated->index], i))
  		    continue;
  
  		  /* Note if the expression would reach the dominated block
*************** hoist_code ()
*** 5726,5733 ****
  
  		     Keep track of how many times this expression is hoistable
  		     from a dominated block into BB.  */
! 		  if (hoist_expr_reaches_here_p (BASIC_BLOCK (bb), i, 
! 						 BASIC_BLOCK (dominated), NULL))
  		    hoistable++;
  		}
  
--- 5740,5746 ----
  
  		     Keep track of how many times this expression is hoistable
  		     from a dominated block into BB.  */
! 		  if (hoist_expr_reaches_here_p (bb, i, dominated, NULL))
  		    hoistable++;
  		}
  
*************** hoist_code ()
*** 5743,5749 ****
  		 to nullify any benefit we get from code hoisting.  */
  	      if (hoistable > 1)
  		{
! 		  SET_BIT (hoist_exprs[bb], i);
  		  found = 1;
  		}
  	    }
--- 5756,5762 ----
  		 to nullify any benefit we get from code hoisting.  */
  	      if (hoistable > 1)
  		{
! 		  SET_BIT (hoist_exprs[bb->index], i);
  		  found = 1;
  		}
  	    }
*************** hoist_code ()
*** 5754,5782 ****
  	continue;
  
        /* Loop over all the hoistable expressions.  */
!       for (i = 0; i < hoist_exprs[bb]->n_bits; i++)
  	{
  	  /* We want to insert the expression into BB only once, so
  	     note when we've inserted it.  */
  	  insn_inserted_p = 0;
  
  	  /* These tests should be the same as the tests above.  */
! 	  if (TEST_BIT (hoist_vbeout[bb], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      for (dominated = 0; dominated < n_basic_blocks; dominated++)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated], bb))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated], i))
  		    continue;
  
  		  /* The expression is computed in the dominated block and
--- 5767,5795 ----
  	continue;
  
        /* Loop over all the hoistable expressions.  */
!       for (i = 0; i < hoist_exprs[bb->index]->n_bits; i++)
  	{
  	  /* We want to insert the expression into BB only once, so
  	     note when we've inserted it.  */
  	  insn_inserted_p = 0;
  
  	  /* These tests should be the same as the tests above.  */
! 	  if (TEST_BIT (hoist_vbeout[bb->index], i))
  	    {
  	      /* We've found a potentially hoistable expression, now
  		 we look at every block BB dominates to see if it
  		 computes the expression.  */
! 	      FOR_EACH_BB (dominated)
  		{
  		  /* Ignore self dominance.  */
  		  if (bb == dominated
! 		      || ! TEST_BIT (dominators[dominated->index], bb->index))
  		    continue;
  
  		  /* We've found a dominated block, now see if it computes
  		     the busy expression and whether or not moving that
  		     expression to the "beginning" of that block is safe.  */
! 		  if (!TEST_BIT (antloc[dominated->index], i))
  		    continue;
  
  		  /* The expression is computed in the dominated block and
*************** hoist_code ()
*** 5784,5791 ****
  		     dominated block.  Now we have to determine if the
  		     expression would reach the dominated block if it was
  		     placed at the end of BB.  */
! 		  if (hoist_expr_reaches_here_p (BASIC_BLOCK (bb), i, 
! 						 BASIC_BLOCK (dominated), NULL))
  		    {
  		      struct expr *expr = index_map[i];
  		      struct occr *occr = expr->antic_occr;
--- 5797,5803 ----
  		     dominated block.  Now we have to determine if the
  		     expression would reach the dominated block if it was
  		     placed at the end of BB.  */
! 		  if (hoist_expr_reaches_here_p (bb, i, dominated, NULL))
  		    {
  		      struct expr *expr = index_map[i];
  		      struct occr *occr = expr->antic_occr;
*************** hoist_code ()
*** 5793,5799 ****
  		      rtx set;
  
  		      /* Find the right occurrence of this expression.  */
! 		      while (BLOCK_NUM (occr->insn) != dominated && occr)
  			occr = occr->next;
  
  		      /* Should never happen.  */
--- 5805,5811 ----
  		      rtx set;
  
  		      /* Find the right occurrence of this expression.  */
! 		      while (BLOCK_FOR_INSN (occr->insn) != dominated && occr)
  			occr = occr->next;
  
  		      /* Should never happen.  */
*************** hoist_code ()
*** 5827,5834 ****
  			  occr->deleted_p = 1;
  			  if (!insn_inserted_p)
  			    {
! 			      insert_insn_end_bb (index_map[i], 
! 						  BASIC_BLOCK (bb), 0);
  			      insn_inserted_p = 1;
  			    }
  			}
--- 5839,5845 ----
  			  occr->deleted_p = 1;
  			  if (!insn_inserted_p)
  			    {
! 			      insert_insn_end_bb (index_map[i], bb, 0);
  			      insn_inserted_p = 1;
  			    }
  			}
*************** static void 
*** 6108,6122 ****
  compute_ld_motion_mems ()
  {
    struct ls_expr * ptr;
!   int bb;
    rtx insn;
    
    pre_ldst_mems = NULL;
  
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       for (insn = BLOCK_HEAD (bb);
! 	   insn && insn != NEXT_INSN (BLOCK_END (bb));
  	   insn = NEXT_INSN (insn))
  	{
  	  if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
--- 6119,6133 ----
  compute_ld_motion_mems ()
  {
    struct ls_expr * ptr;
!   basic_block bb;
    rtx insn;
    
    pre_ldst_mems = NULL;
  
!   FOR_EACH_BB (bb)
      {
!       for (insn = bb->head;
! 	   insn && insn != NEXT_INSN (bb->end);
  	   insn = NEXT_INSN (insn))
  	{
  	  if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
*************** find_moveable_store (insn)
*** 6433,6439 ****
  static int
  compute_store_table ()
  {
!   int bb, ret;
    unsigned regno;
    rtx insn, pat;
  
--- 6444,6451 ----
  static int
  compute_store_table ()
  {
!   int ret;
!   basic_block bb;
    unsigned regno;
    rtx insn, pat;
  
*************** compute_store_table ()
*** 6445,6455 ****
    pre_ldst_mems = 0;
  
    /* Find all the stores we care about.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       regvec = & (reg_set_in_block[bb]);
!       for (insn = BLOCK_END (bb);
! 	   insn && insn != PREV_INSN (BLOCK_HEAD (bb));
  	   insn = PREV_INSN (insn))
  	{
  	  /* Ignore anything that is not a normal insn.  */
--- 6457,6467 ----
    pre_ldst_mems = 0;
  
    /* Find all the stores we care about.  */
!   FOR_EACH_BB (bb)
      {
!       regvec = & (reg_set_in_block[bb->index]);
!       for (insn = bb->end;
! 	   insn && insn != PREV_INSN (bb->end);
  	   insn = PREV_INSN (insn))
  	{
  	  /* Ignore anything that is not a normal insn.  */
*************** compute_store_table ()
*** 6468,6474 ****
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (clobbers_all
  		    || TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  SET_BIT (reg_set_in_block[bb], regno);
  	    }
  	  
  	  pat = PATTERN (insn);
--- 6480,6486 ----
  	      for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
  		if (clobbers_all
  		    || TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
! 		  SET_BIT (reg_set_in_block[bb->index], regno);
  	    }
  	  
  	  pat = PATTERN (insn);
*************** store_killed_before (x, insn, bb)
*** 6634,6641 ****
  static void
  build_store_vectors () 
  {
!   basic_block bb;
!   int b;
    rtx insn, st;
    struct ls_expr * ptr;
  
--- 6646,6652 ----
  static void
  build_store_vectors () 
  {
!   basic_block bb, b;
    rtx insn, st;
    struct ls_expr * ptr;
  
*************** build_store_vectors () 
*** 6707,6715 ****
    sbitmap_vector_zero (transp, n_basic_blocks);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
!     for (b = 0; b < n_basic_blocks; b++)
        {
! 	if (store_killed_after (ptr->pattern, BLOCK_HEAD (b), BASIC_BLOCK (b)))
  	  {
  	    /* The anticipatable expression is not killed if it's gen'd.  */
  	    /*
--- 6718,6726 ----
    sbitmap_vector_zero (transp, n_basic_blocks);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
!     FOR_EACH_BB (b)
        {
! 	if (store_killed_after (ptr->pattern, b->head, b))
  	  {
  	    /* The anticipatable expression is not killed if it's gen'd.  */
  	    /*
*************** build_store_vectors () 
*** 6727,6736 ****
  	      If we always kill it in this case, we'll sometimes do
  	      uneccessary work, but it shouldn't actually hurt anything.
  	    if (!TEST_BIT (ae_gen[b], ptr->index)).  */
! 	    SET_BIT (ae_kill[b], ptr->index);
  	  }
  	else
! 	  SET_BIT (transp[b], ptr->index);
        }
  
    /* Any block with no exits calls some non-returning function, so
--- 6738,6747 ----
  	      If we always kill it in this case, we'll sometimes do
  	      uneccessary work, but it shouldn't actually hurt anything.
  	    if (!TEST_BIT (ae_gen[b], ptr->index)).  */
! 	    SET_BIT (ae_kill[b->index], ptr->index);
  	  }
  	else
! 	  SET_BIT (transp[b->index], ptr->index);
        }
  
    /* Any block with no exits calls some non-returning function, so
*************** free_store_memory ()
*** 6939,6944 ****
--- 6950,6956 ----
  static void
  store_motion ()
  {
+   basic_block bb;
    int x;
    struct ls_expr * ptr;
    int update_flow = 0;
*************** store_motion ()
*** 6972,6980 ****
    /* Now we want to insert the new stores which are going to be needed.  */
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      {
!       for (x = 0; x < n_basic_blocks; x++)
! 	if (TEST_BIT (pre_delete_map[x], ptr->index))
! 	  delete_store (ptr, BASIC_BLOCK (x));
  
        for (x = 0; x < NUM_EDGES (edge_list); x++)
  	if (TEST_BIT (pre_insert_map[x], ptr->index))
--- 6984,6992 ----
    /* Now we want to insert the new stores which are going to be needed.  */
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      {
!       FOR_EACH_BB (bb)
! 	if (TEST_BIT (pre_delete_map[bb->index], ptr->index))
! 	  delete_store (ptr, bb);
  
        for (x = 0; x < NUM_EDGES (edge_list); x++)
  	if (TEST_BIT (pre_insert_map[x], ptr->index))
Index: global.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/global.c,v
retrieving revision 1.80
diff -c -3 -p -r1.80 global.c
*** global.c	21 May 2002 20:37:41 -0000	1.80
--- global.c	22 May 2002 17:04:33 -0000
*************** allocno_compare (v1p, v2p)
*** 636,642 ****
  static void
  global_conflicts ()
  {
!   int b, i;
    rtx insn;
    int *block_start_allocnos;
  
--- 636,643 ----
  static void
  global_conflicts ()
  {
!   int i;
!   basic_block b;
    rtx insn;
    int *block_start_allocnos;
  
*************** global_conflicts ()
*** 645,651 ****
  
    block_start_allocnos = (int *) xmalloc (max_allocno * sizeof (int));
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
        memset ((char *) allocnos_live, 0, allocno_row_words * sizeof (INT_TYPE));
  
--- 646,652 ----
  
    block_start_allocnos = (int *) xmalloc (max_allocno * sizeof (int));
  
!   FOR_EACH_BB (b)
      {
        memset ((char *) allocnos_live, 0, allocno_row_words * sizeof (INT_TYPE));
  
*************** global_conflicts ()
*** 664,670 ****
  	 are explicitly marked in basic_block_live_at_start.  */
  
        {
! 	regset old = BASIC_BLOCK (b)->global_live_at_start;
  	int ax = 0;
  
  	REG_SET_TO_HARD_REG_SET (hard_regs_live, old);
--- 665,671 ----
  	 are explicitly marked in basic_block_live_at_start.  */
  
        {
! 	regset old = b->global_live_at_start;
  	int ax = 0;
  
  	REG_SET_TO_HARD_REG_SET (hard_regs_live, old);
*************** global_conflicts ()
*** 713,719 ****
  	     that is reached by an abnormal edge.  */
  
  	  edge e;
! 	  for (e = BASIC_BLOCK (b)->pred; e ; e = e->pred_next)
  	    if (e->flags & EDGE_ABNORMAL)
  	      break;
  	  if (e != NULL)
--- 714,720 ----
  	     that is reached by an abnormal edge.  */
  
  	  edge e;
! 	  for (e = b->pred; e ; e = e->pred_next)
  	    if (e->flags & EDGE_ABNORMAL)
  	      break;
  	  if (e != NULL)
*************** global_conflicts ()
*** 723,729 ****
  #endif
        }
  
!       insn = BLOCK_HEAD (b);
  
        /* Scan the code of this basic block, noting which allocnos
  	 and hard regs are born or die.  When one is born,
--- 724,730 ----
  #endif
        }
  
!       insn = b->head;
  
        /* Scan the code of this basic block, noting which allocnos
  	 and hard regs are born or die.  When one is born,
*************** global_conflicts ()
*** 823,829 ****
  		}
  	    }
  
! 	  if (insn == BLOCK_END (b))
  	    break;
  	  insn = NEXT_INSN (insn);
  	}
--- 824,830 ----
  		}
  	    }
  
! 	  if (insn == b->end)
  	    break;
  	  insn = NEXT_INSN (insn);
  	}
*************** void
*** 1708,1718 ****
  mark_elimination (from, to)
       int from, to;
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       regset r = BASIC_BLOCK (i)->global_live_at_start; 
        if (REGNO_REG_SET_P (r, from))
  	{
  	  CLEAR_REGNO_REG_SET (r, from);
--- 1709,1719 ----
  mark_elimination (from, to)
       int from, to;
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
!       regset r = bb->global_live_at_start; 
        if (REGNO_REG_SET_P (r, from))
  	{
  	  CLEAR_REGNO_REG_SET (r, from);
Index: graph.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/graph.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 graph.c
*** graph.c	17 May 2002 02:31:35 -0000	1.21
--- graph.c	22 May 2002 17:04:33 -0000
*************** print_rtl_graph_with_bb (base, suffix, r
*** 258,264 ****
      fprintf (fp, "(nil)\n");
    else
      {
-       int i;
        enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
        int max_uid = get_max_uid ();
        int *start = (int *) xmalloc (max_uid * sizeof (int));
--- 258,263 ----
*************** print_rtl_graph_with_bb (base, suffix, r
*** 266,271 ****
--- 265,271 ----
        enum bb_state *in_bb_p = (enum bb_state *)
  	xmalloc (max_uid * sizeof (enum bb_state));
        basic_block bb;
+       int i;
  
        for (i = 0; i < max_uid; ++i)
  	{
*************** print_rtl_graph_with_bb (base, suffix, r
*** 273,284 ****
  	  in_bb_p[i] = NOT_IN_BB;
  	}
  
!       for (i = n_basic_blocks - 1; i >= 0; --i)
  	{
  	  rtx x;
! 	  bb = BASIC_BLOCK (i);
! 	  start[INSN_UID (bb->head)] = i;
! 	  end[INSN_UID (bb->end)] = i;
  	  for (x = bb->head; x != NULL_RTX; x = NEXT_INSN (x))
  	    {
  	      in_bb_p[INSN_UID (x)]
--- 273,283 ----
  	  in_bb_p[i] = NOT_IN_BB;
  	}
  
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  rtx x;
! 	  start[INSN_UID (bb->head)] = bb->index;
! 	  end[INSN_UID (bb->end)] = bb->index;
  	  for (x = bb->head; x != NULL_RTX; x = NEXT_INSN (x))
  	    {
  	      in_bb_p[INSN_UID (x)]
Index: haifa-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/haifa-sched.c,v
retrieving revision 1.201
diff -c -3 -p -r1.201 haifa-sched.c
*** haifa-sched.c	17 May 2002 02:31:35 -0000	1.201
--- haifa-sched.c	22 May 2002 17:04:34 -0000
*************** void
*** 2303,2309 ****
  sched_init (dump_file)
       FILE *dump_file;
  {
!   int luid, b;
    rtx insn;
    int i;
  
--- 2303,2310 ----
  sched_init (dump_file)
       FILE *dump_file;
  {
!   int luid;
!   basic_block b;
    rtx insn;
    int i;
  
*************** sched_init (dump_file)
*** 2356,2363 ****
  
    h_i_d[0].luid = 0;
    luid = 1;
!   for (b = 0; b < n_basic_blocks; b++)
!     for (insn = BLOCK_HEAD (b);; insn = NEXT_INSN (insn))
        {
  	INSN_LUID (insn) = luid;
  
--- 2357,2364 ----
  
    h_i_d[0].luid = 0;
    luid = 1;
!   FOR_EACH_BB (b)
!     for (insn = b->head;; insn = NEXT_INSN (insn))
        {
  	INSN_LUID (insn) = luid;
  
*************** sched_init (dump_file)
*** 2369,2375 ****
  	if (GET_CODE (insn) != NOTE)
  	  ++luid;
  
! 	if (insn == BLOCK_END (b))
  	  break;
        }
  
--- 2370,2376 ----
  	if (GET_CODE (insn) != NOTE)
  	  ++luid;
  
! 	if (insn == b->end)
  	  break;
        }
  
*************** sched_init (dump_file)
*** 2391,2412 ****
           predecessor has been scheduled, it is impossible to accurately
           determine the correct line number for the first insn of the block.  */
  
!       for (b = 0; b < n_basic_blocks; b++)
  	{
! 	  for (line = BLOCK_HEAD (b); line; line = PREV_INSN (line))
  	    if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
  	      {
! 		line_note_head[b] = line;
  		break;
  	      }
  	  /* Do a forward search as well, since we won't get to see the first
  	     notes in a basic block.  */
! 	  for (line = BLOCK_HEAD (b); line; line = NEXT_INSN (line))
  	    {
  	      if (INSN_P (line))
  		break;
  	      if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
! 		line_note_head[b] = line;
  	    }
  	}
      }
--- 2392,2413 ----
           predecessor has been scheduled, it is impossible to accurately
           determine the correct line number for the first insn of the block.  */
  
!       FOR_EACH_BB (b)
  	{
! 	  for (line = b->head; line; line = PREV_INSN (line))
  	    if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
  	      {
! 		line_note_head[b->index] = line;
  		break;
  	      }
  	  /* Do a forward search as well, since we won't get to see the first
  	     notes in a basic block.  */
! 	  for (line = b->head; line; line = NEXT_INSN (line))
  	    {
  	      if (INSN_P (line))
  		break;
  	      if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0)
! 		line_note_head[b->index] = line;
  	    }
  	}
      }
*************** sched_init (dump_file)
*** 2420,2441 ****
    /* ??? Add a NOTE after the last insn of the last basic block.  It is not
       known why this is done.  */
  
!   insn = BLOCK_END (n_basic_blocks - 1);
    if (NEXT_INSN (insn) == 0
        || (GET_CODE (insn) != NOTE
  	  && GET_CODE (insn) != CODE_LABEL
  	  /* Don't emit a NOTE if it would end up before a BARRIER.  */
  	  && GET_CODE (NEXT_INSN (insn)) != BARRIER))
      {
!       emit_note_after (NOTE_INSN_DELETED, BLOCK_END (n_basic_blocks - 1));
        /* Make insn to appear outside BB.  */
!       BLOCK_END (n_basic_blocks - 1) = PREV_INSN (BLOCK_END (n_basic_blocks - 1));
      }
  
    /* Compute INSN_REG_WEIGHT for all blocks.  We must do this before
       removing death notes.  */
!   for (b = n_basic_blocks - 1; b >= 0; b--)
!     find_insn_reg_weight (b);
  }
  
  /* Free global data used during insn scheduling.  */
--- 2421,2442 ----
    /* ??? Add a NOTE after the last insn of the last basic block.  It is not
       known why this is done.  */
  
!   insn = EXIT_BLOCK_PTR->prev_bb->end;
    if (NEXT_INSN (insn) == 0
        || (GET_CODE (insn) != NOTE
  	  && GET_CODE (insn) != CODE_LABEL
  	  /* Don't emit a NOTE if it would end up before a BARRIER.  */
  	  && GET_CODE (NEXT_INSN (insn)) != BARRIER))
      {
!       emit_note_after (NOTE_INSN_DELETED, EXIT_BLOCK_PTR->prev_bb->end);
        /* Make insn to appear outside BB.  */
!       EXIT_BLOCK_PTR->prev_bb->end = PREV_INSN (EXIT_BLOCK_PTR->prev_bb->end);
      }
  
    /* Compute INSN_REG_WEIGHT for all blocks.  We must do this before
       removing death notes.  */
!   FOR_EACH_BB_REVERSE (b)
!     find_insn_reg_weight (b->index);
  }
  
  /* Free global data used during insn scheduling.  */
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 ifcvt.c
*** ifcvt.c	21 May 2002 20:37:41 -0000	1.90
--- ifcvt.c	22 May 2002 17:04:34 -0000
*************** void
*** 2685,2691 ****
  if_convert (x_life_data_ok)
       int x_life_data_ok;
  {
!   int block_num;
  
    num_possible_if_blocks = 0;
    num_updated_if_blocks = 0;
--- 2685,2691 ----
  if_convert (x_life_data_ok)
       int x_life_data_ok;
  {
!   basic_block bb;
  
    num_possible_if_blocks = 0;
    num_updated_if_blocks = 0;
*************** if_convert (x_life_data_ok)
*** 2707,2724 ****
      clear_bb_flags ();
  
    /* Record initial block numbers.  */
!   for (block_num = 0; block_num < n_basic_blocks; block_num++)
!     SET_ORIG_INDEX (BASIC_BLOCK (block_num), block_num);
  
    /* Go through each of the basic blocks looking for things to convert.  */
!   for (block_num = 0; block_num < n_basic_blocks; )
!     {
!       basic_block bb = BASIC_BLOCK (block_num);
!       if (find_if_header (bb))
! 	block_num = bb->index;
!       else 
! 	block_num++;
!     }
  
    if (post_dominators)
      sbitmap_vector_free (post_dominators);
--- 2707,2719 ----
      clear_bb_flags ();
  
    /* Record initial block numbers.  */
!   FOR_EACH_BB (bb)
!     SET_ORIG_INDEX (bb, bb->index);
  
    /* Go through each of the basic blocks looking for things to convert.  */
!   FOR_EACH_BB (bb)
!     while (find_if_header (bb))
!       continue;
  
    if (post_dominators)
      sbitmap_vector_free (post_dominators);
Index: lcm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/lcm.c,v
retrieving revision 1.42
diff -c -3 -p -r1.42 lcm.c
*** lcm.c	17 May 2002 02:31:36 -0000	1.42
--- lcm.c	22 May 2002 17:04:34 -0000
*************** compute_antinout_edge (antloc, transp, a
*** 106,112 ****
       sbitmap *antin;
       sbitmap *antout;
  {
!   int bb;
    edge e;
    basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
--- 106,112 ----
       sbitmap *antin;
       sbitmap *antout;
  {
!   basic_block bb;
    edge e;
    basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
*************** compute_antinout_edge (antloc, transp, a
*** 123,132 ****
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of ANTIN above.  */
!   for (bb = n_basic_blocks - 1; bb >= 0; bb--)
      {
!       *qin++ = BASIC_BLOCK (bb);
!       BASIC_BLOCK (bb)->aux = BASIC_BLOCK (bb);
      }
  
    qin = worklist;
--- 123,132 ----
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of ANTIN above.  */
!   FOR_EACH_BB_REVERSE (bb)
      {
!       *qin++ =bb;
!       bb->aux = bb;
      }
  
    qin = worklist;
*************** compute_antinout_edge (antloc, transp, a
*** 142,173 ****
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *qout++;
!       bb = b->index;
        qlen--;
  
        if (qout >= qend)
          qout = worklist;
  
!       if (b->aux == EXIT_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are predecessors of
  	   the EXIT block.  That way we never add then to the worklist
  	   again.  */
! 	sbitmap_zero (antout[bb]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  b->aux = NULL;
! 	  sbitmap_intersection_of_succs (antout[bb], antin, bb);
  	}
  
!       if (sbitmap_a_or_b_and_c_cg (antin[bb], antloc[bb],
! 				   transp[bb], antout[bb]))
  	/* If the in state of this block changed, then we need
  	   to add the predecessors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = b->pred; e; e = e->pred_next)
  	  if (!e->src->aux && e->src != ENTRY_BLOCK_PTR)
  	    {
  	      *qin++ = e->src;
--- 142,172 ----
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       bb = *qout++;
        qlen--;
  
        if (qout >= qend)
          qout = worklist;
  
!       if (bb->aux == EXIT_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are predecessors of
  	   the EXIT block.  That way we never add then to the worklist
  	   again.  */
! 	sbitmap_zero (antout[bb->index]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  bb->aux = NULL;
! 	  sbitmap_intersection_of_succs (antout[bb->index], antin, bb->index);
  	}
  
!       if (sbitmap_a_or_b_and_c_cg (antin[bb->index], antloc[bb->index],
! 				   transp[bb->index], antout[bb->index]))
  	/* If the in state of this block changed, then we need
  	   to add the predecessors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = bb->pred; e; e = e->pred_next)
  	  if (!e->src->aux && e->src != ENTRY_BLOCK_PTR)
  	    {
  	      *qin++ = e->src;
*************** compute_laterin (edge_list, earliest, an
*** 263,271 ****
       struct edge_list *edge_list;
       sbitmap *earliest, *antloc, *later, *laterin;
  {
!   int bb, num_edges, i;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
  
    num_edges = NUM_EDGES (edge_list);
--- 262,270 ----
       struct edge_list *edge_list;
       sbitmap *earliest, *antloc, *later, *laterin;
  {
!   int num_edges, i;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend, bb;
    unsigned int qlen;
  
    num_edges = NUM_EDGES (edge_list);
*************** compute_laterin (edge_list, earliest, an
*** 301,311 ****
  
    /* Add all the blocks to the worklist.  This prevents an early exit from
       the loop given our optimistic initialization of LATER above.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       basic_block b = BASIC_BLOCK (bb);
!       *qin++ = b;
!       b->aux = b;
      }
    qin = worklist;
    /* Note that we do not use the last allocated element for our queue,
--- 300,309 ----
  
    /* Add all the blocks to the worklist.  This prevents an early exit from
       the loop given our optimistic initialization of LATER above.  */
!   FOR_EACH_BB (bb)
      {
!       *qin++ = bb;
!       bb->aux = bb;
      }
    qin = worklist;
    /* Note that we do not use the last allocated element for our queue,
*************** compute_laterin (edge_list, earliest, an
*** 318,337 ****
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *qout++;
!       b->aux = NULL;
        qlen--;
        if (qout >= qend)
          qout = worklist;
  
        /* Compute the intersection of LATERIN for each incoming edge to B.  */
!       bb = b->index;
!       sbitmap_ones (laterin[bb]);
!       for (e = b->pred; e != NULL; e = e->pred_next)
! 	sbitmap_a_and_b (laterin[bb], laterin[bb], later[(size_t)e->aux]);
  
        /* Calculate LATER for all outgoing edges.  */
!       for (e = b->succ; e != NULL; e = e->succ_next)
  	if (sbitmap_union_of_diff_cg (later[(size_t) e->aux],
  				      earliest[(size_t) e->aux],
  				      laterin[e->src->index],
--- 316,334 ----
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       bb = *qout++;
!       bb->aux = NULL;
        qlen--;
        if (qout >= qend)
          qout = worklist;
  
        /* Compute the intersection of LATERIN for each incoming edge to B.  */
!       sbitmap_ones (laterin[bb->index]);
!       for (e = bb->pred; e != NULL; e = e->pred_next)
! 	sbitmap_a_and_b (laterin[bb->index], laterin[bb->index], later[(size_t)e->aux]);
  
        /* Calculate LATER for all outgoing edges.  */
!       for (e = bb->succ; e != NULL; e = e->succ_next)
  	if (sbitmap_union_of_diff_cg (later[(size_t) e->aux],
  				      earliest[(size_t) e->aux],
  				      laterin[e->src->index],
*************** compute_insert_delete (edge_list, antloc
*** 370,378 ****
       sbitmap *antloc, *later, *laterin, *insert, *delete;
  {
    int x;
  
!   for (x = 0; x < n_basic_blocks; x++)
!     sbitmap_difference (delete[x], antloc[x], laterin[x]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
--- 367,376 ----
       sbitmap *antloc, *later, *laterin, *insert, *delete;
  {
    int x;
+   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     sbitmap_difference (delete[bb->index], antloc[bb->index], laterin[bb->index]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
*************** void
*** 496,504 ****
  compute_available (avloc, kill, avout, avin)
       sbitmap *avloc, *kill, *avout, *avin;
  {
-   int bb;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend;
    unsigned int qlen;
  
    /* Allocate a worklist array/queue.  Entries are only added to the
--- 494,501 ----
  compute_available (avloc, kill, avout, avin)
       sbitmap *avloc, *kill, *avout, *avin;
  {
    edge e;
!   basic_block *worklist, *qin, *qout, *qend, bb;
    unsigned int qlen;
  
    /* Allocate a worklist array/queue.  Entries are only added to the
*************** compute_available (avloc, kill, avout, a
*** 512,521 ****
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of AVOUT above.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       *qin++ = BASIC_BLOCK (bb);
!       BASIC_BLOCK (bb)->aux = BASIC_BLOCK (bb);
      }
  
    qin = worklist;
--- 509,518 ----
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of AVOUT above.  */
!   FOR_EACH_BB (bb)
      {
!       *qin++ = bb;
!       bb->aux = bb;
      }
  
    qin = worklist;
*************** compute_available (avloc, kill, avout, a
*** 531,538 ****
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *qout++;
!       bb = b->index;
        qlen--;
  
        if (qout >= qend)
--- 528,534 ----
    while (qlen)
      {
        /* Take the first entry off the worklist.  */
!       bb = *qout++;
        qlen--;
  
        if (qout >= qend)
*************** compute_available (avloc, kill, avout, a
*** 541,563 ****
        /* If one of the predecessor blocks is the ENTRY block, then the
  	 intersection of avouts is the null set.  We can identify such blocks
  	 by the special value in the AUX field in the block structure.  */
!       if (b->aux == ENTRY_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are successors of the
  	   ENTRY block.  That way we never add then to the worklist again.  */
! 	sbitmap_zero (avin[bb]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  b->aux = NULL;
! 	  sbitmap_intersection_of_preds (avin[bb], avout, bb);
  	}
  
!       if (sbitmap_union_of_diff_cg (avout[bb], avloc[bb], avin[bb], kill[bb]))
  	/* If the out state of this block changed, then we need
  	   to add the successors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = b->succ; e; e = e->succ_next)
  	  if (!e->dest->aux && e->dest != EXIT_BLOCK_PTR)
  	    {
  	      *qin++ = e->dest;
--- 537,559 ----
        /* If one of the predecessor blocks is the ENTRY block, then the
  	 intersection of avouts is the null set.  We can identify such blocks
  	 by the special value in the AUX field in the block structure.  */
!       if (bb->aux == ENTRY_BLOCK_PTR)
  	/* Do not clear the aux field for blocks which are successors of the
  	   ENTRY block.  That way we never add then to the worklist again.  */
! 	sbitmap_zero (avin[bb->index]);
        else
  	{
  	  /* Clear the aux field of this block so that it can be added to
  	     the worklist again if necessary.  */
! 	  bb->aux = NULL;
! 	  sbitmap_intersection_of_preds (avin[bb->index], avout, bb->index);
  	}
  
!       if (sbitmap_union_of_diff_cg (avout[bb->index], avloc[bb->index], avin[bb->index], kill[bb->index]))
  	/* If the out state of this block changed, then we need
  	   to add the successors of this block to the worklist
  	   if they are not already on the worklist.  */
! 	for (e = bb->succ; e; e = e->succ_next)
  	  if (!e->dest->aux && e->dest != EXIT_BLOCK_PTR)
  	    {
  	      *qin++ = e->dest;
*************** compute_nearerout (edge_list, farthest, 
*** 627,635 ****
       struct edge_list *edge_list;
       sbitmap *farthest, *st_avloc, *nearer, *nearerout;
  {
!   int bb, num_edges, i;
    edge e;
!   basic_block *worklist, *tos;
  
    num_edges = NUM_EDGES (edge_list);
  
--- 623,631 ----
       struct edge_list *edge_list;
       sbitmap *farthest, *st_avloc, *nearer, *nearerout;
  {
!   int num_edges, i;
    edge e;
!   basic_block *worklist, *tos, bb;
  
    num_edges = NUM_EDGES (edge_list);
  
*************** compute_nearerout (edge_list, farthest, 
*** 656,684 ****
  
    /* Add all the blocks to the worklist.  This prevents an early exit
       from the loop given our optimistic initialization of NEARER.  */
!   for (bb = 0; bb < n_basic_blocks; bb++)
      {
!       basic_block b = BASIC_BLOCK (bb);
!       *tos++ = b;
!       b->aux = b;
      }
  
    /* Iterate until the worklist is empty.  */
    while (tos != worklist)
      {
        /* Take the first entry off the worklist.  */
!       basic_block b = *--tos;
!       b->aux = NULL;
  
        /* Compute the intersection of NEARER for each outgoing edge from B.  */
!       bb = b->index;
!       sbitmap_ones (nearerout[bb]);
!       for (e = b->succ; e != NULL; e = e->succ_next)
! 	sbitmap_a_and_b (nearerout[bb], nearerout[bb],
  			 nearer[(size_t) e->aux]);
  
        /* Calculate NEARER for all incoming edges.  */
!       for (e = b->pred; e != NULL; e = e->pred_next)
  	if (sbitmap_union_of_diff_cg (nearer[(size_t) e->aux],
  				      farthest[(size_t) e->aux],
  				      nearerout[e->dest->index],
--- 652,678 ----
  
    /* Add all the blocks to the worklist.  This prevents an early exit
       from the loop given our optimistic initialization of NEARER.  */
!   FOR_EACH_BB (bb)
      {
!       *tos++ = bb;
!       bb->aux = bb;
      }
  
    /* Iterate until the worklist is empty.  */
    while (tos != worklist)
      {
        /* Take the first entry off the worklist.  */
!       bb = *--tos;
!       bb->aux = NULL;
  
        /* Compute the intersection of NEARER for each outgoing edge from B.  */
!       sbitmap_ones (nearerout[bb->index]);
!       for (e = bb->succ; e != NULL; e = e->succ_next)
! 	sbitmap_a_and_b (nearerout[bb->index], nearerout[bb->index],
  			 nearer[(size_t) e->aux]);
  
        /* Calculate NEARER for all incoming edges.  */
!       for (e = bb->pred; e != NULL; e = e->pred_next)
  	if (sbitmap_union_of_diff_cg (nearer[(size_t) e->aux],
  				      farthest[(size_t) e->aux],
  				      nearerout[e->dest->index],
*************** compute_rev_insert_delete (edge_list, st
*** 714,722 ****
       sbitmap *st_avloc, *nearer, *nearerout, *insert, *delete;
  {
    int x;
  
!   for (x = 0; x < n_basic_blocks; x++)
!     sbitmap_difference (delete[x], st_avloc[x], nearerout[x]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
--- 708,717 ----
       sbitmap *st_avloc, *nearer, *nearerout, *insert, *delete;
  {
    int x;
+   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     sbitmap_difference (delete[bb->index], st_avloc[bb->index], nearerout[bb->index]);
  
    for (x = 0; x < NUM_EDGES (edge_list); x++)
      {
*************** optimize_mode_switching (file)
*** 1019,1025 ****
       FILE *file;
  {
    rtx insn;
!   int bb, e;
    int need_commit = 0;
    sbitmap *kill;
    struct edge_list *edge_list;
--- 1014,1021 ----
       FILE *file;
  {
    rtx insn;
!   int e;
!   basic_block bb;
    int need_commit = 0;
    sbitmap *kill;
    struct edge_list *edge_list;
*************** optimize_mode_switching (file)
*** 1087,1102 ****
        /* Determine what the first use (if any) need for a mode of entity E is.
  	 This will be the mode that is anticipatable for this block.
  	 Also compute the initial transparency settings.  */
!       for (bb = 0 ; bb < n_basic_blocks; bb++)
  	{
  	  struct seginfo *ptr;
  	  int last_mode = no_mode;
  	  HARD_REG_SET live_now;
  
  	  REG_SET_TO_HARD_REG_SET (live_now,
! 				   BASIC_BLOCK (bb)->global_live_at_start);
! 	  for (insn = BLOCK_HEAD (bb);
! 	       insn != NULL && insn != NEXT_INSN (BLOCK_END (bb));
  	       insn = NEXT_INSN (insn))
  	    {
  	      if (INSN_P (insn))
--- 1083,1098 ----
        /* Determine what the first use (if any) need for a mode of entity E is.
  	 This will be the mode that is anticipatable for this block.
  	 Also compute the initial transparency settings.  */
!       FOR_EACH_BB (bb)
  	{
  	  struct seginfo *ptr;
  	  int last_mode = no_mode;
  	  HARD_REG_SET live_now;
  
  	  REG_SET_TO_HARD_REG_SET (live_now,
! 				   bb->global_live_at_start);
! 	  for (insn = bb->head;
! 	       insn != NULL && insn != NEXT_INSN (bb->end);
  	       insn = NEXT_INSN (insn))
  	    {
  	      if (INSN_P (insn))
*************** optimize_mode_switching (file)
*** 1107,1115 ****
  		  if (mode != no_mode && mode != last_mode)
  		    {
  		      last_mode = mode;
! 		      ptr = new_seginfo (mode, insn, bb, live_now);
! 		      add_seginfo (info + bb, ptr);
! 		      RESET_BIT (transp[bb], j);
  		    }
  
  		  /* Update LIVE_NOW.  */
--- 1103,1111 ----
  		  if (mode != no_mode && mode != last_mode)
  		    {
  		      last_mode = mode;
! 		      ptr = new_seginfo (mode, insn, bb->index, live_now);
! 		      add_seginfo (info + bb->index, ptr);
! 		      RESET_BIT (transp[bb->index], j);
  		    }
  
  		  /* Update LIVE_NOW.  */
*************** optimize_mode_switching (file)
*** 1124,1135 ****
  		}
  	    }
  
! 	  info[bb].computing = last_mode;
  	  /* Check for blocks without ANY mode requirements.  */
  	  if (last_mode == no_mode)
  	    {
! 	      ptr = new_seginfo (no_mode, insn, bb, live_now);
! 	      add_seginfo (info + bb, ptr);
  	    }
  	}
  #ifdef NORMAL_MODE
--- 1120,1131 ----
  		}
  	    }
  
! 	  info[bb->index].computing = last_mode;
  	  /* Check for blocks without ANY mode requirements.  */
  	  if (last_mode == no_mode)
  	    {
! 	      ptr = new_seginfo (no_mode, insn, bb->index, live_now);
! 	      add_seginfo (info + bb->index, ptr);
  	    }
  	}
  #ifdef NORMAL_MODE
*************** optimize_mode_switching (file)
*** 1142,1154 ****
  
  	    for (eg = ENTRY_BLOCK_PTR->succ; eg; eg = eg->succ_next)
  	      {
! 		bb = eg->dest->index;
  
  	        /* By always making this nontransparent, we save
  		   an extra check in make_preds_opaque.  We also
  		   need this to avoid confusing pre_edge_lcm when
  		   antic is cleared but transp and comp are set.  */
! 		RESET_BIT (transp[bb], j);
  
  		/* If the block already has MODE, pretend it
  		   has none (because we don't need to set it),
--- 1138,1150 ----
  
  	    for (eg = ENTRY_BLOCK_PTR->succ; eg; eg = eg->succ_next)
  	      {
! 		bb = eg->dest;
  
  	        /* By always making this nontransparent, we save
  		   an extra check in make_preds_opaque.  We also
  		   need this to avoid confusing pre_edge_lcm when
  		   antic is cleared but transp and comp are set.  */
! 		RESET_BIT (transp[bb->index], j);
  
  		/* If the block already has MODE, pretend it
  		   has none (because we don't need to set it),
*************** optimize_mode_switching (file)
*** 1166,1172 ****
  		  }
  	      }
  
! 	    bb = n_basic_blocks - 1;
  	    info[bb].seginfo->mode = mode;
  	  }
        }
--- 1162,1168 ----
  		  }
  	      }
  
! 	    bb = EXIT_BLOCK_PTR;
  	    info[bb].seginfo->mode = mode;
  	  }
        }
*************** optimize_mode_switching (file)
*** 1186,1206 ****
  	  int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
  	  struct bb_info *info = bb_info[j];
  
! 	  for (bb = 0 ; bb < n_basic_blocks; bb++)
  	    {
! 	      if (info[bb].seginfo->mode == m)
! 		SET_BIT (antic[bb], j);
  
! 	      if (info[bb].computing == m)
! 		SET_BIT (comp[bb], j);
  	    }
  	}
  
        /* Calculate the optimal locations for the
  	 placement mode switches to modes with priority I.  */
  
!       for (bb = n_basic_blocks - 1; bb >= 0; bb--)
! 	sbitmap_not (kill[bb], transp[bb]);
        edge_list = pre_edge_lcm (file, 1, transp, comp, antic,
  				kill, &insert, &delete);
  
--- 1182,1202 ----
  	  int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
  	  struct bb_info *info = bb_info[j];
  
! 	  FOR_EACH_BB (bb)
  	    {
! 	      if (info[bb->index].seginfo->mode == m)
! 		SET_BIT (antic[bb->index], j);
  
! 	      if (info[bb->index].computing == m)
! 		SET_BIT (comp[bb->index], j);
  	    }
  	}
  
        /* Calculate the optimal locations for the
  	 placement mode switches to modes with priority I.  */
  
!       FOR_EACH_BB (bb)
! 	sbitmap_not (kill[bb->index], transp[bb->index]);
        edge_list = pre_edge_lcm (file, 1, transp, comp, antic,
  				kill, &insert, &delete);
  
*************** optimize_mode_switching (file)
*** 1279,1290 ****
  		}
  	    }
  
! 	  for (bb = n_basic_blocks - 1; bb >= 0; bb--)
! 	    if (TEST_BIT (delete[bb], j))
  	      {
! 		make_preds_opaque (BASIC_BLOCK (bb), j);
  		/* Cancel the 'deleted' mode set.  */
! 		bb_info[j][bb].seginfo->mode = no_mode;
  	      }
  	}
  
--- 1275,1286 ----
  		}
  	    }
  
! 	  FOR_EACH_BB_REVERSE (bb)
! 	    if (TEST_BIT (delete[bb->index], j))
  	      {
! 		make_preds_opaque (bb, j);
  		/* Cancel the 'deleted' mode set.  */
! 		bb_info[j][bb->index].seginfo->mode = no_mode;
  	      }
  	}
  
*************** optimize_mode_switching (file)
*** 1349,1358 ****
  	}
  #endif
  
!       for (bb = n_basic_blocks - 1; bb >= 0; bb--)
  	{
  	  struct seginfo *ptr, *next;
! 	  for (ptr = bb_info[j][bb].seginfo; ptr; ptr = next)
  	    {
  	      next = ptr->next;
  	      if (ptr->mode != no_mode)
--- 1345,1354 ----
  	}
  #endif
  
!       FOR_EACH_BB_REVERSE (bb)
  	{
  	  struct seginfo *ptr, *next;
! 	  for (ptr = bb_info[j][bb->index].seginfo; ptr; ptr = next)
  	    {
  	      next = ptr->next;
  	      if (ptr->mode != no_mode)
Index: local-alloc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/local-alloc.c,v
retrieving revision 1.107
diff -c -3 -p -r1.107 local-alloc.c
*** local-alloc.c	17 May 2002 17:01:06 -0000	1.107
--- local-alloc.c	22 May 2002 17:04:34 -0000
*************** alloc_qty (regno, mode, size, birth)
*** 336,343 ****
  int
  local_alloc ()
  {
!   int b, i;
    int max_qty;
  
    /* We need to keep track of whether or not we recorded a LABEL_REF so
       that we know if the jump optimizer needs to be rerun.  */
--- 336,344 ----
  int
  local_alloc ()
  {
!   int i;
    int max_qty;
+   basic_block b;
  
    /* We need to keep track of whether or not we recorded a LABEL_REF so
       that we know if the jump optimizer needs to be rerun.  */
*************** local_alloc ()
*** 394,400 ****
  
    /* Allocate each block's local registers, block by block.  */
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
        /* NEXT_QTY indicates which elements of the `qty_...'
  	 vectors might need to be initialized because they were used
--- 395,401 ----
  
    /* Allocate each block's local registers, block by block.  */
  
!   FOR_EACH_BB (b)
      {
        /* NEXT_QTY indicates which elements of the `qty_...'
  	 vectors might need to be initialized because they were used
*************** local_alloc ()
*** 426,432 ****
  
        next_qty = 0;
  
!       block_alloc (b);
      }
  
    free (qty);
--- 427,433 ----
  
        next_qty = 0;
  
!       block_alloc (b->index);
      }
  
    free (qty);
*************** static void
*** 815,821 ****
  update_equiv_regs ()
  {
    rtx insn;
!   int block;
    int loop_depth;
    regset_head cleared_regs;
    int clear_regnos = 0;
--- 816,822 ----
  update_equiv_regs ()
  {
    rtx insn;
!   basic_block bb;
    int loop_depth;
    regset_head cleared_regs;
    int clear_regnos = 0;
*************** update_equiv_regs ()
*** 828,836 ****
    /* Scan the insns and find which registers have equivalences.  Do this
       in a separate scan of the insns because (due to -fcse-follow-jumps)
       a register can be set below its use.  */
!   for (block = 0; block < n_basic_blocks; block++)
      {
-       basic_block bb = BASIC_BLOCK (block);
        loop_depth = bb->loop_depth;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = NEXT_INSN (insn))
--- 829,836 ----
    /* Scan the insns and find which registers have equivalences.  Do this
       in a separate scan of the insns because (due to -fcse-follow-jumps)
       a register can be set below its use.  */
!   FOR_EACH_BB (bb)
      {
        loop_depth = bb->loop_depth;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end); insn = NEXT_INSN (insn))
*************** update_equiv_regs ()
*** 1044,1053 ****
       within the same loop (or in an inner loop), then move the register
       initialization just before the use, so that they are in the same
       basic block.  */
!   for (block = n_basic_blocks - 1; block >= 0; block--)
      {
-       basic_block bb = BASIC_BLOCK (block);
- 
        loop_depth = bb->loop_depth;
        for (insn = bb->end; insn != PREV_INSN (bb->head); insn = PREV_INSN (insn))
  	{
--- 1044,1051 ----
       within the same loop (or in an inner loop), then move the register
       initialization just before the use, so that they are in the same
       basic block.  */
!   FOR_EACH_BB_REVERSE (bb)
      {
        loop_depth = bb->loop_depth;
        for (insn = bb->end; insn != PREV_INSN (bb->head); insn = PREV_INSN (insn))
  	{
*************** update_equiv_regs ()
*** 1139,1150 ****
  
  		      XEXP (reg_equiv[regno].init_insns, 0) = new_insn;
  
! 		      REG_BASIC_BLOCK (regno) = block >= 0 ? block : 0;
  		      REG_N_CALLS_CROSSED (regno) = 0;
  		      REG_LIVE_LENGTH (regno) = 2;
  
! 		      if (block >= 0 && insn == BLOCK_HEAD (block))
! 			BLOCK_HEAD (block) = PREV_INSN (insn);
  
  		      /* Remember to clear REGNO from all basic block's live
  			 info.  */
--- 1137,1148 ----
  
  		      XEXP (reg_equiv[regno].init_insns, 0) = new_insn;
  
! 		      REG_BASIC_BLOCK (regno) = bb->index;
  		      REG_N_CALLS_CROSSED (regno) = 0;
  		      REG_LIVE_LENGTH (regno) = 2;
  
! 		      if (insn == bb->head)
! 			bb->head = PREV_INSN (insn);
  
  		      /* Remember to clear REGNO from all basic block's live
  			 info.  */
*************** update_equiv_regs ()
*** 1159,1182 ****
    /* Clear all dead REGNOs from all basic block's live info.  */
    if (clear_regnos)
      {
!       int j, l;
        if (clear_regnos > 8)
          {
! 	  for (l = 0; l < n_basic_blocks; l++)
  	    {
! 	      AND_COMPL_REG_SET (BASIC_BLOCK (l)->global_live_at_start,
! 	                         &cleared_regs);
! 	      AND_COMPL_REG_SET (BASIC_BLOCK (l)->global_live_at_end,
! 	                         &cleared_regs);
  	    }
  	}
        else
          EXECUTE_IF_SET_IN_REG_SET (&cleared_regs, 0, j,
            {
! 	    for (l = 0; l < n_basic_blocks; l++)
  	      {
! 	        CLEAR_REGNO_REG_SET (BASIC_BLOCK (l)->global_live_at_start, j);
! 	        CLEAR_REGNO_REG_SET (BASIC_BLOCK (l)->global_live_at_end, j);
  	      }
  	  });
      }
--- 1157,1178 ----
    /* Clear all dead REGNOs from all basic block's live info.  */
    if (clear_regnos)
      {
!       int j;
        if (clear_regnos > 8)
          {
! 	  FOR_EACH_BB (bb)
  	    {
! 	      AND_COMPL_REG_SET (bb->global_live_at_start, &cleared_regs);
! 	      AND_COMPL_REG_SET (bb->global_live_at_end, &cleared_regs);
  	    }
  	}
        else
          EXECUTE_IF_SET_IN_REG_SET (&cleared_regs, 0, j,
            {
! 	    FOR_EACH_BB (bb)
  	      {
! 	        CLEAR_REGNO_REG_SET (bb->global_live_at_start, j);
! 	        CLEAR_REGNO_REG_SET (bb->global_live_at_end, j);
  	      }
  	  });
      }
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.67
diff -c -3 -p -r1.67 predict.c
*** predict.c	21 May 2002 20:37:41 -0000	1.67
--- predict.c	22 May 2002 17:04:34 -0000
*************** estimate_probability (loops_info)
*** 409,414 ****
--- 409,415 ----
       struct loops *loops_info;
  {
    sbitmap *dominators, *post_dominators;
+   basic_block bb;
    int i;
  
    dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
*************** estimate_probability (loops_info)
*** 420,434 ****
       natural loop.  */
    for (i = 0; i < loops_info->num; i++)
      {
-       int j;
        int exits;
        struct loop *loop = &loops_info->array[i];
  
        flow_loop_scan (loops_info, loop, LOOP_EXIT_EDGES);
        exits = loop->num_exits;
  
!       for (j = loop->first->index; j <= loop->last->index; ++j)
! 	if (TEST_BIT (loop->nodes, j))
  	  {
  	    int header_found = 0;
  	    edge e;
--- 421,434 ----
       natural loop.  */
    for (i = 0; i < loops_info->num; i++)
      {
        int exits;
        struct loop *loop = &loops_info->array[i];
  
        flow_loop_scan (loops_info, loop, LOOP_EXIT_EDGES);
        exits = loop->num_exits;
  
!       FOR_BB_BETWEEN (bb, loop->first, loop->last->next_bb, next_bb)
! 	if (TEST_BIT (loop->nodes, bb->index))
  	  {
  	    int header_found = 0;
  	    edge e;
*************** estimate_probability (loops_info)
*** 437,448 ****
  	     statements construct loops via "non-loop" constructs
  	     in the source language and are better to be handled
  	     separately.  */
! 	  if (predicted_by_p (BASIC_BLOCK (j), PRED_CONTINUE))
  	    continue;
  
  	    /* Loop branch heuristics - predict an edge back to a
  	       loop's head as taken.  */
! 	    for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
  	      if (e->dest == loop->header
  		  && e->src == loop->latch)
  		{
--- 437,448 ----
  	     statements construct loops via "non-loop" constructs
  	     in the source language and are better to be handled
  	     separately.  */
! 	  if (predicted_by_p (bb, PRED_CONTINUE))
  	    continue;
  
  	    /* Loop branch heuristics - predict an edge back to a
  	       loop's head as taken.  */
! 	    for (e = bb->succ; e; e = e->succ_next)
  	      if (e->dest == loop->header
  		  && e->src == loop->latch)
  		{
*************** estimate_probability (loops_info)
*** 453,459 ****
  	    /* Loop exit heuristics - predict an edge exiting the loop if the
  	       conditinal has no loop header successors as not taken.  */
  	    if (!header_found)
! 	      for (e = BASIC_BLOCK(j)->succ; e; e = e->succ_next)
  		if (e->dest->index < 0
  		    || !TEST_BIT (loop->nodes, e->dest->index))
  		  predict_edge
--- 453,459 ----
  	    /* Loop exit heuristics - predict an edge exiting the loop if the
  	       conditinal has no loop header successors as not taken.  */
  	    if (!header_found)
! 	      for (e = bb->succ; e; e = e->succ_next)
  		if (e->dest->index < 0
  		    || !TEST_BIT (loop->nodes, e->dest->index))
  		  predict_edge
*************** estimate_probability (loops_info)
*** 465,473 ****
      }
  
    /* Attempt to predict conditional jumps using a number of heuristics.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx last_insn = bb->end;
        rtx cond, earliest;
        edge e;
--- 465,472 ----
      }
  
    /* Attempt to predict conditional jumps using a number of heuristics.  */
!   FOR_EACH_BB (bb)
      {
        rtx last_insn = bb->end;
        rtx cond, earliest;
        edge e;
*************** estimate_probability (loops_info)
*** 604,614 ****
      }
  
    /* Attach the combined probability to each conditional jump.  */
!   for (i = 0; i < n_basic_blocks; i++)
!     if (GET_CODE (BLOCK_END (i)) == JUMP_INSN
! 	&& any_condjump_p (BLOCK_END (i))
! 	&& BASIC_BLOCK (i)->succ->succ_next != NULL)
!       combine_predictions_for_insn (BLOCK_END (i), BASIC_BLOCK (i));
  
    sbitmap_vector_free (post_dominators);
    sbitmap_vector_free (dominators);
--- 603,613 ----
      }
  
    /* Attach the combined probability to each conditional jump.  */
!   FOR_EACH_BB (bb)
!     if (GET_CODE (bb->end) == JUMP_INSN
! 	&& any_condjump_p (bb->end)
! 	&& bb->succ->succ_next != NULL)
!       combine_predictions_for_insn (bb->end, bb);
  
    sbitmap_vector_free (post_dominators);
    sbitmap_vector_free (dominators);
*************** process_note_predictions (bb, heads, dom
*** 834,840 ****
  void
  note_prediction_to_br_prob ()
  {
!   int i;
    sbitmap *post_dominators;
    int *dominators, *heads;
  
--- 833,839 ----
  void
  note_prediction_to_br_prob ()
  {
!   basic_block bb;
    sbitmap *post_dominators;
    int *dominators, *heads;
  
*************** note_prediction_to_br_prob ()
*** 854,864 ****
  
    /* Process all prediction notes.  */
  
!   for (i = 0; i < n_basic_blocks; ++i)
!     {
!       basic_block bb = BASIC_BLOCK (i);
!       process_note_predictions (bb, heads, dominators, post_dominators);
!     }
  
    sbitmap_vector_free (post_dominators);
    free (dominators);
--- 853,860 ----
  
    /* Process all prediction notes.  */
  
!   FOR_EACH_BB (bb)
!     process_note_predictions (bb, heads, dominators, post_dominators);
  
    sbitmap_vector_free (post_dominators);
    free (dominators);
*************** static void
*** 906,922 ****
  propagate_freq (head)
       basic_block head;
  {
!   basic_block bb = head;
!   basic_block last = bb;
    edge e;
    basic_block nextbb;
-   int n;
  
    /* For each basic block we need to visit count number of his predecessors
       we need to visit first.  */
!   for (n = 0; n < n_basic_blocks; n++)
      {
-       basic_block bb = BASIC_BLOCK (n);
        if (BLOCK_INFO (bb)->tovisit)
  	{
  	  int count = 0;
--- 902,916 ----
  propagate_freq (head)
       basic_block head;
  {
!   basic_block bb;
!   basic_block last;
    edge e;
    basic_block nextbb;
  
    /* For each basic block we need to visit count number of his predecessors
       we need to visit first.  */
!   FOR_EACH_BB (bb)
      {
        if (BLOCK_INFO (bb)->tovisit)
  	{
  	  int count = 0;
*************** propagate_freq (head)
*** 934,940 ****
      }
  
    memcpy (&BLOCK_INFO (head)->frequency, &real_one, sizeof (real_one));
!   for (; bb; bb = nextbb)
      {
        REAL_VALUE_TYPE cyclic_probability, frequency;
  
--- 928,935 ----
      }
  
    memcpy (&BLOCK_INFO (head)->frequency, &real_one, sizeof (real_one));
!   last = head;
!   for (bb = head; bb; bb = nextbb)
      {
        REAL_VALUE_TYPE cyclic_probability, frequency;
  
*************** static void
*** 1077,1100 ****
  counts_to_freqs ()
  {
    HOST_WIDEST_INT count_max = 1;
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
!     count_max = MAX (BASIC_BLOCK (i)->count, count_max);
  
!   for (i = -2; i < n_basic_blocks; i++)
!     {
!       basic_block bb;
! 
!       if (i == -2)
! 	bb = ENTRY_BLOCK_PTR;
!       else if (i == -1)
! 	bb = EXIT_BLOCK_PTR;
!       else
! 	bb = BASIC_BLOCK (i);
! 
!       bb->frequency = (bb->count * BB_FREQ_MAX + count_max / 2) / count_max;
!     }
  }
  
  /* Return true if function is likely to be expensive, so there is no point to
--- 1072,1084 ----
  counts_to_freqs ()
  {
    HOST_WIDEST_INT count_max = 1;
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     count_max = MAX (bb->count, count_max);
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->frequency = (bb->count * BB_FREQ_MAX + count_max / 2) / count_max;
  }
  
  /* Return true if function is likely to be expensive, so there is no point to
*************** expensive_function_p (threshold)
*** 1107,1113 ****
  	int threshold;
  {
    unsigned int sum = 0;
!   int i;
    unsigned int limit;
  
    /* We can not compute accurately for large thresholds due to scaled
--- 1091,1097 ----
  	int threshold;
  {
    unsigned int sum = 0;
!   basic_block bb;
    unsigned int limit;
  
    /* We can not compute accurately for large thresholds due to scaled
*************** expensive_function_p (threshold)
*** 1123,1131 ****
  
    /* Maximally BB_FREQ_MAX^2 so overflow won't happen.  */
    limit = ENTRY_BLOCK_PTR->frequency * threshold;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end);
--- 1107,1114 ----
  
    /* Maximally BB_FREQ_MAX^2 so overflow won't happen.  */
    limit = ENTRY_BLOCK_PTR->frequency * threshold;
!   FOR_EACH_BB (bb)
      {
        rtx insn;
  
        for (insn = bb->head; insn != NEXT_INSN (bb->end);
*************** static void
*** 1147,1153 ****
  estimate_bb_frequencies (loops)
       struct loops *loops;
  {
!   int i;
    REAL_VALUE_TYPE freq_max;
    enum machine_mode double_mode = TYPE_MODE (double_type_node);
  
--- 1130,1136 ----
  estimate_bb_frequencies (loops)
       struct loops *loops;
  {
!   basic_block bb;
    REAL_VALUE_TYPE freq_max;
    enum machine_mode double_mode = TYPE_MODE (double_type_node);
  
*************** estimate_bb_frequencies (loops)
*** 1169,1181 ****
        mark_dfs_back_edges ();
        /* Fill in the probability values in flowgraph based on the REG_BR_PROB
           notes.  */
!       for (i = 0; i < n_basic_blocks; i++)
  	{
! 	  rtx last_insn = BLOCK_END (i);
  
  	  if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn)
  	      /* Avoid handling of conditional jumps jumping to fallthru edge.  */
! 	      || BASIC_BLOCK (i)->succ->succ_next == NULL)
  	    {
  	      /* We can predict only conditional jumps at the moment.
  	         Expect each edge to be equally probable.
--- 1152,1164 ----
        mark_dfs_back_edges ();
        /* Fill in the probability values in flowgraph based on the REG_BR_PROB
           notes.  */
!       FOR_EACH_BB (bb)
  	{
! 	  rtx last_insn = bb->end;
  
  	  if (GET_CODE (last_insn) != JUMP_INSN || !any_condjump_p (last_insn)
  	      /* Avoid handling of conditional jumps jumping to fallthru edge.  */
! 	      || bb->succ->succ_next == NULL)
  	    {
  	      /* We can predict only conditional jumps at the moment.
  	         Expect each edge to be equally probable.
*************** estimate_bb_frequencies (loops)
*** 1183,1196 ****
  	      int nedges = 0;
  	      edge e;
  
! 	      for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  		{
  		  nedges++;
  		  if (e->probability != 0)
  		    break;
  		}
  	      if (!e)
! 		for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  		  e->probability = (REG_BR_PROB_BASE + nedges / 2) / nedges;
  	    }
  	}
--- 1166,1179 ----
  	      int nedges = 0;
  	      edge e;
  
! 	      for (e = bb->succ; e; e = e->succ_next)
  		{
  		  nedges++;
  		  if (e->probability != 0)
  		    break;
  		}
  	      if (!e)
! 		for (e = bb->succ; e; e = e->succ_next)
  		  e->probability = (REG_BR_PROB_BASE + nedges / 2) / nedges;
  	    }
  	}
*************** estimate_bb_frequencies (loops)
*** 1200,1221 ****
        /* Set up block info for each basic block.  */
        alloc_aux_for_blocks (sizeof (struct block_info_def));
        alloc_aux_for_edges (sizeof (struct edge_info_def));
!       for (i = -2; i < n_basic_blocks; i++)
  	{
  	  edge e;
- 	  basic_block bb;
- 
- 	  if (i == -2)
- 	    bb = ENTRY_BLOCK_PTR;
- 	  else if (i == -1)
- 	    bb = EXIT_BLOCK_PTR;
- 	  else
- 	    bb = BASIC_BLOCK (i);
  
  	  BLOCK_INFO (bb)->tovisit = 0;
  	  for (e = bb->succ; e; e = e->succ_next)
  	    {
- 
  	      REAL_VALUE_FROM_INT (EDGE_INFO (e)->back_edge_prob,
  				   e->probability, 0, double_mode);
  	      REAL_ARITHMETIC (EDGE_INFO (e)->back_edge_prob,
--- 1183,1195 ----
        /* Set up block info for each basic block.  */
        alloc_aux_for_blocks (sizeof (struct block_info_def));
        alloc_aux_for_edges (sizeof (struct edge_info_def));
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
  	{
  	  edge e;
  
  	  BLOCK_INFO (bb)->tovisit = 0;
  	  for (e = bb->succ; e; e = e->succ_next)
  	    {
  	      REAL_VALUE_FROM_INT (EDGE_INFO (e)->back_edge_prob,
  				   e->probability, 0, double_mode);
  	      REAL_ARITHMETIC (EDGE_INFO (e)->back_edge_prob,
*************** estimate_bb_frequencies (loops)
*** 1229,1260 ****
        estimate_loops_at_level (loops->tree_root);
  
        /* Now fake loop around whole function to finalize probabilities.  */
!       for (i = 0; i < n_basic_blocks; i++)
! 	BLOCK_INFO (BASIC_BLOCK (i))->tovisit = 1;
  
        BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
        BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
        propagate_freq (ENTRY_BLOCK_PTR);
  
        memcpy (&freq_max, &real_zero, sizeof (real_zero));
!       for (i = 0; i < n_basic_blocks; i++)
  	if (REAL_VALUES_LESS
! 	    (freq_max, BLOCK_INFO (BASIC_BLOCK (i))->frequency))
! 	  memcpy (&freq_max, &BLOCK_INFO (BASIC_BLOCK (i))->frequency,
  		  sizeof (freq_max));
  
!       for (i = -2; i < n_basic_blocks; i++)
  	{
- 	  basic_block bb;
  	  REAL_VALUE_TYPE tmp;
  
- 	  if (i == -2)
- 	    bb = ENTRY_BLOCK_PTR;
- 	  else if (i == -1)
- 	    bb = EXIT_BLOCK_PTR;
- 	  else
- 	    bb = BASIC_BLOCK (i);
- 
  	  REAL_ARITHMETIC (tmp, MULT_EXPR, BLOCK_INFO (bb)->frequency,
  			   real_bb_freq_max);
  	  REAL_ARITHMETIC (tmp, RDIV_EXPR, tmp, freq_max);
--- 1203,1226 ----
        estimate_loops_at_level (loops->tree_root);
  
        /* Now fake loop around whole function to finalize probabilities.  */
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
! 	BLOCK_INFO (bb)->tovisit = 1;
  
        BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
        BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
        propagate_freq (ENTRY_BLOCK_PTR);
  
        memcpy (&freq_max, &real_zero, sizeof (real_zero));
!       FOR_EACH_BB (bb)
  	if (REAL_VALUES_LESS
! 	    (freq_max, BLOCK_INFO (bb)->frequency))
! 	  memcpy (&freq_max, &BLOCK_INFO (bb)->frequency,
  		  sizeof (freq_max));
  
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
  	{
  	  REAL_VALUE_TYPE tmp;
  
  	  REAL_ARITHMETIC (tmp, MULT_EXPR, BLOCK_INFO (bb)->frequency,
  			   real_bb_freq_max);
  	  REAL_ARITHMETIC (tmp, RDIV_EXPR, tmp, freq_max);
*************** estimate_bb_frequencies (loops)
*** 1274,1287 ****
  static void
  compute_function_frequency ()
  {
!   int i;
    if (!profile_info.count_profiles_merged
        || !flag_branch_probabilities)
      return;
    cfun->function_frequency = FUNCTION_FREQUENCY_UNLIKELY_EXECUTED;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        if (maybe_hot_bb_p (bb))
  	{
  	  cfun->function_frequency = FUNCTION_FREQUENCY_HOT;
--- 1240,1253 ----
  static void
  compute_function_frequency ()
  {
!   basic_block bb;
! 
    if (!profile_info.count_profiles_merged
        || !flag_branch_probabilities)
      return;
    cfun->function_frequency = FUNCTION_FREQUENCY_UNLIKELY_EXECUTED;
!   FOR_EACH_BB (bb)
      {
        if (maybe_hot_bb_p (bb))
  	{
  	  cfun->function_frequency = FUNCTION_FREQUENCY_HOT;
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.88
diff -c -3 -p -r1.88 profile.c
*** profile.c	21 May 2002 08:54:21 -0000	1.88
--- profile.c	22 May 2002 17:04:34 -0000
*************** static void
*** 137,150 ****
  instrument_edges (el)
       struct edge_list *el;
  {
-   int i;
    int num_instr_edges = 0;
    int num_edges = NUM_EDGES (el);
    remove_fake_edges ();
  
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e = bb->succ;
        while (e)
  	{
--- 137,149 ----
  instrument_edges (el)
       struct edge_list *el;
  {
    int num_instr_edges = 0;
    int num_edges = NUM_EDGES (el);
+   basic_block bb;
    remove_fake_edges ();
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e = bb->succ;
        while (e)
  	{
*************** static gcov_type *
*** 216,223 ****
  get_exec_counts ()
  {
    int num_edges = 0;
!   int i;
!   int okay = 1;
    int mismatch = 0;
    gcov_type *profile;
    char *function_name_buffer;
--- 215,222 ----
  get_exec_counts ()
  {
    int num_edges = 0;
!   basic_block bb;
!   int okay = 1, i;
    int mismatch = 0;
    gcov_type *profile;
    char *function_name_buffer;
*************** get_exec_counts ()
*** 233,247 ****
  
    /* Count the edges to be (possibly) instrumented.  */
  
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
! 	  {
! 	    num_edges++;
! 	  }
      }
  
    /* now read and combine all matching profiles.  */
--- 232,243 ----
  
    /* Count the edges to be (possibly) instrumented.  */
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
! 	  num_edges++;
      }
  
    /* now read and combine all matching profiles.  */
*************** get_exec_counts ()
*** 382,387 ****
--- 378,384 ----
  static void
  compute_branch_probabilities ()
  {
+   basic_block bb;
    int i;
    int num_edges = 0;
    int changes;
*************** compute_branch_probabilities ()
*** 395,403 ****
    /* Attach extra info block to each bb.  */
  
    alloc_aux_for_blocks (sizeof (struct bb_info));
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
--- 392,399 ----
    /* Attach extra info block to each bb.  */
  
    alloc_aux_for_blocks (sizeof (struct bb_info));
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
*************** compute_branch_probabilities ()
*** 418,426 ****
    /* The first count in the .da file is the number of times that the function
       was entered.  This is the exec_count for block zero.  */
  
!   for (i = 0; i < n_basic_blocks + 2; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
--- 414,421 ----
    /* The first count in the .da file is the number of times that the function
       was entered.  This is the exec_count for block zero.  */
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
        for (e = bb->succ; e; e = e->succ_next)
  	if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree)
*************** compute_branch_probabilities ()
*** 472,480 ****
      {
        passes++;
        changes = 0;
!       for (i = n_basic_blocks + 1; i >= 0; i--)
  	{
- 	  basic_block bb = GCOV_INDEX_TO_BB (i);
  	  struct bb_info *bi = BB_INFO (bb);
  	  if (! bi->count_valid)
  	    {
--- 467,474 ----
      {
        passes++;
        changes = 0;
!       FOR_BB_BETWEEN (bb, EXIT_BLOCK_PTR, NULL, prev_bb)
  	{
  	  struct bb_info *bi = BB_INFO (bb);
  	  if (! bi->count_valid)
  	    {
*************** compute_branch_probabilities ()
*** 569,577 ****
  
    /* If the graph has been correctly solved, every block will have a
       succ and pred count of zero.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        if (BB_INFO (bb)->succ_count || BB_INFO (bb)->pred_count)
  	abort ();
      }
--- 563,570 ----
  
    /* If the graph has been correctly solved, every block will have a
       succ and pred count of zero.  */
!   FOR_EACH_BB (bb)
      {
        if (BB_INFO (bb)->succ_count || BB_INFO (bb)->pred_count)
  	abort ();
      }
*************** compute_branch_probabilities ()
*** 584,592 ****
    num_never_executed = 0;
    num_branches = 0;
  
!   for (i = 0; i <= n_basic_blocks + 1; i++)
      {
-       basic_block bb = GCOV_INDEX_TO_BB (i);
        edge e;
        gcov_type total;
        rtx note;
--- 577,584 ----
    num_never_executed = 0;
    num_branches = 0;
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
      {
        edge e;
        gcov_type total;
        rtx note;
*************** static long
*** 702,713 ****
  compute_checksum ()
  {
    long chsum = 0;
!   int i;
! 
  
!   for (i = 0; i < n_basic_blocks ; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
--- 694,703 ----
  compute_checksum ()
  {
    long chsum = 0;
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        edge e;
  
        for (e = bb->succ; e; e = e->succ_next)
*************** compute_checksum ()
*** 740,745 ****
--- 730,736 ----
  void
  branch_prob ()
  {
+   basic_block bb;
    int i;
    int num_edges, ignored_edges;
    struct edge_list *el;
*************** branch_prob ()
*** 768,778 ****
       We also add fake exit edges for each call and asm statement in the
       basic, since it may not return.  */
  
!   for (i = 0; i < n_basic_blocks ; i++)
      {
        int need_exit_edge = 0, need_entry_edge = 0;
        int have_exit_edge = 0, have_entry_edge = 0;
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn;
        edge e;
  
--- 759,768 ----
       We also add fake exit edges for each call and asm statement in the
       basic, since it may not return.  */
  
!   FOR_EACH_BB (bb)
      {
        int need_exit_edge = 0, need_entry_edge = 0;
        int have_exit_edge = 0, have_entry_edge = 0;
        rtx insn;
        edge e;
  
*************** branch_prob ()
*** 797,803 ****
  		{
  		  /* We should not get abort here, as call to setjmp should not
  		     be the very first instruction of function.  */
! 		  if (!i)
  		    abort ();
  		  make_edge (ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
  		}
--- 787,793 ----
  		{
  		  /* We should not get abort here, as call to setjmp should not
  		     be the very first instruction of function.  */
! 		  if (bb == ENTRY_BLOCK_PTR)
  		    abort ();
  		  make_edge (ENTRY_BLOCK_PTR, bb, EDGE_FAKE);
  		}
*************** branch_prob ()
*** 864,873 ****
       GCOV utility.  */
    if (flag_test_coverage)
      {
!       int i = 0;
!       for (i = 0 ; i < n_basic_blocks; i++)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  rtx insn = bb->head;
  	  static int ignore_next_note = 0;
  
--- 854,861 ----
       GCOV utility.  */
    if (flag_test_coverage)
      {
!       FOR_EACH_BB (bb)
  	{
  	  rtx insn = bb->head;
  	  static int ignore_next_note = 0;
  
*************** branch_prob ()
*** 976,984 ****
        __write_long (n_basic_blocks + 2, bbg_file, 4);
        __write_long (num_edges - ignored_edges + 1, bbg_file, 4);
  
!       for (i = 0; i < n_basic_blocks + 1; i++)
  	{
- 	  basic_block bb = GCOV_INDEX_TO_BB (i);
  	  edge e;
  	  long count = 0;
  
--- 964,971 ----
        __write_long (n_basic_blocks + 2, bbg_file, 4);
        __write_long (num_edges - ignored_edges + 1, bbg_file, 4);
  
!       FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
  	{
  	  edge e;
  	  long count = 0;
  
*************** find_spanning_tree (el)
*** 1088,1099 ****
  {
    int i;
    int num_edges = NUM_EDGES (el);
  
    /* We use aux field for standard union-find algorithm.  */
!   EXIT_BLOCK_PTR->aux = EXIT_BLOCK_PTR;
!   ENTRY_BLOCK_PTR->aux = ENTRY_BLOCK_PTR;
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->aux = BASIC_BLOCK (i);
  
    /* Add fake edge exit to entry we can't instrument.  */
    union_groups (EXIT_BLOCK_PTR, ENTRY_BLOCK_PTR);
--- 1075,1085 ----
  {
    int i;
    int num_edges = NUM_EDGES (el);
+   basic_block bb;
  
    /* We use aux field for standard union-find algorithm.  */
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->aux = bb;
  
    /* Add fake edge exit to entry we can't instrument.  */
    union_groups (EXIT_BLOCK_PTR, ENTRY_BLOCK_PTR);
*************** find_spanning_tree (el)
*** 1149,1158 ****
  	}
      }
  
!   EXIT_BLOCK_PTR->aux = NULL;
!   ENTRY_BLOCK_PTR->aux = NULL;
!   for (i = 0; i < n_basic_blocks; i++)
!     BASIC_BLOCK (i)->aux = NULL;
  }
  \f
  /* Perform file-level initialization for branch-prob processing.  */
--- 1135,1142 ----
  	}
      }
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     bb->aux = NULL;
  }
  \f
  /* Perform file-level initialization for branch-prob processing.  */
Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.154
diff -c -3 -p -r1.154 recog.c
*** recog.c	17 May 2002 02:31:48 -0000	1.154
--- recog.c	22 May 2002 17:04:34 -0000
*************** split_all_insns (upd_life)
*** 2727,2741 ****
  {
    sbitmap blocks;
    int changed;
!   int i;
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
    changed = 0;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn, next;
        bool finish = false;
  
--- 2727,2740 ----
  {
    sbitmap blocks;
    int changed;
!   basic_block bb;
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
    changed = 0;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx insn, next;
        bool finish = false;
  
*************** split_all_insns (upd_life)
*** 2756,2762 ****
  
  	      while (GET_CODE (last) == BARRIER)
  		last = PREV_INSN (last);
! 	      SET_BIT (blocks, i);
  	      changed = 1;
  	      insn = last;
  	    }
--- 2755,2761 ----
  
  	      while (GET_CODE (last) == BARRIER)
  		last = PREV_INSN (last);
! 	      SET_BIT (blocks, bb->index);
  	      changed = 1;
  	      insn = last;
  	    }
*************** peephole2_optimize (dump_file)
*** 2999,3005 ****
    regset_head rs_heads[MAX_INSNS_PER_PEEP2 + 2];
    rtx insn, prev;
    regset live;
!   int i, b;
  #ifdef HAVE_conditional_execution
    sbitmap blocks;
    bool changed;
--- 2998,3005 ----
    regset_head rs_heads[MAX_INSNS_PER_PEEP2 + 2];
    rtx insn, prev;
    regset live;
!   int i;
!   basic_block bb;
  #ifdef HAVE_conditional_execution
    sbitmap blocks;
    bool changed;
*************** peephole2_optimize (dump_file)
*** 3020,3028 ****
    count_or_remove_death_notes (NULL, 1);
  #endif
  
!   for (b = n_basic_blocks - 1; b >= 0; --b)
      {
-       basic_block bb = BASIC_BLOCK (b);
        struct propagate_block_info *pbi;
  
        /* Indicate that all slots except the last holds invalid data.  */
--- 3020,3027 ----
    count_or_remove_death_notes (NULL, 1);
  #endif
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        struct propagate_block_info *pbi;
  
        /* Indicate that all slots except the last holds invalid data.  */
*************** peephole2_optimize (dump_file)
*** 3201,3207 ****
  		     death data structures are not so self-contained.
  		     So record that we've made a modification to this
  		     block and update life information at the end.  */
! 		  SET_BIT (blocks, b);
  		  changed = true;
  
  		  for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
--- 3200,3206 ----
  		     death data structures are not so self-contained.
  		     So record that we've made a modification to this
  		     block and update life information at the end.  */
! 		  SET_BIT (blocks, bb->index);
  		  changed = true;
  
  		  for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i)
Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reg-stack.c,v
retrieving revision 1.107
diff -c -3 -p -r1.107 reg-stack.c
*** reg-stack.c	21 May 2002 19:57:39 -0000	1.107
--- reg-stack.c	22 May 2002 17:04:35 -0000
*************** reg_to_stack (first, file)
*** 418,423 ****
--- 418,424 ----
       rtx first;
       FILE *file;
  {
+   basic_block bb;
    int i;
    int max_uid;
  
*************** reg_to_stack (first, file)
*** 451,460 ****
  
    /* Set up block info for each basic block.  */
    alloc_aux_for_blocks (sizeof (struct block_info_def));
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
        edge e;
-       basic_block bb = BASIC_BLOCK (i);
        for (e = bb->pred; e; e=e->pred_next)
  	if (!(e->flags & EDGE_DFS_BACK)
  	    && e->src != ENTRY_BLOCK_PTR)
--- 452,460 ----
  
    /* Set up block info for each basic block.  */
    alloc_aux_for_blocks (sizeof (struct block_info_def));
!   FOR_EACH_BB_REVERSE (bb)
      {
        edge e;
        for (e = bb->pred; e; e=e->pred_next)
  	if (!(e->flags & EDGE_DFS_BACK)
  	    && e->src != ENTRY_BLOCK_PTR)
*************** print_stack (file, s)
*** 2380,2391 ****
  static int
  convert_regs_entry ()
  {
!   int inserted = 0, i;
    edge e;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block block = BASIC_BLOCK (i);
        block_info bi = BLOCK_INFO (block);
        int reg;
  
--- 2380,2391 ----
  static int
  convert_regs_entry ()
  {
!   int inserted = 0;
    edge e;
+   basic_block block;
  
!   FOR_EACH_BB_REVERSE (block)
      {
        block_info bi = BLOCK_INFO (block);
        int reg;
  
*************** static int
*** 2813,2819 ****
  convert_regs (file)
       FILE *file;
  {
!   int inserted, i;
    edge e;
  
    /* Initialize uninitialized registers on function entry.  */
--- 2813,2820 ----
  convert_regs (file)
       FILE *file;
  {
!   int inserted;
!   basic_block b;
    edge e;
  
    /* Initialize uninitialized registers on function entry.  */
*************** convert_regs (file)
*** 2833,2841 ****
  
    /* ??? Process all unreachable blocks.  Though there's no excuse
       for keeping these even when not optimizing.  */
!   for (i = 0; i < n_basic_blocks; ++i)
      {
-       basic_block b = BASIC_BLOCK (i);
        block_info bi = BLOCK_INFO (b);
  
        if (! bi->done)
--- 2834,2841 ----
  
    /* ??? Process all unreachable blocks.  Though there's no excuse
       for keeping these even when not optimizing.  */
!   FOR_EACH_BB (b)
      {
        block_info bi = BLOCK_INFO (b);
  
        if (! bi->done)
Index: regclass.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regclass.c,v
retrieving revision 1.148
diff -c -3 -p -r1.148 regclass.c
*** regclass.c	17 May 2002 02:31:50 -0000	1.148
--- regclass.c	22 May 2002 17:04:35 -0000
*************** scan_one_insn (insn, pass)
*** 1127,1136 ****
  	 INSN could not be at the beginning of that block.  */
        if (previnsn == 0 || GET_CODE (previnsn) == JUMP_INSN)
  	{
! 	  int b;
! 	  for (b = 0; b < n_basic_blocks; b++)
! 	    if (insn == BLOCK_HEAD (b))
! 	      BLOCK_HEAD (b) = newinsn;
  	}
  
        /* This makes one more setting of new insns's dest.  */
--- 1127,1136 ----
  	 INSN could not be at the beginning of that block.  */
        if (previnsn == 0 || GET_CODE (previnsn) == JUMP_INSN)
  	{
! 	  basic_block b;
! 	  FOR_EACH_BB (b)
! 	    if (insn == b->head)
! 	      b->head = newinsn;
  	}
  
        /* This makes one more setting of new insns's dest.  */
*************** regclass (f, nregs, dump)
*** 1255,1261 ****
  
    for (pass = 0; pass <= flag_expensive_optimizations; pass++)
      {
!       int index;
  
        if (dump)
  	fprintf (dump, "\n\nPass %i\n\n",pass);
--- 1255,1261 ----
  
    for (pass = 0; pass <= flag_expensive_optimizations; pass++)
      {
!       basic_block bb;
  
        if (dump)
  	fprintf (dump, "\n\nPass %i\n\n",pass);
*************** regclass (f, nregs, dump)
*** 1277,1286 ****
  	    insn = scan_one_insn (insn, pass);
  	}
        else
! 	for (index = 0; index < n_basic_blocks; index++)
  	  {
- 	    basic_block bb = BASIC_BLOCK (index);
- 
  	    /* Show that an insn inside a loop is likely to be executed three
  	       times more than insns outside a loop.  This is much more
  	       aggressive than the assumptions made elsewhere and is being
--- 1277,1284 ----
  	    insn = scan_one_insn (insn, pass);
  	}
        else
! 	FOR_EACH_BB (bb)
  	  {
  	    /* Show that an insn inside a loop is likely to be executed three
  	       times more than insns outside a loop.  This is much more
  	       aggressive than the assumptions made elsewhere and is being
Index: regmove.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regmove.c,v
retrieving revision 1.129
diff -c -3 -p -r1.129 regmove.c
*** regmove.c	21 May 2002 20:37:42 -0000	1.129
--- regmove.c	22 May 2002 17:04:35 -0000
*************** mark_flags_life_zones (flags)
*** 223,229 ****
  {
    int flags_regno;
    int flags_nregs;
!   int block;
  
  #ifdef HAVE_cc0
    /* If we found a flags register on a cc0 host, bail.  */
--- 223,229 ----
  {
    int flags_regno;
    int flags_nregs;
!   basic_block block;
  
  #ifdef HAVE_cc0
    /* If we found a flags register on a cc0 host, bail.  */
*************** mark_flags_life_zones (flags)
*** 254,266 ****
    flags_set_1_rtx = flags;
  
    /* Process each basic block.  */
!   for (block = n_basic_blocks - 1; block >= 0; block--)
      {
        rtx insn, end;
        int live;
  
!       insn = BLOCK_HEAD (block);
!       end = BLOCK_END (block);
  
        /* Look out for the (unlikely) case of flags being live across
  	 basic block boundaries.  */
--- 254,266 ----
    flags_set_1_rtx = flags;
  
    /* Process each basic block.  */
!   FOR_EACH_BB_REVERSE (block)
      {
        rtx insn, end;
        int live;
  
!       insn = block->head;
!       end = block->end;
  
        /* Look out for the (unlikely) case of flags being live across
  	 basic block boundaries.  */
*************** mark_flags_life_zones (flags)
*** 269,275 ****
        {
  	int i;
  	for (i = 0; i < flags_nregs; ++i)
! 	  live |= REGNO_REG_SET_P (BASIC_BLOCK (block)->global_live_at_start,
  				   flags_regno + i);
        }
  #endif
--- 269,275 ----
        {
  	int i;
  	for (i = 0; i < flags_nregs; ++i)
! 	  live |= REGNO_REG_SET_P (block->global_live_at_start,
  				   flags_regno + i);
        }
  #endif
*************** regmove_optimize (f, nregs, regmove_dump
*** 1061,1066 ****
--- 1061,1067 ----
    int pass;
    int i;
    rtx copy_src, copy_dst;
+   basic_block bb;
  
    /* ??? Hack.  Regmove doesn't examine the CFG, and gets mightily
       confused by non-call exceptions ending blocks.  */
*************** regmove_optimize (f, nregs, regmove_dump
*** 1076,1083 ****
  
    regmove_bb_head = (int *) xmalloc (sizeof (int) * (old_max_uid + 1));
    for (i = old_max_uid; i >= 0; i--) regmove_bb_head[i] = -1;
!   for (i = 0; i < n_basic_blocks; i++)
!     regmove_bb_head[INSN_UID (BLOCK_HEAD (i))] = i;
  
    /* A forward/backward pass.  Replace output operands with input operands.  */
  
--- 1077,1084 ----
  
    regmove_bb_head = (int *) xmalloc (sizeof (int) * (old_max_uid + 1));
    for (i = old_max_uid; i >= 0; i--) regmove_bb_head[i] = -1;
!   FOR_EACH_BB (bb)
!     regmove_bb_head[INSN_UID (bb->head)] = bb->index;
  
    /* A forward/backward pass.  Replace output operands with input operands.  */
  
*************** regmove_optimize (f, nregs, regmove_dump
*** 1504,1512 ****
  
    /* In fixup_match_1, some insns may have been inserted after basic block
       ends.  Fix that here.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx end = bb->end;
        rtx new = end;
        rtx next = NEXT_INSN (new);
--- 1505,1512 ----
  
    /* In fixup_match_1, some insns may have been inserted after basic block
       ends.  Fix that here.  */
!   FOR_EACH_BB (bb)
      {
        rtx end = bb->end;
        rtx new = end;
        rtx next = NEXT_INSN (new);
*************** static int record_stack_memrefs	PARAMS (
*** 2139,2148 ****
  void
  combine_stack_adjustments ()
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; ++i)
!     combine_stack_adjustments_for_block (BASIC_BLOCK (i));
  }
  
  /* Recognize a MEM of the form (sp) or (plus sp const).  */
--- 2139,2148 ----
  void
  combine_stack_adjustments ()
  {
!   basic_block bb;
  
!   FOR_EACH_BB (bb)
!     combine_stack_adjustments_for_block (bb);
  }
  
  /* Recognize a MEM of the form (sp) or (plus sp const).  */
Index: regrename.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regrename.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 regrename.c
*** regrename.c	17 May 2002 02:31:53 -0000	1.51
--- regrename.c	22 May 2002 17:04:35 -0000
*************** regrename_optimize ()
*** 201,207 ****
  {
    int tick[FIRST_PSEUDO_REGISTER];
    int this_tick = 0;
!   int b;
    char *first_obj;
  
    memset (tick, 0, sizeof tick);
--- 201,207 ----
  {
    int tick[FIRST_PSEUDO_REGISTER];
    int this_tick = 0;
!   basic_block bb;
    char *first_obj;
  
    memset (tick, 0, sizeof tick);
*************** regrename_optimize ()
*** 209,217 ****
    gcc_obstack_init (&rename_obstack);
    first_obj = (char *) obstack_alloc (&rename_obstack, 0);
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
-       basic_block bb = BASIC_BLOCK (b);
        struct du_chain *all_chains = 0;
        HARD_REG_SET unavailable;
        HARD_REG_SET regs_seen;
--- 209,216 ----
    gcc_obstack_init (&rename_obstack);
    first_obj = (char *) obstack_alloc (&rename_obstack, 0);
  
!   FOR_EACH_BB (bb)
      {
        struct du_chain *all_chains = 0;
        HARD_REG_SET unavailable;
        HARD_REG_SET regs_seen;
*************** regrename_optimize ()
*** 219,225 ****
        CLEAR_HARD_REG_SET (unavailable);
  
        if (rtl_dump_file)
! 	fprintf (rtl_dump_file, "\nBasic block %d:\n", b);
  
        all_chains = build_def_use (bb);
  
--- 218,224 ----
        CLEAR_HARD_REG_SET (unavailable);
  
        if (rtl_dump_file)
! 	fprintf (rtl_dump_file, "\nBasic block %d:\n", bb->index);
  
        all_chains = build_def_use (bb);
  
*************** copyprop_hardreg_forward ()
*** 1726,1755 ****
  {
    struct value_data *all_vd;
    bool need_refresh;
!   int b;
  
    need_refresh = false;
  
    all_vd = xmalloc (sizeof (struct value_data) * n_basic_blocks);
  
!   for (b = 0; b < n_basic_blocks; b++)
      {
-       basic_block bb = BASIC_BLOCK (b);
- 
        /* If a block has a single predecessor, that we've already
  	 processed, begin with the value data that was live at
  	 the end of the predecessor block.  */
        /* ??? Ought to use more intelligent queueing of blocks.  */
        if (bb->pred
  	  && ! bb->pred->pred_next
  	  && ! (bb->pred->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
! 	  && bb->pred->src->index != ENTRY_BLOCK
! 	  && bb->pred->src->index < b)
! 	all_vd[b] = all_vd[bb->pred->src->index];
        else
! 	init_value_data (all_vd + b);
  
!       if (copyprop_hardreg_forward_1 (bb, all_vd + b))
  	need_refresh = true;
      }
  
--- 1725,1754 ----
  {
    struct value_data *all_vd;
    bool need_refresh;
!   basic_block bb, bbp;
  
    need_refresh = false;
  
    all_vd = xmalloc (sizeof (struct value_data) * n_basic_blocks);
  
!   FOR_EACH_BB (bb)
      {
        /* If a block has a single predecessor, that we've already
  	 processed, begin with the value data that was live at
  	 the end of the predecessor block.  */
        /* ??? Ought to use more intelligent queueing of blocks.  */
+       if (bb->pred)
+ 	for (bbp = bb; bbp && bbp != bb->pred->src; bbp = bbp->prev_bb);
        if (bb->pred
  	  && ! bb->pred->pred_next
  	  && ! (bb->pred->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
! 	  && bb->pred->src != ENTRY_BLOCK_PTR
! 	  && bbp)
! 	all_vd[bb->index] = all_vd[bb->pred->src->index];
        else
! 	init_value_data (all_vd + bb->index);
  
!       if (copyprop_hardreg_forward_1 (bb, all_vd + bb->index))
  	need_refresh = true;
      }
  
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.340
diff -c -3 -p -r1.340 reload1.c
*** reload1.c	21 May 2002 22:40:53 -0000	1.340
--- reload1.c	22 May 2002 17:04:37 -0000
*************** reload (first, global)
*** 676,681 ****
--- 676,682 ----
    int i;
    rtx insn;
    struct elim_table *ep;
+   basic_block bb;
  
    /* The two pointers used to track the true location of the memory used
       for label offsets.  */
*************** reload (first, global)
*** 1123,1130 ****
       pseudo.  */
  
    if (! frame_pointer_needed)
!     for (i = 0; i < n_basic_blocks; i++)
!       CLEAR_REGNO_REG_SET (BASIC_BLOCK (i)->global_live_at_start,
  			   HARD_FRAME_POINTER_REGNUM);
  
    /* Come here (with failure set nonzero) if we can't get enough spill regs
--- 1124,1131 ----
       pseudo.  */
  
    if (! frame_pointer_needed)
!     FOR_EACH_BB (bb)
!       CLEAR_REGNO_REG_SET (bb->global_live_at_start,
  			   HARD_FRAME_POINTER_REGNUM);
  
    /* Come here (with failure set nonzero) if we can't get enough spill regs
*************** reload_combine ()
*** 8613,8618 ****
--- 8614,8620 ----
    int first_index_reg = -1;
    int last_index_reg = 0;
    int i;
+   basic_block bb;
    unsigned int r;
    int last_label_ruid;
    int min_labelno, n_labels;
*************** reload_combine ()
*** 8648,8664 ****
    label_live = (HARD_REG_SET *) xmalloc (n_labels * sizeof (HARD_REG_SET));
    CLEAR_HARD_REG_SET (ever_live_at_start);
  
!   for (i = n_basic_blocks - 1; i >= 0; i--)
      {
!       insn = BLOCK_HEAD (i);
        if (GET_CODE (insn) == CODE_LABEL)
  	{
  	  HARD_REG_SET live;
  
  	  REG_SET_TO_HARD_REG_SET (live,
! 				   BASIC_BLOCK (i)->global_live_at_start);
  	  compute_use_by_pseudos (&live,
! 				  BASIC_BLOCK (i)->global_live_at_start);
  	  COPY_HARD_REG_SET (LABEL_LIVE (insn), live);
  	  IOR_HARD_REG_SET (ever_live_at_start, live);
  	}
--- 8650,8666 ----
    label_live = (HARD_REG_SET *) xmalloc (n_labels * sizeof (HARD_REG_SET));
    CLEAR_HARD_REG_SET (ever_live_at_start);
  
!   FOR_EACH_BB_REVERSE (bb)
      {
!       insn = bb->head;
        if (GET_CODE (insn) == CODE_LABEL)
  	{
  	  HARD_REG_SET live;
  
  	  REG_SET_TO_HARD_REG_SET (live,
! 				   bb->global_live_at_start);
  	  compute_use_by_pseudos (&live,
! 				  bb->global_live_at_start);
  	  COPY_HARD_REG_SET (LABEL_LIVE (insn), live);
  	  IOR_HARD_REG_SET (ever_live_at_start, live);
  	}
*************** copy_eh_notes (insn, x)
*** 9489,9500 ****
  void
  fixup_abnormal_edges ()
  {
-   int i;
    bool inserted = false;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        edge e;
  
        /* Look for cases we are interested in - an calls or instructions causing
--- 9491,9501 ----
  void
  fixup_abnormal_edges ()
  {
    bool inserted = false;
+   basic_block bb;
  
!   FOR_EACH_BB (bb)
      {
        edge e;
  
        /* Look for cases we are interested in - an calls or instructions causing
Index: resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/resource.c,v
retrieving revision 1.56
diff -c -3 -p -r1.56 resource.c
*** resource.c	21 May 2002 20:37:43 -0000	1.56
--- resource.c	22 May 2002 17:04:37 -0000
*************** find_basic_block (insn, search_limit)
*** 133,139 ****
       rtx insn;
       int search_limit;
  {
!   int i;
  
    /* Scan backwards to the previous BARRIER.  Then see if we can find a
       label that starts a basic block.  Return the basic block number.  */
--- 133,139 ----
       rtx insn;
       int search_limit;
  {
!   basic_block bb;
  
    /* Scan backwards to the previous BARRIER.  Then see if we can find a
       label that starts a basic block.  Return the basic block number.  */
*************** find_basic_block (insn, search_limit)
*** 156,164 ****
         insn && GET_CODE (insn) == CODE_LABEL;
         insn = next_nonnote_insn (insn))
      {
!       for (i = 0; i < n_basic_blocks; i++)
! 	if (insn == BLOCK_HEAD (i))
! 	  return i;
      }
  
    return -1;
--- 156,164 ----
         insn && GET_CODE (insn) == CODE_LABEL;
         insn = next_nonnote_insn (insn))
      {
!       FOR_EACH_BB (bb)
! 	if (insn == bb->head)
! 	  return bb->index;
      }
  
    return -1;
Index: sched-ebb.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-ebb.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 sched-ebb.c
*** sched-ebb.c	21 May 2002 20:37:43 -0000	1.13
--- sched-ebb.c	22 May 2002 17:04:37 -0000
*************** void
*** 279,285 ****
  schedule_ebbs (dump_file)
       FILE *dump_file;
  {
!   int i;
  
    /* Taking care of this degenerate case makes the rest of
       this code simpler.  */
--- 279,285 ----
  schedule_ebbs (dump_file)
       FILE *dump_file;
  {
!   basic_block bb;
  
    /* Taking care of this degenerate case makes the rest of
       this code simpler.  */
*************** schedule_ebbs (dump_file)
*** 296,315 ****
    compute_bb_for_insn (get_max_uid ());
  
    /* Schedule every region in the subroutine.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       rtx head = BASIC_BLOCK (i)->head;
        rtx tail;
  
        for (;;)
  	{
- 	  basic_block b = BASIC_BLOCK (i);
  	  edge e;
! 	  tail = b->end;
! 	  if (b->next_bb == EXIT_BLOCK_PTR
! 	      || GET_CODE (b->next_bb->head) == CODE_LABEL)
  	    break;
! 	  for (e = b->succ; e; e = e->succ_next)
  	    if ((e->flags & EDGE_FALLTHRU) != 0)
  	      break;
  	  if (! e)
--- 296,314 ----
    compute_bb_for_insn (get_max_uid ());
  
    /* Schedule every region in the subroutine.  */
!   FOR_EACH_BB (bb)
      {
!       rtx head = bb->head;
        rtx tail;
  
        for (;;)
  	{
  	  edge e;
! 	  tail = bb->end;
! 	  if (bb->next_bb == EXIT_BLOCK_PTR
! 	      || GET_CODE (bb->next_bb->head) == CODE_LABEL)
  	    break;
! 	  for (e = bb->succ; e; e = e->succ_next)
  	    if ((e->flags & EDGE_FALLTHRU) != 0)
  	      break;
  	  if (! e)
*************** schedule_ebbs (dump_file)
*** 325,331 ****
  		}
  	    }
  
! 	  i++;
  	}
  
        /* Blah.  We should fix the rest of the code not to get confused by
--- 324,330 ----
  		}
  	    }
  
! 	  bb = bb->next_bb;
  	}
  
        /* Blah.  We should fix the rest of the code not to get confused by
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 sched-rgn.c
*** sched-rgn.c	17 May 2002 02:31:55 -0000	1.40
--- sched-rgn.c	22 May 2002 17:04:38 -0000
*************** static void free_pending_lists PARAMS ((
*** 319,325 ****
  static int
  is_cfg_nonregular ()
  {
!   int b;
    rtx insn;
    RTX_CODE code;
  
--- 319,325 ----
  static int
  is_cfg_nonregular ()
  {
!   basic_block b;
    rtx insn;
    RTX_CODE code;
  
*************** is_cfg_nonregular ()
*** 346,353 ****
    /* If we have non-jumping insns which refer to labels, then we consider
       the cfg not well structured.  */
    /* Check for labels referred to other thn by jumps.  */
!   for (b = 0; b < n_basic_blocks; b++)
!     for (insn = BLOCK_HEAD (b);; insn = NEXT_INSN (insn))
        {
  	code = GET_CODE (insn);
  	if (GET_RTX_CLASS (code) == 'i' && code != JUMP_INSN)
--- 346,353 ----
    /* If we have non-jumping insns which refer to labels, then we consider
       the cfg not well structured.  */
    /* Check for labels referred to other thn by jumps.  */
!   FOR_EACH_BB (b)
!     for (insn = b->head;; insn = NEXT_INSN (insn))
        {
  	code = GET_CODE (insn);
  	if (GET_RTX_CLASS (code) == 'i' && code != JUMP_INSN)
*************** is_cfg_nonregular ()
*** 361,367 ****
  	      return 1;
  	  }
  
! 	if (insn == BLOCK_END (b))
  	  break;
        }
  
--- 361,367 ----
  	      return 1;
  	  }
  
! 	if (insn == b->end)
  	  break;
        }
  
*************** build_control_flow (edge_list)
*** 382,387 ****
--- 382,388 ----
       struct edge_list *edge_list;
  {
    int i, unreachable, num_edges;
+   basic_block b;
  
    /* This already accounts for entry/exit edges.  */
    num_edges = NUM_EDGES (edge_list);
*************** build_control_flow (edge_list)
*** 393,402 ****
       test is redundant with the one in find_rgns, but it's much
      cheaper to go ahead and catch the trivial case here.  */
    unreachable = 0;
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block b = BASIC_BLOCK (i);
- 
        if (b->pred == NULL
  	  || (b->pred->src == b
  	      && b->pred->pred_next == NULL))
--- 394,401 ----
       test is redundant with the one in find_rgns, but it's much
      cheaper to go ahead and catch the trivial case here.  */
    unreachable = 0;
!   FOR_EACH_BB (b)
      {
        if (b->pred == NULL
  	  || (b->pred->src == b
  	      && b->pred->pred_next == NULL))
*************** debug_regions ()
*** 544,560 ****
  static void
  find_single_block_region ()
  {
!   int i;
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
!       rgn_bb_table[i] = i;
!       RGN_NR_BLOCKS (i) = 1;
!       RGN_BLOCKS (i) = i;
!       CONTAINING_RGN (i) = i;
!       BLOCK_TO_BB (i) = 0;
      }
-   nr_regions = n_basic_blocks;
  }
  
  /* Update number of blocks and the estimate for number of insns
--- 543,561 ----
  static void
  find_single_block_region ()
  {
!   basic_block bb;
  
!   nr_regions = 0;
! 
!   FOR_EACH_BB (bb)
      {
!       rgn_bb_table[nr_regions] = bb->index;
!       RGN_NR_BLOCKS (nr_regions) = 1;
!       RGN_BLOCKS (nr_regions) = nr_regions;
!       CONTAINING_RGN (bb->index) = nr_regions;
!       BLOCK_TO_BB (bb->index) = 0;
!       nr_regions++;
      }
  }
  
  /* Update number of blocks and the estimate for number of insns
*************** find_rgns (edge_list, dom)
*** 631,636 ****
--- 632,638 ----
    int count = 0, sp, idx = 0, current_edge = out_edges[0];
    int num_bbs, num_insns, unreachable;
    int too_large_failure;
+   basic_block bb;
  
    /* Note if an edge has been passed.  */
    sbitmap passed;
*************** find_rgns (edge_list, dom)
*** 772,779 ****
       the entry node by placing a nonzero value in dfs_nr.  Thus if
       dfs_nr is zero for any block, then it must be unreachable.  */
    unreachable = 0;
!   for (i = 0; i < n_basic_blocks; i++)
!     if (dfs_nr[i] == 0)
        {
  	unreachable = 1;
  	break;
--- 774,781 ----
       the entry node by placing a nonzero value in dfs_nr.  Thus if
       dfs_nr is zero for any block, then it must be unreachable.  */
    unreachable = 0;
!   FOR_EACH_BB (bb)
!     if (dfs_nr[bb->index] == 0)
        {
  	unreachable = 1;
  	break;
*************** find_rgns (edge_list, dom)
*** 783,790 ****
       to hold degree counts.  */
    degree = dfs_nr;
  
!   for (i = 0; i < n_basic_blocks; i++)
!     degree[i] = 0;
    for (i = 0; i < num_edges; i++)
      {
        edge e = INDEX_EDGE (edge_list, i);
--- 785,792 ----
       to hold degree counts.  */
    degree = dfs_nr;
  
!   FOR_EACH_BB (bb)
!     degree[bb->index] = 0;
    for (i = 0; i < num_edges; i++)
      {
        edge e = INDEX_EDGE (edge_list, i);
*************** find_rgns (edge_list, dom)
*** 809,820 ****
  
        /* Find blocks which are inner loop headers.  We still have non-reducible
  	 loops to consider at this point.  */
!       for (i = 0; i < n_basic_blocks; i++)
  	{
! 	  if (TEST_BIT (header, i) && TEST_BIT (inner, i))
  	    {
  	      edge e;
! 	      int j;
  
  	      /* Now check that the loop is reducible.  We do this separate
  		 from finding inner loops so that we do not find a reducible
--- 811,822 ----
  
        /* Find blocks which are inner loop headers.  We still have non-reducible
  	 loops to consider at this point.  */
!       FOR_EACH_BB (bb)
  	{
! 	  if (TEST_BIT (header, bb->index) && TEST_BIT (inner, bb->index))
  	    {
  	      edge e;
! 	      basic_block jbb;
  
  	      /* Now check that the loop is reducible.  We do this separate
  		 from finding inner loops so that we do not find a reducible
*************** find_rgns (edge_list, dom)
*** 827,841 ****
  		 If there exists a block that is not dominated by the loop
  		 header, then the block is reachable from outside the loop
  		 and thus the loop is not a natural loop.  */
! 	      for (j = 0; j < n_basic_blocks; j++)
  		{
  		  /* First identify blocks in the loop, except for the loop
  		     entry block.  */
! 		  if (i == max_hdr[j] && i != j)
  		    {
  		      /* Now verify that the block is dominated by the loop
  			 header.  */
! 		      if (!TEST_BIT (dom[j], i))
  			break;
  		    }
  		}
--- 829,843 ----
  		 If there exists a block that is not dominated by the loop
  		 header, then the block is reachable from outside the loop
  		 and thus the loop is not a natural loop.  */
! 	      FOR_EACH_BB (jbb)
  		{
  		  /* First identify blocks in the loop, except for the loop
  		     entry block.  */
! 		  if (bb->index == max_hdr[jbb->index] && bb != jbb)
  		    {
  		      /* Now verify that the block is dominated by the loop
  			 header.  */
! 		      if (!TEST_BIT (dom[jbb->index], bb->index))
  			break;
  		    }
  		}
*************** find_rgns (edge_list, dom)
*** 843,867 ****
  	      /* If we exited the loop early, then I is the header of
  		 a non-reducible loop and we should quit processing it
  		 now.  */
! 	      if (j != n_basic_blocks)
  		continue;
  
  	      /* I is a header of an inner loop, or block 0 in a subroutine
  		 with no loops at all.  */
  	      head = tail = -1;
  	      too_large_failure = 0;
! 	      loop_head = max_hdr[i];
  
  	      /* Decrease degree of all I's successors for topological
  		 ordering.  */
! 	      for (e = BASIC_BLOCK (i)->succ; e; e = e->succ_next)
  		if (e->dest != EXIT_BLOCK_PTR)
  		  --degree[e->dest->index];
  
  	      /* Estimate # insns, and count # blocks in the region.  */
  	      num_bbs = 1;
! 	      num_insns = (INSN_LUID (BLOCK_END (i))
! 			   - INSN_LUID (BLOCK_HEAD (i)));
  
  	      /* Find all loop latches (blocks with back edges to the loop
  		 header) or all the leaf blocks in the cfg has no loops.
--- 845,869 ----
  	      /* If we exited the loop early, then I is the header of
  		 a non-reducible loop and we should quit processing it
  		 now.  */
! 	      if (jbb != EXIT_BLOCK_PTR)
  		continue;
  
  	      /* I is a header of an inner loop, or block 0 in a subroutine
  		 with no loops at all.  */
  	      head = tail = -1;
  	      too_large_failure = 0;
! 	      loop_head = max_hdr[bb->index];
  
  	      /* Decrease degree of all I's successors for topological
  		 ordering.  */
! 	      for (e = bb->succ; e; e = e->succ_next)
  		if (e->dest != EXIT_BLOCK_PTR)
  		  --degree[e->dest->index];
  
  	      /* Estimate # insns, and count # blocks in the region.  */
  	      num_bbs = 1;
! 	      num_insns = (INSN_LUID (bb->end)
! 			   - INSN_LUID (bb->head));
  
  	      /* Find all loop latches (blocks with back edges to the loop
  		 header) or all the leaf blocks in the cfg has no loops.
*************** find_rgns (edge_list, dom)
*** 869,885 ****
  		 Place those blocks into the queue.  */
  	      if (no_loops)
  		{
! 		  for (j = 0; j < n_basic_blocks; j++)
  		    /* Leaf nodes have only a single successor which must
  		       be EXIT_BLOCK.  */
! 		    if (BASIC_BLOCK (j)->succ
! 			&& BASIC_BLOCK (j)->succ->dest == EXIT_BLOCK_PTR
! 			&& BASIC_BLOCK (j)->succ->succ_next == NULL)
  		      {
! 			queue[++tail] = j;
! 			SET_BIT (in_queue, j);
  
! 			if (too_large (j, &num_bbs, &num_insns))
  			  {
  			    too_large_failure = 1;
  			    break;
--- 871,887 ----
  		 Place those blocks into the queue.  */
  	      if (no_loops)
  		{
! 		  FOR_EACH_BB (jbb)
  		    /* Leaf nodes have only a single successor which must
  		       be EXIT_BLOCK.  */
! 		    if (jbb->succ
! 			&& jbb->succ->dest == EXIT_BLOCK_PTR
! 			&& jbb->succ->succ_next == NULL)
  		      {
! 			queue[++tail] = jbb->index;
! 			SET_BIT (in_queue, jbb->index);
  
! 			if (too_large (jbb->index, &num_bbs, &num_insns))
  			  {
  			    too_large_failure = 1;
  			    break;
*************** find_rgns (edge_list, dom)
*** 890,903 ****
  		{
  		  edge e;
  
! 		  for (e = BASIC_BLOCK (i)->pred; e; e = e->pred_next)
  		    {
  		      if (e->src == ENTRY_BLOCK_PTR)
  			continue;
  
  		      node = e->src->index;
  
! 		      if (max_hdr[node] == loop_head && node != i)
  			{
  			  /* This is a loop latch.  */
  			  queue[++tail] = node;
--- 892,905 ----
  		{
  		  edge e;
  
! 		  for (e = bb->pred; e; e = e->pred_next)
  		    {
  		      if (e->src == ENTRY_BLOCK_PTR)
  			continue;
  
  		      node = e->src->index;
  
! 		      if (max_hdr[node] == loop_head && node != bb->index)
  			{
  			  /* This is a loop latch.  */
  			  queue[++tail] = node;
*************** find_rgns (edge_list, dom)
*** 959,965 ****
  			  tail = -1;
  			  break;
  			}
! 		      else if (!TEST_BIT (in_queue, node) && node != i)
  			{
  			  queue[++tail] = node;
  			  SET_BIT (in_queue, node);
--- 961,967 ----
  			  tail = -1;
  			  break;
  			}
! 		      else if (!TEST_BIT (in_queue, node) && node != bb->index)
  			{
  			  queue[++tail] = node;
  			  SET_BIT (in_queue, node);
*************** find_rgns (edge_list, dom)
*** 976,987 ****
  	      if (tail >= 0 && !too_large_failure)
  		{
  		  /* Place the loop header into list of region blocks.  */
! 		  degree[i] = -1;
! 		  rgn_bb_table[idx] = i;
  		  RGN_NR_BLOCKS (nr_regions) = num_bbs;
  		  RGN_BLOCKS (nr_regions) = idx++;
! 		  CONTAINING_RGN (i) = nr_regions;
! 		  BLOCK_TO_BB (i) = count = 0;
  
  		  /* Remove blocks from queue[] when their in degree
  		     becomes zero.  Repeat until no blocks are left on the
--- 978,989 ----
  	      if (tail >= 0 && !too_large_failure)
  		{
  		  /* Place the loop header into list of region blocks.  */
! 		  degree[bb->index] = -1;
! 		  rgn_bb_table[idx] = bb->index;
  		  RGN_NR_BLOCKS (nr_regions) = num_bbs;
  		  RGN_BLOCKS (nr_regions) = idx++;
! 		  CONTAINING_RGN (bb->index) = nr_regions;
! 		  BLOCK_TO_BB (bb->index) = count = 0;
  
  		  /* Remove blocks from queue[] when their in degree
  		     becomes zero.  Repeat until no blocks are left on the
*************** find_rgns (edge_list, dom)
*** 1020,1033 ****
  
    /* Any block that did not end up in a region is placed into a region
       by itself.  */
!   for (i = 0; i < n_basic_blocks; i++)
!     if (degree[i] >= 0)
        {
! 	rgn_bb_table[idx] = i;
  	RGN_NR_BLOCKS (nr_regions) = 1;
  	RGN_BLOCKS (nr_regions) = idx++;
! 	CONTAINING_RGN (i) = nr_regions++;
! 	BLOCK_TO_BB (i) = 0;
        }
  
    free (max_hdr);
--- 1022,1035 ----
  
    /* Any block that did not end up in a region is placed into a region
       by itself.  */
!   FOR_EACH_BB (bb)
!     if (degree[bb->index] >= 0)
        {
! 	rgn_bb_table[idx] = bb->index;
  	RGN_NR_BLOCKS (nr_regions) = 1;
  	RGN_BLOCKS (nr_regions) = idx++;
! 	CONTAINING_RGN (bb->index) = nr_regions++;
! 	BLOCK_TO_BB (bb->index) = 0;
        }
  
    free (max_hdr);
*************** schedule_insns (dump_file)
*** 2980,2985 ****
--- 2982,2988 ----
    sbitmap large_region_blocks, blocks;
    int rgn;
    int any_large_regions;
+   basic_block bb;
  
    /* Taking care of this degenerate case makes the rest of
       this code simpler.  */
*************** schedule_insns (dump_file)
*** 3019,3025 ****
  
    any_large_regions = 0;
    large_region_blocks = sbitmap_alloc (n_basic_blocks);
!   sbitmap_ones (large_region_blocks);
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
--- 3022,3030 ----
  
    any_large_regions = 0;
    large_region_blocks = sbitmap_alloc (n_basic_blocks);
!   sbitmap_zero (large_region_blocks);
!   FOR_EACH_BB (bb)
!     SET_BIT (large_region_blocks, bb->index);
  
    blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
Index: sibcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sibcall.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 sibcall.c
*** sibcall.c	17 May 2002 02:31:55 -0000	1.36
--- sibcall.c	22 May 2002 17:04:38 -0000
*************** optimize_sibling_and_tail_recursive_call
*** 610,616 ****
  
        /* Walk forwards through the last normal block and see if it
  	 does nothing except fall into the exit block.  */
!       for (insn = BLOCK_HEAD (n_basic_blocks - 1);
  	   insn;
  	   insn = NEXT_INSN (insn))
  	{
--- 610,616 ----
  
        /* Walk forwards through the last normal block and see if it
  	 does nothing except fall into the exit block.  */
!       for (insn = EXIT_BLOCK_PTR->prev_bb->head;
  	   insn;
  	   insn = NEXT_INSN (insn))
  	{
Index: ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa-ccp.c,v
retrieving revision 1.21
diff -c -3 -p -r1.21 ssa-ccp.c
*** ssa-ccp.c	17 May 2002 02:31:55 -0000	1.21
--- ssa-ccp.c	22 May 2002 17:04:38 -0000
*************** optimize_unexecutable_edges (edges, exec
*** 740,745 ****
--- 740,746 ----
       sbitmap executable_edges;
  {
    int i;
+   basic_block bb;
  
    for (i = 0; i < NUM_EDGES (edges); i++)
      {
*************** optimize_unexecutable_edges (edges, exec
*** 797,805 ****
       In cases B & C we are removing uses of registers, so make sure
       to note those changes for the DF analyzer.  */
  
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn = bb->end;
        edge edge = bb->succ;
  
--- 798,805 ----
       In cases B & C we are removing uses of registers, so make sure
       to note those changes for the DF analyzer.  */
  
!   FOR_EACH_BB (bb)
      {
        rtx insn = bb->end;
        edge edge = bb->succ;
  
*************** ssa_ccp_substitute_constants ()
*** 929,935 ****
  static void
  ssa_ccp_df_delete_unreachable_insns ()
  {
!   int i;
  
    /* Use the CFG to find all the reachable blocks.  */
    find_unreachable_blocks ();
--- 929,935 ----
  static void
  ssa_ccp_df_delete_unreachable_insns ()
  {
!   basic_block b;
  
    /* Use the CFG to find all the reachable blocks.  */
    find_unreachable_blocks ();
*************** ssa_ccp_df_delete_unreachable_insns ()
*** 937,946 ****
    /* Now we know what blocks are not reachable.  Mark all the insns
       in those blocks as deleted for the DF analyzer.   We'll let the
       normal flow code actually remove the unreachable blocks.  */
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block b = BASIC_BLOCK (i);
- 
        if (!(b->flags & BB_REACHABLE))
  	{
  	  rtx start = b->head;
--- 937,944 ----
    /* Now we know what blocks are not reachable.  Mark all the insns
       in those blocks as deleted for the DF analyzer.   We'll let the
       normal flow code actually remove the unreachable blocks.  */
!   FOR_EACH_BB_REVERSE (b)
      {
        if (!(b->flags & BB_REACHABLE))
  	{
  	  rtx start = b->head;
Index: ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa-dce.c,v
retrieving revision 1.16
diff -c -3 -p -r1.16 ssa-dce.c
*** ssa-dce.c	21 May 2002 20:37:43 -0000	1.16
--- ssa-dce.c	22 May 2002 17:04:38 -0000
*************** ssa_eliminate_dead_code ()
*** 490,495 ****
--- 490,496 ----
  {
    int i;
    rtx insn;
+   basic_block bb;
    /* Necessary instructions with operands to explore.  */
    varray_type unprocessed_instructions;
    /* Map element (b,e) is nonzero if the block is control dependent on
*************** ssa_eliminate_dead_code ()
*** 718,727 ****
    /* Find any blocks with no successors and ensure they are followed
       by a BARRIER.  delete_insn has the nasty habit of deleting barriers
       when deleting insns.  */
!   for (i = 0; i < n_basic_blocks; i++)
      {
-       basic_block bb = BASIC_BLOCK (i);
- 
        if (bb->succ == NULL)
  	{
  	  rtx next = NEXT_INSN (bb->end);
--- 719,726 ----
    /* Find any blocks with no successors and ensure they are followed
       by a BARRIER.  delete_insn has the nasty habit of deleting barriers
       when deleting insns.  */
!   FOR_EACH_BB (bb)
      {
        if (bb->succ == NULL)
  	{
  	  rtx next = NEXT_INSN (bb->end);
Index: ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa.c,v
retrieving revision 1.47
diff -c -3 -p -r1.47 ssa.c
*** ssa.c	17 May 2002 02:31:56 -0000	1.47
--- ssa.c	22 May 2002 17:04:38 -0000
*************** find_evaluations (evals, nregs)
*** 470,487 ****
       sbitmap *evals;
       int nregs;
  {
!   int bb;
  
    sbitmap_vector_zero (evals, nregs);
    fe_evals = evals;
  
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
        rtx p, last;
  
!       fe_current_bb = bb;
!       p = BLOCK_HEAD (bb);
!       last = BLOCK_END (bb);
        while (1)
  	{
  	  if (INSN_P (p))
--- 470,487 ----
       sbitmap *evals;
       int nregs;
  {
!   basic_block bb;
  
    sbitmap_vector_zero (evals, nregs);
    fe_evals = evals;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx p, last;
  
!       fe_current_bb = bb->index;
!       p = bb->head;
!       last = bb->end;
        while (1)
  	{
  	  if (INSN_P (p))
*************** compute_dominance_frontiers_1 (frontiers
*** 520,526 ****
  {
    basic_block b = BASIC_BLOCK (bb);
    edge e;
!   int c;
  
    SET_BIT (done, bb);
    sbitmap_zero (frontiers[bb]);
--- 520,526 ----
  {
    basic_block b = BASIC_BLOCK (bb);
    edge e;
!   basic_block c;
  
    SET_BIT (done, bb);
    sbitmap_zero (frontiers[bb]);
*************** compute_dominance_frontiers_1 (frontiers
*** 528,536 ****
    /* Do the frontier of the children first.  Not all children in the
       dominator tree (blocks dominated by this one) are children in the
       CFG, so check all blocks.  */
!   for (c = 0; c < n_basic_blocks; ++c)
!     if (idom[c] == bb && ! TEST_BIT (done, c))
!       compute_dominance_frontiers_1 (frontiers, idom, c, done);
  
    /* Find blocks conforming to rule (1) above.  */
    for (e = b->succ; e; e = e->succ_next)
--- 528,536 ----
    /* Do the frontier of the children first.  Not all children in the
       dominator tree (blocks dominated by this one) are children in the
       CFG, so check all blocks.  */
!   FOR_EACH_BB (c)
!     if (idom[c->index] == bb && ! TEST_BIT (done, c->index))
!       compute_dominance_frontiers_1 (frontiers, idom, c->index, done);
  
    /* Find blocks conforming to rule (1) above.  */
    for (e = b->succ; e; e = e->succ_next)
*************** compute_dominance_frontiers_1 (frontiers
*** 542,552 ****
      }
  
    /* Find blocks conforming to rule (2).  */
!   for (c = 0; c < n_basic_blocks; ++c)
!     if (idom[c] == bb)
        {
  	int x;
! 	EXECUTE_IF_SET_IN_SBITMAP (frontiers[c], 0, x,
  	  {
  	    if (idom[x] != bb)
  	      SET_BIT (frontiers[bb], x);
--- 542,552 ----
      }
  
    /* Find blocks conforming to rule (2).  */
!   FOR_EACH_BB (c)
!     if (idom[c->index] == bb)
        {
  	int x;
! 	EXECUTE_IF_SET_IN_SBITMAP (frontiers[c->index], 0, x,
  	  {
  	    if (idom[x] != bb)
  	      SET_BIT (frontiers[bb], x);
*************** rename_block (bb, idom)
*** 975,981 ****
    edge e;
    rtx insn, next, last;
    struct rename_set_data *set_data = NULL;
!   int c;
  
    /* Step One: Walk the basic block, adding new names for sets and
       replacing uses.  */
--- 975,981 ----
    edge e;
    rtx insn, next, last;
    struct rename_set_data *set_data = NULL;
!   basic_block c;
  
    /* Step One: Walk the basic block, adding new names for sets and
       replacing uses.  */
*************** rename_block (bb, idom)
*** 1078,1086 ****
    /* Step Three: Do the same to the children of this block in
       dominator order.  */
  
!   for (c = 0; c < n_basic_blocks; ++c)
!     if (idom[c] == bb)
!       rename_block (c, idom);
  
    /* Step Four: Update the sets to refer to their new register,
       and restore ssa_rename_to to its previous state.  */
--- 1078,1086 ----
    /* Step Three: Do the same to the children of this block in
       dominator order.  */
  
!   FOR_EACH_BB (c)
!     if (idom[c->index] == bb)
!       rename_block (c->index, idom);
  
    /* Step Four: Update the sets to refer to their new register,
       and restore ssa_rename_to to its previous state.  */
*************** convert_to_ssa ()
*** 1140,1145 ****
--- 1140,1147 ----
  
    int nregs;
  
+   basic_block bb;
+ 
    /* Don't do it twice.  */
    if (in_ssa_form)
      abort ();
*************** convert_to_ssa ()
*** 1154,1163 ****
  
    if (rtl_dump_file)
      {
-       int i;
        fputs (";; Immediate Dominators:\n", rtl_dump_file);
!       for (i = 0; i < n_basic_blocks; ++i)
! 	fprintf (rtl_dump_file, ";\t%3d = %3d\n", i, idom[i]);
        fflush (rtl_dump_file);
      }
  
--- 1156,1164 ----
  
    if (rtl_dump_file)
      {
        fputs (";; Immediate Dominators:\n", rtl_dump_file);
!       FOR_EACH_BB (bb)
! 	fprintf (rtl_dump_file, ";\t%3d = %3d\n", bb->index, idom[bb->index]);
        fflush (rtl_dump_file);
      }
  
*************** make_equivalent_phi_alternatives_equival
*** 1629,1635 ****
  static partition
  compute_conservative_reg_partition ()
  {
!   int bb;
    int changed = 0;
  
    /* We don't actually work with hard registers, but it's easier to
--- 1630,1636 ----
  static partition
  compute_conservative_reg_partition ()
  {
!   basic_block bb;
    int changed = 0;
  
    /* We don't actually work with hard registers, but it's easier to
*************** compute_conservative_reg_partition ()
*** 1642,1649 ****
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges.  */
!   for (bb = n_basic_blocks; --bb >= 0; )
!     changed += make_regs_equivalent_over_bad_edges (bb, p);
  
    /* Now we have to insure that corresponding arguments of phi nodes
       assigning to corresponding regs are equivalent.  Iterate until
--- 1643,1650 ----
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges.  */
!   FOR_EACH_BB_REVERSE (bb)
!     changed += make_regs_equivalent_over_bad_edges (bb->index, p);
  
    /* Now we have to insure that corresponding arguments of phi nodes
       assigning to corresponding regs are equivalent.  Iterate until
*************** compute_conservative_reg_partition ()
*** 1651,1658 ****
    while (changed > 0)
      {
        changed = 0;
!       for (bb = n_basic_blocks; --bb >= 0; )
! 	changed += make_equivalent_phi_alternatives_equivalent (bb, p);
      }
  
    return p;
--- 1652,1659 ----
    while (changed > 0)
      {
        changed = 0;
!       FOR_EACH_BB_REVERSE (bb)
! 	changed += make_equivalent_phi_alternatives_equivalent (bb->index, p);
      }
  
    return p;
*************** coalesce_regs_in_successor_phi_nodes (bb
*** 1848,1854 ****
  static partition
  compute_coalesced_reg_partition ()
  {
!   int bb;
    int changed = 0;
    regset_head phi_set_head;
    regset phi_set = &phi_set_head;
--- 1849,1855 ----
  static partition
  compute_coalesced_reg_partition ()
  {
!   basic_block bb;
    int changed = 0;
    regset_head phi_set_head;
    regset phi_set = &phi_set_head;
*************** compute_coalesced_reg_partition ()
*** 1860,1867 ****
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges (which can't be done).  */
!   for (bb = n_basic_blocks; --bb >= 0; )
!     make_regs_equivalent_over_bad_edges (bb, p);
  
    INIT_REG_SET (phi_set);
  
--- 1861,1868 ----
       be copied on abnormal critical edges are placed in the same
       partition.  This saves us from having to split abnormal critical
       edges (which can't be done).  */
!   FOR_EACH_BB_REVERSE (bb)
!     make_regs_equivalent_over_bad_edges (bb->index, p);
  
    INIT_REG_SET (phi_set);
  
*************** compute_coalesced_reg_partition ()
*** 1883,1894 ****
  	 blocks first, so that most frequently executed copies would
  	 be more likely to be removed by register coalescing.  But any
  	 order will generate correct, if non-optimal, results.  */
!       for (bb = n_basic_blocks; --bb >= 0; )
  	{
! 	  basic_block block = BASIC_BLOCK (bb);
! 	  changed += coalesce_regs_in_copies (block, p, conflicts);
  	  changed +=
! 	    coalesce_regs_in_successor_phi_nodes (block, p, conflicts);
  	}
  
        conflict_graph_delete (conflicts);
--- 1884,1894 ----
  	 blocks first, so that most frequently executed copies would
  	 be more likely to be removed by register coalescing.  But any
  	 order will generate correct, if non-optimal, results.  */
!       FOR_EACH_BB_REVERSE (bb)
  	{
! 	  changed += coalesce_regs_in_copies (bb, p, conflicts);
  	  changed +=
! 	    coalesce_regs_in_successor_phi_nodes (bb, p, conflicts);
  	}
  
        conflict_graph_delete (conflicts);
*************** static void
*** 2094,2104 ****
  rename_equivalent_regs (reg_partition)
       partition reg_partition;
  {
!   int bb;
  
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
-       basic_block b = BASIC_BLOCK (bb);
        rtx next = b->head;
        rtx last = b->end;
        rtx insn;
--- 2094,2103 ----
  rename_equivalent_regs (reg_partition)
       partition reg_partition;
  {
!   basic_block b;
  
!   FOR_EACH_BB_REVERSE (b)
      {
        rtx next = b->head;
        rtx last = b->end;
        rtx insn;
*************** rename_equivalent_regs (reg_partition)
*** 2141,2147 ****
  void
  convert_from_ssa ()
  {
!   int bb;
    partition reg_partition;
    rtx insns = get_insns ();
  
--- 2140,2146 ----
  void
  convert_from_ssa ()
  {
!   basic_block b, bb;
    partition reg_partition;
    rtx insns = get_insns ();
  
*************** convert_from_ssa ()
*** 2167,2175 ****
    rename_equivalent_regs (reg_partition);
  
    /* Eliminate the PHI nodes.  */
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
-       basic_block b = BASIC_BLOCK (bb);
        edge e;
  
        for (e = b->pred; e; e = e->pred_next)
--- 2166,2173 ----
    rename_equivalent_regs (reg_partition);
  
    /* Eliminate the PHI nodes.  */
!   FOR_EACH_BB_REVERSE (b)
      {
        edge e;
  
        for (e = b->pred; e; e = e->pred_next)
*************** convert_from_ssa ()
*** 2180,2196 ****
    partition_delete (reg_partition);
  
    /* Actually delete the PHI nodes.  */
!   for (bb = n_basic_blocks; --bb >= 0; )
      {
!       rtx insn = BLOCK_HEAD (bb);
  
        while (1)
  	{
  	  /* If this is a PHI node delete it.  */
  	  if (PHI_NODE_P (insn))
  	    {
! 	      if (insn == BLOCK_END (bb))
! 		BLOCK_END (bb) = PREV_INSN (insn);
  	      insn = delete_insn (insn);
  	    }
  	  /* Since all the phi nodes come at the beginning of the
--- 2178,2194 ----
    partition_delete (reg_partition);
  
    /* Actually delete the PHI nodes.  */
!   FOR_EACH_BB_REVERSE (bb)
      {
!       rtx insn = bb->head;
  
        while (1)
  	{
  	  /* If this is a PHI node delete it.  */
  	  if (PHI_NODE_P (insn))
  	    {
! 	      if (insn == bb->end)
! 		bb->end = PREV_INSN (insn);
  	      insn = delete_insn (insn);
  	    }
  	  /* Since all the phi nodes come at the beginning of the
*************** convert_from_ssa ()
*** 2199,2205 ****
  	  else if (INSN_P (insn))
  	    break;
  	  /* If we've reached the end of the block, stop.  */
! 	  else if (insn == BLOCK_END (bb))
  	    break;
  	  else
  	    insn = NEXT_INSN (insn);
--- 2197,2203 ----
  	  else if (INSN_P (insn))
  	    break;
  	  /* If we've reached the end of the block, stop.  */
! 	  else if (insn == bb->end)
  	    break;
  	  else
  	    insn = NEXT_INSN (insn);
Index: ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.169
diff -c -3 -p -r1.169 ia64.c
*** ia64.c	19 May 2002 09:50:21 -0000	1.169
--- ia64.c	22 May 2002 17:08:04 -0000
*************** ia64_sched_finish (dump, sched_verbose)
*** 6566,6576 ****
  static void
  emit_predicate_relation_info ()
  {
!   int i;
  
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        int r;
        rtx head = bb->head;
  
--- 6566,6575 ----
  static void
  emit_predicate_relation_info ()
  {
!   basic_block bb;
  
!   FOR_EACH_BB_REVERSE (bb)
      {
        int r;
        rtx head = bb->head;
  
*************** emit_predicate_relation_info ()
*** 6596,6604 ****
       relations around them.  Otherwise the assembler will assume the call
       returns, and complain about uses of call-clobbered predicates after
       the call.  */
!   for (i = n_basic_blocks - 1; i >= 0; --i)
      {
-       basic_block bb = BASIC_BLOCK (i);
        rtx insn = bb->head;
        
        while (1)
--- 6595,6602 ----
       relations around them.  Otherwise the assembler will assume the call
       returns, and complain about uses of call-clobbered predicates after
       the call.  */
!   FOR_EACH_BB_REVERSE (bb)
      {
        rtx insn = bb->head;
        
        while (1)
*************** ia64_strip_name_encoding (str)
*** 6974,6984 ****
  
  /* The current basic block number.  */
  
! static int block_num;
  
  /* True if we need a copy_state command at the start of the next block.  */
  
! static int need_copy_state;
  
  /* The function emits unwind directives for the start of an epilogue.  */
  
--- 6972,6982 ----
  
  /* The current basic block number.  */
  
! static bool last_block;
  
  /* True if we need a copy_state command at the start of the next block.  */
  
! static bool need_copy_state;
  
  /* The function emits unwind directives for the start of an epilogue.  */
  
*************** process_epilogue ()
*** 6988,6997 ****
    /* If this isn't the last block of the function, then we need to label the
       current state, and copy it back in at the start of the next block.  */
  
!   if (block_num != n_basic_blocks - 1)
      {
        fprintf (asm_out_file, "\t.label_state 1\n");
!       need_copy_state = 1;
      }
  
    fprintf (asm_out_file, "\t.restore sp\n");
--- 6986,6995 ----
    /* If this isn't the last block of the function, then we need to label the
       current state, and copy it back in at the start of the next block.  */
  
!   if (!last_block)
      {
        fprintf (asm_out_file, "\t.label_state 1\n");
!       need_copy_state = true;
      }
  
    fprintf (asm_out_file, "\t.restore sp\n");
*************** process_for_unwind_directive (asm_out_fi
*** 7229,7242 ****
        if (GET_CODE (insn) == NOTE
  	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_BASIC_BLOCK)
  	{
! 	  block_num = NOTE_BASIC_BLOCK (insn)->index;
  
  	  /* Restore unwind state from immediately before the epilogue.  */
  	  if (need_copy_state)
  	    {
  	      fprintf (asm_out_file, "\t.body\n");
  	      fprintf (asm_out_file, "\t.copy_state 1\n");
! 	      need_copy_state = 0;
  	    }
  	}
  
--- 7227,7240 ----
        if (GET_CODE (insn) == NOTE
  	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_BASIC_BLOCK)
  	{
! 	  last_block = NOTE_BASIC_BLOCK (insn)->next_bb == EXIT_BLOCK_PTR;
  
  	  /* Restore unwind state from immediately before the epilogue.  */
  	  if (need_copy_state)
  	    {
  	      fprintf (asm_out_file, "\t.body\n");
  	      fprintf (asm_out_file, "\t.copy_state 1\n");
! 	      need_copy_state = false;
  	    }
  	}
  

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal, part 3
  2002-05-22 13:43                                 ` Basic block renumbering removal, part 3 Zdenek Dvorak
@ 2002-05-23  1:18                                   ` Richard Henderson
  2002-05-23 16:27                                     ` Basic block renumbering removal, part 4 Zdenek Dvorak
  0 siblings, 1 reply; 33+ messages in thread
From: Richard Henderson @ 2002-05-23  1:18 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Wed, May 22, 2002 at 10:38:13PM +0200, Zdenek Dvorak wrote:
> 	* bb-reorder.c (make_reorder_chain, make_reorder_chain_1):
> 	Use FOR_EACH_BB macros to iterate over basic block chain.
>	...

Ok.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Basic block renumbering removal, part 4
  2002-05-23  1:18                                   ` Richard Henderson
@ 2002-05-23 16:27                                     ` Zdenek Dvorak
  2002-05-25 21:41                                       ` Richard Henderson
  0 siblings, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-23 16:27 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

This patch introduces new variable (last_basic_block) containing length
of basic block array (for now it is #defined as alias for n_basic_blocks).

It makes us to use it on places where appropriate (anywhere where
something is indexed by basic block number).

Zdenek

Changelog:

	* basic-block.h (last_basic_block): Defined as synonym for
	n_basic_blocks.
	* cfganal.c (mark_dfs_back_edges, flow_reverse_top_sort_order_compute,
	flow_depth_first_order_compute, flow_preorder_transversal_compute,
	flow_dfs_compute_reverse_init): Replaced relevant occurences of
	n_basic_blocks with last_basic_block.
	* cfgbuild.c (make_edges): Likewise.
	* cfgloop.c (flow_loop_scan, flow_loops_find): Likewise.
	* cfgrtl.c (verify_flow_info, purge_all_dead_edges): Likewise.
	* combine.c (combine_instructions): Likewise.
	* df.c (df_alloc, df_analyse_1, df_analyse, iterative_dataflow_sbitmap,
	iterative_dataflow_bitmap): Likewise.
	* dominance.c (init_dom_info, calc_dfs_tree_nonrec, calc_dfs_tree,
	calc_idoms, idoms_to_doms): Likewise.
	* flow.c (update_life_info_in_dirty_blocks, free_basic_block_vars):
	Likewise.
	* gcse.c (gcse_main, alloc_gcse_mem, compute_local_properties,
	compute_hash_table, expr_reaches_here_p, one_classic_gcse_pass,
	one_cprop_pass, compute_pre_data, pre_expr_reaches_here_p,
	one_pre_gcse_pass, compute_transpout, delete_null_pointer_checks_1,
	delete_null_pointer_checks, compute_code_hoist_vbeinout,
	hoist_expr_reaches_here_p, hoist_code, one_code_hoisting_pass,
	compute_store_table, build_store_vectors): Likewise.
	* haifa-sched.c (sched_init): Likewise.
	* ifcvt.c (if_convert): Likewise.
	* lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete,
	pre_edge_lcm, compute_available, compute_nearerout,
	compute_rev_insert_delete, pre_edge_rev_lcm, optimize_mode_switching):
	Likewise.
	* predict.c (estimate_probability, process_note_prediction,
	note_prediction_to_br_prob): Likewise.
	* profile.c (GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): Likewise.
	* recog.c (split_all_insns, peephole2_optimize): Likewise.
	* regrename.c (copyprop_hardreg_forward): Likewise.
	* resource.c (init_resource_info): Likewise.
	* sched-rgn.c (build_control_flow, find_rgns, compute_trg_info,
	init_regions, schedule_insns): Likewise.
	* ssa-ccp.c (ssa_const_prop): Likewise.
	* ssa-dce.c (ssa_eliminate_dead_code): Likewise.
	* ssa.c (compute_dominance_frontiers,
	compute_iterated_dominance_frontiers, convert_to_ssa): Likewise.

	* df.c (df_refs_unlink): Fix FOR_EACH_BB usage (in #if 0'ed code)
	* gcse.c (alloc_rd_mem, alloc_avail_expr_mem): Use n_blocks for vector
	sizes consistently.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.145
diff -c -3 -p -r1.145 basic-block.h
*** basic-block.h	23 May 2002 15:22:04 -0000	1.145
--- basic-block.h	23 May 2002 21:46:22 -0000
*************** typedef struct basic_block_def {
*** 233,238 ****
--- 233,242 ----
  
  extern int n_basic_blocks;
  
+ /* First free basic block number.  */
+ 
+ #define last_basic_block n_basic_blocks
+ 
  /* Number of edges in the current function.  */
  
  extern int n_edges;
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.22
diff -c -3 -p -r1.22 cfganal.c
*** cfganal.c	23 May 2002 19:23:36 -0000	1.22
--- cfganal.c	23 May 2002 21:46:22 -0000
*************** mark_dfs_back_edges ()
*** 120,134 ****
    bool found = false;
  
    /* Allocate the preorder and postorder number arrays.  */
!   pre = (int *) xcalloc (n_basic_blocks, sizeof (int));
!   post = (int *) xcalloc (n_basic_blocks, sizeof (int));
  
    /* Allocate stack for back-tracking up CFG.  */
    stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge));
    sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (n_basic_blocks);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
--- 120,134 ----
    bool found = false;
  
    /* Allocate the preorder and postorder number arrays.  */
!   pre = (int *) xcalloc (last_basic_block, sizeof (int));
!   post = (int *) xcalloc (last_basic_block, sizeof (int));
  
    /* Allocate stack for back-tracking up CFG.  */
    stack = (edge *) xmalloc ((n_basic_blocks + 1) * sizeof (edge));
    sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (last_basic_block);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
*************** flow_reverse_top_sort_order_compute (rts
*** 741,747 ****
    sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (n_basic_blocks);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
--- 741,747 ----
    sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (last_basic_block);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
*************** flow_depth_first_order_compute (dfs_orde
*** 812,818 ****
    sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (n_basic_blocks);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
--- 812,818 ----
    sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (last_basic_block);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
*************** flow_preorder_transversal_compute (pot_o
*** 918,924 ****
    sp = 0;
  
    /* Allocate the tree.  */
!   dfst = (struct dfst_node *) xcalloc (n_basic_blocks,
  				       sizeof (struct dfst_node));
  
    FOR_EACH_BB (bb)
--- 918,924 ----
    sp = 0;
  
    /* Allocate the tree.  */
!   dfst = (struct dfst_node *) xcalloc (last_basic_block,
  				       sizeof (struct dfst_node));
  
    FOR_EACH_BB (bb)
*************** flow_preorder_transversal_compute (pot_o
*** 935,941 ****
      }
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (n_basic_blocks);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
--- 935,941 ----
      }
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   visited = sbitmap_alloc (last_basic_block);
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (visited);
*************** flow_preorder_transversal_compute (pot_o
*** 1002,1008 ****
  
    /* Free the tree.  */
  
!   for (i = 0; i < n_basic_blocks; i++)
      if (dfst[i].node)
        free (dfst[i].node);
  
--- 1002,1008 ----
  
    /* Free the tree.  */
  
!   for (i = 0; i < last_basic_block; i++)
      if (dfst[i].node)
        free (dfst[i].node);
  
*************** flow_dfs_compute_reverse_init (data)
*** 1049,1055 ****
    data->sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   data->visited_blocks = sbitmap_alloc (n_basic_blocks - (INVALID_BLOCK + 1));
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (data->visited_blocks);
--- 1049,1055 ----
    data->sp = 0;
  
    /* Allocate bitmap to track nodes that have been visited.  */
!   data->visited_blocks = sbitmap_alloc (last_basic_block - (INVALID_BLOCK + 1));
  
    /* None of the nodes in the CFG have been visited yet.  */
    sbitmap_zero (data->visited_blocks);
Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.19
diff -c -3 -p -r1.19 cfgbuild.c
*** cfgbuild.c	23 May 2002 19:23:36 -0000	1.19
--- cfgbuild.c	23 May 2002 21:46:22 -0000
*************** make_edges (label_value_list, min, max, 
*** 295,302 ****
       amount of time searching the edge lists for duplicates.  */
    if (forced_labels || label_value_list)
      {
!       edge_cache = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
!       sbitmap_vector_zero (edge_cache, n_basic_blocks);
  
        if (update_p)
          FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
--- 295,302 ----
       amount of time searching the edge lists for duplicates.  */
    if (forced_labels || label_value_list)
      {
!       edge_cache = sbitmap_vector_alloc (last_basic_block, last_basic_block);
!       sbitmap_vector_zero (edge_cache, last_basic_block);
  
        if (update_p)
          FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
Index: cfgloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.c,v
retrieving revision 1.10
diff -c -3 -p -r1.10 cfgloop.c
*** cfgloop.c	23 May 2002 19:23:37 -0000	1.10
--- cfgloop.c	23 May 2002 21:46:22 -0000
*************** flow_loop_scan (loops, loop, flags)
*** 600,606 ****
  
        /* Determine which loop nodes dominate all the exits
  	 of the loop.  */
!       loop->exits_doms = sbitmap_alloc (n_basic_blocks);
        sbitmap_copy (loop->exits_doms, loop->nodes);
        for (j = 0; j < loop->num_exits; j++)
  	sbitmap_a_and_b (loop->exits_doms, loop->exits_doms,
--- 600,606 ----
  
        /* Determine which loop nodes dominate all the exits
  	 of the loop.  */
!       loop->exits_doms = sbitmap_alloc (last_basic_block);
        sbitmap_copy (loop->exits_doms, loop->nodes);
        for (j = 0; j < loop->num_exits; j++)
  	sbitmap_a_and_b (loop->exits_doms, loop->exits_doms,
*************** flow_loops_find (loops, flags)
*** 663,669 ****
    rc_order = NULL;
  
    /* Compute the dominators.  */
!   dom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
    calculate_dominance_info (NULL, dom, CDI_DOMINATORS);
  
    /* Count the number of loop edges (back edges).  This should be the
--- 663,669 ----
    rc_order = NULL;
  
    /* Compute the dominators.  */
!   dom = sbitmap_vector_alloc (last_basic_block, last_basic_block);
    calculate_dominance_info (NULL, dom, CDI_DOMINATORS);
  
    /* Count the number of loop edges (back edges).  This should be the
*************** flow_loops_find (loops, flags)
*** 705,714 ****
        loops->array
  	= (struct loop *) xcalloc (num_loops, sizeof (struct loop));
  
!       headers = sbitmap_alloc (n_basic_blocks);
        sbitmap_zero (headers);
  
!       loops->shared_headers = sbitmap_alloc (n_basic_blocks);
        sbitmap_zero (loops->shared_headers);
  
        /* Find and record information about all the natural loops
--- 705,714 ----
        loops->array
  	= (struct loop *) xcalloc (num_loops, sizeof (struct loop));
  
!       headers = sbitmap_alloc (last_basic_block);
        sbitmap_zero (headers);
  
!       loops->shared_headers = sbitmap_alloc (last_basic_block);
        sbitmap_zero (loops->shared_headers);
  
        /* Find and record information about all the natural loops
*************** flow_loops_find (loops, flags)
*** 760,766 ****
  	  SET_BIT (headers, loop->header->index);
  
  	  /* Find nodes contained within the loop.  */
! 	  loop->nodes = sbitmap_alloc (n_basic_blocks);
  	  loop->num_nodes
  	    = flow_loop_nodes_find (loop->header, loop->latch, loop->nodes);
  
--- 760,766 ----
  	  SET_BIT (headers, loop->header->index);
  
  	  /* Find nodes contained within the loop.  */
! 	  loop->nodes = sbitmap_alloc (last_basic_block);
  	  loop->num_nodes
  	    = flow_loop_nodes_find (loop->header, loop->latch, loop->nodes);
  
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 cfgrtl.c
*** cfgrtl.c	23 May 2002 19:23:37 -0000	1.51
--- cfgrtl.c	23 May 2002 21:46:23 -0000
*************** verify_flow_info ()
*** 1712,1720 ****
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
!   last_visited = (basic_block *) xcalloc (n_basic_blocks + 2,
  					  sizeof (basic_block));
!   edge_checksum = (size_t *) xcalloc (n_basic_blocks + 2, sizeof (size_t));
  
    /* Check bb chain & numbers.  */
    last_bb_seen = ENTRY_BLOCK_PTR;
--- 1712,1720 ----
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
!   last_visited = (basic_block *) xcalloc (last_basic_block + 2,
  					  sizeof (basic_block));
!   edge_checksum = (size_t *) xcalloc (last_basic_block + 2, sizeof (size_t));
  
    /* Check bb chain & numbers.  */
    last_bb_seen = ENTRY_BLOCK_PTR;
*************** purge_all_dead_edges (update_life_p)
*** 2317,2323 ****
  
    if (update_life_p)
      {
!       blocks = sbitmap_alloc (n_basic_blocks);
        sbitmap_zero (blocks);
      }
  
--- 2317,2323 ----
  
    if (update_life_p)
      {
!       blocks = sbitmap_alloc (last_basic_block);
        sbitmap_zero (blocks);
      }
  
Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.292
diff -c -3 -p -r1.292 combine.c
*** combine.c	23 May 2002 19:23:38 -0000	1.292
--- combine.c	23 May 2002 21:46:25 -0000
*************** combine_instructions (f, nregs)
*** 578,584 ****
  
    setup_incoming_promotions ();
  
!   refresh_blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (refresh_blocks);
    need_refresh = 0;
  
--- 578,584 ----
  
    setup_incoming_promotions ();
  
!   refresh_blocks = sbitmap_alloc (last_basic_block);
    sbitmap_zero (refresh_blocks);
    need_refresh = 0;
  
Index: df.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/df.c,v
retrieving revision 1.30
diff -c -3 -p -r1.30 df.c
*** df.c	23 May 2002 19:23:39 -0000	1.30
--- df.c	23 May 2002 21:46:26 -0000
*************** df_alloc (df, n_regs)
*** 547,553 ****
    df->uses = xmalloc (df->use_size * sizeof (*df->uses));
  
    df->n_regs = n_regs;
!   df->n_bbs = n_basic_blocks;
  
    /* Allocate temporary working array used during local dataflow analysis.  */
    df->reg_def_last = xmalloc (df->n_regs * sizeof (struct ref *));
--- 547,553 ----
    df->uses = xmalloc (df->use_size * sizeof (*df->uses));
  
    df->n_regs = n_regs;
!   df->n_bbs = last_basic_block;
  
    /* Allocate temporary working array used during local dataflow analysis.  */
    df->reg_def_last = xmalloc (df->n_regs * sizeof (struct ref *));
*************** df_alloc (df, n_regs)
*** 561,567 ****
  
    df->flags = 0;
  
!   df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info));
  
    df->all_blocks = BITMAP_XMALLOC ();
    FOR_EACH_BB (bb)
--- 561,567 ----
  
    df->flags = 0;
  
!   df->bbs = xcalloc (last_basic_block, sizeof (struct bb_info));
  
    df->all_blocks = BITMAP_XMALLOC ();
    FOR_EACH_BB (bb)
*************** df_analyse_1 (df, blocks, flags, update)
*** 2006,2014 ****
    df->dfs_order = xmalloc (sizeof(int) * n_basic_blocks);
    df->rc_order = xmalloc (sizeof(int) * n_basic_blocks);
    df->rts_order = xmalloc (sizeof(int) * n_basic_blocks);
!   df->inverse_dfs_map = xmalloc (sizeof(int) * n_basic_blocks);
!   df->inverse_rc_map = xmalloc (sizeof(int) * n_basic_blocks);
!   df->inverse_rts_map = xmalloc (sizeof(int) * n_basic_blocks);
  
    flow_depth_first_order_compute (df->dfs_order, df->rc_order);
    flow_reverse_top_sort_order_compute (df->rts_order);
--- 2006,2014 ----
    df->dfs_order = xmalloc (sizeof(int) * n_basic_blocks);
    df->rc_order = xmalloc (sizeof(int) * n_basic_blocks);
    df->rts_order = xmalloc (sizeof(int) * n_basic_blocks);
!   df->inverse_dfs_map = xmalloc (sizeof(int) * last_basic_block);
!   df->inverse_rc_map = xmalloc (sizeof(int) * last_basic_block);
!   df->inverse_rts_map = xmalloc (sizeof(int) * last_basic_block);
  
    flow_depth_first_order_compute (df->dfs_order, df->rc_order);
    flow_reverse_top_sort_order_compute (df->rts_order);
*************** df_analyse_1 (df, blocks, flags, update)
*** 2023,2032 ****
        /* Compute the sets of gens and kills for the defs of each bb.  */
        df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
        {
! 	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	FOR_EACH_BB (bb)
  	  {
  	    in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
--- 2023,2032 ----
        /* Compute the sets of gens and kills for the defs of each bb.  */
        df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks);
        {
! 	bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
  	FOR_EACH_BB (bb)
  	  {
  	    in[bb->index] = DF_BB_INFO (df, bb)->rd_in;
*************** df_analyse_1 (df, blocks, flags, update)
*** 2059,2068 ****
  	 uses in each bb.  */
        df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
        {
! 	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	FOR_EACH_BB (bb)
  	  {
  	    in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
--- 2059,2068 ----
  	 uses in each bb.  */
        df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks);
        {
! 	bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *gen = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *kill = xmalloc (sizeof (bitmap) * last_basic_block);
  	FOR_EACH_BB (bb)
  	  {
  	    in[bb->index] = DF_BB_INFO (df, bb)->ru_in;
*************** df_analyse_1 (df, blocks, flags, update)
*** 2098,2107 ****
        /* Compute the sets of defs and uses of live variables.  */
        df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
        {
! 	bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *use = xmalloc (sizeof (bitmap) * n_basic_blocks);
! 	bitmap *def = xmalloc (sizeof (bitmap) * n_basic_blocks);
  	FOR_EACH_BB (bb)
  	  {
  	    in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
--- 2098,2107 ----
        /* Compute the sets of defs and uses of live variables.  */
        df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks);
        {
! 	bitmap *in = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *out = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *use = xmalloc (sizeof (bitmap) * last_basic_block);
! 	bitmap *def = xmalloc (sizeof (bitmap) * last_basic_block);
  	FOR_EACH_BB (bb)
  	  {
  	    in[bb->index] = DF_BB_INFO (df, bb)->lr_in;
*************** df_analyse (df, blocks, flags)
*** 2292,2298 ****
  
    /* We could deal with additional basic blocks being created by
       rescanning everything again.  */
!   if (df->n_bbs && df->n_bbs != (unsigned int)n_basic_blocks)
      abort ();
  
    update = df_modified_p (df, blocks);
--- 2292,2298 ----
  
    /* We could deal with additional basic blocks being created by
       rescanning everything again.  */
!   if (df->n_bbs && df->n_bbs != (unsigned int) last_basic_block)
      abort ();
  
    update = df_modified_p (df, blocks);
*************** df_refs_unlink (df, blocks)
*** 2402,2411 ****
      }
    else
      {
!       FOR_EACH_BB (bb,
!       {
  	df_bb_refs_unlink (df, bb);
-       });
      }
  }
  #endif
--- 2402,2409 ----
      }
    else
      {
!       FOR_EACH_BB (bb)
  	df_bb_refs_unlink (df, bb);
      }
  }
  #endif
*************** iterative_dataflow_sbitmap (in, out, gen
*** 3846,3853 ****
    fibheap_t worklist;
    basic_block bb;
    sbitmap visited, pending;
!   pending = sbitmap_alloc (n_basic_blocks);
!   visited = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (pending);
    sbitmap_zero (visited);
    worklist = fibheap_new ();
--- 3844,3851 ----
    fibheap_t worklist;
    basic_block bb;
    sbitmap visited, pending;
!   pending = sbitmap_alloc (last_basic_block);
!   visited = sbitmap_alloc (last_basic_block);
    sbitmap_zero (pending);
    sbitmap_zero (visited);
    worklist = fibheap_new ();
*************** iterative_dataflow_bitmap (in, out, gen,
*** 3905,3912 ****
    fibheap_t worklist;
    basic_block bb;
    sbitmap visited, pending;
!   pending = sbitmap_alloc (n_basic_blocks);
!   visited = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (pending);
    sbitmap_zero (visited);
    worklist = fibheap_new ();
--- 3903,3910 ----
    fibheap_t worklist;
    basic_block bb;
    sbitmap visited, pending;
!   pending = sbitmap_alloc (last_basic_block);
!   visited = sbitmap_alloc (last_basic_block);
    sbitmap_zero (pending);
    sbitmap_zero (visited);
    worklist = fibheap_new ();
Index: dominance.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dominance.c,v
retrieving revision 1.9
diff -c -3 -p -r1.9 dominance.c
*** dominance.c	23 May 2002 19:23:39 -0000	1.9
--- dominance.c	23 May 2002 21:46:26 -0000
***************
*** 45,51 ****
     number of the corresponding basic block.  Please note, that we include the
     artificial ENTRY_BLOCK (or EXIT_BLOCK in the post-dom case) in our lists to
     support multiple entry points.  As it has no real basic block index we use
!    'n_basic_blocks' for that.  Its dfs number is of course 1.  */
  
  /* Type of Basic Block aka. TBB */
  typedef unsigned int TBB;
--- 45,51 ----
     number of the corresponding basic block.  Please note, that we include the
     artificial ENTRY_BLOCK (or EXIT_BLOCK in the post-dom case) in our lists to
     support multiple entry points.  As it has no real basic block index we use
!    'last_basic_block' for that.  Its dfs number is of course 1.  */
  
  /* Type of Basic Block aka. TBB */
  typedef unsigned int TBB;
*************** init_dom_info (di)
*** 155,161 ****
    init_ar (di->set_size, unsigned int, num, 1);
    init_ar (di->set_child, TBB, num, 0);
  
!   init_ar (di->dfs_order, TBB, (unsigned int) n_basic_blocks + 1, 0);
    init_ar (di->dfs_to_bb, basic_block, num, 0);
  
    di->dfsnum = 1;
--- 155,161 ----
    init_ar (di->set_size, unsigned int, num, 1);
    init_ar (di->set_child, TBB, num, 0);
  
!   init_ar (di->dfs_order, TBB, (unsigned int) last_basic_block + 1, 0);
    init_ar (di->dfs_to_bb, basic_block, num, 0);
  
    di->dfsnum = 1;
*************** calc_dfs_tree_nonrec (di, bb, reverse)
*** 271,277 ****
  	  if (bb != en_block)
  	    my_i = di->dfs_order[bb->index];
  	  else
! 	    my_i = di->dfs_order[n_basic_blocks];
  	  child_i = di->dfs_order[bn->index] = di->dfsnum++;
  	  di->dfs_to_bb[child_i] = bn;
  	  di->dfs_parent[child_i] = my_i;
--- 271,277 ----
  	  if (bb != en_block)
  	    my_i = di->dfs_order[bb->index];
  	  else
! 	    my_i = di->dfs_order[last_basic_block];
  	  child_i = di->dfs_order[bn->index] = di->dfsnum++;
  	  di->dfs_to_bb[child_i] = bn;
  	  di->dfs_parent[child_i] = my_i;
*************** calc_dfs_tree (di, reverse)
*** 314,320 ****
  {
    /* The first block is the ENTRY_BLOCK (or EXIT_BLOCK if REVERSE).  */
    basic_block begin = reverse ? EXIT_BLOCK_PTR : ENTRY_BLOCK_PTR;
!   di->dfs_order[n_basic_blocks] = di->dfsnum;
    di->dfs_to_bb[di->dfsnum] = begin;
    di->dfsnum++;
  
--- 314,320 ----
  {
    /* The first block is the ENTRY_BLOCK (or EXIT_BLOCK if REVERSE).  */
    basic_block begin = reverse ? EXIT_BLOCK_PTR : ENTRY_BLOCK_PTR;
!   di->dfs_order[last_basic_block] = di->dfsnum;
    di->dfs_to_bb[di->dfsnum] = begin;
    di->dfsnum++;
  
*************** calc_idoms (di, reverse)
*** 493,499 ****
  	      e_next = e->pred_next;
  	    }
  	  if (b == en_block)
! 	    k1 = di->dfs_order[n_basic_blocks];
  	  else
  	    k1 = di->dfs_order[b->index];
  
--- 493,499 ----
  	      e_next = e->pred_next;
  	    }
  	  if (b == en_block)
! 	    k1 = di->dfs_order[last_basic_block];
  	  else
  	    k1 = di->dfs_order[b->index];
  
*************** idoms_to_doms (di, dominators)
*** 541,550 ****
  {
    TBB i, e_index;
    int bb, bb_idom;
!   sbitmap_vector_zero (dominators, n_basic_blocks);
    /* We have to be careful, to not include the ENTRY_BLOCK or EXIT_BLOCK
       in the list of (post)-doms, so remember that in e_index.  */
!   e_index = di->dfs_order[n_basic_blocks];
  
    for (i = 1; i <= di->nodes; i++)
      {
--- 541,550 ----
  {
    TBB i, e_index;
    int bb, bb_idom;
!   sbitmap_vector_zero (dominators, last_basic_block);
    /* We have to be careful, to not include the ENTRY_BLOCK or EXIT_BLOCK
       in the list of (post)-doms, so remember that in e_index.  */
!   e_index = di->dfs_order[last_basic_block];
  
    for (i = 1; i <= di->nodes; i++)
      {
*************** idoms_to_doms (di, dominators)
*** 576,583 ****
  }
  
  /* The main entry point into this module.  IDOM is an integer array with room
!    for n_basic_blocks integers, DOMS is a preallocated sbitmap array having
!    room for n_basic_blocks^2 bits, and POST is true if the caller wants to
     know post-dominators.
  
     On return IDOM[i] will be the BB->index of the immediate (post) dominator
--- 576,583 ----
  }
  
  /* The main entry point into this module.  IDOM is an integer array with room
!    for last_basic_block integers, DOMS is a preallocated sbitmap array having
!    room for last_basic_block^2 bits, and POST is true if the caller wants to
     know post-dominators.
  
     On return IDOM[i] will be the BB->index of the immediate (post) dominator
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.524
diff -c -3 -p -r1.524 flow.c
*** flow.c	23 May 2002 19:23:40 -0000	1.524
--- flow.c	23 May 2002 21:46:27 -0000
*************** update_life_info_in_dirty_blocks (extent
*** 758,764 ****
       enum update_life_extent extent;
       int prop_flags;
  {
!   sbitmap update_life_blocks = sbitmap_alloc (n_basic_blocks);
    int n = 0;
    basic_block bb;
    int retval = 0;
--- 758,764 ----
       enum update_life_extent extent;
       int prop_flags;
  {
!   sbitmap update_life_blocks = sbitmap_alloc (last_basic_block);
    int n = 0;
    basic_block bb;
    int retval = 0;
*************** free_basic_block_vars (keep_head_end_p)
*** 794,799 ****
--- 794,800 ----
  	  VARRAY_FREE (basic_block_info);
  	}
        n_basic_blocks = 0;
+       last_basic_block = 0;
  
        ENTRY_BLOCK_PTR->aux = NULL;
        ENTRY_BLOCK_PTR->global_live_at_end = NULL;
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.190
diff -c -3 -p -r1.190 gcse.c
*** gcse.c	23 May 2002 19:23:40 -0000	1.190
--- gcse.c	23 May 2002 21:46:28 -0000
*************** gcse_main (f, file)
*** 834,844 ****
  	    {
  	      free_modify_mem_tables ();
  	      modify_mem_list
! 		= (rtx *) gmalloc (n_basic_blocks * sizeof (rtx));
  	      canon_modify_mem_list
! 		= (rtx *) gmalloc (n_basic_blocks * sizeof (rtx));
! 	      memset ((char *) modify_mem_list, 0, n_basic_blocks * sizeof (rtx));
! 	      memset ((char *) canon_modify_mem_list, 0, n_basic_blocks * sizeof (rtx));
  	      orig_bb_count = n_basic_blocks;
  	    }
  	  free_reg_set_mem ();
--- 834,844 ----
  	    {
  	      free_modify_mem_tables ();
  	      modify_mem_list
! 		= (rtx *) gmalloc (last_basic_block * sizeof (rtx));
  	      canon_modify_mem_list
! 		= (rtx *) gmalloc (last_basic_block * sizeof (rtx));
! 	      memset ((char *) modify_mem_list, 0, last_basic_block * sizeof (rtx));
! 	      memset ((char *) canon_modify_mem_list, 0, last_basic_block * sizeof (rtx));
  	      orig_bb_count = n_basic_blocks;
  	    }
  	  free_reg_set_mem ();
*************** alloc_gcse_mem (f)
*** 1019,1032 ****
    reg_set_bitmap = BITMAP_XMALLOC ();
  
    /* Allocate vars to track sets of regs, memory per block.  */
!   reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks,
  						       max_gcse_regno);
    /* Allocate array to keep a list of insns which modify memory in each
       basic block.  */
!   modify_mem_list = (rtx *) gmalloc (n_basic_blocks * sizeof (rtx));
!   canon_modify_mem_list = (rtx *) gmalloc (n_basic_blocks * sizeof (rtx));
!   memset ((char *) modify_mem_list, 0, n_basic_blocks * sizeof (rtx));
!   memset ((char *) canon_modify_mem_list, 0, n_basic_blocks * sizeof (rtx));
    modify_mem_list_set = BITMAP_XMALLOC ();
    canon_modify_mem_list_set = BITMAP_XMALLOC ();
  }
--- 1019,1032 ----
    reg_set_bitmap = BITMAP_XMALLOC ();
  
    /* Allocate vars to track sets of regs, memory per block.  */
!   reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (last_basic_block,
  						       max_gcse_regno);
    /* Allocate array to keep a list of insns which modify memory in each
       basic block.  */
!   modify_mem_list = (rtx *) gmalloc (last_basic_block * sizeof (rtx));
!   canon_modify_mem_list = (rtx *) gmalloc (last_basic_block * sizeof (rtx));
!   memset ((char *) modify_mem_list, 0, last_basic_block * sizeof (rtx));
!   memset ((char *) canon_modify_mem_list, 0, last_basic_block * sizeof (rtx));
    modify_mem_list_set = BITMAP_XMALLOC ();
    canon_modify_mem_list_set = BITMAP_XMALLOC ();
  }
*************** compute_local_properties (transp, comp, 
*** 1132,1146 ****
    if (transp)
      {
        if (setp)
! 	sbitmap_vector_zero (transp, n_basic_blocks);
        else
! 	sbitmap_vector_ones (transp, n_basic_blocks);
      }
  
    if (comp)
!     sbitmap_vector_zero (comp, n_basic_blocks);
    if (antloc)
!     sbitmap_vector_zero (antloc, n_basic_blocks);
  
    /* We use the same code for cprop, pre and hoisting.  For cprop
       we care about the set hash table, for pre and hoisting we
--- 1132,1146 ----
    if (transp)
      {
        if (setp)
! 	sbitmap_vector_zero (transp, last_basic_block);
        else
! 	sbitmap_vector_ones (transp, last_basic_block);
      }
  
    if (comp)
!     sbitmap_vector_zero (comp, last_basic_block);
    if (antloc)
!     sbitmap_vector_zero (antloc, last_basic_block);
  
    /* We use the same code for cprop, pre and hoisting.  For cprop
       we care about the set hash table, for pre and hoisting we
*************** compute_hash_table (set_p)
*** 2495,2501 ****
       registers are set in which blocks.
       ??? This isn't needed during const/copy propagation, but it's cheap to
       compute.  Later.  */
!   sbitmap_vector_zero (reg_set_in_block, n_basic_blocks);
  
    /* re-Cache any INSN_LIST nodes we have allocated.  */
    clear_modify_mem_tables ();
--- 2495,2501 ----
       registers are set in which blocks.
       ??? This isn't needed during const/copy propagation, but it's cheap to
       compute.  Later.  */
!   sbitmap_vector_zero (reg_set_in_block, last_basic_block);
  
    /* re-Cache any INSN_LIST nodes we have allocated.  */
    clear_modify_mem_tables ();
*************** alloc_rd_mem (n_blocks, n_insns)
*** 2940,2955 ****
       int n_blocks, n_insns;
  {
    rd_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (rd_kill, n_basic_blocks);
  
    rd_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (rd_gen, n_basic_blocks);
  
    reaching_defs = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (reaching_defs, n_basic_blocks);
  
    rd_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (rd_out, n_basic_blocks);
  }
  
  /* Free reaching def variables.  */
--- 2940,2955 ----
       int n_blocks, n_insns;
  {
    rd_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (rd_kill, n_blocks);
  
    rd_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (rd_gen, n_blocks);
  
    reaching_defs = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (reaching_defs, n_blocks);
  
    rd_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_insns);
!   sbitmap_vector_zero (rd_out, n_blocks);
  }
  
  /* Free reaching def variables.  */
*************** alloc_avail_expr_mem (n_blocks, n_exprs)
*** 3071,3086 ****
       int n_blocks, n_exprs;
  {
    ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_kill, n_basic_blocks);
  
    ae_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_gen, n_basic_blocks);
  
    ae_in = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_in, n_basic_blocks);
  
    ae_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_out, n_basic_blocks);
  }
  
  static void
--- 3071,3086 ----
       int n_blocks, n_exprs;
  {
    ae_kill = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_kill, n_blocks);
  
    ae_gen = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_gen, n_blocks);
  
    ae_in = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_in, n_blocks);
  
    ae_out = (sbitmap *) sbitmap_vector_alloc (n_blocks, n_exprs);
!   sbitmap_vector_zero (ae_out, n_blocks);
  }
  
  static void
*************** expr_reaches_here_p (occr, expr, bb, che
*** 3285,3291 ****
       int check_self_loop;
  {
    int rval;
!   char *visited = (char *) xcalloc (n_basic_blocks, 1);
  
    rval = expr_reaches_here_p_work (occr, expr, bb, check_self_loop, visited);
    
--- 3285,3291 ----
       int check_self_loop;
  {
    int rval;
!   char *visited = (char *) xcalloc (last_basic_block, 1);
  
    rval = expr_reaches_here_p_work (occr, expr, bb, check_self_loop, visited);
    
*************** one_classic_gcse_pass (pass)
*** 3675,3681 ****
    gcse_create_count = 0;
  
    alloc_expr_hash_table (max_cuid);
!   alloc_rd_mem (n_basic_blocks, max_cuid);
    compute_expr_hash_table ();
    if (gcse_file)
      dump_hash_table (gcse_file, "Expression", expr_hash_table,
--- 3675,3681 ----
    gcse_create_count = 0;
  
    alloc_expr_hash_table (max_cuid);
!   alloc_rd_mem (last_basic_block, max_cuid);
    compute_expr_hash_table ();
    if (gcse_file)
      dump_hash_table (gcse_file, "Expression", expr_hash_table,
*************** one_classic_gcse_pass (pass)
*** 3685,3691 ****
      {
        compute_kill_rd ();
        compute_rd ();
!       alloc_avail_expr_mem (n_basic_blocks, n_exprs);
        compute_ae_gen ();
        compute_ae_kill (ae_gen, ae_kill);
        compute_available (ae_gen, ae_kill, ae_out, ae_in);
--- 3685,3691 ----
      {
        compute_kill_rd ();
        compute_rd ();
!       alloc_avail_expr_mem (last_basic_block, n_exprs);
        compute_ae_gen ();
        compute_ae_kill (ae_gen, ae_kill);
        compute_available (ae_gen, ae_kill, ae_out, ae_in);
*************** one_cprop_pass (pass, alter_jumps)
*** 4358,4364 ****
  		     n_sets);
    if (n_sets > 0)
      {
!       alloc_cprop_mem (n_basic_blocks, n_sets);
        compute_cprop_data ();
        changed = cprop (alter_jumps);
        free_cprop_mem ();
--- 4358,4364 ----
  		     n_sets);
    if (n_sets > 0)
      {
!       alloc_cprop_mem (last_basic_block, n_sets);
        compute_cprop_data ();
        changed = cprop (alter_jumps);
        free_cprop_mem ();
*************** compute_pre_data ()
*** 4472,4478 ****
    unsigned int ui;
  
    compute_local_properties (transp, comp, antloc, 0);
!   sbitmap_vector_zero (ae_kill, n_basic_blocks);
  
    /* Collect expressions which might trap.  */
    trapping_expr = sbitmap_alloc (n_exprs);
--- 4472,4478 ----
    unsigned int ui;
  
    compute_local_properties (transp, comp, antloc, 0);
!   sbitmap_vector_zero (ae_kill, last_basic_block);
  
    /* Collect expressions which might trap.  */
    trapping_expr = sbitmap_alloc (n_exprs);
*************** pre_expr_reaches_here_p (occr_bb, expr, 
*** 4591,4597 ****
       basic_block bb;
  {
    int rval;
!   char *visited = (char *) xcalloc (n_basic_blocks, 1);
  
    rval = pre_expr_reaches_here_p_work (occr_bb, expr, bb, visited);
  
--- 4591,4597 ----
       basic_block bb;
  {
    int rval;
!   char *visited = (char *) xcalloc (last_basic_block, 1);
  
    rval = pre_expr_reaches_here_p_work (occr_bb, expr, bb, visited);
  
*************** one_pre_gcse_pass (pass)
*** 5111,5117 ****
  
    if (n_exprs > 0)
      {
!       alloc_pre_mem (n_basic_blocks, n_exprs);
        compute_pre_data ();
        changed |= pre_gcse ();
        free_edge_list (edge_list);
--- 5111,5117 ----
  
    if (n_exprs > 0)
      {
!       alloc_pre_mem (last_basic_block, n_exprs);
        compute_pre_data ();
        changed |= pre_gcse ();
        free_edge_list (edge_list);
*************** compute_transpout ()
*** 5199,5205 ****
    unsigned int i;
    struct expr *expr;
  
!   sbitmap_vector_ones (transpout, n_basic_blocks);
  
    FOR_EACH_BB (bb)
      {
--- 5199,5205 ----
    unsigned int i;
    struct expr *expr;
  
!   sbitmap_vector_ones (transpout, last_basic_block);
  
    FOR_EACH_BB (bb)
      {
*************** delete_null_pointer_checks_1 (block_reg,
*** 5281,5288 ****
       Note that a register can have both properties in a single block.  That
       indicates that it's killed, then later in the block a new value is
       computed.  */
!   sbitmap_vector_zero (nonnull_local, n_basic_blocks);
!   sbitmap_vector_zero (nonnull_killed, n_basic_blocks);
  
    FOR_EACH_BB (current_block)
      {
--- 5281,5288 ----
       Note that a register can have both properties in a single block.  That
       indicates that it's killed, then later in the block a new value is
       computed.  */
!   sbitmap_vector_zero (nonnull_local, last_basic_block);
!   sbitmap_vector_zero (nonnull_killed, last_basic_block);
  
    FOR_EACH_BB (current_block)
      {
*************** delete_null_pointer_checks (f)
*** 5459,5476 ****
    /* We need four bitmaps, each with a bit for each register in each
       basic block.  */
    max_reg = max_reg_num ();
!   regs_per_pass = get_bitmap_width (4, n_basic_blocks, max_reg);
  
    /* Allocate bitmaps to hold local and global properties.  */
!   npi.nonnull_local = sbitmap_vector_alloc (n_basic_blocks, regs_per_pass);
!   npi.nonnull_killed = sbitmap_vector_alloc (n_basic_blocks, regs_per_pass);
!   nonnull_avin = sbitmap_vector_alloc (n_basic_blocks, regs_per_pass);
!   nonnull_avout = sbitmap_vector_alloc (n_basic_blocks, regs_per_pass);
  
    /* Go through the basic blocks, seeing whether or not each block
       ends with a conditional branch whose condition is a comparison
       against zero.  Record the register compared in BLOCK_REG.  */
!   block_reg = (unsigned int *) xcalloc (n_basic_blocks, sizeof (int));
    FOR_EACH_BB (bb)
      {
        rtx last_insn = bb->end;
--- 5459,5476 ----
    /* We need four bitmaps, each with a bit for each register in each
       basic block.  */
    max_reg = max_reg_num ();
!   regs_per_pass = get_bitmap_width (4, last_basic_block, max_reg);
  
    /* Allocate bitmaps to hold local and global properties.  */
!   npi.nonnull_local = sbitmap_vector_alloc (last_basic_block, regs_per_pass);
!   npi.nonnull_killed = sbitmap_vector_alloc (last_basic_block, regs_per_pass);
!   nonnull_avin = sbitmap_vector_alloc (last_basic_block, regs_per_pass);
!   nonnull_avout = sbitmap_vector_alloc (last_basic_block, regs_per_pass);
  
    /* Go through the basic blocks, seeing whether or not each block
       ends with a conditional branch whose condition is a comparison
       against zero.  Record the register compared in BLOCK_REG.  */
!   block_reg = (unsigned int *) xcalloc (last_basic_block, sizeof (int));
    FOR_EACH_BB (bb)
      {
        rtx last_insn = bb->end;
*************** compute_code_hoist_vbeinout ()
*** 5586,5593 ****
    int changed, passes;
    basic_block bb;
  
!   sbitmap_vector_zero (hoist_vbeout, n_basic_blocks);
!   sbitmap_vector_zero (hoist_vbein, n_basic_blocks);
  
    passes = 0;
    changed = 1;
--- 5586,5593 ----
    int changed, passes;
    basic_block bb;
  
!   sbitmap_vector_zero (hoist_vbeout, last_basic_block);
!   sbitmap_vector_zero (hoist_vbein, last_basic_block);
  
    passes = 0;
    changed = 1;
*************** hoist_expr_reaches_here_p (expr_bb, expr
*** 5653,5659 ****
    if (visited == NULL)
      {
        visited_allocated_locally = 1;
!       visited = xcalloc (n_basic_blocks, 1);
      }
  
    for (pred = bb->pred; pred != NULL; pred = pred->pred_next)
--- 5653,5659 ----
    if (visited == NULL)
      {
        visited_allocated_locally = 1;
!       visited = xcalloc (last_basic_block, 1);
      }
  
    for (pred = bb->pred; pred != NULL; pred = pred->pred_next)
*************** hoist_code ()
*** 5696,5702 ****
    struct expr **index_map;
    struct expr *expr;
  
!   sbitmap_vector_zero (hoist_exprs, n_basic_blocks);
  
    /* Compute a mapping from expression number (`bitmap_index') to
       hash table entry.  */
--- 5696,5702 ----
    struct expr **index_map;
    struct expr *expr;
  
!   sbitmap_vector_zero (hoist_exprs, last_basic_block);
  
    /* Compute a mapping from expression number (`bitmap_index') to
       hash table entry.  */
*************** one_code_hoisting_pass ()
*** 5871,5877 ****
  
    if (n_exprs > 0)
      {
!       alloc_code_hoist_mem (n_basic_blocks, n_exprs);
        compute_code_hoist_data ();
        hoist_code ();
        free_code_hoist_mem ();
--- 5871,5877 ----
  
    if (n_exprs > 0)
      {
!       alloc_code_hoist_mem (last_basic_block, n_exprs);
        compute_code_hoist_data ();
        hoist_code ();
        free_code_hoist_mem ();
*************** compute_store_table ()
*** 6453,6461 ****
  
    max_gcse_regno = max_reg_num ();
  
!   reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks,
  						       max_gcse_regno);
!   sbitmap_vector_zero (reg_set_in_block, n_basic_blocks);
    pre_ldst_mems = 0;
  
    /* Find all the stores we care about.  */
--- 6453,6461 ----
  
    max_gcse_regno = max_reg_num ();
  
!   reg_set_in_block = (sbitmap *) sbitmap_vector_alloc (last_basic_block,
  						       max_gcse_regno);
!   sbitmap_vector_zero (reg_set_in_block, last_basic_block);
    pre_ldst_mems = 0;
  
    /* Find all the stores we care about.  */
*************** build_store_vectors () 
*** 6654,6664 ****
  
    /* Build the gen_vector. This is any store in the table which is not killed
       by aliasing later in its block.  */
!   ae_gen = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks, num_stores);
!   sbitmap_vector_zero (ae_gen, n_basic_blocks);
  
!   st_antloc = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks, num_stores);
!   sbitmap_vector_zero (st_antloc, n_basic_blocks);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      { 
--- 6654,6664 ----
  
    /* Build the gen_vector. This is any store in the table which is not killed
       by aliasing later in its block.  */
!   ae_gen = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores);
!   sbitmap_vector_zero (ae_gen, last_basic_block);
  
!   st_antloc = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores);
!   sbitmap_vector_zero (st_antloc, last_basic_block);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      { 
*************** build_store_vectors () 
*** 6713,6723 ****
        free_INSN_LIST_list (&store_list);
      }
  	  
!   ae_kill = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks, num_stores);
!   sbitmap_vector_zero (ae_kill, n_basic_blocks);
  
!   transp = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks, num_stores);
!   sbitmap_vector_zero (transp, n_basic_blocks);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      FOR_EACH_BB (b)
--- 6713,6723 ----
        free_INSN_LIST_list (&store_list);
      }
  	  
!   ae_kill = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores);
!   sbitmap_vector_zero (ae_kill, last_basic_block);
  
!   transp = (sbitmap *) sbitmap_vector_alloc (last_basic_block, num_stores);
!   sbitmap_vector_zero (transp, last_basic_block);
  
    for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
      FOR_EACH_BB (b)
*************** build_store_vectors () 
*** 6754,6763 ****
      {
        fprintf (gcse_file, "ST_avail and ST_antic (shown under loads..)\n");
        print_ldst_list (gcse_file);
!       dump_sbitmap_vector (gcse_file, "st_antloc", "", st_antloc, n_basic_blocks);
!       dump_sbitmap_vector (gcse_file, "st_kill", "", ae_kill, n_basic_blocks);
!       dump_sbitmap_vector (gcse_file, "Transpt", "", transp, n_basic_blocks);
!       dump_sbitmap_vector (gcse_file, "st_avloc", "", ae_gen, n_basic_blocks);
      }
  }
  
--- 6754,6763 ----
      {
        fprintf (gcse_file, "ST_avail and ST_antic (shown under loads..)\n");
        print_ldst_list (gcse_file);
!       dump_sbitmap_vector (gcse_file, "st_antloc", "", st_antloc, last_basic_block);
!       dump_sbitmap_vector (gcse_file, "st_kill", "", ae_kill, last_basic_block);
!       dump_sbitmap_vector (gcse_file, "Transpt", "", transp, last_basic_block);
!       dump_sbitmap_vector (gcse_file, "st_avloc", "", ae_gen, last_basic_block);
      }
  }
  
Index: haifa-sched.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/haifa-sched.c,v
retrieving revision 1.202
diff -c -3 -p -r1.202 haifa-sched.c
*** haifa-sched.c	23 May 2002 19:23:41 -0000	1.202
--- haifa-sched.c	23 May 2002 21:46:28 -0000
*************** sched_init (dump_file)
*** 2384,2390 ****
      {
        rtx line;
  
!       line_note_head = (rtx *) xcalloc (n_basic_blocks, sizeof (rtx));
  
        /* Save-line-note-head:
           Determine the line-number at the start of each basic block.
--- 2384,2390 ----
      {
        rtx line;
  
!       line_note_head = (rtx *) xcalloc (last_basic_block, sizeof (rtx));
  
        /* Save-line-note-head:
           Determine the line-number at the start of each basic block.
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.91
diff -c -3 -p -r1.91 ifcvt.c
*** ifcvt.c	23 May 2002 19:23:41 -0000	1.91
--- ifcvt.c	23 May 2002 21:46:28 -0000
*************** if_convert (x_life_data_ok)
*** 2700,2706 ****
    post_dominators = NULL;
    if (HAVE_conditional_execution || life_data_ok)
      {
!       post_dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
        calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
      }
    if (life_data_ok)
--- 2700,2706 ----
    post_dominators = NULL;
    if (HAVE_conditional_execution || life_data_ok)
      {
!       post_dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
        calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
      }
    if (life_data_ok)
Index: lcm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/lcm.c,v
retrieving revision 1.43
diff -c -3 -p -r1.43 lcm.c
*** lcm.c	23 May 2002 19:23:41 -0000	1.43
--- lcm.c	23 May 2002 21:46:28 -0000
*************** compute_antinout_edge (antloc, transp, a
*** 119,125 ****
  
    /* We want a maximal solution, so make an optimistic initialization of
       ANTIN.  */
!   sbitmap_vector_ones (antin, n_basic_blocks);
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of ANTIN above.  */
--- 119,125 ----
  
    /* We want a maximal solution, so make an optimistic initialization of
       ANTIN.  */
!   sbitmap_vector_ones (antin, last_basic_block);
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of ANTIN above.  */
*************** compute_laterin (edge_list, earliest, an
*** 264,270 ****
  {
    int num_edges, i;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend, bb;
    unsigned int qlen;
  
    num_edges = NUM_EDGES (edge_list);
--- 264,270 ----
  {
    int num_edges, i;
    edge e;
!   basic_block *worklist, *qin, *qout, *qend, bb, pbb;
    unsigned int qlen;
  
    num_edges = NUM_EDGES (edge_list);
*************** compute_laterin (edge_list, earliest, an
*** 348,357 ****
    /* Computation of insertion and deletion points requires computing LATERIN
       for the EXIT block.  We allocated an extra entry in the LATERIN array
       for just this purpose.  */
!   sbitmap_ones (laterin[n_basic_blocks]);
    for (e = EXIT_BLOCK_PTR->pred; e != NULL; e = e->pred_next)
!     sbitmap_a_and_b (laterin[n_basic_blocks],
! 		     laterin[n_basic_blocks],
  		     later[(size_t) e->aux]);
  
    clear_aux_for_edges ();
--- 348,357 ----
    /* Computation of insertion and deletion points requires computing LATERIN
       for the EXIT block.  We allocated an extra entry in the LATERIN array
       for just this purpose.  */
!   sbitmap_ones (laterin[last_basic_block]);
    for (e = EXIT_BLOCK_PTR->pred; e != NULL; e = e->pred_next)
!     sbitmap_a_and_b (laterin[last_basic_block],
! 		     laterin[last_basic_block],
  		     later[(size_t) e->aux]);
  
    clear_aux_for_edges ();
*************** compute_insert_delete (edge_list, antloc
*** 377,383 ****
        basic_block b = INDEX_EDGE_SUCC_BB (edge_list, x);
  
        if (b == EXIT_BLOCK_PTR)
! 	sbitmap_difference (insert[x], later[x], laterin[n_basic_blocks]);
        else
  	sbitmap_difference (insert[x], later[x], laterin[b->index]);
      }
--- 377,383 ----
        basic_block b = INDEX_EDGE_SUCC_BB (edge_list, x);
  
        if (b == EXIT_BLOCK_PTR)
! 	sbitmap_difference (insert[x], later[x], laterin[last_basic_block]);
        else
  	sbitmap_difference (insert[x], later[x], laterin[b->index]);
      }
*************** pre_edge_lcm (file, n_exprs, transp, avl
*** 413,441 ****
        fprintf (file, "Edge List:\n");
        verify_edge_list (file, edge_list);
        print_edge_list (file, edge_list);
!       dump_sbitmap_vector (file, "transp", "", transp, n_basic_blocks);
!       dump_sbitmap_vector (file, "antloc", "", antloc, n_basic_blocks);
!       dump_sbitmap_vector (file, "avloc", "", avloc, n_basic_blocks);
!       dump_sbitmap_vector (file, "kill", "", kill, n_basic_blocks);
      }
  #endif
  
    /* Compute global availability.  */
!   avin = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
!   avout = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
    compute_available (avloc, kill, avout, avin);
    sbitmap_vector_free (avin);
  
    /* Compute global anticipatability.  */
!   antin = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
!   antout = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
    compute_antinout_edge (antloc, transp, antin, antout);
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
!       dump_sbitmap_vector (file, "antin", "", antin, n_basic_blocks);
!       dump_sbitmap_vector (file, "antout", "", antout, n_basic_blocks);
      }
  #endif
  
--- 413,441 ----
        fprintf (file, "Edge List:\n");
        verify_edge_list (file, edge_list);
        print_edge_list (file, edge_list);
!       dump_sbitmap_vector (file, "transp", "", transp, last_basic_block);
!       dump_sbitmap_vector (file, "antloc", "", antloc, last_basic_block);
!       dump_sbitmap_vector (file, "avloc", "", avloc, last_basic_block);
!       dump_sbitmap_vector (file, "kill", "", kill, last_basic_block);
      }
  #endif
  
    /* Compute global availability.  */
!   avin = sbitmap_vector_alloc (last_basic_block, n_exprs);
!   avout = sbitmap_vector_alloc (last_basic_block, n_exprs);
    compute_available (avloc, kill, avout, avin);
    sbitmap_vector_free (avin);
  
    /* Compute global anticipatability.  */
!   antin = sbitmap_vector_alloc (last_basic_block, n_exprs);
!   antout = sbitmap_vector_alloc (last_basic_block, n_exprs);
    compute_antinout_edge (antloc, transp, antin, antout);
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
!       dump_sbitmap_vector (file, "antin", "", antin, last_basic_block);
!       dump_sbitmap_vector (file, "antout", "", antout, last_basic_block);
      }
  #endif
  
*************** pre_edge_lcm (file, n_exprs, transp, avl
*** 455,467 ****
    later = sbitmap_vector_alloc (num_edges, n_exprs);
  
    /* Allocate an extra element for the exit block in the laterin vector.  */
!   laterin = sbitmap_vector_alloc (n_basic_blocks + 1, n_exprs);
    compute_laterin (edge_list, earliest, antloc, later, laterin);
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
!       dump_sbitmap_vector (file, "laterin", "", laterin, n_basic_blocks + 1);
        dump_sbitmap_vector (file, "later", "", later, num_edges);
      }
  #endif
--- 455,467 ----
    later = sbitmap_vector_alloc (num_edges, n_exprs);
  
    /* Allocate an extra element for the exit block in the laterin vector.  */
!   laterin = sbitmap_vector_alloc (last_basic_block + 1, n_exprs);
    compute_laterin (edge_list, earliest, antloc, later, laterin);
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
!       dump_sbitmap_vector (file, "laterin", "", laterin, last_basic_block + 1);
        dump_sbitmap_vector (file, "later", "", later, num_edges);
      }
  #endif
*************** pre_edge_lcm (file, n_exprs, transp, avl
*** 469,475 ****
    sbitmap_vector_free (earliest);
  
    *insert = sbitmap_vector_alloc (num_edges, n_exprs);
!   *delete = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
    compute_insert_delete (edge_list, antloc, later, laterin, *insert, *delete);
  
    sbitmap_vector_free (laterin);
--- 469,475 ----
    sbitmap_vector_free (earliest);
  
    *insert = sbitmap_vector_alloc (num_edges, n_exprs);
!   *delete = sbitmap_vector_alloc (last_basic_block, n_exprs);
    compute_insert_delete (edge_list, antloc, later, laterin, *insert, *delete);
  
    sbitmap_vector_free (laterin);
*************** pre_edge_lcm (file, n_exprs, transp, avl
*** 480,486 ****
      {
        dump_sbitmap_vector (file, "pre_insert_map", "", *insert, num_edges);
        dump_sbitmap_vector (file, "pre_delete_map", "", *delete,
! 			   n_basic_blocks);
      }
  #endif
  
--- 480,486 ----
      {
        dump_sbitmap_vector (file, "pre_insert_map", "", *insert, num_edges);
        dump_sbitmap_vector (file, "pre_delete_map", "", *delete,
! 			   last_basic_block);
      }
  #endif
  
*************** compute_available (avloc, kill, avout, a
*** 505,511 ****
      = (basic_block *) xmalloc (sizeof (basic_block) * n_basic_blocks);
  
    /* We want a maximal solution.  */
!   sbitmap_vector_ones (avout, n_basic_blocks);
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of AVOUT above.  */
--- 505,511 ----
      = (basic_block *) xmalloc (sizeof (basic_block) * n_basic_blocks);
  
    /* We want a maximal solution.  */
!   sbitmap_vector_ones (avout, last_basic_block);
  
    /* Put every block on the worklist; this is necessary because of the
       optimistic initialization of AVOUT above.  */
*************** compute_nearerout (edge_list, farthest, 
*** 625,631 ****
  {
    int num_edges, i;
    edge e;
!   basic_block *worklist, *tos, bb;
  
    num_edges = NUM_EDGES (edge_list);
  
--- 625,631 ----
  {
    int num_edges, i;
    edge e;
!   basic_block *worklist, *tos, bb, pbb;
  
    num_edges = NUM_EDGES (edge_list);
  
*************** compute_nearerout (edge_list, farthest, 
*** 689,698 ****
    /* Computation of insertion and deletion points requires computing NEAREROUT
       for the ENTRY block.  We allocated an extra entry in the NEAREROUT array
       for just this purpose.  */
!   sbitmap_ones (nearerout[n_basic_blocks]);
    for (e = ENTRY_BLOCK_PTR->succ; e != NULL; e = e->succ_next)
!     sbitmap_a_and_b (nearerout[n_basic_blocks],
! 		     nearerout[n_basic_blocks],
  		     nearer[(size_t) e->aux]);
  
    clear_aux_for_edges ();
--- 689,698 ----
    /* Computation of insertion and deletion points requires computing NEAREROUT
       for the ENTRY block.  We allocated an extra entry in the NEAREROUT array
       for just this purpose.  */
!   sbitmap_ones (nearerout[last_basic_block]);
    for (e = ENTRY_BLOCK_PTR->succ; e != NULL; e = e->succ_next)
!     sbitmap_a_and_b (nearerout[last_basic_block],
! 		     nearerout[last_basic_block],
  		     nearer[(size_t) e->aux]);
  
    clear_aux_for_edges ();
*************** compute_rev_insert_delete (edge_list, st
*** 717,723 ****
      {
        basic_block b = INDEX_EDGE_PRED_BB (edge_list, x);
        if (b == ENTRY_BLOCK_PTR)
! 	sbitmap_difference (insert[x], nearer[x], nearerout[n_basic_blocks]);
        else
  	sbitmap_difference (insert[x], nearer[x], nearerout[b->index]);
      }
--- 717,723 ----
      {
        basic_block b = INDEX_EDGE_PRED_BB (edge_list, x);
        if (b == ENTRY_BLOCK_PTR)
! 	sbitmap_difference (insert[x], nearer[x], nearerout[last_basic_block]);
        else
  	sbitmap_difference (insert[x], nearer[x], nearerout[b->index]);
      }
*************** pre_edge_rev_lcm (file, n_exprs, transp,
*** 749,763 ****
    edge_list = create_edge_list ();
    num_edges = NUM_EDGES (edge_list);
  
!   st_antin = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks, n_exprs);
!   st_antout = (sbitmap *) sbitmap_vector_alloc (n_basic_blocks, n_exprs);
!   sbitmap_vector_zero (st_antin, n_basic_blocks);
!   sbitmap_vector_zero (st_antout, n_basic_blocks);
    compute_antinout_edge (st_antloc, transp, st_antin, st_antout);
  
    /* Compute global anticipatability.  */
!   st_avout = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
!   st_avin = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
    compute_available (st_avloc, kill, st_avout, st_avin);
  
  #ifdef LCM_DEBUG_INFO
--- 749,763 ----
    edge_list = create_edge_list ();
    num_edges = NUM_EDGES (edge_list);
  
!   st_antin = (sbitmap *) sbitmap_vector_alloc (last_basic_block, n_exprs);
!   st_antout = (sbitmap *) sbitmap_vector_alloc (last_basic_block, n_exprs);
!   sbitmap_vector_zero (st_antin, last_basic_block);
!   sbitmap_vector_zero (st_antout, last_basic_block);
    compute_antinout_edge (st_antloc, transp, st_antin, st_antout);
  
    /* Compute global anticipatability.  */
!   st_avout = sbitmap_vector_alloc (last_basic_block, n_exprs);
!   st_avin = sbitmap_vector_alloc (last_basic_block, n_exprs);
    compute_available (st_avloc, kill, st_avout, st_avin);
  
  #ifdef LCM_DEBUG_INFO
*************** pre_edge_rev_lcm (file, n_exprs, transp,
*** 766,785 ****
        fprintf (file, "Edge List:\n");
        verify_edge_list (file, edge_list);
        print_edge_list (file, edge_list);
!       dump_sbitmap_vector (file, "transp", "", transp, n_basic_blocks);
!       dump_sbitmap_vector (file, "st_avloc", "", st_avloc, n_basic_blocks);
!       dump_sbitmap_vector (file, "st_antloc", "", st_antloc, n_basic_blocks);
!       dump_sbitmap_vector (file, "st_antin", "", st_antin, n_basic_blocks);
!       dump_sbitmap_vector (file, "st_antout", "", st_antout, n_basic_blocks);
!       dump_sbitmap_vector (file, "st_kill", "", kill, n_basic_blocks);
      }
  #endif
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
!       dump_sbitmap_vector (file, "st_avout", "", st_avout, n_basic_blocks);
!       dump_sbitmap_vector (file, "st_avin", "", st_avin, n_basic_blocks);
      }
  #endif
  
--- 766,785 ----
        fprintf (file, "Edge List:\n");
        verify_edge_list (file, edge_list);
        print_edge_list (file, edge_list);
!       dump_sbitmap_vector (file, "transp", "", transp, last_basic_block);
!       dump_sbitmap_vector (file, "st_avloc", "", st_avloc, last_basic_block);
!       dump_sbitmap_vector (file, "st_antloc", "", st_antloc, last_basic_block);
!       dump_sbitmap_vector (file, "st_antin", "", st_antin, last_basic_block);
!       dump_sbitmap_vector (file, "st_antout", "", st_antout, last_basic_block);
!       dump_sbitmap_vector (file, "st_kill", "", kill, last_basic_block);
      }
  #endif
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
!       dump_sbitmap_vector (file, "st_avout", "", st_avout, last_basic_block);
!       dump_sbitmap_vector (file, "st_avin", "", st_avin, last_basic_block);
      }
  #endif
  
*************** pre_edge_rev_lcm (file, n_exprs, transp,
*** 802,815 ****
    nearer = sbitmap_vector_alloc (num_edges, n_exprs);
  
    /* Allocate an extra element for the entry block.  */
!   nearerout = sbitmap_vector_alloc (n_basic_blocks + 1, n_exprs);
    compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout);
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
        dump_sbitmap_vector (file, "nearerout", "", nearerout,
! 			   n_basic_blocks + 1);
        dump_sbitmap_vector (file, "nearer", "", nearer, num_edges);
      }
  #endif
--- 802,815 ----
    nearer = sbitmap_vector_alloc (num_edges, n_exprs);
  
    /* Allocate an extra element for the entry block.  */
!   nearerout = sbitmap_vector_alloc (last_basic_block + 1, n_exprs);
    compute_nearerout (edge_list, farthest, st_avloc, nearer, nearerout);
  
  #ifdef LCM_DEBUG_INFO
    if (file)
      {
        dump_sbitmap_vector (file, "nearerout", "", nearerout,
! 			   last_basic_block + 1);
        dump_sbitmap_vector (file, "nearer", "", nearer, num_edges);
      }
  #endif
*************** pre_edge_rev_lcm (file, n_exprs, transp,
*** 817,823 ****
    sbitmap_vector_free (farthest);
  
    *insert = sbitmap_vector_alloc (num_edges, n_exprs);
!   *delete = sbitmap_vector_alloc (n_basic_blocks, n_exprs);
    compute_rev_insert_delete (edge_list, st_avloc, nearer, nearerout,
  			     *insert, *delete);
  
--- 817,823 ----
    sbitmap_vector_free (farthest);
  
    *insert = sbitmap_vector_alloc (num_edges, n_exprs);
!   *delete = sbitmap_vector_alloc (last_basic_block, n_exprs);
    compute_rev_insert_delete (edge_list, st_avloc, nearer, nearerout,
  			     *insert, *delete);
  
*************** pre_edge_rev_lcm (file, n_exprs, transp,
*** 829,835 ****
      {
        dump_sbitmap_vector (file, "pre_insert_map", "", *insert, num_edges);
        dump_sbitmap_vector (file, "pre_delete_map", "", *delete,
! 			   n_basic_blocks);
      }
  #endif
    return edge_list;
--- 829,835 ----
      {
        dump_sbitmap_vector (file, "pre_insert_map", "", *insert, num_edges);
        dump_sbitmap_vector (file, "pre_delete_map", "", *delete,
! 			   last_basic_block);
      }
  #endif
    return edge_list;
*************** optimize_mode_switching (file)
*** 1030,1037 ****
  
    clear_bb_flags ();
  #ifdef NORMAL_MODE
!   /* Increment n_basic_blocks before allocating bb_info.  */
!   n_basic_blocks++;
  #endif
  
    for (e = N_ENTITIES - 1, n_entities = 0; e >= 0; e--)
--- 1030,1037 ----
  
    clear_bb_flags ();
  #ifdef NORMAL_MODE
!   /* Increment last_basic_block before allocating bb_info.  */
!   last_basic_block++;
  #endif
  
    for (e = N_ENTITIES - 1, n_entities = 0; e >= 0; e--)
*************** optimize_mode_switching (file)
*** 1039,1045 ****
        {
  	/* Create the list of segments within each basic block.  */
  	bb_info[n_entities]
! 	  = (struct bb_info *) xcalloc (n_basic_blocks, sizeof **bb_info);
  	entity_map[n_entities++] = e;
  	if (num_modes[e] > max_num_modes)
  	  max_num_modes = num_modes[e];
--- 1039,1045 ----
        {
  	/* Create the list of segments within each basic block.  */
  	bb_info[n_entities]
! 	  = (struct bb_info *) xcalloc (last_basic_block, sizeof **bb_info);
  	entity_map[n_entities++] = e;
  	if (num_modes[e] > max_num_modes)
  	  max_num_modes = num_modes[e];
*************** optimize_mode_switching (file)
*** 1047,1053 ****
  
  #ifdef NORMAL_MODE
    /* Decrement it back in case we return below.  */
!   n_basic_blocks--;
  #endif
  
    if (! n_entities)
--- 1047,1053 ----
  
  #ifdef NORMAL_MODE
    /* Decrement it back in case we return below.  */
!   last_basic_block--;
  #endif
  
    if (! n_entities)
*************** optimize_mode_switching (file)
*** 1059,1078 ****
       EXIT_BLOCK isn't optimized away.  We do this by incrementing the
       basic block count, growing the VARRAY of basic_block_info and
       appending the EXIT_BLOCK_PTR to it.  */
!   n_basic_blocks++;
!   if (VARRAY_SIZE (basic_block_info) < n_basic_blocks)
!     VARRAY_GROW (basic_block_info, n_basic_blocks);
!   BASIC_BLOCK (n_basic_blocks - 1) = EXIT_BLOCK_PTR;
!   EXIT_BLOCK_PTR->index = n_basic_blocks - 1;
  #endif
  
    /* Create the bitmap vectors.  */
  
!   antic = sbitmap_vector_alloc (n_basic_blocks, n_entities);
!   transp = sbitmap_vector_alloc (n_basic_blocks, n_entities);
!   comp = sbitmap_vector_alloc (n_basic_blocks, n_entities);
  
!   sbitmap_vector_ones (transp, n_basic_blocks);
  
    for (j = n_entities - 1; j >= 0; j--)
      {
--- 1059,1078 ----
       EXIT_BLOCK isn't optimized away.  We do this by incrementing the
       basic block count, growing the VARRAY of basic_block_info and
       appending the EXIT_BLOCK_PTR to it.  */
!   last_basic_block++;
!   if (VARRAY_SIZE (basic_block_info) < last_basic_block)
!     VARRAY_GROW (basic_block_info, last_basic_block);
!   BASIC_BLOCK (last_basic_block - 1) = EXIT_BLOCK_PTR;
!   EXIT_BLOCK_PTR->index = last_basic_block - 1;
  #endif
  
    /* Create the bitmap vectors.  */
  
!   antic = sbitmap_vector_alloc (last_basic_block, n_entities);
!   transp = sbitmap_vector_alloc (last_basic_block, n_entities);
!   comp = sbitmap_vector_alloc (last_basic_block, n_entities);
  
!   sbitmap_vector_ones (transp, last_basic_block);
  
    for (j = n_entities - 1; j >= 0; j--)
      {
*************** optimize_mode_switching (file)
*** 1169,1182 ****
  #endif /* NORMAL_MODE */
      }
  
!   kill = sbitmap_vector_alloc (n_basic_blocks, n_entities);
    for (i = 0; i < max_num_modes; i++)
      {
        int current_mode[N_ENTITIES];
  
        /* Set the anticipatable and computing arrays.  */
!       sbitmap_vector_zero (antic, n_basic_blocks);
!       sbitmap_vector_zero (comp, n_basic_blocks);
        for (j = n_entities - 1; j >= 0; j--)
  	{
  	  int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
--- 1169,1182 ----
  #endif /* NORMAL_MODE */
      }
  
!   kill = sbitmap_vector_alloc (last_basic_block, n_entities);
    for (i = 0; i < max_num_modes; i++)
      {
        int current_mode[N_ENTITIES];
  
        /* Set the anticipatable and computing arrays.  */
!       sbitmap_vector_zero (antic, last_basic_block);
!       sbitmap_vector_zero (comp, last_basic_block);
        for (j = n_entities - 1; j >= 0; j--)
  	{
  	  int m = current_mode[j] = MODE_PRIORITY_TO_MODE (entity_map[j], i);
*************** optimize_mode_switching (file)
*** 1301,1310 ****
        int no_mode = num_modes[entity_map[j]];
  
  #ifdef NORMAL_MODE
!       if (bb_info[j][n_basic_blocks].seginfo->mode != no_mode)
  	{
  	  edge eg;
! 	  struct seginfo *ptr = bb_info[j][n_basic_blocks].seginfo;
  
  	  for (eg = EXIT_BLOCK_PTR->pred; eg; eg = eg->pred_next)
  	    {
--- 1301,1310 ----
        int no_mode = num_modes[entity_map[j]];
  
  #ifdef NORMAL_MODE
!       if (bb_info[j][last_basic_block].seginfo->mode != no_mode)
  	{
  	  edge eg;
! 	  struct seginfo *ptr = bb_info[j][last_basic_block].seginfo;
  
  	  for (eg = EXIT_BLOCK_PTR->pred; eg; eg = eg->pred_next)
  	    {
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.68
diff -c -3 -p -r1.68 predict.c
*** predict.c	23 May 2002 19:23:42 -0000	1.68
--- predict.c	23 May 2002 21:46:28 -0000
*************** estimate_probability (loops_info)
*** 412,419 ****
    basic_block bb;
    int i;
  
!   dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
!   post_dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
    calculate_dominance_info (NULL, dominators, CDI_DOMINATORS);
    calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
  
--- 412,419 ----
    basic_block bb;
    int i;
  
!   dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
!   post_dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
    calculate_dominance_info (NULL, dominators, CDI_DOMINATORS);
    calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
  
*************** process_note_prediction (bb, heads, domi
*** 756,762 ****
  
    /* Now find the edge that leads to our branch and aply the prediction.  */
  
!   if (y == n_basic_blocks)
      return;
    for (e = BASIC_BLOCK (y)->succ; e; e = e->succ_next)
      if (e->dest->index >= 0
--- 756,762 ----
  
    /* Now find the edge that leads to our branch and aply the prediction.  */
  
!   if (y == last_basic_block)
      return;
    for (e = BASIC_BLOCK (y)->succ; e; e = e->succ_next)
      if (e->dest->index >= 0
*************** note_prediction_to_br_prob ()
*** 841,855 ****
    add_noreturn_fake_exit_edges ();
    connect_infinite_loops_to_exit ();
  
!   dominators = xmalloc (sizeof (int) * n_basic_blocks);
!   memset (dominators, -1, sizeof (int) * n_basic_blocks);
!   post_dominators = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
    calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
    calculate_dominance_info (dominators, NULL, CDI_DOMINATORS);
  
!   heads = xmalloc (sizeof (int) * n_basic_blocks);
!   memset (heads, -1, sizeof (int) * n_basic_blocks);
!   heads[ENTRY_BLOCK_PTR->next_bb->index] = n_basic_blocks;
  
    /* Process all prediction notes.  */
  
--- 841,855 ----
    add_noreturn_fake_exit_edges ();
    connect_infinite_loops_to_exit ();
  
!   dominators = xmalloc (sizeof (int) * last_basic_block);
!   memset (dominators, -1, sizeof (int) * last_basic_block);
!   post_dominators = sbitmap_vector_alloc (last_basic_block, last_basic_block);
    calculate_dominance_info (NULL, post_dominators, CDI_POST_DOMINATORS);
    calculate_dominance_info (dominators, NULL, CDI_DOMINATORS);
  
!   heads = xmalloc (sizeof (int) * last_basic_block);
!   memset (heads, -1, sizeof (int) * last_basic_block);
!   heads[ENTRY_BLOCK_PTR->next_bb->index] = last_basic_block;
  
    /* Process all prediction notes.  */
  
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.89
diff -c -3 -p -r1.89 profile.c
*** profile.c	23 May 2002 19:23:42 -0000	1.89
--- profile.c	23 May 2002 21:46:28 -0000
*************** struct bb_info
*** 73,83 ****
  /* Keep all basic block indexes nonnegative in the gcov output.  Index 0
     is used for entry block, last block exit block.  */
  #define GCOV_INDEX_TO_BB(i)  ((i) == 0 ? ENTRY_BLOCK_PTR		\
! 			      : (((i) == n_basic_blocks + 1)		\
  			         ? EXIT_BLOCK_PTR : BASIC_BLOCK ((i)-1)))
  #define BB_TO_GCOV_INDEX(bb)  ((bb) == ENTRY_BLOCK_PTR ? 0		\
  			       : ((bb) == EXIT_BLOCK_PTR		\
! 				  ? n_basic_blocks + 1 : (bb)->index + 1))
  
  /* Instantiate the profile info structure.  */
  
--- 73,83 ----
  /* Keep all basic block indexes nonnegative in the gcov output.  Index 0
     is used for entry block, last block exit block.  */
  #define GCOV_INDEX_TO_BB(i)  ((i) == 0 ? ENTRY_BLOCK_PTR		\
! 			      : (((i) == last_basic_block + 1)		\
  			         ? EXIT_BLOCK_PTR : BASIC_BLOCK ((i)-1)))
  #define BB_TO_GCOV_INDEX(bb)  ((bb) == ENTRY_BLOCK_PTR ? 0		\
  			       : ((bb) == EXIT_BLOCK_PTR		\
! 				  ? last_basic_block + 1 : (bb)->index + 1))
  
  /* Instantiate the profile info structure.  */
  
Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.155
diff -c -3 -p -r1.155 recog.c
*** recog.c	23 May 2002 19:23:42 -0000	1.155
--- recog.c	23 May 2002 21:46:29 -0000
*************** split_all_insns (upd_life)
*** 2729,2735 ****
    int changed;
    basic_block bb;
  
!   blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
    changed = 0;
  
--- 2729,2735 ----
    int changed;
    basic_block bb;
  
!   blocks = sbitmap_alloc (last_basic_block);
    sbitmap_zero (blocks);
    changed = 0;
  
*************** peephole2_optimize (dump_file)
*** 3013,3019 ****
    live = INITIALIZE_REG_SET (rs_heads[i]);
  
  #ifdef HAVE_conditional_execution
!   blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
    changed = false;
  #else
--- 3013,3019 ----
    live = INITIALIZE_REG_SET (rs_heads[i]);
  
  #ifdef HAVE_conditional_execution
!   blocks = sbitmap_alloc (last_basic_block);
    sbitmap_zero (blocks);
    changed = false;
  #else
Index: regrename.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regrename.c,v
retrieving revision 1.52
diff -c -3 -p -r1.52 regrename.c
*** regrename.c	23 May 2002 19:23:44 -0000	1.52
--- regrename.c	23 May 2002 21:46:29 -0000
*************** copyprop_hardreg_forward ()
*** 1729,1735 ****
  
    need_refresh = false;
  
!   all_vd = xmalloc (sizeof (struct value_data) * n_basic_blocks);
  
    FOR_EACH_BB (bb)
      {
--- 1729,1735 ----
  
    need_refresh = false;
  
!   all_vd = xmalloc (sizeof (struct value_data) * last_basic_block);
  
    FOR_EACH_BB (bb)
      {
Index: resource.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/resource.c,v
retrieving revision 1.57
diff -c -3 -p -r1.57 resource.c
*** resource.c	23 May 2002 19:23:45 -0000	1.57
--- resource.c	23 May 2002 21:46:29 -0000
*************** init_resource_info (epilogue_insn)
*** 1240,1246 ****
    /* Allocate and initialize the tables used by mark_target_live_regs.  */
    target_hash_table = (struct target_info **)
      xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *));
!   bb_ticks = (int *) xcalloc (n_basic_blocks, sizeof (int));
  }
  \f
  /* Free up the resources allcated to mark_target_live_regs ().  This
--- 1240,1246 ----
    /* Allocate and initialize the tables used by mark_target_live_regs.  */
    target_hash_table = (struct target_info **)
      xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *));
!   bb_ticks = (int *) xcalloc (last_basic_block, sizeof (int));
  }
  \f
  /* Free up the resources allcated to mark_target_live_regs ().  This
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.41
diff -c -3 -p -r1.41 sched-rgn.c
*** sched-rgn.c	23 May 2002 19:23:46 -0000	1.41
--- sched-rgn.c	23 May 2002 21:46:29 -0000
*************** build_control_flow (edge_list)
*** 403,410 ****
      }
  
    /* ??? We can kill these soon.  */
!   in_edges = (int *) xcalloc (n_basic_blocks, sizeof (int));
!   out_edges = (int *) xcalloc (n_basic_blocks, sizeof (int));
    edge_table = (haifa_edge *) xcalloc (num_edges, sizeof (haifa_edge));
  
    nr_edges = 0;
--- 403,410 ----
      }
  
    /* ??? We can kill these soon.  */
!   in_edges = (int *) xcalloc (last_basic_block, sizeof (int));
!   out_edges = (int *) xcalloc (last_basic_block, sizeof (int));
    edge_table = (haifa_edge *) xcalloc (num_edges, sizeof (haifa_edge));
  
    nr_edges = 0;
*************** find_rgns (edge_list, dom)
*** 661,683 ****
       STACK, SP and DFS_NR are only used during the first traversal.  */
  
    /* Allocate and initialize variables for the first traversal.  */
!   max_hdr = (int *) xmalloc (n_basic_blocks * sizeof (int));
!   dfs_nr = (int *) xcalloc (n_basic_blocks, sizeof (int));
    stack = (int *) xmalloc (nr_edges * sizeof (int));
  
!   inner = sbitmap_alloc (n_basic_blocks);
    sbitmap_ones (inner);
  
!   header = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (header);
  
    passed = sbitmap_alloc (nr_edges);
    sbitmap_zero (passed);
  
!   in_queue = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (in_queue);
  
!   in_stack = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (in_stack);
  
    for (i = 0; i < n_basic_blocks; i++)
--- 661,683 ----
       STACK, SP and DFS_NR are only used during the first traversal.  */
  
    /* Allocate and initialize variables for the first traversal.  */
!   max_hdr = (int *) xmalloc (last_basic_block * sizeof (int));
!   dfs_nr = (int *) xcalloc (last_basic_block, sizeof (int));
    stack = (int *) xmalloc (nr_edges * sizeof (int));
  
!   inner = sbitmap_alloc (last_basic_block);
    sbitmap_ones (inner);
  
!   header = sbitmap_alloc (last_basic_block);
    sbitmap_zero (header);
  
    passed = sbitmap_alloc (nr_edges);
    sbitmap_zero (passed);
  
!   in_queue = sbitmap_alloc (last_basic_block);
    sbitmap_zero (in_queue);
  
!   in_stack = sbitmap_alloc (last_basic_block);
    sbitmap_zero (in_stack);
  
    for (i = 0; i < n_basic_blocks; i++)
*************** compute_trg_info (trg)
*** 1197,1204 ****
  	     add the TO block to the update block list.  This list can end
  	     up with a lot of duplicates.  We need to weed them out to avoid
  	     overrunning the end of the bblst_table.  */
! 	  update_blocks = (char *) alloca (n_basic_blocks);
! 	  memset (update_blocks, 0, n_basic_blocks);
  
  	  update_idx = 0;
  	  for (j = 0; j < el.nr_members; j++)
--- 1197,1204 ----
  	     add the TO block to the update block list.  This list can end
  	     up with a lot of duplicates.  We need to weed them out to avoid
  	     overrunning the end of the bblst_table.  */
! 	  update_blocks = (char *) alloca (last_basic_block);
! 	  memset (update_blocks, 0, last_basic_block);
  
  	  update_idx = 0;
  	  for (j = 0; j < el.nr_members; j++)
*************** init_regions ()
*** 2890,2897 ****
    nr_regions = 0;
    rgn_table = (region *) xmalloc ((n_basic_blocks) * sizeof (region));
    rgn_bb_table = (int *) xmalloc ((n_basic_blocks) * sizeof (int));
!   block_to_bb = (int *) xmalloc ((n_basic_blocks) * sizeof (int));
!   containing_rgn = (int *) xmalloc ((n_basic_blocks) * sizeof (int));
  
    /* Compute regions for scheduling.  */
    if (reload_completed
--- 2890,2897 ----
    nr_regions = 0;
    rgn_table = (region *) xmalloc ((n_basic_blocks) * sizeof (region));
    rgn_bb_table = (int *) xmalloc ((n_basic_blocks) * sizeof (int));
!   block_to_bb = (int *) xmalloc ((last_basic_block) * sizeof (int));
!   containing_rgn = (int *) xmalloc ((last_basic_block) * sizeof (int));
  
    /* Compute regions for scheduling.  */
    if (reload_completed
*************** init_regions ()
*** 2912,2918 ****
  	  sbitmap *dom;
  	  struct edge_list *edge_list;
  
! 	  dom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
  
  	  /* The scheduler runs after flow; therefore, we can't blindly call
  	     back into find_basic_blocks since doing so could invalidate the
--- 2912,2918 ----
  	  sbitmap *dom;
  	  struct edge_list *edge_list;
  
! 	  dom = sbitmap_vector_alloc (last_basic_block, last_basic_block);
  
  	  /* The scheduler runs after flow; therefore, we can't blindly call
  	     back into find_basic_blocks since doing so could invalidate the
*************** init_regions ()
*** 2953,2959 ****
  
    if (CHECK_DEAD_NOTES)
      {
!       blocks = sbitmap_alloc (n_basic_blocks);
        deaths_in_region = (int *) xmalloc (sizeof (int) * nr_regions);
        /* Remove all death notes from the subroutine.  */
        for (rgn = 0; rgn < nr_regions; rgn++)
--- 2953,2959 ----
  
    if (CHECK_DEAD_NOTES)
      {
!       blocks = sbitmap_alloc (last_basic_block);
        deaths_in_region = (int *) xmalloc (sizeof (int) * nr_regions);
        /* Remove all death notes from the subroutine.  */
        for (rgn = 0; rgn < nr_regions; rgn++)
*************** schedule_insns (dump_file)
*** 3021,3032 ****
    compute_bb_for_insn (get_max_uid ());
  
    any_large_regions = 0;
!   large_region_blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (large_region_blocks);
    FOR_EACH_BB (bb)
      SET_BIT (large_region_blocks, bb->index);
  
!   blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (blocks);
  
    /* Update life information.  For regions consisting of multiple blocks
--- 3021,3032 ----
    compute_bb_for_insn (get_max_uid ());
  
    any_large_regions = 0;
!   large_region_blocks = sbitmap_alloc (last_basic_block);
    sbitmap_zero (large_region_blocks);
    FOR_EACH_BB (bb)
      SET_BIT (large_region_blocks, bb->index);
  
!   blocks = sbitmap_alloc (last_basic_block);
    sbitmap_zero (blocks);
  
    /* Update life information.  For regions consisting of multiple blocks
Index: ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa-ccp.c,v
retrieving revision 1.22
diff -c -3 -p -r1.22 ssa-ccp.c
*** ssa-ccp.c	23 May 2002 19:23:47 -0000	1.22
--- ssa-ccp.c	23 May 2002 21:46:29 -0000
*************** ssa_const_prop ()
*** 1016,1022 ****
    ssa_edges = sbitmap_alloc (VARRAY_SIZE (ssa_definition));
    sbitmap_zero (ssa_edges);
  
!   executable_blocks = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (executable_blocks);
  
    executable_edges = sbitmap_alloc (NUM_EDGES (edges));
--- 1016,1022 ----
    ssa_edges = sbitmap_alloc (VARRAY_SIZE (ssa_definition));
    sbitmap_zero (ssa_edges);
  
!   executable_blocks = sbitmap_alloc (last_basic_block);
    sbitmap_zero (executable_blocks);
  
    executable_edges = sbitmap_alloc (NUM_EDGES (edges));
Index: ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa-dce.c,v
retrieving revision 1.17
diff -c -3 -p -r1.17 ssa-dce.c
*** ssa-dce.c	23 May 2002 19:23:48 -0000	1.17
--- ssa-dce.c	23 May 2002 21:46:29 -0000
*************** ssa_eliminate_dead_code ()
*** 506,512 ****
    mark_all_insn_unnecessary ();
    VARRAY_RTX_INIT (unprocessed_instructions, 64,
  		   "unprocessed instructions");
!   cdbte = control_dependent_block_to_edge_map_create (n_basic_blocks);
  
    /* Prepare for use of BLOCK_NUM ().  */
    connect_infinite_loops_to_exit ();
--- 506,512 ----
    mark_all_insn_unnecessary ();
    VARRAY_RTX_INIT (unprocessed_instructions, 64,
  		   "unprocessed instructions");
!   cdbte = control_dependent_block_to_edge_map_create (last_basic_block);
  
    /* Prepare for use of BLOCK_NUM ().  */
    connect_infinite_loops_to_exit ();
*************** ssa_eliminate_dead_code ()
*** 514,525 ****
    compute_bb_for_insn (max_insn_uid);
  
    /* Compute control dependence.  */
!   pdom = (int *) xmalloc (n_basic_blocks * sizeof (int));
!   for (i = 0; i < n_basic_blocks; ++i)
      pdom[i] = INVALID_BLOCK;
    calculate_dominance_info (pdom, NULL, CDI_POST_DOMINATORS);
    /* Assume there is a path from each node to the exit block.  */
!   for (i = 0; i < n_basic_blocks; ++i)
      if (pdom[i] == INVALID_BLOCK)
        pdom[i] = EXIT_BLOCK;
    el = create_edge_list ();
--- 514,525 ----
    compute_bb_for_insn (max_insn_uid);
  
    /* Compute control dependence.  */
!   pdom = (int *) xmalloc (last_basic_block * sizeof (int));
!   for (i = 0; i < last_basic_block; ++i)
      pdom[i] = INVALID_BLOCK;
    calculate_dominance_info (pdom, NULL, CDI_POST_DOMINATORS);
    /* Assume there is a path from each node to the exit block.  */
!   for (i = 0; i < last_basic_block; ++i)
      if (pdom[i] == INVALID_BLOCK)
        pdom[i] = EXIT_BLOCK;
    el = create_edge_list ();
Index: ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ssa.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 ssa.c
*** ssa.c	23 May 2002 19:23:49 -0000	1.48
--- ssa.c	23 May 2002 21:46:29 -0000
*************** compute_dominance_frontiers (frontiers, 
*** 559,565 ****
       sbitmap *frontiers;
       int *idom;
  {
!   sbitmap done = sbitmap_alloc (n_basic_blocks);
    sbitmap_zero (done);
  
    compute_dominance_frontiers_1 (frontiers, idom, 0, done);
--- 559,565 ----
       sbitmap *frontiers;
       int *idom;
  {
!   sbitmap done = sbitmap_alloc (last_basic_block);
    sbitmap_zero (done);
  
    compute_dominance_frontiers_1 (frontiers, idom, 0, done);
*************** compute_iterated_dominance_frontiers (id
*** 585,591 ****
    sbitmap worklist;
    int reg, passes = 0;
  
!   worklist = sbitmap_alloc (n_basic_blocks);
  
    for (reg = 0; reg < nregs; ++reg)
      {
--- 585,591 ----
    sbitmap worklist;
    int reg, passes = 0;
  
!   worklist = sbitmap_alloc (last_basic_block);
  
    for (reg = 0; reg < nregs; ++reg)
      {
*************** convert_to_ssa ()
*** 1150,1157 ****
       dead code.  We'll let the SSA optimizers do that.  */
    life_analysis (get_insns (), NULL, 0);
  
!   idom = (int *) alloca (n_basic_blocks * sizeof (int));
!   memset ((void *) idom, -1, (size_t) n_basic_blocks * sizeof (int));
    calculate_dominance_info (idom, NULL, CDI_DOMINATORS);
  
    if (rtl_dump_file)
--- 1150,1157 ----
       dead code.  We'll let the SSA optimizers do that.  */
    life_analysis (get_insns (), NULL, 0);
  
!   idom = (int *) alloca (last_basic_block * sizeof (int));
!   memset ((void *) idom, -1, (size_t) last_basic_block * sizeof (int));
    calculate_dominance_info (idom, NULL, CDI_DOMINATORS);
  
    if (rtl_dump_file)
*************** convert_to_ssa ()
*** 1164,1176 ****
  
    /* Compute dominance frontiers.  */
  
!   dfs = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
    compute_dominance_frontiers (dfs, idom);
  
    if (rtl_dump_file)
      {
        dump_sbitmap_vector (rtl_dump_file, ";; Dominance Frontiers:",
! 			   "; Basic Block", dfs, n_basic_blocks);
        fflush (rtl_dump_file);
      }
  
--- 1164,1176 ----
  
    /* Compute dominance frontiers.  */
  
!   dfs = sbitmap_vector_alloc (last_basic_block, last_basic_block);
    compute_dominance_frontiers (dfs, idom);
  
    if (rtl_dump_file)
      {
        dump_sbitmap_vector (rtl_dump_file, ";; Dominance Frontiers:",
! 			   "; Basic Block", dfs, last_basic_block);
        fflush (rtl_dump_file);
      }
  
*************** convert_to_ssa ()
*** 1178,1189 ****
  
    ssa_max_reg_num = max_reg_num ();
    nregs = ssa_max_reg_num;
!   evals = sbitmap_vector_alloc (nregs, n_basic_blocks);
    find_evaluations (evals, nregs);
  
    /* Compute the iterated dominance frontier for each register.  */
  
!   idfs = sbitmap_vector_alloc (nregs, n_basic_blocks);
    compute_iterated_dominance_frontiers (idfs, dfs, evals, nregs);
  
    if (rtl_dump_file)
--- 1178,1189 ----
  
    ssa_max_reg_num = max_reg_num ();
    nregs = ssa_max_reg_num;
!   evals = sbitmap_vector_alloc (nregs, last_basic_block);
    find_evaluations (evals, nregs);
  
    /* Compute the iterated dominance frontier for each register.  */
  
!   idfs = sbitmap_vector_alloc (nregs, last_basic_block);
    compute_iterated_dominance_frontiers (idfs, dfs, evals, nregs);
  
    if (rtl_dump_file)

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal, part 4
  2002-05-23 16:27                                     ` Basic block renumbering removal, part 4 Zdenek Dvorak
@ 2002-05-25 21:41                                       ` Richard Henderson
  2002-05-27 15:12                                         ` Zdenek Dvorak
  2002-12-19 11:24                                         ` [PATCH] rtlopt merge part 1 -- loop analysis Zdenek Dvorak
  0 siblings, 2 replies; 33+ messages in thread
From: Richard Henderson @ 2002-05-25 21:41 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Fri, May 24, 2002 at 12:49:02AM +0200, Zdenek Dvorak wrote:
> This patch introduces new variable (last_basic_block) containing length
> of basic block array (for now it is #defined as alias for n_basic_blocks).

Ok.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal, part 4
  2002-05-25 21:41                                       ` Richard Henderson
@ 2002-05-27 15:12                                         ` Zdenek Dvorak
  2002-05-27 16:33                                           ` Richard Henderson
  2002-12-19 11:24                                         ` [PATCH] rtlopt merge part 1 -- loop analysis Zdenek Dvorak
  1 sibling, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-05-27 15:12 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-pdo, gcc-patches

Hello.

This patch finally removes basic block renumbering and uses this fact on
several places.

Bootstrapped on i686 and SUN Ultra 60, regtested on i686.

Zdenek Dvorak

Changelog:
	* basic-block.h (last_basic_block): Declare.
	(expunge_block_nocompact): Declaration removed.
	(compact_blocks): Declare.
	* cfg.c (last_basic_block): New variable.
	(expunge_block_nocompact): Removed.
	(expunge_block): Do not compact basic blocks.
	(compact_blocks): New.
	* cfganal.c (flow_call_edges_add): Use the fact that bb indices no
	longer change.
	* cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Set
	last_basic_block.
	* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Do not change
	real positions of blocks.
	(delete_unreachable_blocks): Simplified -- quadratic behavior now
	cannot occur.
	(cleanup_cfg): Compact blocks.
	* cfgrtl.c (create_basic_block): Insert basic blocks to the end of
	basic_block_info varray.
	(flow_delete_block): Comment update.
	(back_edge_of_syntactic_loop_p): Modify position check code.
	(verify_flow_info): Update checking.
	* flow.c (calculate_global_regs_live): Use FOR_EACH_BB.
	* ifcvt.c (SET_ORIG_INDEX, ORIG_INDEX): Removed.
	(find_if_case_1, find_if_case_2, if_convert): Use the fact that bb
	indices no longer change.
	* lcm.c (optimize_mode_switching): Replace n_basic_blocks with
	last_basic_block.
	* predict.c (estimate_bb_frequencies): Remove unneccessary code.
	* profile.c (branch_prob): Compact blocks.
	* sched-rgn.c (find_rgns): Replace n_basic_blocks with
	last_basic_block.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.148
diff -c -3 -p -r1.148 basic-block.h
*** basic-block.h	27 May 2002 13:45:09 -0000	1.148
--- basic-block.h	27 May 2002 17:19:00 -0000
*************** extern int n_basic_blocks;
*** 235,241 ****
  
  /* First free basic block number.  */
  
! #define last_basic_block n_basic_blocks
  
  /* Number of edges in the current function.  */
  
--- 235,241 ----
  
  /* First free basic block number.  */
  
! extern int last_basic_block;
  
  /* Number of edges in the current function.  */
  
*************** extern void allocate_bb_life_data	PARAMS
*** 670,676 ****
  extern void expunge_block		PARAMS ((basic_block));
  extern void link_block			PARAMS ((basic_block, basic_block));
  extern void unlink_block		PARAMS ((basic_block));
! extern void expunge_block_nocompact	PARAMS ((basic_block));
  extern basic_block alloc_block		PARAMS ((void));
  extern void find_unreachable_blocks	PARAMS ((void));
  extern int delete_noop_moves		PARAMS ((rtx));
--- 670,676 ----
  extern void expunge_block		PARAMS ((basic_block));
  extern void link_block			PARAMS ((basic_block, basic_block));
  extern void unlink_block		PARAMS ((basic_block));
! extern void compact_blocks		PARAMS ((void));
  extern basic_block alloc_block		PARAMS ((void));
  extern void find_unreachable_blocks	PARAMS ((void));
  extern int delete_noop_moves		PARAMS ((rtx));
Index: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 cfg.c
*** cfg.c	26 May 2002 19:05:52 -0000	1.31
--- cfg.c	27 May 2002 17:19:00 -0000
*************** static char *flow_firstobj;
*** 65,70 ****
--- 65,74 ----
  
  int n_basic_blocks;
  
+ /* First free basic block number.  */
+ 
+ int last_basic_block;
+ 
  /* Number of edges in the current function.  */
  
  int n_edges;
*************** unlink_block (b)
*** 243,281 ****
    b->prev_bb->next_bb = b->next_bb;
  }
  
  
! /* Remove block B from the basic block array and compact behind it.  */
  
  void
! expunge_block_nocompact (b)
       basic_block b;
  {
    unlink_block (b);
  
    /* Invalidate data to make bughunting easier.  */
    memset (b, 0, sizeof *b);
    b->index = -3;
    b->succ = (edge) first_deleted_block;
    first_deleted_block = (basic_block) b;
- }
- 
- void
- expunge_block (b)
-      basic_block b;
- {
-   int i, n = n_basic_blocks;
- 
-   for (i = b->index; i + 1 < n; ++i)
-     {
-       basic_block x = BASIC_BLOCK (i + 1);
-       BASIC_BLOCK (i) = x;
-       x->index = i;
-     }
- 
-   n_basic_blocks--;
-   basic_block_info->num_elements--;
- 
-   expunge_block_nocompact (b);
  }
  \f
  /* Create an edge connecting SRC and DST with FLAGS optionally using
--- 247,289 ----
    b->prev_bb->next_bb = b->next_bb;
  }
  
+ /* Sequentially order blocks and compact the arrays.  */
+ void
+ compact_blocks ()
+ {
+   int i;
+   basic_block bb;
+  
+   i = 0;
+   FOR_EACH_BB (bb)
+     {
+       BASIC_BLOCK (i) = bb;
+       bb->index = i;
+       i++;
+     }
+ 
+   if (i != n_basic_blocks)
+     abort ();
+ 
+   last_basic_block = n_basic_blocks;
+ }
+ 
  
! /* Remove block B from the basic block array.  */
  
  void
! expunge_block (b)
       basic_block b;
  {
    unlink_block (b);
+   BASIC_BLOCK (b->index) = NULL;
+   n_basic_blocks--;
  
    /* Invalidate data to make bughunting easier.  */
    memset (b, 0, sizeof *b);
    b->index = -3;
    b->succ = (edge) first_deleted_block;
    first_deleted_block = (basic_block) b;
  }
  \f
  /* Create an edge connecting SRC and DST with FLAGS optionally using
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.23
diff -c -3 -p -r1.23 cfganal.c
*** cfganal.c	27 May 2002 13:45:10 -0000	1.23
--- cfganal.c	27 May 2002 17:19:00 -0000
*************** flow_call_edges_add (blocks)
*** 258,286 ****
  {
    int i;
    int blocks_split = 0;
!   int bb_num = 0;
!   basic_block *bbs, bb;
    bool check_last_block = false;
  
!   /* Map bb indices into basic block pointers since split_block
!      will renumber the basic blocks.  */
! 
!   bbs = xmalloc (n_basic_blocks * sizeof (*bbs));
  
    if (! blocks)
!     {
!       FOR_EACH_BB (bb)
! 	bbs[bb_num++] = bb;
! 
!       check_last_block = true;
!     }
    else
!     EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
! 			       {
! 				 bbs[bb_num++] = BASIC_BLOCK (i);
! 				 if (i == n_basic_blocks - 1)
! 				   check_last_block = true;
! 			       });
  
    /* In the last basic block, before epilogue generation, there will be
       a fallthru edge to EXIT.  Special care is required if the last insn
--- 258,273 ----
  {
    int i;
    int blocks_split = 0;
!   int last_bb = last_basic_block;
    bool check_last_block = false;
  
!   if (n_basic_blocks == 0)
!     return 0;
  
    if (! blocks)
!     check_last_block = true;
    else
!     check_last_block = TEST_BIT (blocks, EXIT_BLOCK_PTR->prev_bb->index);
  
    /* In the last basic block, before epilogue generation, there will be
       a fallthru edge to EXIT.  Special care is required if the last insn
*************** flow_call_edges_add (blocks)
*** 321,332 ****
       calls since there is no way that we can determine if they will
       return or not...  */
  
!   for (i = 0; i < bb_num; i++)
      {
!       basic_block bb = bbs[i];
        rtx insn;
        rtx prev_insn;
  
        for (insn = bb->end; ; insn = prev_insn)
  	{
  	  prev_insn = PREV_INSN (insn);
--- 308,325 ----
       calls since there is no way that we can determine if they will
       return or not...  */
  
!   for (i = 0; i < last_bb; i++)
      {
!       basic_block bb = BASIC_BLOCK (i);
        rtx insn;
        rtx prev_insn;
  
+       if (!bb)
+ 	continue;
+ 
+       if (blocks && !TEST_BIT (blocks, i))
+ 	continue;
+ 
        for (insn = bb->end; ; insn = prev_insn)
  	{
  	  prev_insn = PREV_INSN (insn);
*************** flow_call_edges_add (blocks)
*** 374,380 ****
    if (blocks_split)
      verify_flow_info ();
  
-   free (bbs);
    return blocks_split;
  }
  
--- 367,372 ----
Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 cfgbuild.c
*** cfgbuild.c	27 May 2002 13:45:11 -0000	1.20
--- cfgbuild.c	27 May 2002 17:19:00 -0000
*************** find_basic_blocks_1 (f)
*** 471,477 ****
       rtx f;
  {
    rtx insn, next;
-   int i = 0;
    rtx bb_note = NULL_RTX;
    rtx lvl = NULL_RTX;
    rtx trll = NULL_RTX;
--- 471,476 ----
*************** find_basic_blocks_1 (f)
*** 494,500 ****
        if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER)
  	  && head)
  	{
! 	  prev = create_basic_block_structure (i++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
--- 493,499 ----
        if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER)
  	  && head)
  	{
! 	  prev = create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
*************** find_basic_blocks_1 (f)
*** 508,514 ****
  
        if (head && control_flow_insn_p (insn))
  	{
! 	  prev = create_basic_block_structure (i++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
--- 507,513 ----
  
        if (head && control_flow_insn_p (insn))
  	{
! 	  prev = create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
*************** find_basic_blocks_1 (f)
*** 590,600 ****
      }
  
    if (head != NULL_RTX)
!     create_basic_block_structure (i++, head, end, bb_note, prev);
    else if (bb_note)
      delete_insn (bb_note);
  
!   if (i != n_basic_blocks)
      abort ();
  
    label_value_list = lvl;
--- 589,599 ----
      }
  
    if (head != NULL_RTX)
!     create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
    else if (bb_note)
      delete_insn (bb_note);
  
!   if (last_basic_block != n_basic_blocks)
      abort ();
  
    label_value_list = lvl;
*************** find_basic_blocks (f, nregs, file)
*** 635,640 ****
--- 634,640 ----
      }
  
    n_basic_blocks = count_basic_blocks (f);
+   last_basic_block = 0;
    ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
    EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
  
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.60
diff -c -3 -p -r1.60 cfgcleanup.c
*** cfgcleanup.c	23 May 2002 19:23:37 -0000	1.60
--- cfgcleanup.c	27 May 2002 17:19:00 -0000
*************** merge_blocks_move_predecessor_nojumps (a
*** 688,694 ****
       basic_block a, b;
  {
    rtx barrier;
-   int index;
  
    barrier = next_nonnote_insn (a->end);
    if (GET_CODE (barrier) != BARRIER)
--- 688,693 ----
*************** merge_blocks_move_predecessor_nojumps (a
*** 714,727 ****
      fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
  	     a->index, b->index);
  
!   /* Swap the records for the two blocks around.  Although we are deleting B,
!      A is now where B was and we want to compact the BB array from where
!      A used to be.  */
!   BASIC_BLOCK (a->index) = b;
!   BASIC_BLOCK (b->index) = a;
!   index = a->index;
!   a->index = b->index;
!   b->index = index;
  
    unlink_block (a);
    link_block (a, b->prev_bb);
--- 713,719 ----
      fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
  	     a->index, b->index);
  
!   /* Swap the records for the two blocks around.  */
  
    unlink_block (a);
    link_block (a, b->prev_bb);
*************** delete_unreachable_blocks ()
*** 1755,1767 ****
  {
    bool changed = false;
    basic_block b, next_bb;
-   int j = 0;
  
    find_unreachable_blocks ();
  
!   /* Delete all unreachable basic blocks.  Do compaction concurrently,
!      as otherwise we can wind up with O(N^2) behaviour here when we
!      have oodles of dead code.  */
  
    for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
      {
--- 1747,1756 ----
  {
    bool changed = false;
    basic_block b, next_bb;
  
    find_unreachable_blocks ();
  
!   /* Delete all unreachable basic blocks.  */
  
    for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
      {
*************** delete_unreachable_blocks ()
*** 1769,1786 ****
  
        if (!(b->flags & BB_REACHABLE))
  	{
! 	  flow_delete_block_noexpunge (b);
! 	  expunge_block_nocompact (b);
  	  changed = true;
  	}
-       else
- 	{
- 	  BASIC_BLOCK (j) = b;
- 	  b->index = j++;
- 	}
      }
-   n_basic_blocks = j;
-   basic_block_info->num_elements = j;
  
    if (changed)
      tidy_fallthru_edges ();
--- 1758,1767 ----
  
        if (!(b->flags & BB_REACHABLE))
  	{
! 	  flow_delete_block (b);
  	  changed = true;
  	}
      }
  
    if (changed)
      tidy_fallthru_edges ();
*************** cleanup_cfg (mode)
*** 1806,1811 ****
--- 1787,1795 ----
  	  && !reload_completed)
  	delete_trivially_dead_insns (get_insns(), max_reg_num ());
      }
+ 
+   compact_blocks ();
+ 
    while (try_optimize_cfg (mode))
      {
        delete_unreachable_blocks (), changed = true;
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.52
diff -c -3 -p -r1.52 cfgrtl.c
*** cfgrtl.c	27 May 2002 13:45:12 -0000	1.52
--- cfgrtl.c	27 May 2002 17:19:00 -0000
*************** create_basic_block (head, end, after)
*** 336,357 ****
       basic_block after;
  {
    basic_block bb;
!   int i;
!   int index = after->index + 1;
  
!   /* Place the new block just after the block being split.  */
!   VARRAY_GROW (basic_block_info, ++n_basic_blocks);
  
!   /* Some parts of the compiler expect blocks to be number in
!      sequential order so insert the new block immediately after the
!      block being split..  */
!   for (i = n_basic_blocks - 1; i > index; --i)
!     {
!       basic_block tmp = BASIC_BLOCK (i - 1);
! 
!       BASIC_BLOCK (i) = tmp;
!       tmp->index = i;
!     }
  
    bb = create_basic_block_structure (index, head, end, NULL, after);
    bb->aux = NULL;
--- 336,347 ----
       basic_block after;
  {
    basic_block bb;
!   int index = last_basic_block++;
  
!   /* Place the new block just after the end.  */
!   VARRAY_GROW (basic_block_info, last_basic_block);
  
!   n_basic_blocks++;
  
    bb = create_basic_block_structure (index, head, end, NULL, after);
    bb->aux = NULL;
*************** flow_delete_block (b)
*** 435,441 ****
  {
    int deleted_handler = flow_delete_block_noexpunge (b);
  
!   /* Remove the basic block from the array, and compact behind it.  */
    expunge_block (b);
  
    return deleted_handler;
--- 425,431 ----
  {
    int deleted_handler = flow_delete_block_noexpunge (b);
  
!   /* Remove the basic block from the array.  */
    expunge_block (b);
  
    return deleted_handler;
*************** back_edge_of_syntactic_loop_p (bb1, bb2)
*** 1210,1221 ****
  {
    rtx insn;
    int count = 0;
  
!   if (bb1->index > bb2->index)
!     return false;
!   else if (bb1->index == bb2->index)
      return true;
  
    for (insn = bb1->end; insn != bb2->head && count >= 0;
         insn = NEXT_INSN (insn))
      if (GET_CODE (insn) == NOTE)
--- 1200,1216 ----
  {
    rtx insn;
    int count = 0;
+   basic_block bb;
  
!   if (bb1 == bb2)
      return true;
  
+   for (bb = bb1; bb && bb != bb2; bb = bb->next_bb)
+     continue;
+ 
+   if (!bb)
+     return false;
+ 
    for (insn = bb1->end; insn != bb2->head && count >= 0;
         insn = NEXT_INSN (insn))
      if (GET_CODE (insn) == NOTE)
*************** verify_flow_info ()
*** 1708,1714 ****
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int i, num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
--- 1703,1709 ----
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
*************** verify_flow_info ()
*** 1734,1754 ****
  	  err = 1;
  	}
  
-       /* For now, also check that we didn't change the order.  */
-       if (bb != EXIT_BLOCK_PTR && bb->index != last_bb_seen->index + 1)
- 	{
- 	  error ("Wrong order of blocks %d and %d",
- 		 last_bb_seen->index, bb->index);
- 	  err = 1;
- 	}
- 
-       if (bb == EXIT_BLOCK_PTR && last_bb_seen->index != n_basic_blocks - 1)
- 	{
- 	  error ("Only %d of %d blocks in chain",
- 		 last_bb_seen->index + 1, n_basic_blocks);
- 	  err = 1;
- 	}
- 
        last_bb_seen = bb;
      }
  
--- 1729,1734 ----
*************** verify_flow_info ()
*** 2065,2074 ****
        edge_checksum[e->dest->index + 2] -= (size_t) e;
    }
  
!   for (i = -2; i < n_basic_blocks; ++i)
!     if (edge_checksum[i + 2])
        {
! 	error ("basic block %i edge lists are corrupted", i);
  	err = 1;
        }
  
--- 2045,2054 ----
        edge_checksum[e->dest->index + 2] -= (size_t) e;
    }
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     if (edge_checksum[bb->index + 2])
        {
! 	error ("basic block %i edge lists are corrupted", bb->index);
  	err = 1;
        }
  
*************** verify_flow_info ()
*** 2079,2085 ****
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
  	{
! 	  basic_block bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
  	  if (bb != last_bb_seen->next_bb)
--- 2059,2065 ----
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
  	{
! 	  bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
  	  if (bb != last_bb_seen->next_bb)
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.526
diff -c -3 -p -r1.526 flow.c
*** flow.c	27 May 2002 13:45:22 -0000	1.526
--- flow.c	27 May 2002 17:19:01 -0000
*************** calculate_global_regs_live (blocks_in, b
*** 1108,1116 ****
      }
    else
      {
!       for (i = 0; i < n_basic_blocks; ++i)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  *--qhead = bb;
  	  bb->aux = bb;
  	}
--- 1108,1115 ----
      }
    else
      {
!       FOR_EACH_BB (bb)
  	{
  	  *--qhead = bb;
  	  bb->aux = bb;
  	}
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.92
diff -c -3 -p -r1.92 ifcvt.c
*** ifcvt.c	27 May 2002 13:45:29 -0000	1.92
--- ifcvt.c	27 May 2002 17:19:01 -0000
*************** static int dead_or_predicable		PARAMS ((
*** 111,124 ****
  						 basic_block, basic_block, int));
  static void noce_emit_move_insn		PARAMS ((rtx, rtx));
  \f
- /* Abuse the basic_block AUX field to store the original block index,
-    as well as a flag indicating that the block should be rescaned for
-    life analysis.  */
- 
- #define SET_ORIG_INDEX(BB,I)	((BB)->aux = (void *)((size_t)(I)))
- #define ORIG_INDEX(BB)		((size_t)(BB)->aux)
- 
- \f
  /* Count the number of non-jump active insns in BB.  */
  
  static int
--- 111,116 ----
*************** find_if_case_1 (test_bb, then_edge, else
*** 2279,2284 ****
--- 2271,2277 ----
    basic_block then_bb = then_edge->dest;
    basic_block else_bb = else_edge->dest, new_bb;
    edge then_succ = then_bb->succ;
+   int then_bb_index;
  
    /* THEN has one successor.  */
    if (!then_succ || then_succ->succ_next != NULL)
*************** find_if_case_1 (test_bb, then_edge, else
*** 2319,2329 ****
  		    then_bb->global_live_at_end, BITMAP_IOR);
    
    new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb);
    /* Make rest of code believe that the newly created block is the THEN_BB
!      block we are going to remove.  */
    if (new_bb)
!     new_bb->aux = then_bb->aux;
!   flow_delete_block (then_bb);
    /* We've possibly created jump to next insn, cleanup_cfg will solve that
       later.  */
  
--- 2312,2326 ----
  		    then_bb->global_live_at_end, BITMAP_IOR);
    
    new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb);
+   then_bb_index = then_bb->index;
+   flow_delete_block (then_bb);
    /* Make rest of code believe that the newly created block is the THEN_BB
!      block we removed.  */
    if (new_bb)
!     {
!       new_bb->index = then_bb_index;
!       BASIC_BLOCK (then_bb_index) = new_bb;
!     }
    /* We've possibly created jump to next insn, cleanup_cfg will solve that
       later.  */
  
*************** find_if_case_2 (test_bb, then_edge, else
*** 2366,2373 ****
    if (note && INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2)
      ;
    else if (else_succ->dest->index < 0
! 	   || TEST_BIT (post_dominators[ORIG_INDEX (then_bb)], 
! 			ORIG_INDEX (else_succ->dest)))
      ;
    else
      return FALSE;
--- 2363,2370 ----
    if (note && INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2)
      ;
    else if (else_succ->dest->index < 0
! 	   || TEST_BIT (post_dominators[then_bb->index], 
! 			else_succ->dest->index))
      ;
    else
      return FALSE;
*************** if_convert (x_life_data_ok)
*** 2705,2714 ****
      }
    if (life_data_ok)
      clear_bb_flags ();
- 
-   /* Record initial block numbers.  */
-   FOR_EACH_BB (bb)
-     SET_ORIG_INDEX (bb, bb->index);
  
    /* Go through each of the basic blocks looking for things to convert.  */
    FOR_EACH_BB (bb)
--- 2702,2707 ----
Index: lcm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/lcm.c,v
retrieving revision 1.45
diff -c -3 -p -r1.45 lcm.c
*** lcm.c	27 May 2002 13:45:30 -0000	1.45
--- lcm.c	27 May 2002 17:19:01 -0000
*************** optimize_mode_switching (file)
*** 1290,1296 ****
  
  #ifdef NORMAL_MODE
    /* Restore the special status of EXIT_BLOCK.  */
!   n_basic_blocks--;
    VARRAY_POP (basic_block_info);
    EXIT_BLOCK_PTR->index = EXIT_BLOCK;
  #endif
--- 1290,1296 ----
  
  #ifdef NORMAL_MODE
    /* Restore the special status of EXIT_BLOCK.  */
!   last_basic_block--;
    VARRAY_POP (basic_block_info);
    EXIT_BLOCK_PTR->index = EXIT_BLOCK;
  #endif
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.69
diff -c -3 -p -r1.69 predict.c
*** predict.c	27 May 2002 13:45:31 -0000	1.69
--- predict.c	27 May 2002 17:19:01 -0000
*************** estimate_bb_frequencies (loops)
*** 1206,1213 ****
        FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
  	BLOCK_INFO (bb)->tovisit = 1;
  
-       BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
-       BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
        propagate_freq (ENTRY_BLOCK_PTR);
  
        memcpy (&freq_max, &real_zero, sizeof (real_zero));
--- 1206,1211 ----
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 profile.c
*** profile.c	27 May 2002 13:45:34 -0000	1.90
--- profile.c	27 May 2002 17:19:01 -0000
*************** branch_prob ()
*** 831,836 ****
--- 831,839 ----
    num_edges = NUM_EDGES (el);
    alloc_aux_for_edges (sizeof (struct edge_info));
  
+   /* The basic blocks are expected to be numbered sequentially.  */
+   compact_blocks ();
+ 
    ignored_edges = 0;
    for (i = 0 ; i < num_edges ; i++)
      {
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.42
diff -c -3 -p -r1.42 sched-rgn.c
*** sched-rgn.c	27 May 2002 13:45:42 -0000	1.42
--- sched-rgn.c	27 May 2002 17:19:01 -0000
*************** find_rgns (edge_list, dom)
*** 680,686 ****
    in_stack = sbitmap_alloc (last_basic_block);
    sbitmap_zero (in_stack);
  
!   for (i = 0; i < n_basic_blocks; i++)
      max_hdr[i] = -1;
  
    /* DFS traversal to find inner loops in the cfg.  */
--- 680,686 ----
    in_stack = sbitmap_alloc (last_basic_block);
    sbitmap_zero (in_stack);
  
!   for (i = 0; i < last_basic_block; i++)
      max_hdr[i] = -1;
  
    /* DFS traversal to find inner loops in the cfg.  */

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Basic block renumbering removal, part 4
  2002-05-27 15:12                                         ` Zdenek Dvorak
@ 2002-05-27 16:33                                           ` Richard Henderson
  0 siblings, 0 replies; 33+ messages in thread
From: Richard Henderson @ 2002-05-27 16:33 UTC (permalink / raw)
  To: Jan Hubicka, gcc-pdo, gcc-patches

On Mon, May 27, 2002 at 10:25:12PM +0200, Zdenek Dvorak wrote:
> *************** back_edge_of_syntactic_loop_p (bb1, bb2)
> +   for (bb = bb1; bb && bb != bb2; bb = bb->next_bb)
> +     continue;

Please put a ??? comment about arranging for the bb indicies
to be monotonically increasing during this optimization so
that we can compare indicies again.

I seem to recall there was one other place we did a search
as well?  Please mark that one as well.


Otherwise ok.


r~

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [PATCH] rtlopt merge part 1 -- loop analysis
  2002-05-25 21:41                                       ` Richard Henderson
  2002-05-27 15:12                                         ` Zdenek Dvorak
@ 2002-12-19 11:24                                         ` Zdenek Dvorak
  2002-12-19 11:38                                           ` Joseph S. Myers
  1 sibling, 1 reply; 33+ messages in thread
From: Zdenek Dvorak @ 2002-12-19 11:24 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-patches

Hello,

this is the first part of new loop optimizer code; it contains mostly
loop analysis. It also moves things around a bit and introduces several
miscelaneous loop manipulation functions.

It does not change any functionality, but just for sure bootstrapped on
i686.

Zdenek

Changelog:
	* cfgloopanal.c: New file.
	* cfgloopmanip.c: New file.
	* Makefile.in (cfgloopanal.o, cfgloopmanip.o): New.
	(toplev.o, loop.o, doloop.o, unroll.o, cfgloop.o, predict.o,
	cfglayout.o): Add dependency on cfgloop.h.
	(cfgloop.o): Add flags.h dependency.
	* basic-block.h (BB_IRREDUCIBLE_LOOP, BB_SUPERBLOCK): New flags.
	(VLS_EXPECT_PREHEADERS, VLS_EXPECT_SIMPLE_LATCHES): Removed.
	(struct loop, struct loops, flow_loops_find, flow_loops_update,
	flow_loops_free, flow_loops_dump, flow_loop_dump,
	flow_loop_scan, flow_loop_tree_node_add, flow_loop_tree_node_remove,
	LOOP_TREE,,LOOP_PRE_HEADER, LOOP_ENTRY_EDGES, LOOP_EXIT_EDGES,
	LOOP_ALL, flow_loop_outside_edge_p, flow_loop_nested_p,
	flow_bb_inside_loop_p, get_loop_body, loop_preheader_edge,
	loop_latch_edge, add_bb_to_loop, remove_bb_from_loops,
	find_common_loop, verify_loop_structure): Declarations moved to ...
	* cfgloop.h: New file.
	* bb-reorder.c (reorder_basic_blocks): Modified.
	* cfglayout.c: Include cfgloop.h.
	(cleanup_unconditional_jumps, cfg_layout_redirect_edge,
	cfg_layout_duplicate_bb, cfg_layout_initialize): Update loop structure.
	(break_superblocks): New static function.
	(cfg_layout_finalize): Use it.
	(cfg_layout_split_block): New function.
	* cfglayout.h (struct reorder_block_def): Add copy and duplicated
	fields.
	(cfg_layout_initialize, cfg_layout_redirect_edge): Declaration
	changed.
	(cfg_layout_split_block): Declare.
	* cfgloop.c: Include cfgloop.h and flags.h.
	(flow_loop_dump, flow_loops_free, flow_loop_exit_edges_find,
	get_loop_body): Avoid signed versus unsigned comparison warnings.
	(make_forwarder_block, flow_loops_find, loop_preheader_edge,
	loop_latch_edge): Modified.
	(verify_loop_structure): Modified to use flags stored in loop structure;
	check irreducible loops.
	(cancel_loop, cancel_loop_tree): New functions.
	(estimate_probability): Use loop analysis code for predictions.
	(estimate_loops_at_level):  Avoid signed versus unsigned comparison
	warnings.
	* doloop.c: Include cfgloop.h.
	* loop.c: Include cfgloop.h.
	* predict.c: Include cfgloop.h.
	* toplev.c: Include cfgloop.h.
	* unroll.c: Include cfgloop.h.
	* tracer.c (tracer): Modified.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.960
diff -c -3 -p -r1.960 Makefile.in
*** Makefile.in	17 Dec 2002 02:02:48 -0000	1.960
--- Makefile.in	18 Dec 2002 22:23:26 -0000
*************** C_OBJS = c-parse.o c-lang.o c-pretty-pri
*** 745,750 ****
--- 745,751 ----
  
  OBJS = alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o	   \
   cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfglayout.o cfgloop.o		   \
+  cfgloopanal.o cfgloopmanip.o 						   \
   cfgrtl.o combine.o conflict.o convert.o cse.o cselib.o dbxout.o	   \
   debug.o df.o diagnostic.o doloop.o dominance.o		                   \
   dwarf2asm.o dwarf2out.o dwarfout.o emit-rtl.o except.o explow.o	   \
*************** toplev.o : toplev.c $(CONFIG_H) $(SYSTEM
*** 1403,1409 ****
     dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
     graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \
     ssa.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
!    langhooks.h insn-flags.h options.h cfglayout.h real.h
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
  	  -DTARGET_NAME=\"$(target_alias)\" \
  	  -c $(srcdir)/toplev.c $(OUTPUT_OPTION)
--- 1404,1410 ----
     dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
     graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \
     ssa.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
!    langhooks.h insn-flags.h options.h cfglayout.h real.h cfgloop.h
  	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
  	  -DTARGET_NAME=\"$(target_alias)\" \
  	  -c $(srcdir)/toplev.c $(OUTPUT_OPTION)
*************** profile.o : profile.c $(CONFIG_H) $(SYST
*** 1534,1546 ****
     $(TARGET_H) langhooks.h profile.h libfuncs.h gt-profile.h $(HASHTAB_H)
  loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(LOOP_H) \
     insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
!    real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h \
     toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H)
  doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
!    $(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h
  unroll.o : unroll.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) insn-config.h \
     function.h $(INTEGRATE_H) $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) $(LOOP_H) toplev.h \
!    hard-reg-set.h varray.h $(BASIC_BLOCK_H) $(TM_P_H) $(PREDICT_H) $(PARAMS_H)
  flow.o : flow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
     flags.h insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \
     $(RECOG_H) function.h except.h $(EXPR_H) ssa.h $(GGC_H) $(TM_P_H)
--- 1535,1549 ----
     $(TARGET_H) langhooks.h profile.h libfuncs.h gt-profile.h $(HASHTAB_H)
  loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(LOOP_H) \
     insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
!    real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h cfgloop.h \
     toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H)
  doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
!    $(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h \
!    cfgloop.h
  unroll.o : unroll.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) insn-config.h \
     function.h $(INTEGRATE_H) $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) $(LOOP_H) toplev.h \
!    hard-reg-set.h varray.h $(BASIC_BLOCK_H) $(TM_P_H) $(PREDICT_H) $(PARAMS_H) \
!    cfgloop.h
  flow.o : flow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
     flags.h insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \
     $(RECOG_H) function.h except.h $(EXPR_H) ssa.h $(GGC_H) $(TM_P_H)
*************** cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SY
*** 1558,1565 ****
  cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(TIMEVAR_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h $(RECOG_H) toplev.h \
     $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H)
! cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
!    $(BASIC_BLOCK_H) hard-reg-set.h
  dominance.o : dominance.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     hard-reg-set.h $(BASIC_BLOCK_H) et-forest.h
  et-forest.o : et-forest.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) et-forest.h
--- 1561,1572 ----
  cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(TIMEVAR_H) $(BASIC_BLOCK_H) hard-reg-set.h output.h flags.h $(RECOG_H) toplev.h \
     $(GGC_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H)
! cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
!    $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h flags.h
! cfgloopanal.o : cfgloopanal.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
!    $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h $(EXPR_H)
! cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
!    $(BASIC_BLOCK_H) hard-reg-set.h cfgloop.h cfglayout.h output.h
  dominance.o : dominance.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     hard-reg-set.h $(BASIC_BLOCK_H) et-forest.h
  et-forest.o : et-forest.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) et-forest.h
*************** reg-stack.o : reg-stack.c $(CONFIG_H) $(
*** 1642,1648 ****
  predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
     flags.h insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \
     $(RECOG_H) function.h except.h $(EXPR_H) $(TM_P_H) $(PREDICT_H) real.h \
!    $(PARAMS_H) $(TARGET_H)
  lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(RTL_H) $(GGC_H)
  bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(TREE_H) flags.h $(BASIC_BLOCK_H) hard-reg-set.h output.h cfglayout.h $(TARGET_H)
--- 1649,1655 ----
  predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
     flags.h insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h \
     $(RECOG_H) function.h except.h $(EXPR_H) $(TM_P_H) $(PREDICT_H) real.h \
!    $(PARAMS_H) $(TARGET_H) cfgloop.h
  lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(RTL_H) $(GGC_H)
  bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
     $(TREE_H) flags.h $(BASIC_BLOCK_H) hard-reg-set.h output.h cfglayout.h $(TARGET_H)
*************** tracer.o : tracer.c $(CONFIG_H) $(SYSTEM
*** 1651,1657 ****
     $(PARAMS_H) profile.h
  cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
     insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h function.h \
!    cfglayout.h
  timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TIMEVAR_H) flags.h \
     intl.h
  regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
--- 1658,1664 ----
     $(PARAMS_H) profile.h
  cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
     insn-config.h $(BASIC_BLOCK_H) hard-reg-set.h output.h function.h \
!    cfglayout.h cfgloop.h
  timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TIMEVAR_H) flags.h \
     intl.h
  regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.162
diff -c -3 -p -r1.162 basic-block.h
*** basic-block.h	16 Dec 2002 18:18:59 -0000	1.162
--- basic-block.h	18 Dec 2002 22:23:26 -0000
*************** typedef struct edge_def {
*** 152,157 ****
--- 152,160 ----
  
  #define EDGE_COMPLEX	(EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)
  
+ /* Declared in cfgloop.h.  */
+ struct loop;
+ struct loops;
  
  /* A basic block is a sequence of instructions with only entry and
     only one exit.  If any one of the instructions are executed, they
*************** typedef struct basic_block_def {
*** 239,244 ****
--- 242,249 ----
  #define BB_NEW			2
  #define BB_REACHABLE		4
  #define BB_VISITED		8
+ #define BB_IRREDUCIBLE_LOOP	16
+ #define BB_SUPERBLOCK		32
  
  /* Number of basic blocks in the current function.  */
  
*************** extern void tidy_fallthru_edges		PARAMS 
*** 359,364 ****
--- 364,372 ----
  extern void flow_reverse_top_sort_order_compute	PARAMS ((int *));
  extern int flow_depth_first_order_compute	PARAMS ((int *, int *));
  extern void flow_preorder_transversal_compute	PARAMS ((int *));
+ extern int dfs_enumerate_from		PARAMS ((basic_block, int,
+ 						bool (*)(basic_block, void *),
+ 						basic_block *, int, void *));
  extern void dump_edge_info		PARAMS ((FILE *, edge, int));
  extern void clear_edges			PARAMS ((void));
  extern void mark_critical_edges		PARAMS ((void));
*************** extern rtx first_insn_after_basic_block_
*** 368,532 ****
  
  typedef struct dominance_info *dominance_info;
  
- /* Structure to hold information for each natural loop.  */
- struct loop
- {
-   /* Index into loops array.  */
-   int num;
- 
-   /* Basic block of loop header.  */
-   basic_block header;
- 
-   /* Basic block of loop latch.  */
-   basic_block latch;
- 
-   /* Basic block of loop pre-header or NULL if it does not exist.  */
-   basic_block pre_header;
- 
-   /* Array of edges along the pre-header extended basic block trace.
-      The source of the first edge is the root node of pre-header
-      extended basic block, if it exists.  */
-   edge *pre_header_edges;
- 
-   /* Number of edges along the pre_header extended basic block trace.  */
-   int num_pre_header_edges;
- 
-   /* The first block in the loop.  This is not necessarily the same as
-      the loop header.  */
-   basic_block first;
- 
-   /* The last block in the loop.  This is not necessarily the same as
-      the loop latch.  */
-   basic_block last;
- 
-   /* Bitmap of blocks contained within the loop.  */
-   sbitmap nodes;
- 
-   /* Number of blocks contained within the loop.  */
-   int num_nodes;
- 
-   /* Array of edges that enter the loop.  */
-   edge *entry_edges;
- 
-   /* Number of edges that enter the loop.  */
-   int num_entries;
- 
-   /* Array of edges that exit the loop.  */
-   edge *exit_edges;
- 
-   /* Number of edges that exit the loop.  */
-   int num_exits;
- 
-   /* Bitmap of blocks that dominate all exits of the loop.  */
-   sbitmap exits_doms;
- 
-   /* The loop nesting depth.  */
-   int depth;
- 
-   /* Superloops of the loop.  */
-   struct loop **pred;
- 
-   /* The height of the loop (enclosed loop levels) within the loop
-      hierarchy tree.  */
-   int level;
- 
-   /* The outer (parent) loop or NULL if outermost loop.  */
-   struct loop *outer;
- 
-   /* The first inner (child) loop or NULL if innermost loop.  */
-   struct loop *inner;
- 
-   /* Link to the next (sibling) loop.  */
-   struct loop *next;
- 
-   /* Nonzero if the loop is invalid (e.g., contains setjmp.).  */
-   int invalid;
- 
-   /* Auxiliary info specific to a pass.  */
-   void *aux;
- 
-   /* The following are currently used by loop.c but they are likely to
-      disappear as loop.c is converted to use the CFG.  */
- 
-   /* Nonzero if the loop has a NOTE_INSN_LOOP_VTOP.  */
-   rtx vtop;
- 
-   /* Nonzero if the loop has a NOTE_INSN_LOOP_CONT.
-      A continue statement will generate a branch to NEXT_INSN (cont).  */
-   rtx cont;
- 
-   /* The NOTE_INSN_LOOP_BEG.  */
-   rtx start;
- 
-   /* The NOTE_INSN_LOOP_END.  */
-   rtx end;
- 
-   /* For a rotated loop that is entered near the bottom,
-      this is the label at the top.  Otherwise it is zero.  */
-   rtx top;
- 
-   /* Place in the loop where control enters.  */
-   rtx scan_start;
- 
-   /* The position where to sink insns out of the loop.  */
-   rtx sink;
- 
-   /* List of all LABEL_REFs which refer to code labels outside the
-      loop.  Used by routines that need to know all loop exits, such as
-      final_biv_value and final_giv_value.
- 
-      This does not include loop exits due to return instructions.
-      This is because all bivs and givs are pseudos, and hence must be
-      dead after a return, so the presense of a return does not affect
-      any of the optimizations that use this info.  It is simpler to
-      just not include return instructions on this list.  */
-   rtx exit_labels;
- 
-   /* The number of LABEL_REFs on exit_labels for this loop and all
-      loops nested inside it.  */
-   int exit_count;
- };
- 
- 
- /* Structure to hold CFG information about natural loops within a function.  */
- struct loops
- {
-   /* Number of natural loops in the function.  */
-   int num;
- 
-   /* Maxium nested loop level in the function.  */
-   int levels;
- 
-   /* Array of natural loop descriptors (scanning this array in reverse order
-      will find the inner loops before their enclosing outer loops).  */
-   struct loop *array;
- 
-   /* The above array is unused in new loop infrastructure and is kept only for
-      purposes of the old loop optimizer.  Instead we store just pointers to
-      loops here.  */
-   struct loop **parray;
- 
-   /* Pointer to root of loop heirachy tree.  */
-   struct loop *tree_root;
- 
-   /* Information derived from the CFG.  */
-   struct cfg
-   {
-     /* The bitmap vector of dominators or NULL if not computed.  */
-     dominance_info dom;
- 
-     /* The ordering of the basic blocks in a depth first search.  */
-     int *dfs_order;
- 
-     /* The reverse completion ordering of the basic blocks found in a
-        depth first search.  */
-     int *rc_order;
-   } cfg;
- 
-   /* Headers shared by multiple loops that should be merged.  */
-   sbitmap shared_headers;
- };
- 
  /* Structure to group all of the information to process IF-THEN and
     IF-THEN-ELSE blocks for the conditional execution support.  This
     needs to be in a public file in case the IFCVT macros call
--- 376,381 ----
*************** typedef struct ce_if_block
*** 554,572 ****
  
  } ce_if_block_t;
  
- extern int flow_loops_find PARAMS ((struct loops *, int flags));
- extern int flow_loops_update PARAMS ((struct loops *, int flags));
- extern void flow_loops_free PARAMS ((struct loops *));
- extern void flow_loops_dump PARAMS ((const struct loops *, FILE *,
- 				     void (*)(const struct loop *,
- 					      FILE *, int), int));
- extern void flow_loop_dump PARAMS ((const struct loop *, FILE *,
- 				    void (*)(const struct loop *,
- 					     FILE *, int), int));
- extern int flow_loop_scan PARAMS ((struct loops *, struct loop *, int));
- extern void flow_loop_tree_node_add PARAMS ((struct loop *, struct loop *));
- extern void flow_loop_tree_node_remove PARAMS ((struct loop *));
- 
  /* This structure maintains an edge list vector.  */
  struct edge_list
  {
--- 403,408 ----
*************** enum update_life_extent
*** 657,671 ****
  #define CLEANUP_THREADING	64	/* Do jump threading.  */
  #define CLEANUP_NO_INSN_DEL	128	/* Do not try to delete trivially dead
  					   insns.  */
- /* Flags for loop discovery.  */
- 
- #define LOOP_TREE		1	/* Build loop hierarchy tree.  */
- #define LOOP_PRE_HEADER		2	/* Analyse loop pre-header.  */
- #define LOOP_ENTRY_EDGES	4	/* Find entry edges.  */
- #define LOOP_EXIT_EDGES		8	/* Find exit edges.  */
- #define LOOP_EDGES		(LOOP_ENTRY_EDGES | LOOP_EXIT_EDGES)
- #define LOOP_ALL	       15	/* All of the above  */
- 
  extern void life_analysis	PARAMS ((rtx, FILE *, int));
  extern int update_life_info	PARAMS ((sbitmap, enum update_life_extent,
  					 int));
--- 493,498 ----
*************** extern void free_aux_for_edges		PARAMS (
*** 751,774 ****
     debugger, and it is declared extern so we don't get warnings about
     it being unused.  */
  extern void verify_flow_info		PARAMS ((void));
- extern bool flow_loop_outside_edge_p	PARAMS ((const struct loop *, edge));
- extern bool flow_loop_nested_p PARAMS ((const struct loop *, const struct loop *));
- extern bool flow_bb_inside_loop_p       PARAMS ((const struct loop *, basic_block));
- extern basic_block *get_loop_body       PARAMS ((const struct loop *));
- extern int dfs_enumerate_from           PARAMS ((basic_block, int,
- 				         bool (*)(basic_block, void *),
- 					 basic_block *, int, void *));
- 
- extern edge loop_preheader_edge PARAMS ((struct loop *));
- extern edge loop_latch_edge PARAMS ((struct loop *));
- 
- extern void add_bb_to_loop PARAMS ((basic_block, struct loop *));
- extern void remove_bb_from_loops PARAMS ((basic_block));
- extern struct loop * find_common_loop PARAMS ((struct loop *, struct loop *));
- 
- extern void verify_loop_structure PARAMS ((struct loops *, int));
- #define VLS_EXPECT_PREHEADERS 1
- #define VLS_EXPECT_SIMPLE_LATCHES 2
  
  typedef struct conflict_graph_def *conflict_graph;
  
--- 578,583 ----
Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 bb-reorder.c
*** bb-reorder.c	16 Dec 2002 18:18:59 -0000	1.51
--- bb-reorder.c	18 Dec 2002 22:23:26 -0000
*************** reorder_basic_blocks ()
*** 268,274 ****
    if ((* targetm.cannot_modify_jumps_p) ())
      return;
  
!   cfg_layout_initialize ();
  
    make_reorder_chain ();
  
--- 268,274 ----
    if ((* targetm.cannot_modify_jumps_p) ())
      return;
  
!   cfg_layout_initialize (NULL);
  
    make_reorder_chain ();
  
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.24
diff -c -3 -p -r1.24 cfglayout.c
*** cfglayout.c	16 Dec 2002 18:19:07 -0000	1.24
--- cfglayout.c	18 Dec 2002 22:23:26 -0000
*************** Software Foundation, 59 Temple Place - S
*** 31,36 ****
--- 31,37 ----
  #include "function.h"
  #include "obstack.h"
  #include "cfglayout.h"
+ #include "cfgloop.h"
  
  /* The contents of the current function definition are allocated
     in this obstack, and all are freed at the end of the function.  */
*************** static void set_block_levels		PARAMS ((t
*** 48,57 ****
  static void change_scope		PARAMS ((rtx, tree, tree));
  
  void verify_insn_chain			PARAMS ((void));
! static void cleanup_unconditional_jumps	PARAMS ((void));
  static void fixup_fallthru_exit_predecessor PARAMS ((void));
  static rtx unlink_insn_chain PARAMS ((rtx, rtx));
  static rtx duplicate_insn_chain PARAMS ((rtx, rtx));
  \f
  static rtx
  unlink_insn_chain (first, last)
--- 49,59 ----
  static void change_scope		PARAMS ((rtx, tree, tree));
  
  void verify_insn_chain			PARAMS ((void));
! static void cleanup_unconditional_jumps	PARAMS ((struct loops *));
  static void fixup_fallthru_exit_predecessor PARAMS ((void));
  static rtx unlink_insn_chain PARAMS ((rtx, rtx));
  static rtx duplicate_insn_chain PARAMS ((rtx, rtx));
+ static void break_superblocks PARAMS ((void));
  \f
  static rtx
  unlink_insn_chain (first, last)
*************** verify_insn_chain ()
*** 612,621 ****
  /* Remove any unconditional jumps and forwarder block creating fallthru
     edges instead.  During BB reordering, fallthru edges are not required
     to target next basic block in the linear CFG layout, so the unconditional
!    jumps are not needed.  */
  
  static void
! cleanup_unconditional_jumps ()
  {
    basic_block bb;
  
--- 614,625 ----
  /* Remove any unconditional jumps and forwarder block creating fallthru
     edges instead.  During BB reordering, fallthru edges are not required
     to target next basic block in the linear CFG layout, so the unconditional
!    jumps are not needed.  If LOOPS is not null, also update loop structure &
!    dominators.  */
  
  static void
! cleanup_unconditional_jumps (loops)
!      struct loops *loops;
  {
    basic_block bb;
  
*************** cleanup_unconditional_jumps ()
*** 637,642 ****
--- 641,665 ----
  		fprintf (rtl_dump_file, "Removing forwarder BB %i\n",
  			 bb->index);
  
+ 	      if (loops)
+ 		{
+ 		  /* bb cannot be loop header, as it only has one entry
+ 		     edge.  It could be a loop latch.  */
+ 		  if (bb->loop_father->header == bb)
+ 		    abort ();
+ 
+ 		  if (bb->loop_father->latch == bb)
+ 		    bb->loop_father->latch = bb->pred->src;
+ 
+ 		  if (get_immediate_dominator
+ 		      (loops->cfg.dom, bb->succ->dest) == bb)
+ 		    set_immediate_dominator
+ 		      (loops->cfg.dom, bb->succ->dest, bb->pred->src);
+ 
+ 		  remove_bb_from_loops (bb);
+ 		  delete_from_dominance_info (loops->cfg.dom, bb);
+ 		}
+ 
  	      redirect_edge_succ_nodup (bb->pred, bb->succ->dest);
  	      flow_delete_block (bb);
  	      bb = prev;
*************** duplicate_insn_chain (from, to)
*** 822,834 ****
  }
  
  /* Redirect Edge to DEST.  */
! void
  cfg_layout_redirect_edge (e, dest)
       edge e;
       basic_block dest;
  {
    basic_block src = e->src;
    basic_block old_next_bb = src->next_bb;
  
    /* Redirect_edge_and_branch may decide to turn branch into fallthru edge
       in the case the basic block appears to be in sequence.  Avoid this
--- 845,858 ----
  }
  
  /* Redirect Edge to DEST.  */
! bool
  cfg_layout_redirect_edge (e, dest)
       edge e;
       basic_block dest;
  {
    basic_block src = e->src;
    basic_block old_next_bb = src->next_bb;
+   bool ret;
  
    /* Redirect_edge_and_branch may decide to turn branch into fallthru edge
       in the case the basic block appears to be in sequence.  Avoid this
*************** cfg_layout_redirect_edge (e, dest)
*** 849,857 ****
  	    delete_insn (src->end);
  	}
        redirect_edge_succ_nodup (e, dest);
      }
    else
!     redirect_edge_and_branch (e, dest);
  
    /* We don't want simplejumps in the insn stream during cfglayout.  */
    if (simplejump_p (src->end))
--- 873,883 ----
  	    delete_insn (src->end);
  	}
        redirect_edge_succ_nodup (e, dest);
+ 
+       ret = true;
      }
    else
!     ret = redirect_edge_and_branch (e, dest);
  
    /* We don't want simplejumps in the insn stream during cfglayout.  */
    if (simplejump_p (src->end))
*************** cfg_layout_redirect_edge (e, dest)
*** 861,866 ****
--- 887,908 ----
        src->succ->flags |= EDGE_FALLTHRU;
      }
    src->next_bb = old_next_bb;
+ 
+   return ret;
+ }
+ 
+ /* Same as split_block but update cfg_layout structures.  */
+ edge
+ cfg_layout_split_block (bb, insn)
+      basic_block bb;
+      rtx insn;
+ {
+   edge fallthru = split_block (bb, insn);
+ 
+   alloc_aux_for_block (fallthru->dest, sizeof (struct reorder_block_def));
+   RBI (fallthru->dest)->footer = RBI (fallthru->src)->footer;
+   RBI (fallthru->src)->footer = NULL;
+   return fallthru;
  }
  
  /* Create a duplicate of the basic block BB and redirect edge E into it.  */
*************** cfg_layout_duplicate_bb (bb, e)
*** 949,954 ****
--- 991,997 ----
      bb->frequency = 0;
  
    RBI (new_bb)->original = bb;
+   RBI (bb)->copy = new_bb;
    return new_bb;
  }
  \f
*************** cfg_layout_duplicate_bb (bb, e)
*** 956,972 ****
     CFG layout changes.  It keeps LOOPS up-to-date if not null.  */
  
  void
! cfg_layout_initialize ()
  {
    /* Our algorithm depends on fact that there are now dead jumptables
       around the code.  */
    alloc_aux_for_blocks (sizeof (struct reorder_block_def));
  
!   cleanup_unconditional_jumps ();
  
    record_effective_endpoints ();
  }
  
  /* Finalize the changes: reorder insn list according to the sequence, enter
     compensation code, rebuild scope forest.  */
  
--- 999,1045 ----
     CFG layout changes.  It keeps LOOPS up-to-date if not null.  */
  
  void
! cfg_layout_initialize (loops)
!      struct loops *loops;
  {
    /* Our algorithm depends on fact that there are now dead jumptables
       around the code.  */
    alloc_aux_for_blocks (sizeof (struct reorder_block_def));
  
!   cleanup_unconditional_jumps (loops);
  
    record_effective_endpoints ();
  }
  
+ /* Splits superblocks.  */
+ static void
+ break_superblocks ()
+ {
+   sbitmap superblocks;
+   int i, need;
+ 
+   superblocks = sbitmap_alloc (n_basic_blocks);
+   sbitmap_zero (superblocks);
+ 
+   need = 0;
+ 
+   for (i = 0; i < n_basic_blocks; i++)
+     if (BASIC_BLOCK(i)->flags & BB_SUPERBLOCK)
+       {
+ 	BASIC_BLOCK(i)->flags &= ~BB_SUPERBLOCK;
+ 	SET_BIT (superblocks, i);
+ 	need = 1;
+       }
+ 
+   if (need)
+     {
+       rebuild_jump_labels (get_insns ());
+       find_many_sub_basic_blocks (superblocks);
+     }
+ 
+   free (superblocks);
+ }
+ 
  /* Finalize the changes: reorder insn list according to the sequence, enter
     compensation code, rebuild scope forest.  */
  
*************** cfg_layout_finalize ()
*** 981,986 ****
--- 1054,1061 ----
  #endif
  
    free_aux_for_blocks ();
+ 
+   break_superblocks ();
  
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
Index: cfglayout.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 cfglayout.h
*** cfglayout.h	8 May 2002 09:17:17 -0000	1.3
--- cfglayout.h	18 Dec 2002 22:23:26 -0000
*************** typedef struct reorder_block_def
*** 25,30 ****
--- 25,33 ----
    rtx footer;
    basic_block next;
    basic_block original;
+   /* Used by loop copying.  */
+   basic_block copy;
+   int duplicated;
  
    /* These fields are used by bb-reorder pass.  */
    int visited;
*************** typedef struct reorder_block_def
*** 32,41 ****
  
  #define RBI(BB)	((reorder_block_def) (BB)->aux)
  
! extern void cfg_layout_initialize	PARAMS ((void));
  extern void cfg_layout_finalize		PARAMS ((void));
  extern bool cfg_layout_can_duplicate_bb_p PARAMS ((basic_block));
  extern basic_block cfg_layout_duplicate_bb PARAMS ((basic_block, edge));
  extern void scope_to_insns_initialize	PARAMS ((void));
  extern void scope_to_insns_finalize	PARAMS ((void));
! extern void cfg_layout_redirect_edge	PARAMS ((edge, basic_block));
--- 35,45 ----
  
  #define RBI(BB)	((reorder_block_def) (BB)->aux)
  
! extern void cfg_layout_initialize	PARAMS ((struct loops *));
  extern void cfg_layout_finalize		PARAMS ((void));
  extern bool cfg_layout_can_duplicate_bb_p PARAMS ((basic_block));
  extern basic_block cfg_layout_duplicate_bb PARAMS ((basic_block, edge));
  extern void scope_to_insns_initialize	PARAMS ((void));
  extern void scope_to_insns_finalize	PARAMS ((void));
! extern bool cfg_layout_redirect_edge	PARAMS ((edge, basic_block));
! extern edge cfg_layout_split_block	PARAMS ((basic_block, rtx));
Index: cfgloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.c,v
retrieving revision 1.18
diff -c -3 -p -r1.18 cfgloop.c
*** cfgloop.c	16 Dec 2002 18:19:07 -0000	1.18
--- cfgloop.c	18 Dec 2002 22:23:26 -0000
*************** Software Foundation, 59 Temple Place - S
*** 26,31 ****
--- 26,33 ----
  #include "hard-reg-set.h"
  #include "basic-block.h"
  #include "toplev.h"
+ #include "cfgloop.h"
+ #include "flags.h"
  
  /* Ratio of frequencies of edges so that one of more latch edges is
     considered to belong to inner loop with same header.  */
*************** flow_loop_dump (loop, file, loop_dump_au
*** 114,120 ****
       int verbose;
  {
    basic_block *bbs;
!   int i;
  
    if (! loop || ! loop->header)
      return;
--- 116,122 ----
       int verbose;
  {
    basic_block *bbs;
!   unsigned i;
  
    if (! loop || ! loop->header)
      return;
*************** flow_loops_free (loops)
*** 206,212 ****
  {
    if (loops->parray)
      {
!       int i;
  
        if (! loops->num)
  	abort ();
--- 208,214 ----
  {
    if (loops->parray)
      {
!       unsigned i;
  
        if (! loops->num)
  	abort ();
*************** flow_loop_exit_edges_find (loop)
*** 275,281 ****
  {
    edge e;
    basic_block node, *bbs;
!   int num_exits, i;
  
    loop->exit_edges = NULL;
    loop->num_exits = 0;
--- 277,283 ----
  {
    edge e;
    basic_block node, *bbs;
!   unsigned num_exits, i;
  
    loop->exit_edges = NULL;
    loop->num_exits = 0;
*************** make_forwarder_block (bb, redirect_latch
*** 609,614 ****
--- 611,620 ----
  
    insn = PREV_INSN (first_insn_after_basic_block_note (bb));
  
+   /* For empty block split_block will return NULL.  */
+   if (bb->end == insn)
+     emit_note_after (NOTE_INSN_DELETED, insn);
+ 
    fallthru = split_block (bb, insn);
    dummy = fallthru->src;
    bb = fallthru->dest;
*************** flow_loops_find (loops, flags)
*** 925,933 ****
        loops->cfg.dom = NULL;
        free_dominance_info (dom);
      }
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
!   verify_loop_structure (loops, 0);
  #endif
  
    return loops->num;
--- 931,941 ----
        loops->cfg.dom = NULL;
        free_dominance_info (dom);
      }
+ 
+   loops->state = 0;
  #ifdef ENABLE_CHECKING
    verify_flow_info ();
!   verify_loop_structure (loops);
  #endif
  
    return loops->num;
*************** get_loop_body (loop)
*** 991,997 ****
       const struct loop *loop;
  {
    basic_block *tovisit, bb;
!   int tv = 0;
  
    if (!loop->num_nodes)
      abort ();
--- 999,1005 ----
       const struct loop *loop;
  {
    basic_block *tovisit, bb;
!   unsigned tv = 0;
  
    if (!loop->num_nodes)
      abort ();
*************** get_loop_body (loop)
*** 1002,1008 ****
    if (loop->latch == EXIT_BLOCK_PTR)
      {
        /* There may be blocks unreachable from EXIT_BLOCK.  */
!       if (loop->num_nodes != n_basic_blocks + 2)
  	abort ();
        FOR_EACH_BB (bb)
  	tovisit[tv++] = bb;
--- 1010,1016 ----
    if (loop->latch == EXIT_BLOCK_PTR)
      {
        /* There may be blocks unreachable from EXIT_BLOCK.  */
!       if (loop->num_nodes != (unsigned) n_basic_blocks + 2)
  	abort ();
        FOR_EACH_BB (bb)
  	tovisit[tv++] = bb;
*************** find_common_loop (loop_s, loop_d)
*** 1072,1089 ****
    return loop_s;
  }
  
  /* Checks that LOOPS are allright:
       -- sizes of loops are allright
       -- results of get_loop_body really belong to the loop
       -- loop header have just single entry edge and single latch edge
       -- loop latches have only single successor that is header of their loop
    */
  void
! verify_loop_structure (loops, flags)
       struct loops *loops;
-      int flags;
  {
!   int *sizes, i, j;
    basic_block *bbs, bb;
    struct loop *loop;
    int err = 0;
--- 1080,1136 ----
    return loop_s;
  }
  
+ /* Cancels the LOOP; it must be innermost one.  */
+ void
+ cancel_loop (loops, loop)
+      struct loops *loops;
+      struct loop *loop;
+ {
+   basic_block *bbs;
+   unsigned i;
+ 
+   if (loop->inner)
+     abort ();
+ 
+   /* Move blocks up one level (they should be removed as soon as possible).  */
+   bbs = get_loop_body (loop);
+   for (i = 0; i < loop->num_nodes; i++)
+     bbs[i]->loop_father = loop->outer;
+ 
+   /* Remove the loop from structure.  */
+   flow_loop_tree_node_remove (loop);
+ 
+   /* Remove loop from loops array.  */
+   loops->parray[loop->num] = NULL;
+ 
+   /* Free loop data.  */
+   flow_loop_free (loop);
+ }
+ 
+ /* Cancels LOOP and all its subloops.  */
+ void
+ cancel_loop_tree (loops, loop)
+      struct loops *loops;
+      struct loop *loop;
+ {
+   while (loop->inner)
+     cancel_loop_tree (loops, loop->inner);
+   cancel_loop (loops, loop);
+ }
+ 
  /* Checks that LOOPS are allright:
       -- sizes of loops are allright
       -- results of get_loop_body really belong to the loop
       -- loop header have just single entry edge and single latch edge
       -- loop latches have only single successor that is header of their loop
+      -- irreducible loops are correctly marked
    */
  void
! verify_loop_structure (loops)
       struct loops *loops;
  {
!   unsigned *sizes, i, j;
!   sbitmap irreds;
    basic_block *bbs, bb;
    struct loop *loop;
    int err = 0;
*************** verify_loop_structure (loops, flags)
*** 1136,1149 ****
        if (!loop)
  	continue;
  
!       if ((flags & VLS_EXPECT_PREHEADERS)
  	  && (!loop->header->pred->pred_next
  	      || loop->header->pred->pred_next->pred_next))
  	{
  	  error ("Loop %d's header does not have exactly 2 entries.", i);
  	  err = 1;
  	}
!       if (flags & VLS_EXPECT_SIMPLE_LATCHES)
  	{
  	  if (!loop->latch->succ
  	      || loop->latch->succ->succ_next)
--- 1183,1196 ----
        if (!loop)
  	continue;
  
!       if ((loops->state & LOOPS_HAVE_PREHEADERS)
  	  && (!loop->header->pred->pred_next
  	      || loop->header->pred->pred_next->pred_next))
  	{
  	  error ("Loop %d's header does not have exactly 2 entries.", i);
  	  err = 1;
  	}
!       if (loops->state & LOOPS_HAVE_SIMPLE_LATCHES)
  	{
  	  if (!loop->latch->succ
  	      || loop->latch->succ->succ_next)
*************** verify_loop_structure (loops, flags)
*** 1169,1174 ****
--- 1216,1254 ----
  	}
      }
  
+   /* Check irreducible loops.  */
+   if (loops->state & LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS)
+     {
+       /* Record old info.  */
+       irreds = sbitmap_alloc (last_basic_block);
+       FOR_EACH_BB (bb)
+ 	if (bb->flags & BB_IRREDUCIBLE_LOOP)
+ 	  SET_BIT (irreds, bb->index);
+ 	else
+ 	  RESET_BIT (irreds, bb->index);
+ 
+       /* Recount it.  */
+       mark_irreducible_loops (loops);
+ 
+       /* Compare.  */
+       FOR_EACH_BB (bb)
+ 	{
+ 	  if ((bb->flags & BB_IRREDUCIBLE_LOOP)
+ 	      && !TEST_BIT (irreds, bb->index))
+ 	    {
+ 	      error ("Basic block %d should be marked irreducible.", bb->index);
+ 	      err = 1;
+ 	    }
+ 	  else if (!(bb->flags & BB_IRREDUCIBLE_LOOP)
+ 	      && TEST_BIT (irreds, bb->index))
+ 	    {
+ 	      error ("Basic block %d should not be marked irreducible.", bb->index);
+ 	      err = 1;
+ 	    }
+ 	}
+       free (irreds);
+     }
+ 
    if (err)
      abort ();
  }
*************** verify_loop_structure (loops, flags)
*** 1176,1182 ****
  /* Returns latch edge of LOOP.  */
  edge
  loop_latch_edge (loop)
!      struct loop *loop;
  {
    edge e;
  
--- 1256,1262 ----
  /* Returns latch edge of LOOP.  */
  edge
  loop_latch_edge (loop)
!      const struct loop *loop;
  {
    edge e;
  
*************** loop_latch_edge (loop)
*** 1189,1195 ****
  /* Returns preheader edge of LOOP.  */
  edge
  loop_preheader_edge (loop)
!      struct loop *loop;
  {
    edge e;
  
--- 1269,1275 ----
  /* Returns preheader edge of LOOP.  */
  edge
  loop_preheader_edge (loop)
!      const struct loop *loop;
  {
    edge e;
  
Index: doloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doloop.c,v
retrieving revision 1.27
diff -c -3 -p -r1.27 doloop.c
*** doloop.c	16 Dec 2002 18:19:21 -0000	1.27
--- doloop.c	18 Dec 2002 22:23:26 -0000
*************** Software Foundation, 59 Temple Place - S
*** 31,36 ****
--- 31,37 ----
  #include "basic-block.h"
  #include "toplev.h"
  #include "tm_p.h"
+ #include "cfgloop.h"
  
  
  /* This module is used to modify loops with a determinable number of
Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.434
diff -c -3 -p -r1.434 loop.c
*** loop.c	16 Dec 2002 18:19:42 -0000	1.434
--- loop.c	18 Dec 2002 22:23:27 -0000
*************** Software Foundation, 59 Temple Place - S
*** 56,61 ****
--- 56,62 ----
  #include "predict.h"
  #include "insn-flags.h"
  #include "optabs.h"
+ #include "cfgloop.h"
  
  /* Not really meaningful values, but at least something.  */
  #ifndef SIMULTANEOUS_PREFETCHES
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.76
diff -c -3 -p -r1.76 predict.c
*** predict.c	16 Dec 2002 18:19:45 -0000	1.76
--- predict.c	18 Dec 2002 22:23:27 -0000
*************** Software Foundation, 59 Temple Place - S
*** 52,57 ****
--- 52,58 ----
  #include "params.h"
  #include "target.h"
  #include "loop.h"
+ #include "cfgloop.h"
  
  /* real constants: 0, 1, 1-1/REG_BR_PROB_BASE, REG_BR_PROB_BASE, 0.5,
                     REAL_BB_FREQ_MAX.  */
*************** estimate_probability (loops_info)
*** 425,431 ****
  {
    dominance_info dominators, post_dominators;
    basic_block bb;
!   int i;
  
    connect_infinite_loops_to_exit ();
    dominators = calculate_dominance_info (CDI_DOMINATORS);
--- 426,432 ----
  {
    dominance_info dominators, post_dominators;
    basic_block bb;
!   unsigned i;
  
    connect_infinite_loops_to_exit ();
    dominators = calculate_dominance_info (CDI_DOMINATORS);
*************** estimate_probability (loops_info)
*** 436,448 ****
    for (i = 1; i < loops_info->num; i++)
      {
        basic_block bb, *bbs;
!       int j;
        int exits;
        struct loop *loop = loops_info->parray[i];
  
        flow_loop_scan (loops_info, loop, LOOP_EXIT_EDGES);
        exits = loop->num_exits;
  
        bbs = get_loop_body (loop);
        for (j = 0; j < loop->num_nodes; j++)
  	{
--- 437,464 ----
    for (i = 1; i < loops_info->num; i++)
      {
        basic_block bb, *bbs;
!       unsigned j;
        int exits;
        struct loop *loop = loops_info->parray[i];
+       struct loop_desc desc;
+       unsigned HOST_WIDE_INT niter;
  
        flow_loop_scan (loops_info, loop, LOOP_EXIT_EDGES);
        exits = loop->num_exits;
  
+       if (simple_loop_p (loops_info, loop, &desc)
+ 	  && desc.const_iter)
+ 	{
+ 	  niter = desc.niter + 1;
+ 	  if (niter == 0)        /* We might overflow here.  */
+ 	    niter = desc.niter;
+ 
+ 	  predict_edge (desc.in_edge, PRED_LOOP_ITERATIONS,
+ 			REG_BR_PROB_BASE
+ 			- (REG_BR_PROB_BASE + niter /2)
+ 			/ niter);
+ 	}
+ 
        bbs = get_loop_body (loop);
        for (j = 0; j < loop->num_nodes; j++)
  	{
*************** estimate_loops_at_level (first_loop)
*** 1055,1061 ****
      {
        edge e;
        basic_block *bbs;
!       int i;
  
        estimate_loops_at_level (loop->inner);
        
--- 1071,1077 ----
      {
        edge e;
        basic_block *bbs;
!       unsigned i;
  
        estimate_loops_at_level (loop->inner);
        
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.691
diff -c -3 -p -r1.691 toplev.c
*** toplev.c	16 Dec 2002 18:19:59 -0000	1.691
--- toplev.c	18 Dec 2002 22:23:27 -0000
*************** Software Foundation, 59 Temple Place - S
*** 73,78 ****
--- 73,79 ----
  #include "target.h"
  #include "langhooks.h"
  #include "cfglayout.h"
+ #include "cfgloop.h"
  
  #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
  #include "dwarf2out.h"
Index: tracer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tracer.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 tracer.c
*** tracer.c	16 Dec 2002 18:20:00 -0000	1.5
--- tracer.c	18 Dec 2002 22:23:28 -0000
*************** tracer ()
*** 366,372 ****
  {
    if (n_basic_blocks <= 1)
      return;
!   cfg_layout_initialize ();
    mark_dfs_back_edges ();
    if (rtl_dump_file)
      dump_flow_info (rtl_dump_file);
--- 366,372 ----
  {
    if (n_basic_blocks <= 1)
      return;
!   cfg_layout_initialize (NULL);
    mark_dfs_back_edges ();
    if (rtl_dump_file)
      dump_flow_info (rtl_dump_file);
Index: unroll.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unroll.c,v
retrieving revision 1.185
diff -c -3 -p -r1.185 unroll.c
*** unroll.c	16 Dec 2002 18:20:01 -0000	1.185
--- unroll.c	18 Dec 2002 22:23:28 -0000
*************** Software Foundation, 59 Temple Place - S
*** 150,155 ****
--- 150,156 ----
  #include "basic-block.h"
  #include "predict.h"
  #include "params.h"
+ #include "cfgloop.h"
  
  /* The prime factors looked for when trying to unroll a loop by some
     number which is modulo the total number of iterations.  Just checking


and new files:

cfgloop.h:
===================================================
/* Natural loop functions
   Copyright (C) 1987, 1997, 1998, 1999, 2000, 2001, 2002
   Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.  */

/* Structure to hold decision about unrolling/peeling.  */
enum lpt_dec
{
  LPT_NONE,
  LPT_PEEL_COMPLETELY,
  LPT_PEEL_SIMPLE,
  LPT_UNROLL_CONSTANT,
  LPT_UNROLL_RUNTIME,
  LPT_UNROLL_STUPID
};

struct lpt_decision
{
  enum lpt_dec decision;
  unsigned times;
};

/* Description of loop for simple loop unrolling.  */
struct loop_desc
{
  int postincr;		/* 1 if increment/decrement is done after loop exit condition.  */
  rtx stride;		/* Value added to VAR in each iteration.  */
  rtx var;		/* Loop control variable.  */
  rtx var_alts;		/* List of definitions of its initial value.  */
  rtx lim;		/* Expression var is compared with.  */
  rtx lim_alts;		/* List of definitions of its initial value.  */
  bool const_iter;      /* True if it iterates constant number of times.  */
  unsigned HOST_WIDE_INT niter;
			/* Number of iterations if it is constant.  */
  bool may_be_zero;     /* If we cannot determine that the first iteration will pass.  */
  enum rtx_code cond;	/* Exit condition.  */
  int neg;		/* Set to 1 if loop ends when condition is satisfied.  */
  edge out_edge;	/* The exit edge.  */
  edge in_edge;		/* And the other one.  */
  int n_branches;	/* Number of branches inside the loop.  */
};

/* Structure to hold information for each natural loop.  */
struct loop
{
  /* Index into loops array.  */
  int num;

  /* Basic block of loop header.  */
  basic_block header;

  /* Basic block of loop latch.  */
  basic_block latch;

  /* Basic block of loop pre-header or NULL if it does not exist.  */
  basic_block pre_header;

  /* For loop unrolling/peeling decision.  */
  struct lpt_decision lpt_decision;

  /* Simple loop description.  */
  int simple;
  struct loop_desc desc;
  int has_desc;

  /* Number of loop insns.  */
  unsigned ninsns;

  /* Average number of executed insns per iteration.  */
  unsigned av_ninsns;

  /* Array of edges along the pre-header extended basic block trace.
     The source of the first edge is the root node of pre-header
     extended basic block, if it exists.  */
  edge *pre_header_edges;

  /* Number of edges along the pre_header extended basic block trace.  */
  int num_pre_header_edges;

  /* The first block in the loop.  This is not necessarily the same as
     the loop header.  */
  basic_block first;

  /* The last block in the loop.  This is not necessarily the same as
     the loop latch.  */
  basic_block last;

  /* Bitmap of blocks contained within the loop.  */
  sbitmap nodes;

  /* Number of blocks contained within the loop.  */
  unsigned num_nodes;

  /* Array of edges that enter the loop.  */
  edge *entry_edges;

  /* Number of edges that enter the loop.  */
  int num_entries;

  /* Array of edges that exit the loop.  */
  edge *exit_edges;

  /* Number of edges that exit the loop.  */
  int num_exits;

  /* Bitmap of blocks that dominate all exits of the loop.  */
  sbitmap exits_doms;

  /* The loop nesting depth.  */
  int depth;

  /* Superloops of the loop.  */
  struct loop **pred;

  /* The height of the loop (enclosed loop levels) within the loop
     hierarchy tree.  */
  int level;

  /* The outer (parent) loop or NULL if outermost loop.  */
  struct loop *outer;

  /* The first inner (child) loop or NULL if innermost loop.  */
  struct loop *inner;

  /* Link to the next (sibling) loop.  */
  struct loop *next;

  /* Loop that is copy of this loop.  */
  struct loop *copy;

  /* Non-zero if the loop is invalid (e.g., contains setjmp.).  */
  int invalid;

  /* Auxiliary info specific to a pass.  */
  void *aux;

  /* The following are currently used by loop.c but they are likely to
     disappear as loop.c is converted to use the CFG.  */

  /* Non-zero if the loop has a NOTE_INSN_LOOP_VTOP.  */
  rtx vtop;

  /* Non-zero if the loop has a NOTE_INSN_LOOP_CONT.
     A continue statement will generate a branch to NEXT_INSN (cont).  */
  rtx cont;

  /* The dominator of cont.  */
  rtx cont_dominator;

  /* The NOTE_INSN_LOOP_BEG.  */
  rtx start;

  /* The NOTE_INSN_LOOP_END.  */
  rtx end;

  /* For a rotated loop that is entered near the bottom,
     this is the label at the top.  Otherwise it is zero.  */
  rtx top;

  /* Place in the loop where control enters.  */
  rtx scan_start;

  /* The position where to sink insns out of the loop.  */
  rtx sink;

  /* List of all LABEL_REFs which refer to code labels outside the
     loop.  Used by routines that need to know all loop exits, such as
     final_biv_value and final_giv_value.

     This does not include loop exits due to return instructions.
     This is because all bivs and givs are pseudos, and hence must be
     dead after a return, so the presense of a return does not affect
     any of the optimizations that use this info.  It is simpler to
     just not include return instructions on this list.  */
  rtx exit_labels;

  /* The number of LABEL_REFs on exit_labels for this loop and all
     loops nested inside it.  */
  int exit_count;
};

/* Flags for state of loop structure.  */
enum
{
  LOOPS_HAVE_PREHEADERS = 1,
  LOOPS_HAVE_SIMPLE_LATCHES = 2,
  LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS = 4
};

/* Structure to hold CFG information about natural loops within a function.  */
struct loops
{
  /* Number of natural loops in the function.  */
  unsigned num;

  /* Maximum nested loop level in the function.  */
  unsigned levels;

  /* Array of natural loop descriptors (scanning this array in reverse order
     will find the inner loops before their enclosing outer loops).  */
  struct loop *array;

  /* The above array is unused in new loop infrastructure and is kept only for
     purposes of the old loop optimizer.  Instead we store just pointers to
     loops here.  */
  struct loop **parray;

  /* Pointer to root of loop heirachy tree.  */
  struct loop *tree_root;

  /* Information derived from the CFG.  */
  struct cfg
  {
    /* The bitmap vector of dominators or NULL if not computed.  */
    dominance_info dom;

    /* The ordering of the basic blocks in a depth first search.  */
    int *dfs_order;

    /* The reverse completion ordering of the basic blocks found in a
       depth first search.  */
    int *rc_order;
  } cfg;

  /* Headers shared by multiple loops that should be merged.  */
  sbitmap shared_headers;

  /* State of loops.  */
  int state;
};

/* Flags for loop discovery.  */

#define LOOP_TREE		1	/* Build loop hierarchy tree.  */
#define LOOP_PRE_HEADER		2	/* Analyse loop pre-header.  */
#define LOOP_ENTRY_EDGES	4	/* Find entry edges.  */
#define LOOP_EXIT_EDGES		8	/* Find exit edges.  */
#define LOOP_EDGES		(LOOP_ENTRY_EDGES | LOOP_EXIT_EDGES)
#define LOOP_ALL	       15	/* All of the above  */

/* Loop recognition.  */
extern int flow_loops_find		PARAMS ((struct loops *, int flags));
extern int flow_loops_update		PARAMS ((struct loops *, int flags));
extern void flow_loops_free		PARAMS ((struct loops *));
extern void flow_loops_dump		PARAMS ((const struct loops *, FILE *,
						void (*)(const struct loop *,
						FILE *, int), int));
extern void flow_loop_dump		PARAMS ((const struct loop *, FILE *,
						void (*)(const struct loop *,
						FILE *, int), int));
extern int flow_loop_scan		PARAMS ((struct loops *,
						struct loop *, int));
void mark_irreducible_loops		PARAMS ((struct loops *));

/* Loop datastructure manipulation/querying.  */
extern void flow_loop_tree_node_add	PARAMS ((struct loop *, struct loop *));
extern void flow_loop_tree_node_remove	PARAMS ((struct loop *));
extern bool flow_loop_outside_edge_p	PARAMS ((const struct loop *, edge));
extern bool flow_loop_nested_p		PARAMS ((const struct loop *,
						const struct loop *));
extern bool flow_bb_inside_loop_p	PARAMS ((const struct loop *,
						const basic_block));
extern struct loop * find_common_loop	PARAMS ((struct loop *, struct loop *));
extern int num_loop_insns		PARAMS ((struct loop *));
extern int average_num_loop_insns	PARAMS ((struct loop *));

/* Loops & cfg manipulation.  */
extern basic_block *get_loop_body	PARAMS ((const struct loop *));

extern edge loop_preheader_edge		PARAMS ((const struct loop *));
extern edge loop_latch_edge		PARAMS ((const struct loop *));

extern void add_bb_to_loop		PARAMS ((basic_block, struct loop *));
extern void remove_bb_from_loops	PARAMS ((basic_block));

extern void cancel_loop			PARAMS ((struct loops *, struct loop *));
extern void cancel_loop_tree		PARAMS ((struct loops *, struct loop *));

extern basic_block loop_split_edge_with PARAMS ((edge, rtx, struct loops *));

enum
{
  CP_SIMPLE_PREHEADERS = 1,
  CP_INSIDE_CFGLAYOUT = 2
};

extern void create_preheaders		PARAMS ((struct loops *, int));
extern void force_single_succ_latches	PARAMS ((struct loops *));

extern void verify_loop_structure	PARAMS ((struct loops *));

/* Loop analysis.  */
extern bool simple_loop_p		PARAMS ((struct loops *, struct loop *,
						struct loop_desc *));
extern rtx count_loop_iterations	PARAMS ((struct loop_desc *, rtx, rtx));
extern bool just_once_each_iteration_p	PARAMS ((struct loops *,struct loop *,
						 basic_block));
extern unsigned expected_loop_iterations PARAMS ((const struct loop *));

cfgloopanal.c:
==============================================================
/* Natural loop analysis code for GNU compiler.
   Copyright (C) 2002 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.  */

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "expr.h"
#include "output.h"

struct unmark_altered_insn_data;
static void unmark_altered	 PARAMS ((rtx, rtx, regset));
static void blocks_invariant_registers PARAMS ((basic_block *, int, regset));
static void unmark_altered_insn	 PARAMS ((rtx, rtx, struct unmark_altered_insn_data *));
static void blocks_single_set_registers PARAMS ((basic_block *, int, rtx *));
static int invariant_rtx_wrto_regs_p_helper PARAMS ((rtx *, regset));
static bool invariant_rtx_wrto_regs_p PARAMS ((rtx, regset));
static rtx test_for_iteration PARAMS ((struct loop_desc *desc,
				       unsigned HOST_WIDE_INT));
static bool constant_iterations PARAMS ((struct loop_desc *,
					 unsigned HOST_WIDE_INT *,
					 bool *));
static bool simple_loop_exit_p PARAMS ((struct loops *, struct loop *,
					edge, regset, rtx *,
					struct loop_desc *));
static rtx variable_initial_value PARAMS ((rtx, regset, rtx, rtx *));
static rtx variable_initial_values PARAMS ((edge, rtx));
static bool simple_condition_p PARAMS ((struct loop *, rtx,
					regset, struct loop_desc *));
static basic_block simple_increment PARAMS ((struct loops *, struct loop *,
					     rtx *, struct loop_desc *));

/* Checks whether BB is executed exactly once in each LOOP iteration.  */
bool
just_once_each_iteration_p (loops, loop, bb)
     struct loops *loops;
     struct loop *loop;
     basic_block bb;
{
  /* It must be executed at least once each iteration.  */
  if (!dominated_by_p (loops->cfg.dom, loop->latch, bb))
    return false;

  /* And just once.  */
  if (bb->loop_father != loop)
    return false;

  /* But this was not enough.  We might have some irreducible loop here.  */
  if (bb->flags & BB_IRREDUCIBLE_LOOP)
    return false;

  return true;
}


/* Unmarks modified registers; helper to blocks_invariant_registers.  */
static void
unmark_altered (what, by, regs)
     rtx what;
     rtx by ATTRIBUTE_UNUSED;
     regset regs;
{
  if (GET_CODE (what) == SUBREG)
    what = SUBREG_REG (what);
  if (!REG_P (what))
    return;
  CLEAR_REGNO_REG_SET (regs, REGNO (what));
}

/* Marks registers that are invariant inside blocks BBS.  */
static void
blocks_invariant_registers (bbs, nbbs, regs)
     basic_block *bbs;
     int nbbs;
     regset regs;
{
  rtx insn;
  int i;

  for (i = 0; i < max_reg_num (); i++)
    SET_REGNO_REG_SET (regs, i);
  for (i = 0; i < nbbs; i++)
    for (insn = bbs[i]->head;
	 insn != NEXT_INSN (bbs[i]->end);
	 insn = NEXT_INSN (insn))
      if (INSN_P (insn))
	note_stores (PATTERN (insn),
		     (void (*) PARAMS ((rtx, rtx, void *))) unmark_altered,
		     regs);
}

/* Unmarks modified registers; helper to blocks_single_set_registers.  */
struct unmark_altered_insn_data
{
  rtx *regs;
  rtx insn;
};

static void
unmark_altered_insn (what, by, data)
     rtx what;
     rtx by ATTRIBUTE_UNUSED;
     struct unmark_altered_insn_data *data;
{
  int rn;

  if (GET_CODE (what) == SUBREG)
    what = SUBREG_REG (what);
  if (!REG_P (what))
    return;
  rn = REGNO (what);
  if (data->regs[rn] == data->insn)
    return;
  data->regs[rn] = NULL;
}

/* Marks registers that have just single simple set in BBS; the relevant
   insn is returned in REGS.  */
static void
blocks_single_set_registers (bbs, nbbs, regs)
     basic_block *bbs;
     int nbbs;
     rtx *regs;
{
  rtx insn;
  int i;
  struct unmark_altered_insn_data data;

  for (i = 0; i < max_reg_num (); i++)
    regs[i] = NULL;

  for (i = 0; i < nbbs; i++)
    for (insn = bbs[i]->head;
	 insn != NEXT_INSN (bbs[i]->end);
	 insn = NEXT_INSN (insn))
      {
	rtx set = single_set (insn);
	if (!set)
	  continue;
	if (!REG_P (SET_DEST (set)))
	  continue;
	regs[REGNO (SET_DEST (set))] = insn;
      }

  data.regs = regs;
  for (i = 0; i < nbbs; i++)
    for (insn = bbs[i]->head;
	 insn != NEXT_INSN (bbs[i]->end);
	 insn = NEXT_INSN (insn))
      {
        if (!INSN_P (insn))
	  continue;
	data.insn = insn;
	note_stores (PATTERN (insn),
	    (void (*) PARAMS ((rtx, rtx, void *))) unmark_altered_insn,
	    &data);
      }
}

/* Helper for invariant_rtx_wrto_regs_p.  */
static int
invariant_rtx_wrto_regs_p_helper (expr, invariant_regs)
     rtx *expr;
     regset invariant_regs;
{
  switch (GET_CODE (*expr))
    {
    case CC0:
    case PC:
    case UNSPEC_VOLATILE:
      return 1;

    case CONST_INT:
    case CONST_DOUBLE:
    case CONST:
    case SYMBOL_REF:
    case LABEL_REF:
      return 0;

    case ASM_OPERANDS:
      return MEM_VOLATILE_P (*expr);

    case MEM:
      /* If the memory is not constant, assume it is modified.  If it is
	 constant, we still have to check the address.  */
      return !RTX_UNCHANGING_P (*expr);

    case REG:
      return !REGNO_REG_SET_P (invariant_regs, REGNO (*expr));

    default:
      return 0;
    }
}

/* Checks that EXPR is invariant provided that INVARIANT_REGS are invariant. */
static bool
invariant_rtx_wrto_regs_p (expr, invariant_regs)
     rtx expr;
     regset invariant_regs;
{
  return !for_each_rtx (&expr, (rtx_function) invariant_rtx_wrto_regs_p_helper,
			invariant_regs);
}

/* Checks whether CONDITION is a simple comparison in that one of operands
   is register and the other one is invariant in the LOOP. Fills var, lim
   and cond fields in DESC.  */
static bool
simple_condition_p (loop, condition, invariant_regs, desc)
     struct loop *loop ATTRIBUTE_UNUSED;
     rtx condition;
     regset invariant_regs;
     struct loop_desc *desc;
{
  rtx op0, op1;

  /* Check condition.  */
  switch (GET_CODE (condition))
    {
      case EQ:
      case NE:
      case LE:
      case LT:
      case GE:
      case GT:
      case GEU:
      case GTU:
      case LEU:
      case LTU:
	break;
      default:
	return false;
    }

  /* Of integers or pointers.  */
  if (GET_MODE_CLASS (GET_MODE (XEXP (condition, 0))) != MODE_INT
      && GET_MODE_CLASS (GET_MODE (XEXP (condition, 0))) != MODE_PARTIAL_INT)
    return false;

  /* One of operands must be a simple register.  */
  op0 = XEXP (condition, 0);
  op1 = XEXP (condition, 1);
  
  /* One of operands must be invariant.  */
  if (invariant_rtx_wrto_regs_p (op0, invariant_regs))
    {
      /* And the other one must be a register.  */
      if (!REG_P (op1))
	return false;
      desc->var = op1;
      desc->lim = op0;

      desc->cond = swap_condition (GET_CODE (condition));
      if (desc->cond == UNKNOWN)
	return false;
      return true;
    }

  /* Check the other operand. */
  if (!invariant_rtx_wrto_regs_p (op1, invariant_regs))
    return false;
  if (!REG_P (op0))
    return false;

  desc->var = op0;
  desc->lim = op1;

  desc->cond = GET_CODE (condition);

  return true;
}

/* Checks whether DESC->var is incremented/decremented exactly once each
   iteration.  Fills in DESC->stride and returns block in that DESC->var is
   modified.  */
static basic_block
simple_increment (loops, loop, simple_increment_regs, desc)
     struct loops *loops;
     struct loop *loop;
     rtx *simple_increment_regs;
     struct loop_desc *desc;
{
  rtx mod_insn, set, set_src, set_add;
  basic_block mod_bb;

  /* Find insn that modifies var.  */
  mod_insn = simple_increment_regs[REGNO (desc->var)];
  if (!mod_insn)
    return NULL;
  mod_bb = BLOCK_FOR_INSN (mod_insn);

  /* Check that it is executed exactly once each iteration.  */
  if (!just_once_each_iteration_p (loops, loop, mod_bb))
    return NULL;

  /* mod_insn must be a simple increment/decrement.  */
  set = single_set (mod_insn);
  if (!set)
    abort ();
  if (!rtx_equal_p (SET_DEST (set), desc->var))
    abort ();

  set_src = find_reg_equal_equiv_note (mod_insn);
  if (!set_src)
    set_src = SET_SRC (set);
  if (GET_CODE (set_src) != PLUS)
    return NULL;
  if (!rtx_equal_p (XEXP (set_src, 0), desc->var))
    return NULL;

  /* Set desc->stride.  */
  set_add = XEXP (set_src, 1);
  if (CONSTANT_P (set_add))
    desc->stride = set_add;
  else
    return NULL;

  return mod_bb;
}

/* Tries to find initial value of VAR in INSN.  This value must be invariant
   wrto INVARIANT_REGS.  If SET_INSN is not NULL, insn in that var is set is
   placed here.  */
static rtx
variable_initial_value (insn, invariant_regs, var, set_insn)
     rtx insn;
     regset invariant_regs;
     rtx var;
     rtx *set_insn;
{
  basic_block bb;
  rtx set;

  /* Go back through cfg.  */
  bb = BLOCK_FOR_INSN (insn);
  while (1)
    {
      for (; insn != bb->head; insn = PREV_INSN (insn))
	{
	  if (modified_between_p (var, PREV_INSN (insn), NEXT_INSN (insn)))
	    break;
	  if (INSN_P (insn))
	    note_stores (PATTERN (insn),
		(void (*) PARAMS ((rtx, rtx, void *))) unmark_altered,
		invariant_regs);
	}

      if (insn != bb->head)
	{
	  /* We found place where var is set.  */
	  rtx set_dest;
	  rtx val;
	  rtx note;
          
	  set = single_set (insn);
	  if (!set)
	    return NULL;
	  set_dest = SET_DEST (set);
	  if (!rtx_equal_p (set_dest, var))
	    return NULL;

	  note = find_reg_equal_equiv_note (insn);
	  if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST)
	    val = XEXP (note, 0);
	  else
	    val = SET_SRC (set);
	  if (!invariant_rtx_wrto_regs_p (val, invariant_regs))
	    return NULL;

	  if (set_insn)
	    *set_insn = insn;
	  return val;
	}


      if (bb->pred->pred_next || bb->pred->src == ENTRY_BLOCK_PTR)
	return NULL;

      bb = bb->pred->src;
      insn = bb->end;
    }

  return NULL;
}

/* Returns list of definitions of initial value of VAR at Edge.  */
static rtx
variable_initial_values (e, var)
     edge e;
     rtx var;
{
  rtx set_insn, list;
  regset invariant_regs;
  regset_head invariant_regs_head;
  int i;

  invariant_regs = INITIALIZE_REG_SET (invariant_regs_head);
  for (i = 0; i < max_reg_num (); i++)
    SET_REGNO_REG_SET (invariant_regs, i);

  list = alloc_EXPR_LIST (0, copy_rtx (var), NULL);

  if (e->src == ENTRY_BLOCK_PTR)
    return list;

  set_insn = e->src->end;
  while (REG_P (var)
	 && (var = variable_initial_value (set_insn, invariant_regs, var, &set_insn)))
    list = alloc_EXPR_LIST (0, copy_rtx (var), list);

  FREE_REG_SET (invariant_regs);
  return list;
}

/* Counts constant number of iterations of the loop described by DESC;
   returns false if impossible.  */
static bool
constant_iterations (desc, niter, may_be_zero)
     struct loop_desc *desc;
     unsigned HOST_WIDE_INT *niter;
     bool *may_be_zero;
{
  rtx test, expr;
  rtx ainit, alim;

  test = test_for_iteration (desc, 0);
  if (test == const0_rtx)
    {
      *niter = 0;
      *may_be_zero = false;
      return true;
    }

  *may_be_zero = (test != const_true_rtx);

  /* It would make a little sense to check every with every when we
     know that all but the first alternative are simply registers.  */
  for (ainit = desc->var_alts; ainit; ainit = XEXP (ainit, 1))
    {
      alim = XEXP (desc->lim_alts, 0);
      if (!(expr = count_loop_iterations (desc, XEXP (ainit, 0), alim)))
	abort ();
      if (GET_CODE (expr) == CONST_INT)
	{
	  *niter = INTVAL (expr);
	  return true;
	}
    }
  for (alim = XEXP (desc->lim_alts, 1); alim; alim = XEXP (alim, 1))
    {
      ainit = XEXP (desc->var_alts, 0);
      if (!(expr = count_loop_iterations (desc, ainit, XEXP (alim, 0))))
	abort ();
      if (GET_CODE (expr) == CONST_INT)
	{
	  *niter = INTVAL (expr);
	  return true;
	}
    }

  return false;
}

/* Return RTX expression representing number of iterations of loop as bounded
   by test described by DESC (in the case loop really has multiple exit
   edges, fewer iterations may happen in the practice).  

   Return NULL if it is unknown.  Additionally the value may be invalid for
   paradoxical loop (lets define paradoxical loops as loops whose test is
   failing at -1th iteration, for instance "for (i=5;i<1;i++);").
   
   These cases needs to be eighter cared by copying the loop test in the front
   of loop or keeping the test in first iteration of loop.
   
   When INIT/LIM are set, they are used instead of var/lim of DESC. */
rtx
count_loop_iterations (desc, init, lim)
     struct loop_desc *desc;
     rtx init;
     rtx lim;
{
  enum rtx_code cond = desc->cond;
  rtx stride = desc->stride;
  rtx mod, exp;

  /* Give up on floating point modes and friends.  It can be possible to do
     the job for constant loop bounds, but it is probably not worthwhile.  */
  if (!INTEGRAL_MODE_P (GET_MODE (desc->var)))
    return NULL;

  init = copy_rtx (init ? init : desc->var);
  lim = copy_rtx (lim ? lim : desc->lim);

  /* Ensure that we always handle the condition to stay inside loop.  */
  if (desc->neg)
    cond = reverse_condition (cond);

  /* Compute absolute value of the difference of initial and final value.  */
  if (INTVAL (stride) > 0)
    {
      /* Bypass nonsential tests.  */
      if (cond == EQ || cond == GE || cond == GT || cond == GEU
	  || cond == GTU)
	return NULL;
      exp = simplify_gen_binary (MINUS, GET_MODE (desc->var),
				 lim, init);
    }
  else
    {
      /* Bypass nonsential tests.  */
      if (cond == EQ || cond == LE || cond == LT || cond == LEU
	  || cond == LTU)
	return NULL;
      exp = simplify_gen_binary (MINUS, GET_MODE (desc->var),
				 init, lim);
      stride = simplify_gen_unary (NEG, GET_MODE (desc->var),
				   stride, GET_MODE (desc->var));
    }

  /* Normalize difference so the value is always first examined
     and later incremented.  */

  if (!desc->postincr)
    exp = simplify_gen_binary (MINUS, GET_MODE (desc->var),
			       exp, stride);

  /* Determine delta caused by exit condition.  */
  switch (cond)
    {
    case NE:
      /* For NE tests, make sure that the iteration variable won't miss
	 the final value.  If EXP mod STRIDE is not zero, then the
	 iteration variable will overflow before the loop exits, and we
	 can not calculate the number of iterations easilly.  */
      if (stride != const1_rtx
	  && (simplify_gen_binary (UMOD, GET_MODE (desc->var), exp, stride)
              != const0_rtx))
	return NULL;
      break;
    case LT:
    case GT:
    case LTU:
    case GTU:
      break;
    case LE:
    case GE:
    case LEU:
    case GEU:
      exp = simplify_gen_binary (PLUS, GET_MODE (desc->var),
				 exp, const1_rtx);
      break;
    default:
      abort ();
    }

  if (stride != const1_rtx)
    {
      /* Number of iterations is now (EXP + STRIDE - 1 / STRIDE),
	 but we need to take care for overflows.   */

      mod = simplify_gen_binary (UMOD, GET_MODE (desc->var), exp, stride);

      /* This is dirty trick.  When we can't compute number of iterations
	 to be constant, we simply ignore the possible overflow, as
	 runtime unroller always use power of 2 amounts and does not
	 care about possible lost bits.  */

      if (GET_CODE (mod) != CONST_INT)
	{
	  rtx stridem1 = simplify_gen_binary (PLUS, GET_MODE (desc->var),
					      stride, constm1_rtx);
	  exp = simplify_gen_binary (PLUS, GET_MODE (desc->var),
				     exp, stridem1);
	  exp = simplify_gen_binary (UDIV, GET_MODE (desc->var), exp, stride);
	}
      else
	{
	  exp = simplify_gen_binary (UDIV, GET_MODE (desc->var), exp, stride);
	  if (mod != const0_rtx)
	    exp = simplify_gen_binary (PLUS, GET_MODE (desc->var),
				       exp, const1_rtx);
	}
    }

  if (rtl_dump_file)
    {
      fprintf (rtl_dump_file, ";  Number of iterations: ");
      print_simple_rtl (rtl_dump_file, exp);
      fprintf (rtl_dump_file, "\n");
    }

  return exp;
}

/* Return simplified RTX expression representing the value of test
   described of DESC at given iteration of loop.  */

static rtx
test_for_iteration (desc, iter)
     struct loop_desc *desc;
     unsigned HOST_WIDE_INT iter;
{
  enum rtx_code cond = desc->cond;
  rtx exp = XEXP (desc->var_alts, 0);
  rtx addval;

  /* Give up on floating point modes and friends.  It can be possible to do
     the job for constant loop bounds, but it is probably not worthwhile.  */
  if (!INTEGRAL_MODE_P (GET_MODE (desc->var)))
    return NULL;

  /* Ensure that we always handle the condition to stay inside loop.  */
  if (desc->neg)
    cond = reverse_condition (cond);

  /* Compute the value of induction variable.  */
  addval = simplify_gen_binary (MULT, GET_MODE (desc->var),
				desc->stride,
				gen_int_mode (desc->postincr
					      ? iter : iter + 1,
					      GET_MODE (desc->var)));
  exp = simplify_gen_binary (PLUS, GET_MODE (desc->var), exp, addval);
  /* Test at given condtion.  */
  exp = simplify_gen_relational (cond, SImode,
				 GET_MODE (desc->var), exp, desc->lim);

  if (rtl_dump_file)
    {
      fprintf (rtl_dump_file,
	       ";  Conditional to continue loop at %ld th iteration: ", iter);
      print_simple_rtl (rtl_dump_file, exp);
      fprintf (rtl_dump_file, "\n");
    }
  return exp;
}


/* Tests whether exit at EXIT_EDGE from LOOP is simple.  Returns simple loop
   description joined to it in in DESC.  INVARIANT_REGS and SINGLE_SET_REGS
   are results of blocks_{invariant,single_set}_regs over BODY.  */
static bool
simple_loop_exit_p (loops, loop, exit_edge, invariant_regs, single_set_regs, desc)
     struct loops *loops;
     struct loop *loop;
     edge exit_edge;
     struct loop_desc *desc;
     regset invariant_regs;
     rtx *single_set_regs;
{
  basic_block mod_bb, exit_bb;
  int fallthru_out;
  rtx condition;
  edge ei, e;

  exit_bb = exit_edge->src;

  fallthru_out = (exit_edge->flags & EDGE_FALLTHRU);

  if (!exit_bb)
    return false;

  /* It must be tested (at least) once during any iteration.  */
  if (!dominated_by_p (loops->cfg.dom, loop->latch, exit_bb))
    return false;

  /* It must end in a simple conditional jump.  */
  if (!any_condjump_p (exit_bb->end))
    return false;

  ei = exit_bb->succ;
  if (ei == exit_edge)
    ei = ei->succ_next;

  desc->out_edge = exit_edge;
  desc->in_edge = ei;

  /* Condition must be a simple comparison in that one of operands
     is register and the other one is invariant.  */
  if (!(condition = get_condition (exit_bb->end, NULL)))
    return false;

  if (!simple_condition_p (loop, condition, invariant_regs, desc))
    return false;

  /*  Var must be simply incremented or decremented in exactly one insn that
     is executed just once every iteration.  */
  if (!(mod_bb = simple_increment (loops, loop, single_set_regs, desc)))
    return false;

  /* OK, it is simple loop.  Now just fill in remaining info.  */
  desc->postincr = !dominated_by_p (loops->cfg.dom, exit_bb, mod_bb);
  desc->neg = !fallthru_out;

  /* Find initial value of var and alternative values for lim.  */
  e = loop_preheader_edge (loop);
  desc->var_alts = variable_initial_values (e, desc->var);
  desc->lim_alts = variable_initial_values (e, desc->lim);

  /* Number of iterations. */
  if (!count_loop_iterations (desc, NULL, NULL))
    return false;
  desc->const_iter =
    constant_iterations (desc, &desc->niter, &desc->may_be_zero);
  return true;
}

/* Tests whether LOOP is simple for loop.  Returns simple loop description
   in DESC.  */
bool
simple_loop_p (loops, loop, desc)
     struct loops *loops;
     struct loop *loop;
     struct loop_desc *desc;
{
  unsigned i;
  basic_block *body;
  edge e;
  struct loop_desc act;
  bool any = false;
  regset invariant_regs;
  regset_head invariant_regs_head;
  rtx *single_set_regs;
  int n_branches;
  
  body = get_loop_body (loop);

  invariant_regs = INITIALIZE_REG_SET (invariant_regs_head);
  single_set_regs = xmalloc (max_reg_num () * sizeof (rtx));

  blocks_invariant_registers (body, loop->num_nodes, invariant_regs);
  blocks_single_set_registers (body, loop->num_nodes, single_set_regs);

  n_branches = 0;
  for (i = 0; i < loop->num_nodes; i++)
    {
      for (e = body[i]->succ; e; e = e->succ_next)
	if (!flow_bb_inside_loop_p (loop, e->dest)
	    && simple_loop_exit_p (loops, loop, e,
		   invariant_regs, single_set_regs, &act))
	  {
	    /* Prefer constant iterations; the less the better.  */
	    if (!any)
	      any = true;
	    else if (!act.const_iter
		     || (desc->const_iter && act.niter >= desc->niter))
	      continue;
	    *desc = act;
	  }

      if (body[i]->succ && body[i]->succ->succ_next)
	n_branches++;
    }
  desc->n_branches = n_branches;

  if (rtl_dump_file && any)
    {
      fprintf (rtl_dump_file, "; Simple loop %i\n", loop->num);
      if (desc->postincr)
	fprintf (rtl_dump_file,
		 ";  does postincrement after loop exit condition\n");

      fprintf (rtl_dump_file, ";  Induction variable:");
      print_simple_rtl (rtl_dump_file, desc->var);
      fputc ('\n', rtl_dump_file);

      fprintf (rtl_dump_file, ";  Initial values:");
      print_simple_rtl (rtl_dump_file, desc->var_alts);
      fputc ('\n', rtl_dump_file);

      fprintf (rtl_dump_file, ";  Stride:");
      print_simple_rtl (rtl_dump_file, desc->stride);
      fputc ('\n', rtl_dump_file);

      fprintf (rtl_dump_file, ";  Compared with:");
      print_simple_rtl (rtl_dump_file, desc->lim);
      fputc ('\n', rtl_dump_file);

      fprintf (rtl_dump_file, ";  Alternative values:");
      print_simple_rtl (rtl_dump_file, desc->lim_alts);
      fputc ('\n', rtl_dump_file);

      fprintf (rtl_dump_file, ";  Exit condition:");
      if (desc->neg)
	fprintf (rtl_dump_file, "(negated)");
      fprintf (rtl_dump_file, "%s\n", GET_RTX_NAME (desc->cond));

      fprintf (rtl_dump_file, ";  Number of branches:");
      fprintf (rtl_dump_file, "%d\n", desc->n_branches);

      fputc ('\n', rtl_dump_file);
    }

  free (body);
  FREE_REG_SET (invariant_regs);
  free (single_set_regs);
  return any;
}

/* Marks blocks that are part of non-reckognized loops; i.e. we throw away
   all latch edges and mark blocks inside any remaining cycle.  Everything
   is a bit complicated due to fact we do not want to do this for parts of
   cycles that only "pass" through some loop -- i.e. for each cycle, we want
   to mark blocks that belong directly to innermost loop containing the whole
   cycle.  */
void
mark_irreducible_loops (loops)
     struct loops *loops;
{
  int *dfs_in, *closed, *mr, *mri, *n_edges, *stack;
  unsigned i;
  edge **edges, e;
  basic_block act;
  int stack_top, tick, depth;
  struct loop *cloop;

  /* The first last_basic_block + 1 entries are for real blocks (including
     entry); then we have loops->num - 1 fake blocks for loops to that we
     assign edges leading from loops (fake loop 0 is not interesting).  */
  dfs_in = xmalloc ((last_basic_block + loops->num) * sizeof (int));
  closed = xmalloc ((last_basic_block + loops->num) * sizeof (int));
  mr = xmalloc ((last_basic_block + loops->num) * sizeof (int));
  mri = xmalloc ((last_basic_block + loops->num) * sizeof (int));
  n_edges = xmalloc ((last_basic_block + loops->num) * sizeof (int));
  edges = xmalloc ((last_basic_block + loops->num) * sizeof (edge *));
  stack = xmalloc ((n_basic_blocks + loops->num) * sizeof (int));

  /* Create the edge lists.  */
  for (i = 0; i < last_basic_block + loops->num; i++)
    n_edges[i] = 0;
  FOR_BB_BETWEEN (act, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
    for (e = act->succ; e; e = e->succ_next)
      {
        /* Ignore edges to exit.  */
        if (e->dest == EXIT_BLOCK_PTR)
	  continue;
	/* And latch edges.  */
	if (e->dest->loop_father->header == e->dest
	    && e->dest->loop_father->latch == act)
	  continue;
	/* Edges inside a single loop should be left where they are.  Edges
	   to subloop headers should lead to representative of the subloop,
	   but from the same place.  */
	if (act->loop_father == e->dest->loop_father
	    || act->loop_father == e->dest->loop_father->outer)
	  {
	    n_edges[act->index + 1]++;
	    continue;
	  }
	/* Edges exiting loops remain.  They should lead from representative
	   of the son of nearest common ancestor of the loops in that
	   act lays.  */
	depth = find_common_loop (act->loop_father, e->dest->loop_father)->depth + 1;
	if (depth == act->loop_father->depth)
	  cloop = act->loop_father;
	else
	  cloop = act->loop_father->pred[depth];
	n_edges[cloop->num + last_basic_block]++;
      }

  for (i = 0; i < last_basic_block + loops->num; i++)
    {
      edges[i] = xmalloc (n_edges[i] * sizeof (edge));
      n_edges[i] = 0;
    }

  FOR_BB_BETWEEN (act, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb)
    for (e = act->succ; e; e = e->succ_next)
      {
        if (e->dest == EXIT_BLOCK_PTR)
	  continue;
	if (e->dest->loop_father->header == e->dest
	    && e->dest->loop_father->latch == act)
	  continue;
	if (act->loop_father == e->dest->loop_father
	    || act->loop_father == e->dest->loop_father->outer)
	  {
	    edges[act->index + 1][n_edges[act->index + 1]++] = e;
	    continue;
	  }
	depth = find_common_loop (act->loop_father, e->dest->loop_father)->depth + 1;
	if (depth == act->loop_father->depth)
	  cloop = act->loop_father;
	else
	  cloop = act->loop_father->pred[depth];
	i = cloop->num + last_basic_block;
	edges[i][n_edges[i]++] = e;
      }

  /* Compute dfs numbering, starting from loop headers, and mark found
     loops.*/
  tick = 0;
  for (i = 0; i < last_basic_block + loops->num; i++)
    {
      dfs_in[i] = -1;
      closed[i] = 0;
      mr[i] = last_basic_block + loops->num;
      mri[i] = -1;
    }

  stack_top = 0;
  for (i = 0; i < loops->num; i++)
    if (loops->parray[i])
      stack[stack_top++] = loops->parray[i]->header->index + 1;

  while (stack_top)
    {
      int idx, sidx;

      idx = stack[stack_top - 1];
      if (dfs_in[idx] < 0)
	dfs_in[idx] = tick++;

      while (n_edges[idx])
	{
	  e = edges[idx][--n_edges[idx]];
	  sidx = e->dest->loop_father->header == e->dest
	           ? e->dest->loop_father->num + last_basic_block
	           : e->dest->index + 1;
          if (closed[sidx])
	    {
	      if (mr[sidx] < mr[idx] && !closed[mri[sidx]])
		{
		  mr[idx] = mr[sidx];
		  mri[idx] = mri[sidx];
		}
	      continue;
	    }
	  if (dfs_in[sidx] < 0)
	    {
	      stack[stack_top++] = sidx;
	      goto next;
	    }
	  if (dfs_in[sidx] < mr[idx])
	    {
	      mr[idx] = dfs_in[sidx];
	      mri[idx] = sidx;
	    }
	}

      /* Return back.  */
      closed[idx] = 1;
      stack_top--;
      if (stack_top && dfs_in[stack[stack_top - 1]] >= 0)
        {
	  /* Propagate information back.  */
	  sidx = stack[stack_top - 1];
	  if (mr[sidx] > mr[idx])
	    {
	      mr[sidx] = mr[idx];
	      mri[sidx] = mri[idx];
	    }
	}
      /* Mark the block if relevant.  */
      if (idx && idx <= last_basic_block && mr[idx] <= dfs_in[idx])
        BASIC_BLOCK (idx - 1)->flags |= BB_IRREDUCIBLE_LOOP;
next:;
    }

  free (stack);
  free (dfs_in);
  free (closed);
  free (mr);
  free (mri);
  for (i = 0; i < last_basic_block + loops->num; i++)
    free (edges[i]);
  free (edges);
  free (n_edges);
  loops->state |= LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS;
}

/* Counts number of insns inside LOOP.  */
int
num_loop_insns (loop)
     struct loop *loop;
{
  basic_block *bbs, bb;
  unsigned i, ninsns = 0;
  rtx insn;

  bbs = get_loop_body (loop);
  for (i = 0; i < loop->num_nodes; i++)
    {
      bb = bbs[i];
      ninsns++;
      for (insn = bb->head; insn != bb->end; insn = NEXT_INSN (insn))
	ninsns++;
    }
  free(bbs);
  
  return ninsns;
}

/* Counts number of insns executed on average per iteration LOOP.  */
int
average_num_loop_insns (loop)
     struct loop *loop;
{
  basic_block *bbs, bb;
  unsigned i, binsns, ninsns, ratio;
  rtx insn;

  ninsns = 0;
  bbs = get_loop_body (loop);
  for (i = 0; i < loop->num_nodes; i++)
    {
      bb = bbs[i];

      binsns = 1;
      for (insn = bb->head; insn != bb->end; insn = NEXT_INSN (insn))
	binsns++;

      ratio = loop->header->frequency == 0
	      ? BB_FREQ_MAX
	      : (bb->frequency * BB_FREQ_MAX) / loop->header->frequency;
      ninsns += binsns * ratio;
    }
  free(bbs);
 
  ninsns /= BB_FREQ_MAX;
  if (!ninsns)
    ninsns = 1; /* To avoid division by zero.  */

  return ninsns;
}

/* Returns expected number of LOOP iterations.
   Comput upper bound on number of iterations in case they do not fit integer
   to help loop peeling heuristics.  Use exact counts if at all possible.  */
unsigned
expected_loop_iterations (loop)
     const struct loop *loop;
{
  edge e;

  if (loop->header->count)
    {
      gcov_type count_in, count_latch, expected;

      count_in = 0;
      count_latch = 0;

      for (e = loop->header->pred; e; e = e->pred_next)
	if (e->src == loop->latch)
	  count_latch = e->count;
	else
	  count_in += e->count;

      if (count_in == 0)
	return 0;

      expected = (count_latch + count_in - 1) / count_in;

      /* Avoid overflows.  */
      return (expected > REG_BR_PROB_BASE ? REG_BR_PROB_BASE : expected);
    }
  else
    {
      int freq_in, freq_latch;

      freq_in = 0;
      freq_latch = 0;

      for (e = loop->header->pred; e; e = e->pred_next)
	if (e->src == loop->latch)
	  freq_latch = EDGE_FREQUENCY (e);
	else
	  freq_in += EDGE_FREQUENCY (e);

      if (freq_in == 0)
	return 0;

      return (freq_latch + freq_in - 1) / freq_in;
    }
}

cfgloopmanip.c:
================================================
/* Loop manipulation code for GNU compiler.
   Copyright (C) 2002 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING.  If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.  */

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "cfglayout.h"
#include "output.h"

static basic_block create_preheader	PARAMS ((struct loop *, dominance_info,
						int));

/* Creates a pre-header for a LOOP.  Returns newly created block.  Unless
   CP_SIMPLE_PREHEADERS is set in FLAGS, we only force LOOP to have single
   entry; otherwise we also force preheader block to have only one successor.
   */
static basic_block
create_preheader (loop, dom, flags)
     struct loop *loop;
     dominance_info dom;
     int flags;
{
  edge e, fallthru;
  basic_block dummy;
  basic_block jump, src;
  struct loop *cloop, *ploop;
  int nentry = 0;
  rtx insn;

  cloop = loop->outer;

  for (e = loop->header->pred; e; e = e->pred_next)
    {
      if (e->src == loop->latch)
	continue;
      nentry++;
    }
  if (!nentry)
    abort ();
  if (nentry == 1)
    {
      for (e = loop->header->pred; e->src == loop->latch; e = e->pred_next);
      if (!(flags & CP_SIMPLE_PREHEADERS)
	  || !e->src->succ->succ_next)
	return NULL;
    }

  insn = first_insn_after_basic_block_note (loop->header);
  if (insn)
    insn = PREV_INSN (insn);
  else
    insn = get_last_insn ();
  if (insn == loop->header->end)
    {
      /* Split_block would not split block after its end.  */
      emit_note_after (NOTE_INSN_DELETED, insn);
    }
  if (flags & CP_INSIDE_CFGLAYOUT)
    fallthru = cfg_layout_split_block (loop->header, insn);
  else
    fallthru = split_block (loop->header, insn);
  dummy = fallthru->src;
  loop->header = fallthru->dest;

  /* The header could be a latch of some superloop(s); due to design of
     split_block, it would now move to fallthru->dest.  */
  for (ploop = loop; ploop; ploop = ploop->outer)
    if (ploop->latch == dummy)
      ploop->latch = fallthru->dest;

  add_to_dominance_info (dom, fallthru->dest);
  
  /* Redirect edges. */
  for (e = dummy->pred; e; e = e->pred_next)
    {
      src = e->src;
      if (src == loop->latch)
	break;
    }
  if (!e)
    abort ();

  dummy->frequency -= EDGE_FREQUENCY (e);
  dummy->count -= e->count;
  fallthru->count -= e->count;
  if (flags & CP_INSIDE_CFGLAYOUT)
    cfg_layout_redirect_edge (e, loop->header);
  else
    {
      jump = redirect_edge_and_branch_force (e, loop->header);
      if (jump)
	{
	  add_to_dominance_info (dom, jump);
	  set_immediate_dominator (dom, jump, src);
	  add_bb_to_loop (jump, loop);
	  loop->latch = jump;
	}
    }

  /* Update structures.  */
  redirect_immediate_dominators (dom, dummy, loop->header);
  set_immediate_dominator (dom, loop->header, dummy);
  loop->header->loop_father = loop;
  add_bb_to_loop (dummy, cloop);
  if (rtl_dump_file)
    fprintf (rtl_dump_file, "Created preheader block for loop %i\n",
	     loop->num);

  return dummy;
}

/* Create preheaders for each loop; for meaning of flags see
   create_preheader.  */
void
create_preheaders (loops, flags)
     struct loops *loops;
     int flags;
{
  unsigned i;
  for (i = 1; i < loops->num; i++)
    create_preheader (loops->parray[i], loops->cfg.dom, flags);
  loops->state |= LOOPS_HAVE_PREHEADERS;
}

/* Forces all loop latches to have only single successor.  */
void
force_single_succ_latches (loops)
     struct loops *loops;
{
  unsigned i;
  struct loop *loop;
  edge e;

  for (i = 1; i < loops->num; i++)
    {
      loop = loops->parray[i];
      if (!loop->latch->succ->succ_next)
	continue;
 
      for (e = loop->header->pred; e->src != loop->latch; e = e->pred_next);
	loop_split_edge_with (e, NULL_RTX, loops);
    }
  loops->state |= LOOPS_HAVE_SIMPLE_LATCHES;
}

/* A quite stupid function to put INSNS on E. They are supposed to form
   just one basic block. Jumps out are not handled, so cfg do not have to
   be ok after this function.  */
basic_block
loop_split_edge_with (e, insns, loops)
     edge e;
     rtx insns;
     struct loops *loops;
{
  basic_block src, dest, new_bb;
  struct loop *loop_c;
  edge new_e;
  
  src = e->src;
  dest = e->dest;

  loop_c = find_common_loop (src->loop_father, dest->loop_father);

  /* Create basic block for it.  */

  new_bb = create_basic_block (NULL_RTX, NULL_RTX, EXIT_BLOCK_PTR->prev_bb);
  add_to_dominance_info (loops->cfg.dom, new_bb);
  add_bb_to_loop (new_bb, loop_c);
  new_bb->flags = insns ? BB_SUPERBLOCK : 0;
  if (src->flags & BB_IRREDUCIBLE_LOOP)
    {
      /* We expect simple preheaders here.  */
      if ((dest->flags & BB_IRREDUCIBLE_LOOP)
          || dest->loop_father->header == dest)
        new_bb->flags |= BB_IRREDUCIBLE_LOOP;
    }

  new_e = make_edge (new_bb, dest, EDGE_FALLTHRU);
  new_e->probability = REG_BR_PROB_BASE;
  new_e->count = e->count;

  new_bb->count = e->count;
  new_bb->frequency = EDGE_FREQUENCY (e);
  cfg_layout_redirect_edge (e, new_bb);

  alloc_aux_for_block (new_bb, sizeof (struct reorder_block_def));
  if (insns)
    {
      start_sequence ();
      emit_insn (insns);
      insns = get_insns ();
      end_sequence ();
      emit_insn_after (insns, new_bb->end);
    }

  set_immediate_dominator (loops->cfg.dom, new_bb, src);
  set_immediate_dominator (loops->cfg.dom, dest,
    recount_dominator (loops->cfg.dom, dest));

  if (dest->loop_father->latch == src)
    dest->loop_father->latch = new_bb;
  
  return new_bb;
}

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] rtlopt merge part 1 -- loop analysis
  2002-12-19 11:24                                         ` [PATCH] rtlopt merge part 1 -- loop analysis Zdenek Dvorak
@ 2002-12-19 11:38                                           ` Joseph S. Myers
  2002-12-19 12:42                                             ` Zdenek Dvorak
  0 siblings, 1 reply; 33+ messages in thread
From: Joseph S. Myers @ 2002-12-19 11:38 UTC (permalink / raw)
  To: Zdenek Dvorak; +Cc: Richard Henderson, Jan Hubicka, gcc-patches

On Thu, 19 Dec 2002, Zdenek Dvorak wrote:

> 	* cfgloopanal.c: New file.
> 	* cfgloopmanip.c: New file.

New files need documenting in passes.texi.  There are various spelling
errors in them, which should be shown up by doing a spellcheck.  Note that
the GCC conventions say "nonzero" rather than "non-zero".

-- 
Joseph S. Myers
jsm28@cam.ac.uk

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [PATCH] rtlopt merge part 1 -- loop analysis
  2002-12-19 11:38                                           ` Joseph S. Myers
@ 2002-12-19 12:42                                             ` Zdenek Dvorak
  0 siblings, 0 replies; 33+ messages in thread
From: Zdenek Dvorak @ 2002-12-19 12:42 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Richard Henderson, Jan Hubicka, gcc-patches

Hello,

> > 	* cfgloopanal.c: New file.
> > 	* cfgloopmanip.c: New file.
> 
> New files need documenting in passes.texi.

the documentation for new loop optimizer describes them; but I would
prefer to add the documentation as whole rather than to try to extract
relevant bits for every patch.

Zdenek

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2002-12-19 20:42 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-27 16:15 Fix attributes for SSE/MMX instructions Jan Hubicka
2002-04-29 15:19 ` Richard Henderson
2002-04-30 10:29   ` Jan Hubicka
     [not found]   ` <20020430160511.GK18000@atrey.karlin.mff.cuni.cz>
     [not found]     ` <20020430163200.A3211@redhat.com>
     [not found]       ` <20020501070806.GC21948@atrey.karlin.mff.cuni.cz>
     [not found]         ` <20020501093122.A3948@redhat.com>
     [not found]           ` <20020501194421.GD1512@atrey.karlin.mff.cuni.cz>
     [not found]             ` <20020501135713.A4134@redhat.com>
     [not found]               ` <20020501220959.GB10884@atrey.karlin.mff.cuni.cz>
     [not found]                 ` <20020501153524.A4237@redhat.com>
2002-05-02  9:33                   ` Re-enable crossjumping before bb-reorder Jan Hubicka
2002-05-02 10:34                     ` Richard Henderson
2002-05-02 10:39                       ` Jan Hubicka
2002-05-02 10:42                         ` Richard Henderson
     [not found]       ` <20020514091823.GN6514@atrey.karlin.mff.cuni.cz>
     [not found]         ` <20020514172803.GC1535@atrey.karlin.mff.cuni.cz>
     [not found]           ` <20020515072607.GH4292@atrey.karlin.mff.cuni.cz>
     [not found]             ` <20020515151110.GA24680@atrey.karlin.mff.cuni.cz>
2002-05-15 17:00               ` Basic block renumbering removal Richard Henderson
2002-05-15 23:48                 ` Zdenek Dvorak
2002-05-16 10:41                   ` Richard Henderson
2002-05-16 11:42                     ` Zdenek Dvorak
2002-05-16 13:00                     ` Zdenek Dvorak
2002-05-16 15:30                       ` Richard Henderson
2002-05-16 15:38                         ` Zdenek Dvorak
2002-05-17  5:10                         ` Jan Hubicka
2002-05-17  4:53                     ` Jan Hubicka
2002-05-19 14:40                       ` Zdenek Dvorak
2002-05-19 14:48                         ` Richard Henderson
2002-05-19 15:13                           ` Zdenek Dvorak
2002-05-19 16:56                             ` Richard Henderson
2002-05-19 18:50                               ` Basic block renumbering removal, part 2 Zdenek Dvorak
2002-05-20 20:10                                 ` Richard Henderson
2002-05-20 23:09                                   ` Zdenek Dvorak
2002-05-21  1:03                                     ` Richard Henderson
2002-05-22 13:43                                 ` Basic block renumbering removal, part 3 Zdenek Dvorak
2002-05-23  1:18                                   ` Richard Henderson
2002-05-23 16:27                                     ` Basic block renumbering removal, part 4 Zdenek Dvorak
2002-05-25 21:41                                       ` Richard Henderson
2002-05-27 15:12                                         ` Zdenek Dvorak
2002-05-27 16:33                                           ` Richard Henderson
2002-12-19 11:24                                         ` [PATCH] rtlopt merge part 1 -- loop analysis Zdenek Dvorak
2002-12-19 11:38                                           ` Joseph S. Myers
2002-12-19 12:42                                             ` Zdenek Dvorak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).