[PATCH] D24311: Implement MS _rot intrinsics
Albert Gutowski via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 7 16:29:11 PDT 2016
agutowski marked 2 inline comments as done.
agutowski added a comment.
In https://reviews.llvm.org/D24311#536333, @rnk wrote:
> You should locally verify that this generates the correct assembly when optimizations are enabled, and if it doesn't, try to make the input look more like llvm/test/CodeGen/X86/rotate.ll
Yeah, I checked that it's optimized to ROL/ROR instruction - now, after looking closer, I can see that it's optimized for all functions except for the ones operating on 16-bit integers. Could that be a calculated decision, or should I try to make it generate ROL/ROR whenever it can?
Comment at: lib/CodeGen/CGBuiltin.cpp:740
@@ +739,3 @@
+ Value *Mask = llvm::ConstantInt::get(ArgType, ArgWidth - 1);
+ Shift = Builder.CreateAnd(Shift, Mask);
+ Value *RightShift = Builder.CreateSub(ArgTypeSize, Shift);
Ah, I am sure I saw that bug, but apparently I forgot about it, as on my machine it returned correct values. Thanks!
More information about the cfe-commits