How to lowing unsupported math op to "llvm.intr" op?

Such milr code

func.func @simple_constant() -> f32 {
  %0 = arith.constant 1.0 : f32
  %1 = arith.constant 1.0 : f32
  %res = math.atan2 %1, %0 : f32
  return %res: f32
}

And I use mlir-opt --lower-affine --convert-arith-to-llvm --test-expand-math --convert-scf-to-cf --convert-func-to-llvm --test-expand-math --convert-math-to-llvm --reconcile-unrealized-casts simple_constant.mlir

generate like this

module attributes {llvm.data_layout = ""} {
  llvm.func @simple_constant() -> f32 {
    %0 = llvm.mlir.constant(1.000000e+00 : f32) : f32
    %1 = math.atan2 %0, %0 : f32
    llvm.return %1 : f32
  }
}

And math.atan2 do not changed. So how to lowing this op?

Hi, try this: convert-math-to-libm I think it coverts to libm only.