[all-commits] [llvm/llvm-project] 12af40: [mlir][EmitC] Convert math::RoundEvenOp, SqrtOp an...

ioana ghiban via All-commits all-commits at lists.llvm.org
Tue Apr 14 04:52:08 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 12af401f6ab586aad5ee86103e6c5dd6aa798e88
      https://github.com/llvm/llvm-project/commit/12af401f6ab586aad5ee86103e6c5dd6aa798e88
  Author: ioana ghiban <ioana.ghiban at arm.com>
  Date:   2026-04-14 (Tue, 14 Apr 2026)

  Changed paths:
    M mlir/lib/Conversion/MathToEmitC/MathToEmitC.cpp
    M mlir/test/Conversion/MathToEmitC/math-to-emitc.mlir
    A mlir/test/Dialect/EmitC/math/ops.mlir

  Log Message:
  -----------
  [mlir][EmitC] Convert math::RoundEvenOp, SqrtOp and RsqrtOp (#190158)

This patch extends the Math-to-EmitC conversion to cover `math.roundeven` and
`math.sqrt` for scalar f32/f64 values.

`math.roundeven` and `math.sqrt` are lowered to `emitc.call_opaque` using the
appropriate target-specific names:

C: `roundevenf` / `roundeven`, `sqrtf` / `sqrt`
C++: `std::roundeven`, `std::sqrt`
The patch also adds coverage for `math.rsqrt`. There is no direct EmitC
lowering for `math.rsqrt`; instead, the new tests verify the existing expansion
path through `-math-expand-ops=ops=rsqrt`, followed by `-convert-math-to-emitc`
and `-convert-arith-to-emitc`. This ensures the cross-dialect lowering sequence
produces the expected `emitc.constant`, `emitc.call_opaque`, and `emitc.div`
operations for f32/f64.

Unsupported cases remain unchanged. In particular, the new test documents that
f16 math.rsqrt is not lowered because math.sqrt is only converted for f32/f64.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list