================
@@ -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)
----------------
andykaylor wrote:

I intentionally separated floating point operations from integer operations 
because they have almost entirely disjoint attributes. I don't think inc/dec is 
particularly useful for floating point values. I'm not sure how useful it is 
for integers for that matter.

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