Skip to content

Commit f7967ef

Browse files
authored
[mlir][spirv][nfc] Add missing tests for GL Tanh Op (#143538)
The problem was noticed when adding Log2 operation.
1 parent 7137021 commit f7967ef

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

mlir/test/Dialect/SPIRV/IR/gl-ops.mlir

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,3 +763,29 @@ func.func @log2_invalid_type(%arg0 : i32) -> () {
763763
%0 = spirv.GL.Log2 %arg0 : i32
764764
return
765765
}
766+
767+
// -----
768+
769+
//===----------------------------------------------------------------------===//
770+
// spirv.GL.Tanh
771+
//===----------------------------------------------------------------------===//
772+
773+
func.func @tanh(%arg0 : f32) -> () {
774+
// CHECK: spirv.GL.Tanh {{%.*}} : f32
775+
%0 = spirv.GL.Tanh %arg0 : f32
776+
return
777+
}
778+
779+
func.func @tanhvec(%arg0 : vector<3xf16>) -> () {
780+
// CHECK: spirv.GL.Tanh {{%.*}} : vector<3xf16>
781+
%0 = spirv.GL.Tanh %arg0 : vector<3xf16>
782+
return
783+
}
784+
785+
// -----
786+
787+
func.func @tanh_invalid_type(%arg0 : i32) -> () {
788+
// expected-error @+1 {{op operand #0 must be 16/32-bit float or vector of 16/32-bit float values}}
789+
%0 = spirv.GL.Tanh %arg0 : i32
790+
return
791+
}

mlir/test/Target/SPIRV/gl-ops.mlir

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
4242
%19 = spirv.GL.Atanh %arg0 : f32
4343
// CHECK: {{%.*}} = spirv.GL.Log2 {{%.*}} : f32
4444
%20 = spirv.GL.Log2 %arg0 : f32
45+
// CHECK: {{%.*}} = spirv.GL.Tanh {{%.*}} : f32
46+
%21 = spirv.GL.Tanh %arg0 : f32
4547
spirv.Return
4648
}
4749

0 commit comments

Comments
 (0)