xref: /llvm-project/mlir/test/Conversion/ArithToEmitC/arith-to-emitc-unsupported.mlir (revision f9a80062470daf94e07f65f9dd23df6a4f2946a2)
1// RUN: mlir-opt -split-input-file -convert-arith-to-emitc -verify-diagnostics %s
2
3func.func @arith_cast_tensor(%arg0: tensor<5xf32>) -> tensor<5xi32> {
4  // expected-error @+1 {{failed to legalize operation 'arith.fptosi'}}
5  %t = arith.fptosi %arg0 : tensor<5xf32> to tensor<5xi32>
6  return %t: tensor<5xi32>
7}
8
9// -----
10
11func.func @arith_cast_vector(%arg0: vector<5xf32>) -> vector<5xi32> {
12  // expected-error @+1 {{failed to legalize operation 'arith.fptosi'}}
13  %t = arith.fptosi %arg0 : vector<5xf32> to vector<5xi32>
14  return %t: vector<5xi32>
15}
16
17// -----
18func.func @arith_cast_f80(%arg0: f80) -> i32 {
19  // expected-error @+1 {{failed to legalize operation 'arith.fptosi'}}
20  %t = arith.fptosi %arg0 : f80 to i32
21  return %t: i32
22}
23
24// -----
25
26func.func @arith_cast_f128(%arg0: f128) -> i32 {
27  // expected-error @+1 {{failed to legalize operation 'arith.fptosi'}}
28  %t = arith.fptosi %arg0 : f128 to i32
29  return %t: i32
30}
31
32
33// -----
34
35func.func @arith_cast_to_f80(%arg0: i32) -> f80 {
36  // expected-error @+1 {{failed to legalize operation 'arith.sitofp'}}
37  %t = arith.sitofp %arg0 : i32 to f80
38  return %t: f80
39}
40
41// -----
42
43func.func @arith_cast_to_f128(%arg0: i32) -> f128 {
44  // expected-error @+1 {{failed to legalize operation 'arith.sitofp'}}
45  %t = arith.sitofp %arg0 : i32 to f128
46  return %t: f128
47}
48
49// -----
50
51func.func @arith_cast_fptosi_i1(%arg0: f32) -> i1 {
52  // expected-error @+1 {{failed to legalize operation 'arith.fptosi'}}
53  %t = arith.fptosi %arg0 : f32 to i1
54  return %t: i1
55}
56
57// -----
58
59func.func @arith_cast_fptoui_i1(%arg0: f32) -> i1 {
60  // expected-error @+1 {{failed to legalize operation 'arith.fptoui'}}
61  %t = arith.fptoui %arg0 : f32 to i1
62  return %t: i1
63}
64
65// -----
66
67func.func @arith_cmpf_vector(%arg0: vector<5xf32>, %arg1: vector<5xf32>) -> vector<5xi1> {
68  // expected-error @+1 {{failed to legalize operation 'arith.cmpf'}}
69  %t = arith.cmpf uno, %arg0, %arg1 : vector<5xf32>
70  return %t: vector<5xi1>
71}
72
73// -----
74
75func.func @arith_cmpf_tensor(%arg0: tensor<5xf32>, %arg1: tensor<5xf32>) -> tensor<5xi1> {
76  // expected-error @+1 {{failed to legalize operation 'arith.cmpf'}}
77  %t = arith.cmpf uno, %arg0, %arg1 : tensor<5xf32>
78  return %t: tensor<5xi1>
79}
80
81// -----
82
83func.func @arith_negf_f80(%arg0: f80) -> f80 {
84  // expected-error @+1 {{failed to legalize operation 'arith.negf'}}
85  %n = arith.negf %arg0 : f80
86  return %n: f80
87}
88
89// -----
90
91func.func @arith_negf_tensor(%arg0: tensor<5xf32>) -> tensor<5xf32> {
92  // expected-error @+1 {{failed to legalize operation 'arith.negf'}}
93  %n = arith.negf %arg0 : tensor<5xf32>
94  return %n: tensor<5xf32>
95}
96
97// -----
98
99func.func @arith_negf_vector(%arg0: vector<5xf32>) -> vector<5xf32> {
100  // expected-error @+1 {{failed to legalize operation 'arith.negf'}}
101  %n = arith.negf %arg0 : vector<5xf32>
102  return %n: vector<5xf32>
103}
104
105// -----
106
107func.func @arith_extsi_i1_to_i32(%arg0: i1) {
108  // expected-error @+1 {{failed to legalize operation 'arith.extsi'}}
109  %idx = arith.extsi %arg0 : i1 to i32
110  return
111}
112
113// -----
114
115func.func @arith_shli_i1(%arg0: i1, %arg1: i1) {
116  // expected-error @+1 {{failed to legalize operation 'arith.shli'}}
117  %shli = arith.shli %arg0, %arg1 : i1
118  return
119}
120
121// -----
122
123func.func @arith_shrsi_i1(%arg0: i1, %arg1: i1) {
124  // expected-error @+1 {{failed to legalize operation 'arith.shrsi'}}
125  %shrsi = arith.shrsi %arg0, %arg1 : i1
126  return
127}
128
129// -----
130
131func.func @arith_shrui_i1(%arg0: i1, %arg1: i1) {
132  // expected-error @+1 {{failed to legalize operation 'arith.shrui'}}
133  %shrui = arith.shrui %arg0, %arg1 : i1
134  return
135}
136
137// -----
138
139func.func @arith_divui_vector(%arg0: vector<5xi32>, %arg1: vector<5xi32>) -> vector<5xi32> {
140  // expected-error @+1 {{failed to legalize operation 'arith.divui'}}
141  %divui = arith.divui %arg0, %arg1 : vector<5xi32>
142  return %divui: vector<5xi32>
143}
144
145// -----
146
147func.func @arith_remui_vector(%arg0: vector<5xi32>, %arg1: vector<5xi32>) -> vector<5xi32> {
148  // expected-error @+1 {{failed to legalize operation 'arith.remui'}}
149  %divui = arith.remui %arg0, %arg1 : vector<5xi32>
150  return %divui: vector<5xi32>
151}
152
153// -----
154
155func.func @arith_truncf(%arg0: f64) -> f32 {
156  // expected-error @+1 {{failed to legalize operation 'arith.truncf'}}
157  %truncd = arith.truncf %arg0 to_nearest_away : f64 to f32
158  return %truncd : f32
159}
160
161// -----
162
163func.func @arith_extf_f128(%arg0: f32) -> f128 {
164  // expected-error @+1 {{failed to legalize operation 'arith.extf'}}
165  %extd = arith.extf %arg0 : f32 to f128
166  return %extd : f128
167}
168
169// -----
170
171func.func @arith_truncf_f128(%arg0: f128) -> f32 {
172  // expected-error @+1 {{failed to legalize operation 'arith.truncf'}}
173  %truncd = arith.truncf %arg0 : f128 to f32
174  return %truncd : f32
175}
176
177// -----
178
179func.func @arith_extf_vector(%arg0: vector<4xf32>) -> vector<4xf64> {
180  // expected-error @+1 {{failed to legalize operation 'arith.extf'}}
181  %extd = arith.extf %arg0 : vector<4xf32> to vector<4xf64>
182  return %extd : vector<4xf64>
183}
184
185// -----
186
187func.func @arith_truncf_vector(%arg0: vector<4xf64>) -> vector<4xf32> {
188  // expected-error @+1 {{failed to legalize operation 'arith.truncf'}}
189  %truncd = arith.truncf %arg0 : vector<4xf64> to vector<4xf32>
190  return %truncd : vector<4xf32>
191}
192