1// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
2
3//===----------------------------------------------------------------------===//
4// spv.GLSL.Exp
5//===----------------------------------------------------------------------===//
6
7func @exp(%arg0 : f32) -> () {
8  // CHECK: spv.GLSL.Exp {{%.*}} : f32
9  %2 = spv.GLSL.Exp %arg0 : f32
10  return
11}
12
13func @expvec(%arg0 : vector<3xf16>) -> () {
14  // CHECK: spv.GLSL.Exp {{%.*}} : vector<3xf16>
15  %2 = spv.GLSL.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-bit float or vector of 16/32-bit float values}}
23  %2 = spv.GLSL.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-bit float or vector of 16/32-bit float values of length 2/3/4}}
31  %2 = spv.GLSL.Exp %arg0 : vector<5xf32>
32  return
33}
34
35// -----
36
37func @exp(%arg0 : f32, %arg1 : f32) -> () {
38  // expected-error @+1 {{expected ':'}}
39  %2 = spv.GLSL.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.GLSL.Exp %arg0 :
48  return
49}
50
51// -----
52
53//===----------------------------------------------------------------------===//
54// spv.GLSL.FMax
55//===----------------------------------------------------------------------===//
56
57func @fmax(%arg0 : f32, %arg1 : f32) -> () {
58  // CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : f32
59  %2 = spv.GLSL.FMax %arg0, %arg1 : f32
60  return
61}
62
63func @fmaxvec(%arg0 : vector<3xf16>, %arg1 : vector<3xf16>) -> () {
64  // CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : vector<3xf16>
65  %2 = spv.GLSL.FMax %arg0, %arg1 : vector<3xf16>
66  return
67}
68
69func @fmaxf64(%arg0 : f64, %arg1 : f64) -> () {
70  // CHECK: spv.GLSL.FMax {{%.*}}, {{%.*}} : f64
71  %2 = spv.GLSL.FMax %arg0, %arg1 : f64
72  return
73}
74
75// -----
76
77//===----------------------------------------------------------------------===//
78// spv.GLSL.InverseSqrt
79//===----------------------------------------------------------------------===//
80
81func @inversesqrt(%arg0 : f32) -> () {
82  // CHECK: spv.GLSL.InverseSqrt {{%.*}} : f32
83  %2 = spv.GLSL.InverseSqrt %arg0 : f32
84  return
85}
86
87func @inversesqrtvec(%arg0 : vector<3xf16>) -> () {
88  // CHECK: spv.GLSL.InverseSqrt {{%.*}} : vector<3xf16>
89  %2 = spv.GLSL.InverseSqrt %arg0 : vector<3xf16>
90  return
91}
92
93// -----
94
95//===----------------------------------------------------------------------===//
96// spv.GLSL.Sqrt
97//===----------------------------------------------------------------------===//
98
99func @sqrt(%arg0 : f32) -> () {
100  // CHECK: spv.GLSL.Sqrt {{%.*}} : f32
101  %2 = spv.GLSL.Sqrt %arg0 : f32
102  return
103}
104
105func @sqrtvec(%arg0 : vector<3xf16>) -> () {
106  // CHECK: spv.GLSL.Sqrt {{%.*}} : vector<3xf16>
107  %2 = spv.GLSL.Sqrt %arg0 : vector<3xf16>
108  return
109}
110
111//===----------------------------------------------------------------------===//
112// spv.GLSL.Cos
113//===----------------------------------------------------------------------===//
114
115func @cos(%arg0 : f32) -> () {
116  // CHECK: spv.GLSL.Cos {{%.*}} : f32
117  %2 = spv.GLSL.Cos %arg0 : f32
118  return
119}
120
121func @cosvec(%arg0 : vector<3xf16>) -> () {
122  // CHECK: spv.GLSL.Cos {{%.*}} : vector<3xf16>
123  %2 = spv.GLSL.Cos %arg0 : vector<3xf16>
124  return
125}
126
127//===----------------------------------------------------------------------===//
128// spv.GLSL.Sin
129//===----------------------------------------------------------------------===//
130
131func @sin(%arg0 : f32) -> () {
132  // CHECK: spv.GLSL.Sin {{%.*}} : f32
133  %2 = spv.GLSL.Sin %arg0 : f32
134  return
135}
136
137func @sinvec(%arg0 : vector<3xf16>) -> () {
138  // CHECK: spv.GLSL.Sin {{%.*}} : vector<3xf16>
139  %2 = spv.GLSL.Sin %arg0 : vector<3xf16>
140  return
141}
142
143//===----------------------------------------------------------------------===//
144// spv.GLSL.Tan
145//===----------------------------------------------------------------------===//
146
147func @tan(%arg0 : f32) -> () {
148  // CHECK: spv.GLSL.Tan {{%.*}} : f32
149  %2 = spv.GLSL.Tan %arg0 : f32
150  return
151}
152
153func @tanvec(%arg0 : vector<3xf16>) -> () {
154  // CHECK: spv.GLSL.Tan {{%.*}} : vector<3xf16>
155  %2 = spv.GLSL.Tan %arg0 : vector<3xf16>
156  return
157}
158