public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org,  Richard Biener <richard.guenther@gmail.com>
Subject: Re: Handle data dependence relations with different bases
Date: Fri, 07 Jul 2017 14:01:00 -0000	[thread overview]
Message-ID: <87y3s08hy2.fsf@linaro.org> (raw)
In-Reply-To: <3947361.mLME8MOua7@polaris> (Eric Botcazou's message of "Tue, 04	Jul 2017 11:40:34 +0200")

Eric Botcazou <ebotcazou@adacore.com> writes:
> [Sorry for missing the previous messages]
>
>> Thanks.  Just been retesting, and I think I must have forgotten
>> to include Ada last time.  It turns out that the patch causes a dg-scan
>> regression in gnat.dg/vect17.adb, because we now think that if the
>> array RECORD_TYPEs *do* alias in:
>> 
>>    procedure Add (X, Y : aliased Sarray; R : aliased out Sarray) is
>>    begin
>>       for I in Sarray'Range loop
>>          R(I) := X(I) + Y(I);
>>       end loop;
>>    end;
>> 
>> then the dependence distance must be zero.  Eric, does that hold true
>> for Ada?  I.e. if X and R (or Y and R) alias, must it be the case that
>> X(I) can only alias R(I) and not for example R(I-1) or R(I+1)?
>
> Yes, I'd think so (even without the artificial RECORD_TYPE around the arrays).

Good!

>> 2017-06-07  Richard Sandiford  <richard.sandiford@linaro.org>
>> 
>> gcc/testsuite/
>> 	* gnat.dg/vect17.ads (Sarray): Increase range to 1 .. 5.
>> 	* gnat.dg/vect17.adb (Add): Create a dependence distance of 1
>> 	when X = R or Y = R.
>
> I think that you need to modify vect15 and vect16 the same way.

Ah, yeah.  And doing that shows that I'd not handled safelen for
DDR_COULD_BE_INDEPENDENT_P.  I've fixed that locally.

How does this look?  Tested on x86_64-linux-gnu both without the
vectoriser changes and with the fixed vectoriser patch.

Thanks,
Richard


2017-07-07  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/testsuite/
	* gnat.dg/vect15.ads (Sarray): Increase range to 1 .. 5.
	* gnat.dg/vect16.ads (Sarray): Likewise.
	* gnat.dg/vect17.ads (Sarray): Likewise.
	* gnat.dg/vect15.adb (Add): Create a dependence distance of 1.
	* gnat.dg/vect16.adb (Add): Likewise.
	* gnat.dg/vect17.adb (Add): Likewise.

Index: gcc/testsuite/gnat.dg/vect15.ads
===================================================================
--- gcc/testsuite/gnat.dg/vect15.ads	2015-10-14 14:58:56.000000000 +0100
+++ gcc/testsuite/gnat.dg/vect15.ads	2017-07-07 13:12:51.509540701 +0100
@@ -1,6 +1,6 @@
 package Vect15 is
 
-   type Sarray is array (1 .. 4) of Long_Float;
+   type Sarray is array (1 .. 5) of Long_Float;
    for Sarray'Alignment use 16;
 
    procedure Add (X, Y : Sarray; R : out Sarray);
Index: gcc/testsuite/gnat.dg/vect16.ads
===================================================================
--- gcc/testsuite/gnat.dg/vect16.ads	2015-10-14 14:58:56.000000000 +0100
+++ gcc/testsuite/gnat.dg/vect16.ads	2017-07-07 13:12:51.511540636 +0100
@@ -1,6 +1,6 @@
 package Vect16 is
 
-   type Sarray is array (1 .. 4) of Long_Float;
+   type Sarray is array (1 .. 5) of Long_Float;
    for Sarray'Alignment use 16;
 
    procedure Add_Sub (X, Y : Sarray; R,S : out Sarray);
Index: gcc/testsuite/gnat.dg/vect17.ads
===================================================================
--- gcc/testsuite/gnat.dg/vect17.ads	2017-06-07 22:13:29.692531472 +0100
+++ gcc/testsuite/gnat.dg/vect17.ads	2017-07-07 13:12:51.514540538 +0100
@@ -1,6 +1,6 @@
 package Vect17 is
 
-   type Sarray is array (1 .. 4) of Long_Float;
+   type Sarray is array (1 .. 5) of Long_Float;
    for Sarray'Alignment use 16;
 
    procedure Add (X, Y : aliased Sarray; R : aliased out Sarray);
Index: gcc/testsuite/gnat.dg/vect15.adb
===================================================================
--- gcc/testsuite/gnat.dg/vect15.adb	2015-10-14 14:58:56.000000000 +0100
+++ gcc/testsuite/gnat.dg/vect15.adb	2017-07-07 13:12:51.509540701 +0100
@@ -5,8 +5,9 @@ package body Vect15 is
 
    procedure Add (X, Y : Sarray; R : out Sarray) is
    begin
-      for I in Sarray'Range loop
-         R(I) := X(I) + Y(I);
+      R(1) := X(5) + Y(5);
+      for I in 1 .. 4 loop
+         R(I + 1) := X(I) + Y(I);
       end loop;
    end;
 
Index: gcc/testsuite/gnat.dg/vect16.adb
===================================================================
--- gcc/testsuite/gnat.dg/vect16.adb	2015-10-14 14:58:56.000000000 +0100
+++ gcc/testsuite/gnat.dg/vect16.adb	2017-07-07 13:12:51.510540669 +0100
@@ -5,9 +5,11 @@ package body Vect16 is
 
    procedure Add_Sub (X, Y : Sarray; R,S : out Sarray) is
    begin
-      for I in Sarray'Range loop
-         R(I) := X(I) + Y(I);
-         S(I) := X(I) - Y(I);
+      R(1) := X(5) + Y(5);
+      S(1) := X(5) - Y(5);
+      for I in 1 .. 4 loop
+         R(I + 1) := X(I) + Y(I);
+         S(I + 1) := X(I) - Y(I);
       end loop;
    end;
 
Index: gcc/testsuite/gnat.dg/vect17.adb
===================================================================
--- gcc/testsuite/gnat.dg/vect17.adb	2017-06-07 22:13:29.692531472 +0100
+++ gcc/testsuite/gnat.dg/vect17.adb	2017-07-07 13:12:51.512540603 +0100
@@ -5,8 +5,9 @@ package body Vect17 is
 
    procedure Add (X, Y : aliased Sarray; R : aliased out Sarray) is
    begin
-      for I in Sarray'Range loop
-         R(I) := X(I) + Y(I);
+      R(1) := X(5) + Y(5);
+      for I in 1 .. 4 loop
+         R(I + 1) := X(I) + Y(I);
       end loop;
    end;
 

  reply	other threads:[~2017-07-07 14:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03  8:02 Richard Sandiford
2017-05-04  9:36 ` Bin.Cheng
2017-05-04 10:07   ` Richard Sandiford
2017-05-04 10:59     ` Bin.Cheng
2017-05-04 12:11       ` Richard Sandiford
2017-05-04 12:13 ` Richard Biener
2017-05-04 12:37   ` Richard Biener
2017-05-04 17:23     ` Richard Sandiford
2017-05-09 10:10       ` Richard Biener
2017-05-18  8:35         ` Richard Sandiford
2017-05-31  6:57           ` Richard Sandiford
2017-06-07 10:17             ` Richard Biener
2017-06-07 21:27               ` Richard Sandiford
2017-06-15 13:45                 ` [PING, Ada] " Richard Sandiford
2017-06-22 11:34                   ` [PING*2, " Richard Sandiford
2017-06-29 17:20                     ` [PING*3, " Richard Sandiford
2017-07-04  9:40                 ` Eric Botcazou
2017-07-07 14:01                   ` Richard Sandiford [this message]
2017-07-07 16:03                     ` Eric Botcazou
2017-07-27 12:20                     ` Richard Sandiford
2017-08-03 20:52                       ` Richard Sandiford
2017-08-04  9:06                       ` Richard Biener
2017-08-04  9:29                         ` Richard Sandiford
2017-08-04  9:35                           ` Richard Biener
2017-05-05 22:03   ` Bernhard Reutner-Fischer
2017-05-09 10:21     ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y3s08hy2.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).