[PATCH] Check isTypeDesirableForOp before replacing mulhu/mulhs

Matt Arsenault arsenm2 at gmail.com
Tue Dec 2 13:43:13 PST 2014


This is for a target which has legal mul in a wider type, but it is more desirable to do the mulhi in a 32-bit type rather than  promoting and doing a 64-bit multiply. This was removing the benefit of the expansion of divide by a constant if isIntDivCheap() is false by promoting the mulhi this way.

This breaks 2 x86 tests. The divide-by-constant.ll changes look like improvements. The jump_sign.ll one looks like a regression, but I don’t know much about x86. It decides to not do the combine since it would do an i16 mul, but there isn’t an i16 mul in the output so something more complicated seems to be going on afterwards. Attached is the before / after for the apparently regressing test.


jump_sign diff:

264c264
< 	setb	%dl
---
> 	sbbl	%edx, %edx
267,268c267,268
< 	movb	%cl, %dh
< 	andb	%dl, %dh
---
> 	andl	%ecx, %edx
> 	testb	$1, %dl


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-isTypeDesirableForOp-before-replacing-mulhu-mu.patch
Type: application/octet-stream
Size: 3349 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141202/ab29257e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jump_sign_after.s
Type: application/octet-stream
Size: 6262 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141202/ab29257e/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jump_sign_before.s
Type: application/octet-stream
Size: 6253 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141202/ab29257e/attachment-0002.obj>


More information about the llvm-commits mailing list