[Mlir-commits] [mlir] [mlir][emitc] Support convert arith.extf and arith.truncf to emitc (PR #121184)

Tina Jung llvmlistbot at llvm.org
Thu Jan 2 00:17:58 PST 2025


================
@@ -149,3 +149,11 @@ func.func @arith_remui_vector(%arg0: vector<5xi32>, %arg1: vector<5xi32>) -> vec
   %divui = arith.remui %arg0, %arg1 : vector<5xi32>
   return %divui: vector<5xi32>
 }
+
+// -----
+
+func.func @arith_truncf(%arg0: f64) -> f32 {
+  // expected-error @+1 {{failed to legalize operation 'arith.truncf'}}
+  %truncd = arith.truncf %arg0 to_nearest_away : f64 to f32
+  return %truncd : f32
+}
----------------
TinaAMD wrote:

Maybe add the following tests (for extf and truncf):
* Unsupported source type
* Unsupported destination type
* Cast-incompatible type conversion (tensors of supported types should work)

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


More information about the Mlir-commits mailing list