public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][Modulo-sched] Avoid SMS when the candidate loop contains INC  instruction
@ 2007-07-26 11:06 Revital1 Eres
  2007-07-26 16:40 ` Kenneth Zadeck
  0 siblings, 1 reply; 4+ messages in thread
From: Revital1 Eres @ 2007-07-26 11:06 UTC (permalink / raw)
  To: Ayal Zaks; +Cc: volodyan, abel, gcc-patches

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


Hello,

We decided to break Patch 1 of 2 into sub-patches and insert them
gradually.  (http://gcc.gnu.org/ml/gcc-patches/2007-07/msg01515.html)

This is the first one which avoids performing SMS when the candidate
loop contains auto-increment instruction.

The testcase attached is inspired from array_constructor_12.f90 testcase.

This patch was bootstrapped and tested on ppc64 with -fmodulo-sched
flag. (all languages except Ada)

:ADDPATCH modulo-sched:

OK for mainline?

Thanks,
Revital

2007-07-26  Vladimir Yanovsky  <yanov@il.ibm.com>

        * modulo-sched.c (sms_schedule): Avoid loops which includes
        auto-increment instructions.

        * testsuite/gfortran.dg/sms-1.f90: New test.


(See attached file: autoinc_patch.txt)(See attached file: sms-1.f90.txt)

[-- Attachment #2: autoinc_patch.txt --]
[-- Type: text/plain, Size: 1391 bytes --]

Index: modulo-sched.c
===================================================================
--- modulo-sched.c	(revision 126552)
+++ modulo-sched.c	(working copy)
@@ -988,12 +988,16 @@
       if ( !(count_reg = doloop_register_get (tail)))
 	continue;
 
-      /* Don't handle BBs with calls or barriers, or !single_set insns.  */
+      /* Don't handle BBs with calls or barriers, or !single_set insns,
+         or auto-increment insns (to avoid creating invalid reg-moves
+         for the auto-increment insns).  
+         ??? Should handle auto-increment insns.  */
       for (insn = head; insn != NEXT_INSN (tail); insn = NEXT_INSN (insn))
 	if (CALL_P (insn)
 	    || BARRIER_P (insn)
 	    || (INSN_P (insn) && !JUMP_P (insn)
-		&& !single_set (insn) && GET_CODE (PATTERN (insn)) != USE))
+		&& !single_set (insn) && GET_CODE (PATTERN (insn)) != USE)
+            || (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0))
 	  break;
 
       if (insn != NEXT_INSN (tail))
@@ -1004,6 +1008,8 @@
 		fprintf (dump_file, "SMS loop-with-call\n");
 	      else if (BARRIER_P (insn))
 		fprintf (dump_file, "SMS loop-with-barrier\n");
+              else if (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0)
+                fprintf (dump_file, "SMS reg inc\n");
 	      else
 		fprintf (dump_file, "SMS loop-with-not-single-set\n");
 	      print_rtl_single (dump_file, insn);

[-- Attachment #3: sms-1.f90.txt --]
[-- Type: text/plain, Size: 708 bytes --]

! { dg-do run }
! { dg-options "-O2 -fmodulo-sched" } 
program main
  integer (kind = 8) :: i, l8, u8, step8
  integer (kind = 4) :: l4, step4
  integer (kind = 8), parameter :: big = 10000000000_8

  u8 = big * 40 + 200
  l4 = 200
  step8 = -big
  call test ((/ (i, i = u8, l4, step8) /), u8, l4 + 0_8, step8)
contains
  subroutine test (a, l, u, step)
    integer (kind = 8), dimension (:), intent (in) :: a
    integer (kind = 8), intent (in) :: l, u, step
    integer (kind = 8) :: i
    integer :: j

    j = 1
    do i = l, u, step
      if (a (j) .ne. i) call abort
      j = j + 1
    end do
    if (size (a, 1) .ne. j - 1) call abort
  end subroutine test
end program main

^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <OF75BAE848.B63E5DE5-ONC2257323.005B1F08-C2257324.003B7333@LocalDomain>]

end of thread, other threads:[~2007-07-26 17:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-26 11:06 [PATCH][Modulo-sched] Avoid SMS when the candidate loop contains INC instruction Revital1 Eres
2007-07-26 16:40 ` Kenneth Zadeck
2007-07-26 18:21   ` Ayal Zaks
     [not found] <OF75BAE848.B63E5DE5-ONC2257323.005B1F08-C2257324.003B7333@LocalDomain>
2007-07-26 11:34 ` Ayal Zaks

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).