[clang] [CIR] Add rotate operation (PR #148426)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 14 04:54:00 PDT 2025


================
@@ -57,6 +57,20 @@ static RValue emitBuiltinBitOp(CIRGenFunction &cgf, const CallExpr *e,
   return RValue::get(result);
 }
 
+RValue CIRGenFunction::emitRotate(const CallExpr *e, bool isRotateLeft) {
+  mlir::Value input = emitScalarExpr(e->getArg(0));
+  mlir::Value amount = emitScalarExpr(e->getArg(1));
+
+  // The builtin's amount parameter may have a different type than the input
+  // argument, but the CIR op uses the same type for all values.
----------------
xlauko wrote:

why? This just creates unnecessary int cast. 

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


More information about the cfe-commits mailing list