[llvm] [X86] Prefer andl to andb to save one byte encoding when using with bzhi or bextr (PR #86921)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 00:30:32 PDT 2024


topperc wrote:

> > > * As I mentioned above, it is considered beneficial for bzhi/bextr, which matches with GCC;
> > 
> > 
> > It's been a long time since I looked, but I thought gcc generally avoids 8 bit registers. Not just for bzhi/bextr.
> 
> Do you have an example in mind, I did some simple experiment, the Clang code generation looks good to me https://godbolt.org/z/6h3W348WM

gcc uses %eax, clang uses %al https://godbolt.org/z/vfbezP9ac but like I said its been a long time since I looked at this. My recollection was that gcc promotes more operations to 32-bit registers than clang. I long ago thought maybe we should promote i8 to i32 like we do i16 through IsDesirableToPromoteOp.

https://github.com/llvm/llvm-project/pull/86921


More information about the llvm-commits mailing list