================
@@ -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.
----------------
Lancern wrote:

I believe this is for the MSVC flavor builtins which uses different types for 
`input` and `amount`:

- https://learn.microsoft.com/en-us/cpp/intrinsics/rotl8-rotl16?view=msvc-170
- 
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/rotl-rotl64-rotr-rotr64?view=msvc-170

I think a proper way to resolve this would be to relax the type constraints on 
the `amount` argument and allow it to have a different type than `input`.

https://github.com/llvm/llvm-project/pull/148426
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to