================ @@ -2661,6 +2661,45 @@ def BitPopcountOp : CIR_BitOpBase<"bit.popcnt", }]; } +def BitReverseOp : CIR_BitOpBase<"bit.reverse", + CIR_UIntOfWidths<[8, 16, 32, 64]>> { + let summary = "Reverse the bit pattern of the operand integer"; + let description = [{ + The `cir.bit.reverse` operation reverses the bits of the operand integer. + Its only argument must be of unsigned integer types of width 8, 16, 32, or + 64. + + This operation covers the C/C++ builtin function `__builtin_bitreverse`. + + Example: + + ```mlir + %1 = cir.bit.reverse(%0 : !u32i): !u32i + ``` + }]; +} + +def ByteSwapOp : CIR_BitOpBase<"bit.bswap", CIR_UIntOfWidths<[16, 32, 64]>> { ---------------- Lancern wrote:
> For the same reason, I’d like to eliminate the bit. prefix entirely and use > the builtin names directly, like bitreverse (This can be, and probably should > be done as separate PR). I'll send a separate PR for this after this PR lands. https://github.com/llvm/llvm-project/pull/147200 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits