public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49061] New: wrong code with ARM NEON intrinsics
@ 2011-05-19 12:23 hules at free dot fr
  2011-05-19 13:12 ` [Bug c/49061] " irar at il dot ibm.com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hules at free dot fr @ 2011-05-19 12:23 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: wrong code with ARM NEON intrinsics
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hules@free.fr


The code below generates wrong results when compiled with optimizations
enabled:

#include <stdio.h>
#include <string.h>
#include <arm_neon.h>

static void vvalidate(float *f) {
  float32x4_t a0 = { 0, 1, 2, 3};
  float32x4_t a1 = { 4, 5, 6, 7};
  float32x4_t a2 = { 8, 9, 10, 11};
  float32x4x2_t t0 = vzipq_f32(a1, a2);
  t0 = vzipq_f32(a0, a2);
  memcpy(f, &t0.val[0], 8*sizeof(float));
}

int main() {
  float f[8];
  vvalidate(f);
  printf("interleaved([0 1 2 3], [8 9 10 11])=%g %g %g %g %g %g %g %g\n", f[0],
f[1], f[2], f[3], f[4], f[5], f[6], f[7]);
  if (f[4] != 2) printf("BUUUUGGG -- should be 0 8 1 9 2 10 3 11\n");           
  return 0;
}

# gcc-4.6.0 -mfloat-abi=softfp -mfpu=neon -O0 ./neon_bug.c && ./a.out
interleaved([0 1 2 3], [8 9 10 11])=0 8 1 9 2 10 3 11

# gcc-4.6.0 -mfloat-abi=softfp -mfpu=neon -O1 ./neon_bug.c && ./a.out
interleaved([0 1 2 3], [8 9 10 11])=0 8 1 9 6 10 7 11
BUUUUGGG -- should be 0 8 1 9 2 10 3 11

The bug also happens with the gcc-4.5 (Ubuntu/Linaro 4.5.2-8ubuntu4) and
gcc-4.4 (Ubuntu/Linaro 4.4.5-15ubuntu1) that ship with ubuntu 11.04.


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

* [Bug c/49061] wrong code with ARM NEON intrinsics
  2011-05-19 12:23 [Bug c/49061] New: wrong code with ARM NEON intrinsics hules at free dot fr
@ 2011-05-19 13:12 ` irar at il dot ibm.com
  2011-05-19 19:58 ` [Bug target/49061] " hules at free dot fr
  2011-05-20  8:39 ` irar at il dot ibm.com
  2 siblings, 0 replies; 4+ messages in thread
From: irar at il dot ibm.com @ 2011-05-19 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |irar at il dot ibm.com

--- Comment #1 from Ira Rosen <irar at il dot ibm.com> 2011-05-19 12:35:35 UTC ---
This is probably related to pr 48252.


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

* [Bug target/49061] wrong code with ARM NEON intrinsics
  2011-05-19 12:23 [Bug c/49061] New: wrong code with ARM NEON intrinsics hules at free dot fr
  2011-05-19 13:12 ` [Bug c/49061] " irar at il dot ibm.com
@ 2011-05-19 19:58 ` hules at free dot fr
  2011-05-20  8:39 ` irar at il dot ibm.com
  2 siblings, 0 replies; 4+ messages in thread
From: hules at free dot fr @ 2011-05-19 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Julien Pommier <hules at free dot fr> 2011-05-19 19:30:49 UTC ---
Thanks Ira, I guess you are right. Testing with the latest gcc 4.6.1 snapshot,
the bug seems to be gone !


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

* [Bug target/49061] wrong code with ARM NEON intrinsics
  2011-05-19 12:23 [Bug c/49061] New: wrong code with ARM NEON intrinsics hules at free dot fr
  2011-05-19 13:12 ` [Bug c/49061] " irar at il dot ibm.com
  2011-05-19 19:58 ` [Bug target/49061] " hules at free dot fr
@ 2011-05-20  8:39 ` irar at il dot ibm.com
  2 siblings, 0 replies; 4+ messages in thread
From: irar at il dot ibm.com @ 2011-05-20  8:39 UTC (permalink / raw)
  To: gcc-bugs

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

Ira Rosen <irar at il dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #3 from Ira Rosen <irar at il dot ibm.com> 2011-05-20 07:52:13 UTC ---
Good, I am closing the pr then.

*** This bug has been marked as a duplicate of bug 48252 ***


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

end of thread, other threads:[~2011-05-20  8:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 12:23 [Bug c/49061] New: wrong code with ARM NEON intrinsics hules at free dot fr
2011-05-19 13:12 ` [Bug c/49061] " irar at il dot ibm.com
2011-05-19 19:58 ` [Bug target/49061] " hules at free dot fr
2011-05-20  8:39 ` irar at il dot ibm.com

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