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 optimization/6585] Redundant store/load instruction pairs on ix86


------- Additional Comments From bruno at clisp dot org  2004-03-17 12:10 -------
This result is much better, indeed. Still there is room for two more optimizations: 
 
1) The final "movl %ebx, %edx" instruction could be removed if the preceding lea 
instruction would write its results into %edx, not into %ebx. 
 
2) Storing a0 and a1 in temporary stack locations is useless since a0 and a1 
already come from the stack, and data analysis could find out that they are 
read-only. 
 
Commented listing: 
 
mul: 
	subl	$20, %esp 
	movl	%esi, 12(%esp)				; save %esi 
	movl	24(%esp), %eax		a0 
	movl	32(%esp), %esi		b0 
	movl	28(%esp), %ecx		a1 
	movl	%edi, 16(%esp)				; save %edi 
	movl	36(%esp), %edi		b1 
	movl	%eax, (%esp)				USELESS! Use 24(%esp) instead 
	mull	%esi			%edx:%eax := a0*b0 
	movl	%ecx, 4(%esp)				USELESS! Use 28(%esp) instead 
	movl	%ebx, 8(%esp)				; save %ebx 
	movl	%eax, %ecx 
	movl	(%esp), %eax 
	imull	%eax, %edi		a0*b1 
	movl	4(%esp), %eax 
	imull	%esi, %eax		a1*b0 
	movl	12(%esp), %esi				; restore %esi 
	leal	(%edx,%edi), %edi	hi+a0*b1 
	leal	(%edi,%eax), %ebx	hi+a0*b1+a1*b0	COULD BE SIMPLIFIED 
	movl	16(%esp), %edi				; restore %edi 
	movl	%ecx, %eax		lo 
	movl	%ebx, %edx				USELESS! 
	movl	8(%esp), %ebx				; restore %ebx 
	addl	$20, %esp 
	ret 
 

-- 


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


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