This is the mail archive of the gcc-patches@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]

[PATCH, i386]: Fix PR target/21981


Hello!

__m64 functions should return its value in %mm0. When attached patch is applied,
gcc -O2 -mmmx generates correct code:

aaa:
        pushl %ebp
        paddb %mm1, %mm0
        movl  %esp, %ebp
        popl  %ebp
        ret

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

BTW: There is a bit of confusion, what emms/femms insn should do. This
instruction is used when FPU is switched _from_ MMX mode back to X87 mode. MMX
instructions set x87 tag word to valid and emms is used to clear tag word before
x87 insn is used. It is basically an x87 insn.

Regression testing on i686-pc-linux-gnu is in progress. OK for mainline if
regression test passes?

2005-06-10  Uros Bizjak  <uros@kss-loka.si>

	PR target/21981
	* config/i386/i386.c (ix86_function_value_regno_p): Return true
	for FIRST_MMX_REG if TARGET_MMX.
	(ix86_return_in_memory): Return 1 for MMX/3dNow vectors. Delete
	wrong comment.
	(ix86_struct_value_rtx): Emit warning for MMX ABI violations.
	(ix86_value_regno): Return FIRST_MMX_REG for MMX vector modes.

Uros.

Attachment: mmx.diff
Description: Binary data


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