11// RUN: mlir-opt %s --convert-arith-to-apfloat -split-input-file -verify-diagnostics | FileCheck %s
22
3- // CHECK-LABEL: func.func private @__mlir_apfloat_add (i32, i64, i64) -> i64
3+ // CHECK-LABEL: func.func private @_mlir_apfloat_add (i32, i64, i64) -> i64
44
55// CHECK-LABEL: func.func @foo() -> f8E4M3FN {
66// CHECK: %[[CONSTANT_0:.*]] = arith.constant 2.250000e+00 : f8E4M3FN
1212// CHECK: return %[[CONSTANT_0]] : f6E3M2FN
1313// CHECK: }
1414
15- // Illustrate that both f8E4M3FN and f6E3M2FN calling the same __mlir_apfloat_add is fine
15+ // Illustrate that both f8E4M3FN and f6E3M2FN calling the same _mlir_apfloat_add is fine
1616// because each gets its own semantics enum and gets bitcast/extui/trunci to its own width.
1717// CHECK-LABEL: func.func @full_example() {
1818// CHECK: %[[CONSTANT_0:.*]] = arith.constant 1.375000e+00 : f8E4M3FN
2323// CHECK: %[[EXTUI_1:.*]] = arith.extui %[[BITCAST_1]] : i8 to i64
2424// // fltSemantics semantics for f8E4M3FN
2525// CHECK: %[[CONSTANT_1:.*]] = arith.constant 10 : i32
26- // CHECK: %[[VAL_1:.*]] = call @__mlir_apfloat_add (%[[CONSTANT_1]], %[[EXTUI_0]], %[[EXTUI_1]]) : (i32, i64, i64) -> i64
26+ // CHECK: %[[VAL_1:.*]] = call @_mlir_apfloat_add (%[[CONSTANT_1]], %[[EXTUI_0]], %[[EXTUI_1]]) : (i32, i64, i64) -> i64
2727// CHECK: %[[TRUNCI_0:.*]] = arith.trunci %[[VAL_1]] : i64 to i8
2828// CHECK: %[[BITCAST_2:.*]] = arith.bitcast %[[TRUNCI_0]] : i8 to f8E4M3FN
2929// CHECK: vector.print %[[BITCAST_2]] : f8E4M3FN
3636// CHECK: %[[EXTUI_3:.*]] = arith.extui %[[BITCAST_4]] : i6 to i64
3737// // fltSemantics semantics for f6E3M2FN
3838// CHECK: %[[CONSTANT_3:.*]] = arith.constant 16 : i32
39- // CHECK: %[[VAL_3:.*]] = call @__mlir_apfloat_add (%[[CONSTANT_3]], %[[EXTUI_2]], %[[EXTUI_3]]) : (i32, i64, i64) -> i64
39+ // CHECK: %[[VAL_3:.*]] = call @_mlir_apfloat_add (%[[CONSTANT_3]], %[[EXTUI_2]], %[[EXTUI_3]]) : (i32, i64, i64) -> i64
4040// CHECK: %[[TRUNCI_1:.*]] = arith.trunci %[[VAL_3]] : i64 to i6
4141// CHECK: %[[BITCAST_5:.*]] = arith.bitcast %[[TRUNCI_1]] : i6 to f6E3M2FN
4242// CHECK: vector.print %[[BITCAST_5]] : f6E3M2FN
@@ -69,9 +69,9 @@ func.func @full_example() {
6969
7070// -----
7171
72- // CHECK: func.func private @__mlir_apfloat_add (i32, i64, i64) -> i64
72+ // CHECK: func.func private @_mlir_apfloat_add (i32, i64, i64) -> i64
7373// CHECK: %[[sem:.*]] = arith.constant 18 : i32
74- // CHECK: call @__mlir_apfloat_add (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
74+ // CHECK: call @_mlir_apfloat_add (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
7575func.func @addf (%arg0: f4E2M1FN , %arg1: f4E2M1FN ) {
7676 %0 = arith.addf %arg0 , %arg1 : f4E2M1FN
7777 return
@@ -80,48 +80,48 @@ func.func @addf(%arg0: f4E2M1FN, %arg1: f4E2M1FN) {
8080// -----
8181
8282// Test decl collision (different type)
83- // expected-error@+1{{matched function '__mlir_apfloat_add ' but with different type: '(i32, i32, f32) -> index' (expected '(i32, i64, i64) -> i64')}}
84- func.func private @__mlir_apfloat_add (i32 , i32 , f32 ) -> index
83+ // expected-error@+1{{matched function '_mlir_apfloat_add ' but with different type: '(i32, i32, f32) -> index' (expected '(i32, i64, i64) -> i64')}}
84+ func.func private @_mlir_apfloat_add (i32 , i32 , f32 ) -> index
8585func.func @addf (%arg0: f4E2M1FN , %arg1: f4E2M1FN ) {
8686 %0 = arith.addf %arg0 , %arg1 : f4E2M1FN
8787 return
8888}
8989
9090// -----
9191
92- // CHECK: func.func private @__mlir_apfloat_subtract (i32, i64, i64) -> i64
92+ // CHECK: func.func private @_mlir_apfloat_subtract (i32, i64, i64) -> i64
9393// CHECK: %[[sem:.*]] = arith.constant 18 : i32
94- // CHECK: call @__mlir_apfloat_subtract (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
94+ // CHECK: call @_mlir_apfloat_subtract (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
9595func.func @subf (%arg0: f4E2M1FN , %arg1: f4E2M1FN ) {
9696 %0 = arith.subf %arg0 , %arg1 : f4E2M1FN
9797 return
9898}
9999
100100// -----
101101
102- // CHECK: func.func private @__mlir_apfloat_multiply (i32, i64, i64) -> i64
102+ // CHECK: func.func private @_mlir_apfloat_multiply (i32, i64, i64) -> i64
103103// CHECK: %[[sem:.*]] = arith.constant 18 : i32
104- // CHECK: call @__mlir_apfloat_multiply (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
104+ // CHECK: call @_mlir_apfloat_multiply (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
105105func.func @subf (%arg0: f4E2M1FN , %arg1: f4E2M1FN ) {
106106 %0 = arith.mulf %arg0 , %arg1 : f4E2M1FN
107107 return
108108}
109109
110110// -----
111111
112- // CHECK: func.func private @__mlir_apfloat_divide (i32, i64, i64) -> i64
112+ // CHECK: func.func private @_mlir_apfloat_divide (i32, i64, i64) -> i64
113113// CHECK: %[[sem:.*]] = arith.constant 18 : i32
114- // CHECK: call @__mlir_apfloat_divide (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
114+ // CHECK: call @_mlir_apfloat_divide (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
115115func.func @subf (%arg0: f4E2M1FN , %arg1: f4E2M1FN ) {
116116 %0 = arith.divf %arg0 , %arg1 : f4E2M1FN
117117 return
118118}
119119
120120// -----
121121
122- // CHECK: func.func private @__mlir_apfloat_remainder (i32, i64, i64) -> i64
122+ // CHECK: func.func private @_mlir_apfloat_remainder (i32, i64, i64) -> i64
123123// CHECK: %[[sem:.*]] = arith.constant 18 : i32
124- // CHECK: call @__mlir_apfloat_remainder (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
124+ // CHECK: call @_mlir_apfloat_remainder (%[[sem]], %{{.*}}, %{{.*}}) : (i32, i64, i64) -> i64
125125func.func @remf (%arg0: f4E2M1FN , %arg1: f4E2M1FN ) {
126126 %0 = arith.remf %arg0 , %arg1 : f4E2M1FN
127127 return
0 commit comments