public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/22076] New: Strange code for MMX register moves
@ 2005-06-15 12:40 uros at kss-loka dot si
  2005-06-15 12:57 ` [Bug target/22076] " falk at debian dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: uros at kss-loka dot si @ 2005-06-15 12:40 UTC (permalink / raw)
  To: gcc-bugs

This testcase:
#include <mmintrin.h>

__m64 test() {
   __m64 a;

   return a;
}

results in quite strange code when compiled with '-O2 -mmmx':

test:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$8, %esp
	movl	%eax, -8(%ebp)   <<<<
	movl	%edx, -4(%ebp)   <<<<
	movq	-8(%ebp), %mm0
	leave
	ret

If xmm registers are used (change __m64 into __m128), asm code is OK.
It looks there are some problems with register costs, from _.22.lreg:

Pass 0

  Register 58 costs: AD_REGS:13000 Q_REGS:13000 NON_Q_REGS:13000 
INDEX_REGS:13000 LEGACY_REGS:13000 GENERAL_REGS:13000 MMX_REGS:24000 
FLOAT_INT_REGS:30000 INT_SSE_REGS:30000 FLOAT_INT_SSE_REGS:30000 ALL_REGS:30000 
MEM:20000

  Register 58 pref GENERAL_REGS or none


Pass 1

  Register 58 costs: AD_REGS:13000 Q_REGS:13000 NON_Q_REGS:13000 
INDEX_REGS:13000 LEGACY_REGS:13000 GENERAL_REGS:13000 MMX_REGS:24000 
FLOAT_INT_REGS:30000 INT_SSE_REGS:30000 FLOAT_INT_SSE_REGS:30000 ALL_REGS:30000 
MEM:20000

...

(insn:HI 16 28 22 1 (set (reg/i:V2SI 29 mm0 [ <result> ])
        (reg/v:V2SI 58 [ a ])) 768 {*movv2si_internal} (nil)
    (expr_list:REG_DEAD (reg/v:V2SI 58 [ a ])
        (nil)))
...

The instructions, marked with '<<<<' are then produced by reload.

-- 
           Summary: Strange code for MMX register moves
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: ssemmx
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: uros at kss-loka dot si
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
@ 2005-06-15 12:57 ` falk at debian dot org
  2005-06-15 17:35 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: falk at debian dot org @ 2005-06-15 12:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk at debian dot org  2005-06-15 12:56 -------
(In reply to comment #0)
> This testcase:
> #include <mmintrin.h>
> 
> __m64 test() {
>    __m64 a;
> 
>    return a;
> }

Well, this is invalid code, so it's not really important what the code
looks like. If it also occurs in valid code, it might be related to PR 7061.


-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
  2005-06-15 12:57 ` [Bug target/22076] " falk at debian dot org
@ 2005-06-15 17:35 ` pinskia at gcc dot gnu dot org
  2005-06-21 12:04 ` uros at kss-loka dot si
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-15 17:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-15 17:35 -------
a is uninitialized so what do you expect?

-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
  2005-06-15 12:57 ` [Bug target/22076] " falk at debian dot org
  2005-06-15 17:35 ` pinskia at gcc dot gnu dot org
@ 2005-06-21 12:04 ` uros at kss-loka dot si
  2005-06-21 13:06 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: uros at kss-loka dot si @ 2005-06-21 12:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From uros at kss-loka dot si  2005-06-21 12:04 -------
New testcase (everything is initialized this time):

--cut here--
#include <mmintrin.h>

__v8qi test ()
{
  __v8qi mm0 = {1,2,3,4,5,6,7,8};
  __v8qi mm1 = {11,22,33,44,55,66,77,88};
  volatile __m64 x;

  x = _mm_add_pi8 (mm0, mm1);

  return x;
}
--cut here--


Pass 0

  Register 67 costs: AD_REGS:4000 Q_REGS:4000 NON_Q_REGS:4000 INDEX_REGS:4000 
LEGACY_REGS:4000 GENERAL_REGS:4000 MMX_REGS:46000 INT_SSE_REGS:38000 MEM:16000

  Register 67 pref GENERAL_REGS or none


Pass 1

  Register 67 costs: AD_REGS:4000 Q_REGS:4000 NON_Q_REGS:4000 INDEX_REGS:4000 
LEGACY_REGS:4000 GENERAL_REGS:4000 MMX_REGS:46000 INT_SSE_REGS:38000 MEM:16000

69 registers.

...

(insn:HI 18 45 22 1 (set (reg:V8QI 67)
        (mem/u/i:V8QI (symbol_ref/u:SI ("*.LC2") [flags 0x2]) [0 S8 A64])) 766 
{*movv8qi_internal} (nil)
    (expr_list:REG_EQUIV (const_vector:V8QI [
                (const_int 12 [0xc])
                (const_int 24 [0x18])
                (const_int 36 [0x24])
                (const_int 48 [0x30])
                (const_int 60 [0x3c])
                (const_int 72 [0x48])
                (const_int 84 [0x54])
                (const_int 96 [0x60])
            ])
        (nil)))

...

test:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$24, %esp
	movl	$807671820, %eax
	movl	$1616136252, %edx
	movl	%eax, -8(%ebp)
	movl	%edx, -4(%ebp)
	movl	-8(%ebp), %eax
	movl	-4(%ebp), %edx
	movl	%eax, -24(%ebp)
	movl	%edx, -20(%ebp)
	movq	-24(%ebp), %mm1
	leave
	movq	%mm1, %mm0
	ret



-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
                   ` (2 preceding siblings ...)
  2005-06-21 12:04 ` uros at kss-loka dot si
@ 2005-06-21 13:06 ` pinskia at gcc dot gnu dot org
  2005-06-22 20:27 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-21 13:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-21 13:06 -------
I think this is more related to PR 14552 which was shown by me that we regressed because we did not 
output emms at all before so not emmiting mmx instructions without use of the functions in 
mmintrin.h

-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
                   ` (3 preceding siblings ...)
  2005-06-21 13:06 ` pinskia at gcc dot gnu dot org
@ 2005-06-22 20:27 ` pinskia at gcc dot gnu dot org
  2005-06-22 20:29 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-22 20:27 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |22152
              nThis|                            |


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
                   ` (4 preceding siblings ...)
  2005-06-22 20:27 ` pinskia at gcc dot gnu dot org
@ 2005-06-22 20:29 ` pinskia at gcc dot gnu dot org
  2005-08-31 19:18 ` pinskia at gcc dot gnu dot org
  2005-08-31 20:42 ` bangerth at dealii dot org
  7 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-22 20:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-22 20:27 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-22 20:27:37
               date|                            |


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
                   ` (5 preceding siblings ...)
  2005-06-22 20:29 ` pinskia at gcc dot gnu dot org
@ 2005-08-31 19:18 ` pinskia at gcc dot gnu dot org
  2005-08-31 20:42 ` bangerth at dealii dot org
  7 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-31 19:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-31 19:18 -------
*** Bug 23660 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vahur dot sinijarv at
                   |                            |cydonia dot ee


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


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

* [Bug target/22076] Strange code for MMX register moves
  2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
                   ` (6 preceding siblings ...)
  2005-08-31 19:18 ` pinskia at gcc dot gnu dot org
@ 2005-08-31 20:42 ` bangerth at dealii dot org
  7 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2005-08-31 20:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2005-08-31 20:34 -------
In the discussion on the duplicate PR 23660, rth explained part of this here: 
  http://gcc.gnu.org/ml/gcc/2005-08/msg00934.html 
 
W. 

-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
       [not found] <bug-22076-1649@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2008-11-16  0:14 ` howarth at nitro dot med dot uc dot edu
@ 2008-11-16  0:15 ` howarth at nitro dot med dot uc dot edu
  5 siblings, 0 replies; 15+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2008-11-16  0:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from howarth at nitro dot med dot uc dot edu  2008-11-16 00:14 -------
Created an attachment (id=16692)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16692&action=view)
assembly file generated for gcc.target/i386/pr22076.c at -m64 on
i686-apple-darwin9


-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
       [not found] <bug-22076-1649@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2008-03-08  7:24 ` ubizjak at gmail dot com
@ 2008-11-16  0:14 ` howarth at nitro dot med dot uc dot edu
  2008-11-16  0:15 ` howarth at nitro dot med dot uc dot edu
  5 siblings, 0 replies; 15+ messages in thread
From: howarth at nitro dot med dot uc dot edu @ 2008-11-16  0:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from howarth at nitro dot med dot uc dot edu  2008-11-16 00:13 -------
The gcc.target/i386/pr22076.c test case fails for i686-apple-darwin9 at -m64 as
follows...

Executing on host:
/sw/src/fink.build/gcc44-4.3.999-20081115/darwin_objdir/gcc/xgcc
-B/sw/src/fink.build/gcc44-4.3.999-20081115/darwin_objdi
r/gcc/
/sw/src/fink.build/gcc44-4.3.999-20081115/gcc-4.4-20081115/gcc/testsuite/gcc.target/i386/pr22076.c
  -O2 -flax-vector-conversions -mm
mx -S  -m64 -o pr22076.s    (timeout = 300)
PASS: gcc.target/i386/pr22076.c (test for excess errors)
FAIL: gcc.target/i386/pr22076.c scan-assembler-times movq 3


-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
       [not found] <bug-22076-1649@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-02-23 15:34 ` ubizjak at gmail dot com
@ 2008-03-08  7:24 ` ubizjak at gmail dot com
  2008-11-16  0:14 ` howarth at nitro dot med dot uc dot edu
  2008-11-16  0:15 ` howarth at nitro dot med dot uc dot edu
  5 siblings, 0 replies; 15+ messages in thread
From: ubizjak at gmail dot com @ 2008-03-08  7:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from ubizjak at gmail dot com  2008-03-08 07:23 -------
Fixed for real.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug target/22076] Strange code for MMX register moves
       [not found] <bug-22076-1649@http.gcc.gnu.org/bugzilla/>
  2007-12-10  8:40 ` ubizjak at gmail dot com
  2008-02-23 15:25 ` uros at gcc dot gnu dot org
@ 2008-02-23 15:34 ` ubizjak at gmail dot com
  2008-03-08  7:24 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: ubizjak at gmail dot com @ 2008-02-23 15:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from ubizjak at gmail dot com  2008-02-23 15:33 -------
Fixed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |02/msg01026.html
   Target Milestone|---                         |4.4.0


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


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

* [Bug target/22076] Strange code for MMX register moves
       [not found] <bug-22076-1649@http.gcc.gnu.org/bugzilla/>
  2007-12-10  8:40 ` ubizjak at gmail dot com
@ 2008-02-23 15:25 ` uros at gcc dot gnu dot org
  2008-02-23 15:34 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: uros at gcc dot gnu dot org @ 2008-02-23 15:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from uros at gcc dot gnu dot org  2008-02-23 15:24 -------
Subject: Bug 22076

Author: uros
Date: Sat Feb 23 15:24:02 2008
New Revision: 132572

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132572
Log:
        PR target/22076
        PR target/34256

        * config/i386/mmx.md (*mov<mode>_internal_rex64): Use "!y" to
        prevent reload from using MMX registers.
        (*mov<mode>_internal): Ditto.
        (*movv2sf_internal_rex64): Ditto.
        (*movv2sf_internal): Ditto.

testsuite/ChangeLog:

        PR target/22076
        PR target/34256
        * gcc.target/i386/pr22076.c: New test.
        * gcc.target/i386/pr34256.c: New test.
        * gcc.target/i386/vecinit-5.c: New test.
        * gcc.target/i386/vecinit-6.c: New test.
        * gcc.target/i386/vecinit-[1-4].c: Check that no MMX register is used.

        * g++.dg/compat/struct-layout-1.h: Do not include <mmintrin.h> and
        <xmmintrin.h>, define __m64 and __m128 directly.
        * g++.dg/compat/struct-layout-1_generate.c: Add -mno-mmx for x86.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr22076.c
    trunk/gcc/testsuite/gcc.target/i386/pr34256.c
    trunk/gcc/testsuite/gcc.target/i386/vecinit-5.c
    trunk/gcc/testsuite/gcc.target/i386/vecinit-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/mmx.md
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/compat/struct-layout-1.h
    trunk/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c
    trunk/gcc/testsuite/gcc.target/i386/vecinit-1.c
    trunk/gcc/testsuite/gcc.target/i386/vecinit-2.c
    trunk/gcc/testsuite/gcc.target/i386/vecinit-3.c
    trunk/gcc/testsuite/gcc.target/i386/vecinit-4.c


-- 


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


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

* [Bug target/22076] Strange code for MMX register moves
       [not found] <bug-22076-1649@http.gcc.gnu.org/bugzilla/>
@ 2007-12-10  8:40 ` ubizjak at gmail dot com
  2008-02-23 15:25 ` uros at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: ubizjak at gmail dot com @ 2007-12-10  8:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from ubizjak at gmail dot com  2007-12-10 08:40 -------
*** Bug 34256 has been marked as a duplicate of this bug. ***


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dean at arctic dot org


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


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

end of thread, other threads:[~2008-11-16  0:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-15 12:40 [Bug target/22076] New: Strange code for MMX register moves uros at kss-loka dot si
2005-06-15 12:57 ` [Bug target/22076] " falk at debian dot org
2005-06-15 17:35 ` pinskia at gcc dot gnu dot org
2005-06-21 12:04 ` uros at kss-loka dot si
2005-06-21 13:06 ` pinskia at gcc dot gnu dot org
2005-06-22 20:27 ` pinskia at gcc dot gnu dot org
2005-06-22 20:29 ` pinskia at gcc dot gnu dot org
2005-08-31 19:18 ` pinskia at gcc dot gnu dot org
2005-08-31 20:42 ` bangerth at dealii dot org
     [not found] <bug-22076-1649@http.gcc.gnu.org/bugzilla/>
2007-12-10  8:40 ` ubizjak at gmail dot com
2008-02-23 15:25 ` uros at gcc dot gnu dot org
2008-02-23 15:34 ` ubizjak at gmail dot com
2008-03-08  7:24 ` ubizjak at gmail dot com
2008-11-16  0:14 ` howarth at nitro dot med dot uc dot edu
2008-11-16  0:15 ` howarth at nitro dot med dot uc dot edu

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