================
@@ -825,14 +818,23 @@ class ScalarExprEmitter : public 
StmtVisitor<ScalarExprEmitter, mlir::Value> {
     return builder.createOrFold<cir::MinusOp>(loc, operand, nsw);
   }
 
-  mlir::Value emitIncOrDec(const UnaryOperator *e, mlir::Value input,
-                           bool nsw = false) {
+  mlir::Value emitIntIncOrDec(const UnaryOperator *e, mlir::Value input,
+                              bool nsw = false) {
     mlir::Location loc = cgf.getLoc(e->getSourceRange().getBegin());
     return e->isIncrementOp()
                ? builder.createOrFold<cir::IncOp>(loc, input, nsw)
                : builder.createOrFold<cir::DecOp>(loc, input, nsw);
   }
 
+  mlir::Value emitFloatIncOrDec(const UnaryOperator *e, mlir::Value input) {
+    mlir::Location loc = cgf.getLoc(e->getSourceRange().getBegin());
+    auto fpType = mlir::cast<cir::FPTypeInterface>(input.getType());
+    mlir::Value amount = builder.getConstFP(
+        loc, input.getType(), llvm::APFloat(fpType.getFloatSemantics(), 1));
+    return e->isIncrementOp() ? builder.createFAdd(loc, input, amount)
----------------
Luhaocong wrote:

@andykaylor adds constraint  `CIR_AnyIntOrVecOfIntType` for 
`CIR_IncOp/CIR_DecOp` in PR https://github.com/llvm/llvm-project/pull/201727

https://github.com/llvm/llvm-project/pull/193215
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to