public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/52457] New: Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7
@ 2012-03-02  1:57 bergner at gcc dot gnu.org
  2012-03-02  2:00 ` [Bug target/52457] " bergner at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bergner at gcc dot gnu.org @ 2012-03-02  1:57 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52457
           Summary: Wrong VSX code generation bug when compiled with -O1
                    -m32 -mcpu=power7
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: bergner@gcc.gnu.org
        ReportedBy: bergner@gcc.gnu.org
                CC: meissner@gcc.gnu.org
              Host: powerpc*-linux
            Target: powerpc*-linux
             Build: powerpc*-linux


The following test case aborts when compiled with -O1 and -O2, but runs
successfully when compiled with -O0 and -O3.  The wrong code generation occurs
in the function buggy_func().  The bug is caused by a typo in the
rs600/vsx.md's vsx_set_<mode> pattern.

bergner@igoo:~> cat bug.c 
extern void abort (void);

typedef long long T;
typedef T vl_t __attribute__((vector_size(2 * sizeof (T))));

vl_t
buggy_func (T x)
{
  vl_t w;
  T *p = (T *)&w;
  p[0] = p[1] = x;
  return w;
}

int
main(void)
{
  vl_t rval;
  T *pl;

  pl = (T *) &rval;
  rval = buggy_func (2);

  if (pl[0] != 2 || pl[1] != 2)
    abort ();

  return 0;
}
bergner@igoo:~> /home/bergner/gcc/build/gcc-mainline-testsuite/gcc/xgcc
-B/home/bergner/gcc/build/gcc-mainline-testsuite/gcc/ -O0 -m32 -mcpu=power7
bug.c 
bergner@igoo:~> ./a.out 
bergner@igoo:~> /home/bergner/gcc/build/gcc-mainline-testsuite/gcc/xgcc
-B/home/bergner/gcc/build/gcc-mainline-testsuite/gcc/ -O1 -m32 -mcpu=power7
bug.c 
bergner@igoo:~> ./a.out 
Aborted


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

* [Bug target/52457] Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7
  2012-03-02  1:57 [Bug target/52457] New: Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7 bergner at gcc dot gnu.org
@ 2012-03-02  2:00 ` bergner at gcc dot gnu.org
  2012-03-02 10:01 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bergner at gcc dot gnu.org @ 2012-03-02  2:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Peter Bergner <bergner at gcc dot gnu.org> 2012-03-02 01:59:22 UTC ---
I'm bootstrapping the following patch which fixes the bug for me.

Index: gcc/config/rs6000/vsx.md
===================================================================
--- gcc/config/rs6000/vsx.md    (revision 184649)
+++ gcc/config/rs6000/vsx.md    (working copy)
@@ -1119,9 +1119,9 @@ (define_insn "vsx_set_<mode>"
   "VECTOR_MEM_VSX_P (<MODE>mode)"
 {
   if (INTVAL (operands[3]) == 0)
-    return \"xxpermdi %x0,%x1,%x2,1\";
+    return \"xxpermdi %x0,%x2,%x1,1\";
   else if (INTVAL (operands[3]) == 1)
-    return \"xxpermdi %x0,%x2,%x1,0\";
+    return \"xxpermdi %x0,%x1,%x2,0\";
   else
     gcc_unreachable ();
 }


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

* [Bug target/52457] Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7
  2012-03-02  1:57 [Bug target/52457] New: Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7 bergner at gcc dot gnu.org
  2012-03-02  2:00 ` [Bug target/52457] " bergner at gcc dot gnu.org
@ 2012-03-02 10:01 ` rguenth at gcc dot gnu.org
  2012-03-02 15:59 ` bergner at gcc dot gnu.org
  2012-03-02 22:46 ` bergner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-02 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-03-02
     Ever Confirmed|0                           |1


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

* [Bug target/52457] Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7
  2012-03-02  1:57 [Bug target/52457] New: Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7 bergner at gcc dot gnu.org
  2012-03-02  2:00 ` [Bug target/52457] " bergner at gcc dot gnu.org
  2012-03-02 10:01 ` rguenth at gcc dot gnu.org
@ 2012-03-02 15:59 ` bergner at gcc dot gnu.org
  2012-03-02 22:46 ` bergner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: bergner at gcc dot gnu.org @ 2012-03-02 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2012-03/msg00132.htm
                   |                            |l

--- Comment #2 from Peter Bergner <bergner at gcc dot gnu.org> 2012-03-02 15:59:27 UTC ---
Patch posted to gcc-patches in the URL above.


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

* [Bug target/52457] Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7
  2012-03-02  1:57 [Bug target/52457] New: Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7 bergner at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-03-02 15:59 ` bergner at gcc dot gnu.org
@ 2012-03-02 22:46 ` bergner at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: bergner at gcc dot gnu.org @ 2012-03-02 22:46 UTC (permalink / raw)
  To: gcc-bugs

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

Peter Bergner <bergner at gcc dot gnu.org> changed:

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

--- Comment #3 from Peter Bergner <bergner at gcc dot gnu.org> 2012-03-02 22:46:25 UTC ---
Patch was committed to trunk and the 4.7, 4.6 and 4.5 release branches.  Bah, I
forgot to include the PR# in the ChangeLog, so you won't see the automatic
confirmation note here. :(


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

end of thread, other threads:[~2012-03-02 22:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-02  1:57 [Bug target/52457] New: Wrong VSX code generation bug when compiled with -O1 -m32 -mcpu=power7 bergner at gcc dot gnu.org
2012-03-02  2:00 ` [Bug target/52457] " bergner at gcc dot gnu.org
2012-03-02 10:01 ` rguenth at gcc dot gnu.org
2012-03-02 15:59 ` bergner at gcc dot gnu.org
2012-03-02 22:46 ` bergner 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).