public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61292] New: auto keyword to vector reference generates wrong alignment move
Date: Fri, 23 May 2014 10:05:00 -0000	[thread overview]
Message-ID: <bug-61292-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61292

            Bug ID: 61292
           Summary: auto keyword to vector reference generates wrong
                    alignment move
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincenzo.innocente at cern dot ch

given
typedef float __attribute__( ( vector_size( 16 ) ) ) float32x4_t;
typedef float __attribute__( ( vector_size( 16 ) , aligned(4) ) )
float32x4a4_t;


void add11(float * x, float y, float32x4_t v) {
   auto & k1 = *(float32x4a4_t*)(x);
   auto & k2 = *(float32x4a4_t*)(x);
   k1 +=v;
   k2 += k1+v;
}

void add98(float * x, float y, float32x4_t v) {
   float32x4a4_t & k1 = *(float32x4a4_t*)(x);
   float32x4a4_t & k2 = *(float32x4a4_t*)(x);
   k1 +=v;
   k2 += k1+v;
}

I get
c++ -std=c++1y -Ofast -march=haswell  -S extNotAlign.cc; cat extNotAlign.s
__Z5add11PffU8__vectorf:
LFB4:
    vaddps    (%rdi), %xmm1, %xmm0
    vaddps    %xmm0, %xmm0, %xmm0
    vaddps    %xmm1, %xmm0, %xmm1
    vmovaps    %xmm1, (%rdi)
    ret
LFE4:
    .section __TEXT,__text_cold,regular,pure_instructions
LCOLDE4:
    .text
LHOTE4:
    .section __TEXT,__text_cold,regular,pure_instructions
LCOLDB5:
    .text
LHOTB5:
    .align 4,0x90
    .globl __Z5add98PffU8__vectorf
__Z5add98PffU8__vectorf:
LFB5:
    vaddps    (%rdi), %xmm1, %xmm0
    vaddps    %xmm0, %xmm0, %xmm0
    vaddps    %xmm1, %xmm0, %xmm1
    vmovups    %xmm1, (%rdi)
    ret

second of course is correct (vmovups not vmovaps)


             reply	other threads:[~2014-05-23 10:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23 10:05 vincenzo.innocente at cern dot ch [this message]
2014-05-25 12:19 ` [Bug c++/61292] auto keyword to vector reference generates wrong alignment move (causing runtime segfault) vincenzo.innocente at cern dot ch
2021-07-28 16:09 ` [Bug c++/61292] auto keyword to " pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-61292-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).