public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: optimization/10623: Incorrect generation of IA-32 SSE movups via __builtin_ia32_loadups
@ 2003-05-10 19:36 Dara Hazeghi
  0 siblings, 0 replies; 3+ messages in thread
From: Dara Hazeghi @ 2003-05-10 19:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/10623; it has been noted by GNATS.

From: Dara Hazeghi <dhazeghi@yahoo.com>
To: yourst@yourst.com, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: optimization/10623: Incorrect generation of IA-32 SSE movups via __builtin_ia32_loadups
Date: Sat, 10 May 2003 12:34:08 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=10623
 
 Hello,
 
 I see the problem you mentioned with 3.2.3, but on 3.3 or mainline, the  
 testcase compiles and runs without segfaulting, so it looks like the  
 next release of gcc won't have this problem.
 
 Dara
 


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

* Re: optimization/10623: Incorrect generation of IA-32 SSE movups via __builtin_ia32_loadups
@ 2003-05-12 11:23 giovannibajo
  0 siblings, 0 replies; 3+ messages in thread
From: giovannibajo @ 2003-05-12 11:23 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, yourst

Synopsis: Incorrect generation of IA-32 SSE movups via __builtin_ia32_loadups

State-Changed-From-To: open->closed
State-Changed-By: bajo
State-Changed-When: Mon May 12 11:21:40 2003
State-Changed-Why:
    Fixed in 3.3 and mainline (20030510)

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10623


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

* optimization/10623: Incorrect generation of IA-32 SSE movups via __builtin_ia32_loadups
@ 2003-05-04 17:36 yourst
  0 siblings, 0 replies; 3+ messages in thread
From: yourst @ 2003-05-04 17:36 UTC (permalink / raw)
  To: gcc-gnats; +Cc: yourst


>Number:         10623
>Category:       optimization
>Synopsis:       Incorrect generation of IA-32 SSE movups via __builtin_ia32_loadups
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun May 04 17:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Matt Yourst
>Release:        gcc 3.2.2
>Organization:
>Environment:
gcc from Mandrake Linux (release gcc-3.2.2-3mdk)
>Description:
When using the __builtin_ia32_loadups function, gcc generates incorrect code at all optimization levels including -O1. In some circumstances, gcc generates a "movaps" load instruction instead of the specified "movups"; the code will cause an unaligned SSE load exception when run.

Furthermore, if the (incorrectly) loaded vector is subsequently stored to another correctly aligned address, gcc places the "movups" there in place of the correct instruction, "movaps".

See below for code and commented disassembly.
>How-To-Repeat:
// Compile with gcc -O2 -msse -fomit-frame-pointer:

typedef float vec4f_t __attribute__ ((mode(V4SF)));

void test(vec4f_t* dest, float* src, int count) {
  for (int i = 0; i < count; i++) {
    vec4f_t v = __builtin_ia32_loadups(src + i);
    dest[i] = v;
  }
}

int main() {
  vec4f_t dest[64];
  float src[64];
  test(dest, src, 64-4);
}

/*

Dump of assembler code for function _Z4testPU8__vectorfPfi:
  mov    0xc(%esp,1),%eax
  test   %eax,%eax
  jle    0x80483ef <_Z4testPU8__vectorfPfi+31>
  mov    0x4(%esp,1),%ecx
  mov    0x8(%esp,1),%edx
  movaps (%edx),%xmm0       << INCORRECT: this should be movups (%edx),%xmm0
  movups %xmm0,(%ecx)       << INCORRECT: this should be movaps %xmm0,(%ecx)
  add    $0x4,%edx
  add    $0x10,%ecx
  dec    %eax
  jne    0x80483e0 <_Z4testPU8__vectorfPfi+16>
  ret

*/
>Fix:
Unknown; only workaround is to compile at -O0 or use inline assembly instead of __builtin_ia32_loadups intrinsic.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-05-12 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-10 19:36 optimization/10623: Incorrect generation of IA-32 SSE movups via __builtin_ia32_loadups Dara Hazeghi
  -- strict thread matches above, loose matches on Subject: below --
2003-05-12 11:23 giovannibajo
2003-05-04 17:36 yourst

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