spatel added a comment. In https://reviews.llvm.org/D49606#1170278, @craig.topper wrote:
> Here are the IR patterns for this that work. Not sure if we can do this > directly in C, we need a 128 bit type, but maybe we can emit it from > CGBuiltin.cpp? > > define i64 @__shiftleft128(i64 %x, i64 %y, i8 %amt) { > %a = zext i64 %x to i128 > %b = zext i64 %y to i128 > %c = shl i128 %b, 64 > %d = or i128 %a, %c > %amtmask = and i8 %amt, 63 > %e = zext i8 %amtmask to i128 > %f = shl i128 %d, %e > %g = lshr i128 %f, 64 > %h = trunc i128 %g to i64 > ret i64 %h > } > > define i64 @__shiftright128(i64 %x, i64 %y, i8 %amt) { > %a = zext i64 %x to i128 > %b = zext i64 %y to i128 > %c = shl i128 %b, 64 > %d = or i128 %a, %c > %amtmask = and i8 %amt, 63 > %e = zext i8 %amtmask to i128 > %f = lshr i128 %d, %e > %g = trunc i128 %f to i64 > ret i64 %g > } > I’m not at my dev machine, but this is exactly the definition of funnel shift, no? Unless that got reverted, adding/modifying clang builtins was the next step in the plan for those intrinsics. We probably need some backend work to match the variable shift version, but shift-by constant should already work. https://reviews.llvm.org/D49606 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits