[clang] [CIR] Add bit reverse and byte reverse operations (PR #147200)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 8 05:23:38 PDT 2025
================
@@ -190,6 +190,26 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
expectedValue, probAttr);
return RValue::get(result);
}
+
+ case Builtin::BI__builtin_bswap16:
+ case Builtin::BI__builtin_bswap32:
+ case Builtin::BI__builtin_bswap64:
+ case Builtin::BI_byteswap_ushort:
+ case Builtin::BI_byteswap_ulong:
+ case Builtin::BI_byteswap_uint64: {
+ mlir::Value arg = emitScalarExpr(e->getArg(0));
+ return RValue::get(
+ builder.create<cir::ByteSwapOp>(getLoc(e->getSourceRange()), arg));
----------------
xlauko wrote:
Lets pull out `mlir::Location loc = getLoc(e->getSourceRange())` to the beginning of the function and use it throughout the function. This will reduce a lot of unnecessary indent.
https://github.com/llvm/llvm-project/pull/147200
More information about the cfe-commits
mailing list