1// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
2
3//===----------------------------------------------------------------------===//
4// spv.OCL.exp
5//===----------------------------------------------------------------------===//
6
7func @exp(%arg0 : f32) -> () {
8  // CHECK: spv.OCL.exp {{%.*}} : f32
9  %2 = spv.OCL.exp %arg0 : f32
10  return
11}
12
13func @expvec(%arg0 : vector<3xf16>) -> () {
14  // CHECK: spv.OCL.exp {{%.*}} : vector<3xf16>
15  %2 = spv.OCL.exp %arg0 : vector<3xf16>
16  return
17}
18
19// -----
20
21func @exp(%arg0 : i32) -> () {
22  // expected-error @+1 {{op operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values}}
23  %2 = spv.OCL.exp %arg0 : i32
24  return
25}
26
27// -----
28
29func @exp(%arg0 : vector<5xf32>) -> () {
30  // expected-error @+1 {{op operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values of length 2/3/4}}
31  %2 = spv.OCL.exp %arg0 : vector<5xf32>
32  return
33}
34
35// -----
36
37func @exp(%arg0 : f32, %arg1 : f32) -> () {
38  // expected-error @+1 {{expected ':'}}
39  %2 = spv.OCL.exp %arg0, %arg1 : i32
40  return
41}
42
43// -----
44
45func @exp(%arg0 : i32) -> () {
46  // expected-error @+2 {{expected non-function type}}
47  %2 = spv.OCL.exp %arg0 :
48  return
49}
50
51// -----
52
53//===----------------------------------------------------------------------===//
54// spv.OCL.fabs
55//===----------------------------------------------------------------------===//
56
57func @fabs(%arg0 : f32) -> () {
58  // CHECK: spv.OCL.fabs {{%.*}} : f32
59  %2 = spv.OCL.fabs %arg0 : f32
60  return
61}
62
63func @fabsvec(%arg0 : vector<3xf16>) -> () {
64  // CHECK: spv.OCL.fabs {{%.*}} : vector<3xf16>
65  %2 = spv.OCL.fabs %arg0 : vector<3xf16>
66  return
67}
68
69func @fabsf64(%arg0 : f64) -> () {
70  // CHECK: spv.OCL.fabs {{%.*}} : f64
71  %2 = spv.OCL.fabs %arg0 : f64
72  return
73}
74
75// -----
76
77func @fabs(%arg0 : i32) -> () {
78  // expected-error @+1 {{op operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values}}
79  %2 = spv.OCL.fabs %arg0 : i32
80  return
81}
82
83// -----
84
85func @fabs(%arg0 : vector<5xf32>) -> () {
86  // expected-error @+1 {{op operand #0 must be 16/32/64-bit float or vector of 16/32/64-bit float values of length 2/3/4}}
87  %2 = spv.OCL.fabs %arg0 : vector<5xf32>
88  return
89}
90
91// -----
92
93func @fabs(%arg0 : f32, %arg1 : f32) -> () {
94  // expected-error @+1 {{expected ':'}}
95  %2 = spv.OCL.fabs %arg0, %arg1 : i32
96  return
97}
98
99// -----
100
101func @fabs(%arg0 : i32) -> () {
102  // expected-error @+2 {{expected non-function type}}
103  %2 = spv.OCL.fabs %arg0 :
104  return
105}
106
107// -----
108
109//===----------------------------------------------------------------------===//
110// spv.OCL.s_abs
111//===----------------------------------------------------------------------===//
112
113func @sabs(%arg0 : i32) -> () {
114  // CHECK: spv.OCL.s_abs {{%.*}} : i32
115  %2 = spv.OCL.s_abs %arg0 : i32
116  return
117}
118
119func @sabsvec(%arg0 : vector<3xi16>) -> () {
120  // CHECK: spv.OCL.s_abs {{%.*}} : vector<3xi16>
121  %2 = spv.OCL.s_abs %arg0 : vector<3xi16>
122  return
123}
124
125func @sabsi64(%arg0 : i64) -> () {
126  // CHECK: spv.OCL.s_abs {{%.*}} : i64
127  %2 = spv.OCL.s_abs %arg0 : i64
128  return
129}
130
131func @sabsi8(%arg0 : i8) -> () {
132  // CHECK: spv.OCL.s_abs {{%.*}} : i8
133  %2 = spv.OCL.s_abs %arg0 : i8
134  return
135}
136
137// -----
138
139func @sabs(%arg0 : f32) -> () {
140  // expected-error @+1 {{op operand #0 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values}}
141  %2 = spv.OCL.s_abs %arg0 : f32
142  return
143}
144
145// -----
146
147func @sabs(%arg0 : vector<5xi32>) -> () {
148  // expected-error @+1 {{op operand #0 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values of length 2/3/4}}
149  %2 = spv.OCL.s_abs %arg0 : vector<5xi32>
150  return
151}
152
153// -----
154
155func @sabs(%arg0 : i32, %arg1 : i32) -> () {
156  // expected-error @+1 {{expected ':'}}
157  %2 = spv.OCL.s_abs %arg0, %arg1 : i32
158  return
159}
160
161// -----
162
163func @sabs(%arg0 : i32) -> () {
164  // expected-error @+2 {{expected non-function type}}
165  %2 = spv.OCL.s_abs %arg0 :
166  return
167}
168
169