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

Possible CSE quirk involving SUBREG on the i386


Compiling:

  unsigned short c;

  int
  func(unsigned short a)
    {
    unsigned short b;
 
    b = a;
    c = b;

    return b;
    }

for the i386 using egcs current with -O -S yields:

_func:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%eax
	movl %eax,%edx
	movw %ax,_c
	movzwl %dx,%eax
	leave
	ret

Which is interesting since I expected:

_func:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%eax
	movw %ax,_c
	movzwl %ax,%eax
	leave
	ret

The use of %edx seems wasteful.

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



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