public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/54446] New: Stack needlessly aligned with AVX
@ 2012-09-01  1:22 cesarb at cesarb dot net
  2012-09-01  1:24 ` [Bug target/54446] " cesarb at cesarb dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cesarb at cesarb dot net @ 2012-09-01  1:22 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54446
           Summary: Stack needlessly aligned with AVX
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cesarb@cesarb.net


When compiling the following small function, gcc aligns the stack, even though
the function does not store any AVX values in the stack:

bool test(__m256i *p)
{
    __m256i x = _mm256_load_si256(p);
    return _mm256_testz_si256(x, x);
}

The generated assembly output is:

test:
    pushq    %rbp
    movq    %rsp, %rbp
    andq    $-32, %rsp
    addq    $16, %rsp
    vmovdqa    (%rdi), %ymm0
    vptest    %ymm0, %ymm0
    leave
    sete    %al
    vzeroupper
    ret

The assembly output should instead be something like:

test:
    vmovdqa    (%rdi), %ymm0
    vptest    %ymm0, %ymm0
    sete    %al
    vzeroupper
    ret

The command line is "gcc -mavx -std=c99 -O3 -Wall -Wextra -Werror -save-temps".

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.3/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)


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

* [Bug target/54446] Stack needlessly aligned with AVX
  2012-09-01  1:22 [Bug target/54446] New: Stack needlessly aligned with AVX cesarb at cesarb dot net
@ 2012-09-01  1:24 ` cesarb at cesarb dot net
  2012-09-01 14:30 ` hjl.tools at gmail dot com
  2024-03-28  4:47 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cesarb at cesarb dot net @ 2012-09-01  1:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Cesar Eduardo Barros <cesarb at cesarb dot net> 2012-09-01 01:23:48 UTC ---
Created attachment 28114
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28114
testcase


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

* [Bug target/54446] Stack needlessly aligned with AVX
  2012-09-01  1:22 [Bug target/54446] New: Stack needlessly aligned with AVX cesarb at cesarb dot net
  2012-09-01  1:24 ` [Bug target/54446] " cesarb at cesarb dot net
@ 2012-09-01 14:30 ` hjl.tools at gmail dot com
  2024-03-28  4:47 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: hjl.tools at gmail dot com @ 2012-09-01 14:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2012-09-01 14:30:22 UTC ---
It has been fixed in GCC 4.7:

    .cfi_startproc
    vmovdqa    (%rdi), %ymm0
    vptest    %ymm0, %ymm0
    sete    %al
    ret
    .cfi_endproc


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

* [Bug target/54446] Stack needlessly aligned with AVX
  2012-09-01  1:22 [Bug target/54446] New: Stack needlessly aligned with AVX cesarb at cesarb dot net
  2012-09-01  1:24 ` [Bug target/54446] " cesarb at cesarb dot net
  2012-09-01 14:30 ` hjl.tools at gmail dot com
@ 2024-03-28  4:47 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-28  4:47 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |4.7.0
         Resolution|---                         |FIXED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed a long time ago.

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

end of thread, other threads:[~2024-03-28  4:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-01  1:22 [Bug target/54446] New: Stack needlessly aligned with AVX cesarb at cesarb dot net
2012-09-01  1:24 ` [Bug target/54446] " cesarb at cesarb dot net
2012-09-01 14:30 ` hjl.tools at gmail dot com
2024-03-28  4:47 ` pinskia 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).