public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/53338] New: [4.8 Regression] Unaligned store generated for aligned data
@ 2012-05-13 19:27 ubizjak at gmail dot com
  2012-05-13 22:07 ` [Bug middle-end/53338] " ubizjak at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ubizjak at gmail dot com @ 2012-05-13 19:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53338

             Bug #: 53338
           Summary: [4.8 Regression] Unaligned store generated for aligned
                    data
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ubizjak@gmail.com


Following testcase:

--cut here--
#define SIZE 10240

int b[SIZE], c[SIZE];
long long __attribute__((__aligned__ (128))) a[SIZE];

void
imul32_to_64 (void)
{
  int i;

  for (i = 0; i < SIZE; i++)
    a[i] = (long)b[i] * (long)c[i];
}
--cut here--

regressed from 4.7 when compiled with "-O3 -msse4". An unaligned store is
generated in 4.8, where in 4.7 aligned store is used.

4.8:

.L3:
        movdqa  b(%rax), %xmm1
        movdqa  c(%rax), %xmm0
        movdqa  %xmm1, %xmm3
        movdqa  %xmm0, %xmm2
        punpckldq       %xmm1, %xmm3
        punpckldq       %xmm0, %xmm2
        punpckhdq       %xmm1, %xmm1
        punpckhdq       %xmm0, %xmm0
        pmuldq  %xmm3, %xmm2
>>      movdqu  %xmm2, a(%rax,%rax)
        pmuldq  %xmm1, %xmm0
>>      movdqu  %xmm0, a+16(%rax,%rax)
        addq    $16, %rax
        cmpq    $40960, %rax
        jne     .L3

4.7.1:

.L2:
        movdqa  b(%rax), %xmm1
        movdqa  c(%rax), %xmm0
        movdqa  %xmm1, %xmm3
        movdqa  %xmm0, %xmm2
        punpckldq       %xmm1, %xmm3
        punpckldq       %xmm0, %xmm2
        punpckhdq       %xmm1, %xmm1
        punpckhdq       %xmm0, %xmm0
        pmuldq  %xmm3, %xmm2
>>      movdqa  %xmm2, a(%rax,%rax)
        pmuldq  %xmm1, %xmm0
>>      movdqa  %xmm0, a+16(%rax,%rax)
        addq    $16, %rax
        cmpq    $40960, %rax
        jne     .L2

The unaligned store is generated from expr.c, expand_assignment.


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

end of thread, other threads:[~2012-09-07 11:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-13 19:27 [Bug middle-end/53338] New: [4.8 Regression] Unaligned store generated for aligned data ubizjak at gmail dot com
2012-05-13 22:07 ` [Bug middle-end/53338] " ubizjak at gmail dot com
2012-05-14  4:41 ` hjl.tools at gmail dot com
2012-05-14  8:51 ` rguenth at gcc dot gnu.org
2012-05-14  9:22 ` ubizjak at gmail dot com
2012-05-14  9:24 ` dominiq at lps dot ens.fr
2012-05-14  9:34 ` rguenth at gcc dot gnu.org
2012-05-14  9:44 ` dominiq at lps dot ens.fr
2012-09-07 11:50 ` rguenth at gcc dot gnu.org

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