rnk added inline comments. ================ Comment at: lib/CodeGen/CGBuiltin.cpp:740 @@ +739,3 @@ + Value *LeftShifted = Builder.CreateShl(Val, Shift); + Value *RightShifted = Builder.CreateLShr(Val, RightShift); + Value *Shifted = Builder.CreateOr(LeftShifted, RightShifted); ---------------- I don't think this is correct when rotating by zero. That will cause us to shift right by ArgTypeSize, which will result in an undefined value: http://llvm.org/docs/LangRef.html#lshr-instruction
I think we need to generate a select or conditional branch as in the original code. ================ Comment at: test/CodeGen/ms-intrinsics-rotations.c:138 @@ +137,3 @@ + +// CHECK-64BIT-LONG: i64 @test_lrotr +// CHECK-64BIT-LONG: [[SHIFT:%[0-9]+]] = and i64 %shift, 63 ---------------- Nice, testing both LP64 and LLP64. :) https://reviews.llvm.org/D24311 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits