Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Commit c82c4e1

Browse files
antiagainsttensorflower-gardener
authored andcommitted
[spirv] NFC: rename test files and sort tests inside
PiperOrigin-RevId: 282132339
1 parent 3ce7f94 commit c82c4e1

File tree

3 files changed

+50
-34
lines changed

3 files changed

+50
-34
lines changed

include/mlir/Dialect/SPIRV/SPIRVLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// limitations under the License.
1616
// =============================================================================
1717
//
18-
// Defines, utilities and base classes to use while targeting SPIR-V dialect.
18+
// Defines utilities to use while targeting SPIR-V dialect.
1919
//
2020
//===----------------------------------------------------------------------===//
2121

test/Conversion/StandardToSPIRV/op_conversion.mlir renamed to test/Conversion/StandardToSPIRV/std-to-spirv.mlir

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
// RUN: mlir-opt -convert-std-to-spirv %s -o - | FileCheck %s
22

3+
//===----------------------------------------------------------------------===//
4+
// std binary arithmetic ops
5+
//===----------------------------------------------------------------------===//
6+
7+
// CHECK-LABEL: @add_sub
8+
func @add_sub(%arg0 : i32, %arg1 : i32) {
9+
// CHECK: spv.IAdd
10+
%0 = addi %arg0, %arg1 : i32
11+
// CHECK: spv.ISub
12+
%1 = subi %arg0, %arg1 : i32
13+
return
14+
}
15+
316
// CHECK-LABEL: @fmul_scalar
417
func @fmul_scalar(%arg: f32) -> f32 {
518
// CHECK: spv.FMul
@@ -44,23 +57,21 @@ func @fmul_tensor(%arg: tensor<4xf32>) -> tensor<4xf32> {
4457
return %0 : tensor<4xf32>
4558
}
4659

47-
// CHECK-LABEL: @constval
48-
func @constval() {
49-
// CHECK: spv.constant true
50-
%0 = constant true
51-
// CHECK: spv.constant 42 : i64
52-
%1 = constant 42
53-
// CHECK: spv.constant {{[0-9]*\.[0-9]*e?-?[0-9]*}} : f32
54-
%2 = constant 0.5 : f32
55-
// CHECK: spv.constant dense<[2, 3]> : vector<2xi32>
56-
%3 = constant dense<[2, 3]> : vector<2xi32>
57-
// CHECK: spv.constant 1 : i32
58-
%4 = constant 1 : index
60+
// CHECK-LABEL: @div_rem
61+
func @div_rem(%arg0 : i32, %arg1 : i32) {
62+
// CHECK: spv.SDiv
63+
%0 = divis %arg0, %arg1 : i32
64+
// CHECK: spv.SMod
65+
%1 = remis %arg0, %arg1 : i32
5966
return
6067
}
6168

62-
// CHECK-LABEL: @cmpiop
63-
func @cmpiop(%arg0 : i32, %arg1 : i32) {
69+
//===----------------------------------------------------------------------===//
70+
// std.cmpi
71+
//===----------------------------------------------------------------------===//
72+
73+
// CHECK-LABEL: @cmpi
74+
func @cmpi(%arg0 : i32, %arg1 : i32) {
6475
// CHECK: spv.IEqual
6576
%0 = cmpi "eq", %arg0, %arg1 : i32
6677
// CHECK: spv.INotEqual
@@ -76,28 +87,33 @@ func @cmpiop(%arg0 : i32, %arg1 : i32) {
7687
return
7788
}
7889

79-
// CHECK-LABEL: @select
80-
func @selectOp(%arg0 : i32, %arg1 : i32) {
81-
%0 = cmpi "sle", %arg0, %arg1 : i32
82-
// CHECK: spv.Select
83-
%1 = select %0, %arg0, %arg1 : i32
84-
return
85-
}
90+
//===----------------------------------------------------------------------===//
91+
// std.constant
92+
//===----------------------------------------------------------------------===//
8693

87-
// CHECK-LABEL: @div_rem
88-
func @div_rem(%arg0 : i32, %arg1 : i32) {
89-
// CHECK: spv.SDiv
90-
%0 = divis %arg0, %arg1 : i32
91-
// CHECK: spv.SMod
92-
%1 = remis %arg0, %arg1 : i32
94+
// CHECK-LABEL: @constant
95+
func @constant() {
96+
// CHECK: spv.constant true
97+
%0 = constant true
98+
// CHECK: spv.constant 42 : i64
99+
%1 = constant 42
100+
// CHECK: spv.constant {{[0-9]*\.[0-9]*e?-?[0-9]*}} : f32
101+
%2 = constant 0.5 : f32
102+
// CHECK: spv.constant dense<[2, 3]> : vector<2xi32>
103+
%3 = constant dense<[2, 3]> : vector<2xi32>
104+
// CHECK: spv.constant 1 : i32
105+
%4 = constant 1 : index
93106
return
94107
}
95108

96-
// CHECK-LABEL: @add_sub
97-
func @add_sub(%arg0 : i32, %arg1 : i32) {
98-
// CHECK: spv.IAdd
99-
%0 = addi %arg0, %arg1 : i32
100-
// CHECK: spv.ISub
101-
%1 = subi %arg0, %arg1 : i32
109+
//===----------------------------------------------------------------------===//
110+
// std.select
111+
//===----------------------------------------------------------------------===//
112+
113+
// CHECK-LABEL: @select
114+
func @select(%arg0 : i32, %arg1 : i32) {
115+
%0 = cmpi "sle", %arg0, %arg1 : i32
116+
// CHECK: spv.Select
117+
%1 = select %0, %arg0, %arg1 : i32
102118
return
103119
}

0 commit comments

Comments
 (0)