public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386]: Committed: Fix PR target/35496
@ 2008-03-09 13:38 Uros Bizjak
  2008-03-09 14:26 ` H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Uros Bizjak @ 2008-03-09 13:38 UTC (permalink / raw)
  To: GCC Patches

Hello!

We have to compute alignment of VECTOR_CST and INTEGER_CST constants via 
ALIGN_MODE_128 in the same way as other ALIGN_MODE_128 data is aligned.

2008-03-09  Uros Bizjak  <ubizjak@gmail.com>

        PR target/35496
        * config/i386/i386.c (ix86_constant_algnment): Compute alignment 
using
        ALIGN_MODE_128 for VECTOR_CST and INTEGER_CST in addition to 
REAL_CST.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu 
{,-m32}. Patch is committed to mainline, but I think that it should be 
committed to 4.3 branch as well.

Uros.

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 133051)
+++ config/i386/i386.c  (working copy)
@@ -16789,7 +16789,8 @@
 int
 ix86_constant_alignment (tree exp, int align)
 {
-  if (TREE_CODE (exp) == REAL_CST)
+  if (TREE_CODE (exp) == REAL_CST || TREE_CODE (exp) == VECTOR_CST
+      || TREE_CODE (exp) == INTEGER_CST)
     {
       if (TYPE_MODE (TREE_TYPE (exp)) == DFmode && align < 64)
        return 64;

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

* Re: [PATCH, i386]: Committed: Fix PR target/35496
  2008-03-09 13:38 [PATCH, i386]: Committed: Fix PR target/35496 Uros Bizjak
@ 2008-03-09 14:26 ` H.J. Lu
  2008-03-09 17:07   ` Uros Bizjak
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2008-03-09 14:26 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: GCC Patches

On Sun, Mar 9, 2008 at 5:38 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
>  We have to compute alignment of VECTOR_CST and INTEGER_CST constants via
>  ALIGN_MODE_128 in the same way as other ALIGN_MODE_128 data is aligned.
>
>  2008-03-09  Uros Bizjak  <ubizjak@gmail.com>
>
>         PR target/35496
>         * config/i386/i386.c (ix86_constant_algnment): Compute alignment
>  using
>         ALIGN_MODE_128 for VECTOR_CST and INTEGER_CST in addition to
>  REAL_CST.
>
>  Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
>  {,-m32}. Patch is committed to mainline, but I think that it should be
>  committed to 4.3 branch as well.
>

Can we add a few testcases for Linux/ia32?


H.J.

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

* Re: [PATCH, i386]: Committed: Fix PR target/35496
  2008-03-09 14:26 ` H.J. Lu
@ 2008-03-09 17:07   ` Uros Bizjak
  2008-03-09 17:33     ` H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Uros Bizjak @ 2008-03-09 17:07 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Patches

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

H.J. Lu wrote:

>>  Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
>>  {,-m32}. Patch is committed to mainline, but I think that it should be
>>  committed to 4.3 branch as well.
>>     
>
> Can we add a few testcases for Linux/ia32?
>   

Actually, I have a testcase (attached), that clearly shows the problem 
in the asm dump, but it looks that linker somehow fixed this alignment, 
so I was not able to fail it (-m32 -O2 -msse2):

        .section        .rodata
        .align 8
.LC0:
        .long   1
        .long   0
        .long   2
        .long   0

It looks that this fixup is the reason that the problem went undetected 
for so long.

Uros.


[-- Attachment #2: vv.c --]
[-- Type: text/x-csrc, Size: 339 bytes --]

typedef long long __v2di __attribute__ ((__vector_size__ (16)));

typedef union
{
  __v2di _v;
  long long _a[2];
} __v2di_t;

void abort (void);

static __v2di x = { 1, 2 };

__v2di __attribute__((noinline))
test (void)
{
  return x;
}

int main()
{
  __v2di_t val;

  val._v = test ();

  if (val._a[0] + val._a[1] != 3)
    abort ();
}

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

* Re: [PATCH, i386]: Committed: Fix PR target/35496
  2008-03-09 17:07   ` Uros Bizjak
@ 2008-03-09 17:33     ` H.J. Lu
  2008-03-09 18:40       ` Uros Bizjak
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2008-03-09 17:33 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: GCC Patches

Hi Uros,

Did you confirm it on Linux with visual inspection?

H.J.
2008/3/9 Uros Bizjak <ubizjak@gmail.com>:
> H.J. Lu wrote:
>
>  >>  Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
>  >>  {,-m32}. Patch is committed to mainline, but I think that it should be
>  >>  committed to 4.3 branch as well.
>  >>
>  >
>  > Can we add a few testcases for Linux/ia32?
>  >
>
>  Actually, I have a testcase (attached), that clearly shows the problem
>  in the asm dump, but it looks that linker somehow fixed this alignment,
>  so I was not able to fail it (-m32 -O2 -msse2):
>
>         .section        .rodata
>         .align 8
>  .LC0:
>         .long   1
>         .long   0
>         .long   2
>         .long   0
>
>  It looks that this fixup is the reason that the problem went undetected
>  for so long.
>
>  Uros.
>
>

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

* Re: [PATCH, i386]: Committed: Fix PR target/35496
  2008-03-09 17:33     ` H.J. Lu
@ 2008-03-09 18:40       ` Uros Bizjak
  2008-03-09 20:17         ` H.J. Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Uros Bizjak @ 2008-03-09 18:40 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Patches

H.J. Lu wrote:

> Did you confirm it on Linux with visual inspection?
>   

No, fortran testcase failed with -O2 -msse2 -m32.

Uros.

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

* Re: [PATCH, i386]: Committed: Fix PR target/35496
  2008-03-09 18:40       ` Uros Bizjak
@ 2008-03-09 20:17         ` H.J. Lu
  2008-03-09 20:53           ` Uros Bizjak
  0 siblings, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2008-03-09 20:17 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: GCC Patches

On Sun, Mar 09, 2008 at 07:39:36PM +0100, Uros Bizjak wrote:
> H.J. Lu wrote:
>
>> Did you confirm it on Linux with visual inspection?
>>   
>
> No, fortran testcase failed with -O2 -msse2 -m32.

Can we create a few Fortran tests with -O2 -msse2 -m32?


H.J.

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

* Re: [PATCH, i386]: Committed: Fix PR target/35496
  2008-03-09 20:17         ` H.J. Lu
@ 2008-03-09 20:53           ` Uros Bizjak
  2008-03-10 14:58             ` Kaveh R. GHAZI
  0 siblings, 1 reply; 8+ messages in thread
From: Uros Bizjak @ 2008-03-09 20:53 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GCC Patches

H.J. Lu wrote:

>>> Did you confirm it on Linux with visual inspection?
>>>   
>>>       
>> No, fortran testcase failed with -O2 -msse2 -m32.
>>     
>
> Can we create a few Fortran tests with -O2 -msse2 -m32?
>   

No, because fortran testsuite can't detect SSE2 support at runtime. See 
fortran vectorizer tests...

Uros.

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

* Re: [PATCH, i386]: Committed: Fix PR target/35496
  2008-03-09 20:53           ` Uros Bizjak
@ 2008-03-10 14:58             ` Kaveh R. GHAZI
  0 siblings, 0 replies; 8+ messages in thread
From: Kaveh R. GHAZI @ 2008-03-10 14:58 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: H.J. Lu, GCC Patches

On Sun, 9 Mar 2008, Uros Bizjak wrote:

> H.J. Lu wrote:
>
> >>> Did you confirm it on Linux with visual inspection?
> >>>
> >>>
> >> No, fortran testcase failed with -O2 -msse2 -m32.
> >>
> >
> > Can we create a few Fortran tests with -O2 -msse2 -m32?
> >
>
> No, because fortran testsuite can't detect SSE2 support at runtime. See
> fortran vectorizer tests...
> Uros.

See PRs 34168 & 34878, (hoping someone will fix them...)

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu

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

end of thread, other threads:[~2008-03-10 14:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-09 13:38 [PATCH, i386]: Committed: Fix PR target/35496 Uros Bizjak
2008-03-09 14:26 ` H.J. Lu
2008-03-09 17:07   ` Uros Bizjak
2008-03-09 17:33     ` H.J. Lu
2008-03-09 18:40       ` Uros Bizjak
2008-03-09 20:17         ` H.J. Lu
2008-03-09 20:53           ` Uros Bizjak
2008-03-10 14:58             ` Kaveh R. GHAZI

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