[Mlir-commits] [mlir] [mlir][spirv] Update math.powf lowering (PR #111388)

Jakub Kuderski llvmlistbot at llvm.org
Mon Oct 7 08:03:03 PDT 2024


================
@@ -389,7 +389,31 @@ struct PowFOpPattern final : public OpConversionPattern<math::PowFOp> {
         spirv::ConstantOp::getZero(adaptor.getLhs().getType(), loc, rewriter);
     Value lessThan =
         rewriter.create<spirv::FOrdLessThanOp>(loc, adaptor.getLhs(), zero);
-    Value abs = rewriter.create<spirv::GLFAbsOp>(loc, adaptor.getLhs());
+
+    // Per C/CPP spec:
+    // "pow(base, exponent) returns NaN (and raises FE_INVALID) if base is "
+    // " finite and negative and exponent is finite and non-integer. "
+    // Calculae calc reminder from exponent and check whether it is zero
----------------
kuhar wrote:

```suggestion
    // Per C/C++ spec:
    //   > pow(base, exponent) returns NaN (and raises FE_INVALID) if base is
    //   > finite and negative and exponent is finite and non-integer.
    // Calculate the reminder from the exponent and check whether it is zero.
```

https://github.com/llvm/llvm-project/pull/111388


More information about the Mlir-commits mailing list