[PATCH] D48768: [X86] When have BMI2, prefer shifts to clear low/high bits, rather than variable mask.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 3 07:37:44 PDT 2018


spatel added a comment.

I think the original motivating question was independent of any BMI extensions? Ie, which of these is better for a generic x86(-64):

  0000000000000000	movl	%esi, %ecx
  0000000000000002	shll	%cl, %edi
  0000000000000004	movl	%edi, %eax
  0000000000000006	shrl	%cl, %eax
  0000000000000008	retq
  
  0000000000000000	movl	$0xffffffff, %eax
  0000000000000005	movl	%esi, %ecx
  0000000000000007	shrl	%cl, %eax
  0000000000000009	andl	%edi, %eax
  000000000000000b	retq

The 'and' version is bigger and might be slower, so that's not a good default for x86 codegen?

Either way, I think it would be better to change the check-prefixes in the test files so they map to the enabled/disabled target attributes. It's not clear to me that we want to tie the transform to any particular set of those attributes.


Repository:
  rL LLVM

https://reviews.llvm.org/D48768





More information about the llvm-commits mailing list