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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: SMS in gcc4.0


Hi, all

This patch will fix doloop_register_get defined in 
modulo-sched.c, and let the program of PI caculation 
on IA-64 be successfully modulo scheduled. On 1GHz 
Itanium-2, it costs just 3.128 seconds to execute when 
compiled with "-fmodulo-shced -O3" turned on, while 
5.454 seconds whithout "-fmodulo-sched".


2005-03-31  Canqun Yang  <canqun@nudt.edu.cn>

	* modulo-sched.c (doloop_register_get): Deal 
with if_then_else pattern.  


Canqun Yang
Creative Compiler Research Group.
National University of Defense Technology, China.

Attachment: pi.f90
Description: Binary data

*** /home/ycq/mainline/gcc/gcc/modulo-sched.c	Mon Mar 21 10:49:23 2005
--- modulo-sched.c	Thu Mar 31 21:11:08 2005
*************** static rtx
*** 263,269 ****
  doloop_register_get (rtx insn, rtx *comp)
  {
    rtx pattern, cmp, inc, reg, condition;
! 
    if (!JUMP_P (insn))
      return NULL_RTX;
    pattern = PATTERN (insn);
--- 263,270 ----
  doloop_register_get (rtx insn, rtx *comp)
  {
    rtx pattern, cmp, inc, reg, condition;
!   rtx src;
!   
    if (!JUMP_P (insn))
      return NULL_RTX;
    pattern = PATTERN (insn);
*************** doloop_register_get (rtx insn, rtx *comp
*** 293,303 ****
  
    /* Extract loop counter register.  */
    reg = SET_DEST (inc);
  
    /* Check if something = (plus (reg) (const_int -1)).  */
!   if (GET_CODE (SET_SRC (inc)) != PLUS
!       || XEXP (SET_SRC (inc), 0) != reg
!       || XEXP (SET_SRC (inc), 1) != constm1_rtx)
      return NULL_RTX;
  
    /* Check for (set (pc) (if_then_else (condition)
--- 294,315 ----
  
    /* Extract loop counter register.  */
    reg = SET_DEST (inc);
+   src = SET_SRC (inc);
  
+   /* On IA-64, the RTL pattern of SRC is just like this 
+     (if_then_else:DI (ne (reg:DI 332 ar.lc)
+             (const_int 0 [0x0]))
+         (plus:DI (reg:DI 332 ar.lc)
+             (const_int -1 [0xffffffffffffffff]))
+         (reg:DI 332 ar.lc))  */
+ 
+   if (GET_CODE (src) == IF_THEN_ELSE)
+     src = XEXP (src, 1);
+   
    /* Check if something = (plus (reg) (const_int -1)).  */
!   if (GET_CODE (src) != PLUS
!       || XEXP (src, 0) != reg
!       || XEXP (src, 1) != constm1_rtx)
      return NULL_RTX;
  
    /* Check for (set (pc) (if_then_else (condition)
*************** doloop_register_get (rtx insn, rtx *comp
*** 318,324 ****
       if ((GET_CODE (condition) != GE && GET_CODE (condition) != NE)
  	 || GET_CODE (XEXP (condition, 1)) != CONST_INT).  */
    if (GET_CODE (condition) != NE
!       || XEXP (condition, 1) != const1_rtx)
      return NULL_RTX;
  
    if (XEXP (condition, 0) == reg)
--- 330,337 ----
       if ((GET_CODE (condition) != GE && GET_CODE (condition) != NE)
  	 || GET_CODE (XEXP (condition, 1)) != CONST_INT).  */
    if (GET_CODE (condition) != NE
!       || (XEXP (condition, 1) != const1_rtx
! 	  && XEXP (condition, 1) != const0_rtx))
      return NULL_RTX;
  
    if (XEXP (condition, 0) == reg)

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