diff mbox

[ARM,tests] Make input and output arrays 128-bit aligned in vectorisation tests

Message ID 540F1945.2010107@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov Sept. 9, 2014, 3:14 p.m. UTC
Hi all,

As Christophe mentioned at 
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00202.html
These tests fail on big-endian. The reason is that the input is not 
aligned to 128 bit forcing the use of a movmisalign which we don't 
support on big-endian.

A solution is to force the alignment of the arrays, allowing for the use 
of normal loads and stores.
We can look into enabling misaligned loads on big-endian with the 
appropriate reversal logic as a separate
piece of work...

Ok for trunk?

2014-09-09  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * gcc.target/arm/vect-lceilf_1.c: Make input and output arrays global
     and 16-byte aligned.
     * gcc.target/arm/vect-lfloorf_1.c: Likewise.
     * gcc.target/arm/vect-lroundf_1.c: Likewise.
     * gcc.target/arm/vect-rounding-btruncf.c: Likewise.
     * gcc.target/arm/vect-rounding-ceilf.c: Likewise.
     * gcc.target/arm/vect-rounding-floorf.c: Likewise.
     * gcc.target/arm/vect-rounding-roundf.c: Likewise.

Comments

Ramana Radhakrishnan Sept. 9, 2014, 3:14 p.m. UTC | #1
On 09/09/14 16:14, Kyrill Tkachov wrote:
> Hi all,
>
> As Christophe mentioned at
> https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00202.html
> These tests fail on big-endian. The reason is that the input is not
> aligned to 128 bit forcing the use of a movmisalign which we don't
> support on big-endian.
>
> A solution is to force the alignment of the arrays, allowing for the use
> of normal loads and stores.
> We can look into enabling misaligned loads on big-endian with the
> appropriate reversal logic as a separate
> piece of work...
>
> Ok for trunk?
>
> 2014-09-09  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>       * gcc.target/arm/vect-lceilf_1.c: Make input and output arrays global
>       and 16-byte aligned.
>       * gcc.target/arm/vect-lfloorf_1.c: Likewise.
>       * gcc.target/arm/vect-lroundf_1.c: Likewise.
>       * gcc.target/arm/vect-rounding-btruncf.c: Likewise.
>       * gcc.target/arm/vect-rounding-ceilf.c: Likewise.
>       * gcc.target/arm/vect-rounding-floorf.c: Likewise.
>       * gcc.target/arm/vect-rounding-roundf.c: Likewise.
>


Ok.

Ramana
Richard Earnshaw Sept. 12, 2014, 10:13 a.m. UTC | #2
On 09/09/14 16:14, Kyrill Tkachov wrote:
> Hi all,
> 
> As Christophe mentioned at 
> https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00202.html
> These tests fail on big-endian. The reason is that the input is not 
> aligned to 128 bit forcing the use of a movmisalign which we don't 
> support on big-endian.
> 
> A solution is to force the alignment of the arrays, allowing for the use 
> of normal loads and stores.
> We can look into enabling misaligned loads on big-endian with the 
> appropriate reversal logic as a separate
> piece of work...
> 

So surely these tests *ought* to pass on big-endian without this change
and the fact that they don't is a bug.

So in that case, surely we should be (at most XFAILing them), rather
than papering over a real problem.

R.

> Ok for trunk?
> 
> 2014-09-09  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>      * gcc.target/arm/vect-lceilf_1.c: Make input and output arrays global
>      and 16-byte aligned.
>      * gcc.target/arm/vect-lfloorf_1.c: Likewise.
>      * gcc.target/arm/vect-lroundf_1.c: Likewise.
>      * gcc.target/arm/vect-rounding-btruncf.c: Likewise.
>      * gcc.target/arm/vect-rounding-ceilf.c: Likewise.
>      * gcc.target/arm/vect-rounding-floorf.c: Likewise.
>      * gcc.target/arm/vect-rounding-roundf.c: Likewise.
> 
> 
> arm-vect-tests-align.patch
> 
> 
> diff --git a/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c b/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
> index 75705ae..5e98b74 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
> @@ -5,8 +5,11 @@
>  
>  #define N 32
>  
> +float __attribute__((aligned(16))) input[N];
> +int __attribute__((aligned(16))) output[N];
> +
>  void
> -foo (int *output, float *input)
> +foo ()
>  {
>    int i = 0;
>    /* Vectorizable.  */
> diff --git a/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c b/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
> index 298d54e..655f437 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
> @@ -5,8 +5,11 @@
>  
>  #define N 32
>  
> +float __attribute__((aligned(16))) input[N];
> +int __attribute__((aligned(16))) output[N];
> +
>  void
> -foo (int *output, float *input)
> +foo ()
>  {
>    int i = 0;
>    /* Vectorizable.  */
> diff --git a/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c b/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
> index 6443821..92a722e 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
> @@ -5,8 +5,11 @@
>  
>  #define N 32
>  
> +float __attribute__((aligned(16))) input[N];
> +int __attribute__((aligned(16))) output[N];
> +
>  void
> -foo (int *output, float *input)
> +foo ()
>  {
>    int i = 0;
>    /* Vectorizable.  */
> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
> index 5616837..372ddc5 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
> @@ -5,8 +5,11 @@
>  
>  #define N 32
>  
> +float __attribute__((aligned(16))) input[N];
> +float __attribute__((aligned(16))) output[N];
> +
>  void
> -foo (float *output, float *input)
> +foo ()
>  {
>    int i = 0;
>    /* Vectorizable.  */
> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
> index cb8f1d5..3c786d4 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
> @@ -5,8 +5,11 @@
>  
>  #define N 32
>  
> +float __attribute__((aligned(16))) input[N];
> +float __attribute__((aligned(16))) output[N];
> +
>  void
> -foo (float *output, float *input)
> +foo ()
>  {
>    int i = 0;
>    /* Vectorizable.  */
> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
> index bf68af7..eedb295 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
> @@ -5,8 +5,11 @@
>  
>  #define N 32
>  
> +float __attribute__((aligned(16))) input[N];
> +float __attribute__((aligned(16))) output[N];
> +
>  void
> -foo (float *output, float *input)
> +foo ()
>  {
>    int i = 0;
>    /* Vectorizable.  */
> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
> index 7c0a1b4..360b2b9 100644
> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
> @@ -5,8 +5,11 @@
>  
>  #define N 32
>  
> +float __attribute__((aligned(16))) input[N];
> +float __attribute__((aligned(16))) output[N];
> +
>  void
> -foo (float *output, float *input)
> +foo ()
>  {
>    int i = 0;
>    /* Vectorizable.  */
>
Ramana Radhakrishnan Sept. 12, 2014, 10:20 a.m. UTC | #3
On 12/09/14 11:13, Richard Earnshaw wrote:
> On 09/09/14 16:14, Kyrill Tkachov wrote:
>> Hi all,
>>
>> As Christophe mentioned at
>> https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00202.html
>> These tests fail on big-endian. The reason is that the input is not
>> aligned to 128 bit forcing the use of a movmisalign which we don't
>> support on big-endian.
>>
>> A solution is to force the alignment of the arrays, allowing for the use
>> of normal loads and stores.
>> We can look into enabling misaligned loads on big-endian with the
>> appropriate reversal logic as a separate
>> piece of work...
>>
>
> So surely these tests *ought* to pass on big-endian without this change
> and the fact that they don't is a bug.

The backend disables misaligned loads in neon for big endian. You can't 
do a vld1.8 on a movmisalignv2si and expect it to work correctly, can you ?

>
> So in that case, surely we should be (at most XFAILing them), rather
> than papering over a real problem.


I disagree - The tests are to detect vectorization of lceilf, lfloor and 
all the other functions.

So until the backend is fixed, I asked for the tests to be changed to 
test what they are supposed to - vectorizing calls to these builtin 
functions which is more useful than XFAILing these.

regards
Ramana

>
> R.
>
>> Ok for trunk?
>>
>> 2014-09-09  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>       * gcc.target/arm/vect-lceilf_1.c: Make input and output arrays global
>>       and 16-byte aligned.
>>       * gcc.target/arm/vect-lfloorf_1.c: Likewise.
>>       * gcc.target/arm/vect-lroundf_1.c: Likewise.
>>       * gcc.target/arm/vect-rounding-btruncf.c: Likewise.
>>       * gcc.target/arm/vect-rounding-ceilf.c: Likewise.
>>       * gcc.target/arm/vect-rounding-floorf.c: Likewise.
>>       * gcc.target/arm/vect-rounding-roundf.c: Likewise.
>>
>>
>> arm-vect-tests-align.patch
>>
>>
>> diff --git a/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c b/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
>> index 75705ae..5e98b74 100644
>> --- a/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
>> +++ b/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
>> @@ -5,8 +5,11 @@
>>
>>   #define N 32
>>
>> +float __attribute__((aligned(16))) input[N];
>> +int __attribute__((aligned(16))) output[N];
>> +
>>   void
>> -foo (int *output, float *input)
>> +foo ()
>>   {
>>     int i = 0;
>>     /* Vectorizable.  */
>> diff --git a/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c b/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
>> index 298d54e..655f437 100644
>> --- a/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
>> +++ b/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
>> @@ -5,8 +5,11 @@
>>
>>   #define N 32
>>
>> +float __attribute__((aligned(16))) input[N];
>> +int __attribute__((aligned(16))) output[N];
>> +
>>   void
>> -foo (int *output, float *input)
>> +foo ()
>>   {
>>     int i = 0;
>>     /* Vectorizable.  */
>> diff --git a/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c b/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
>> index 6443821..92a722e 100644
>> --- a/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
>> +++ b/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
>> @@ -5,8 +5,11 @@
>>
>>   #define N 32
>>
>> +float __attribute__((aligned(16))) input[N];
>> +int __attribute__((aligned(16))) output[N];
>> +
>>   void
>> -foo (int *output, float *input)
>> +foo ()
>>   {
>>     int i = 0;
>>     /* Vectorizable.  */
>> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
>> index 5616837..372ddc5 100644
>> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
>> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
>> @@ -5,8 +5,11 @@
>>
>>   #define N 32
>>
>> +float __attribute__((aligned(16))) input[N];
>> +float __attribute__((aligned(16))) output[N];
>> +
>>   void
>> -foo (float *output, float *input)
>> +foo ()
>>   {
>>     int i = 0;
>>     /* Vectorizable.  */
>> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
>> index cb8f1d5..3c786d4 100644
>> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
>> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
>> @@ -5,8 +5,11 @@
>>
>>   #define N 32
>>
>> +float __attribute__((aligned(16))) input[N];
>> +float __attribute__((aligned(16))) output[N];
>> +
>>   void
>> -foo (float *output, float *input)
>> +foo ()
>>   {
>>     int i = 0;
>>     /* Vectorizable.  */
>> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
>> index bf68af7..eedb295 100644
>> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
>> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
>> @@ -5,8 +5,11 @@
>>
>>   #define N 32
>>
>> +float __attribute__((aligned(16))) input[N];
>> +float __attribute__((aligned(16))) output[N];
>> +
>>   void
>> -foo (float *output, float *input)
>> +foo ()
>>   {
>>     int i = 0;
>>     /* Vectorizable.  */
>> diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
>> index 7c0a1b4..360b2b9 100644
>> --- a/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
>> +++ b/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
>> @@ -5,8 +5,11 @@
>>
>>   #define N 32
>>
>> +float __attribute__((aligned(16))) input[N];
>> +float __attribute__((aligned(16))) output[N];
>> +
>>   void
>> -foo (float *output, float *input)
>> +foo ()
>>   {
>>     int i = 0;
>>     /* Vectorizable.  */
>>
>
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c b/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
index 75705ae..5e98b74 100644
--- a/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
+++ b/gcc/testsuite/gcc.target/arm/vect-lceilf_1.c
@@ -5,8 +5,11 @@ 
 
 #define N 32
 
+float __attribute__((aligned(16))) input[N];
+int __attribute__((aligned(16))) output[N];
+
 void
-foo (int *output, float *input)
+foo ()
 {
   int i = 0;
   /* Vectorizable.  */
diff --git a/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c b/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
index 298d54e..655f437 100644
--- a/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
+++ b/gcc/testsuite/gcc.target/arm/vect-lfloorf_1.c
@@ -5,8 +5,11 @@ 
 
 #define N 32
 
+float __attribute__((aligned(16))) input[N];
+int __attribute__((aligned(16))) output[N];
+
 void
-foo (int *output, float *input)
+foo ()
 {
   int i = 0;
   /* Vectorizable.  */
diff --git a/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c b/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
index 6443821..92a722e 100644
--- a/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
+++ b/gcc/testsuite/gcc.target/arm/vect-lroundf_1.c
@@ -5,8 +5,11 @@ 
 
 #define N 32
 
+float __attribute__((aligned(16))) input[N];
+int __attribute__((aligned(16))) output[N];
+
 void
-foo (int *output, float *input)
+foo ()
 {
   int i = 0;
   /* Vectorizable.  */
diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
index 5616837..372ddc5 100644
--- a/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
+++ b/gcc/testsuite/gcc.target/arm/vect-rounding-btruncf.c
@@ -5,8 +5,11 @@ 
 
 #define N 32
 
+float __attribute__((aligned(16))) input[N];
+float __attribute__((aligned(16))) output[N];
+
 void
-foo (float *output, float *input)
+foo ()
 {
   int i = 0;
   /* Vectorizable.  */
diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
index cb8f1d5..3c786d4 100644
--- a/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
+++ b/gcc/testsuite/gcc.target/arm/vect-rounding-ceilf.c
@@ -5,8 +5,11 @@ 
 
 #define N 32
 
+float __attribute__((aligned(16))) input[N];
+float __attribute__((aligned(16))) output[N];
+
 void
-foo (float *output, float *input)
+foo ()
 {
   int i = 0;
   /* Vectorizable.  */
diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
index bf68af7..eedb295 100644
--- a/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
+++ b/gcc/testsuite/gcc.target/arm/vect-rounding-floorf.c
@@ -5,8 +5,11 @@ 
 
 #define N 32
 
+float __attribute__((aligned(16))) input[N];
+float __attribute__((aligned(16))) output[N];
+
 void
-foo (float *output, float *input)
+foo ()
 {
   int i = 0;
   /* Vectorizable.  */
diff --git a/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c b/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
index 7c0a1b4..360b2b9 100644
--- a/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
+++ b/gcc/testsuite/gcc.target/arm/vect-rounding-roundf.c
@@ -5,8 +5,11 @@ 
 
 #define N 32
 
+float __attribute__((aligned(16))) input[N];
+float __attribute__((aligned(16))) output[N];
+
 void
-foo (float *output, float *input)
+foo ()
 {
   int i = 0;
   /* Vectorizable.  */