This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/21981] __m64 return value should be returned in %mm0


------- Additional Comments From gcc-bugzilla at gcc dot gnu dot org  2005-06-09 16:11 -------
Subject:  New: __m64 return value should  be returned in %mm0

Calling convetions for x86 specify that __m64 values should be returned in %mm0 
MMX register [1]. Gcc returns __m64 values on stack.

The testcase:

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

__v8qi
aaa (__v8qi x, __v8qi y)
{
  __v8qi mm1;

  mm1 = _mm_add_pi8 (x, y);

  return mm1;
}

int main() {
  __v8qi mm0 = { 1,2,3,4,5,6,7,8 };
  __v8qi mm1 = { 11,12,13,14,15,16,17,18 };

  union ttt {
    __v8qi mm;
    char x[8];
  } temp;

  temp.mm = aaa (mm0, mm1);
  printf ("%i\n", temp.x[0]);

  return 0;
}
--cut here--

will produce:

aaa:
	pushl	%ebp
	movl	%esp, %ebp
	movl	8(%ebp), %eax
	paddb	%mm1, %mm0
	movq	%mm0, (%eax)   <<<<-- %mm0 goes to memory
	popl	%ebp
	ret	$4

main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$24, %esp
	andl	$-16, %esp
	subl	$16, %esp
	leal	-8(%ebp), %eax
	movl	%eax, (%esp)
	movq	.LC0, %mm1
	movq	.LC1, %mm0
	call	aaa
	movsbl	-8(%ebp),%eax    <<<<-- return value taken from memory
	subl	$4, %esp
	movl	%eax, 4(%esp)
	movl	$.LC2, (%esp)
	call	printf
	xorl	%eax, %eax
	leave
	ret


[1] http://www.agner.org/assem/calling_conventions.pdf

-- 
           Summary: __m64 return value should  be returned in %mm0
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          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=21981


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]