[Mlir-commits] [mlir] b9266f8 - [MLIR][SPIRVToLLVM] Indentation and style fix in tests

George Mitenkov llvmlistbot at llvm.org
Tue Aug 4 10:54:06 PDT 2020


Author: George Mitenkov
Date: 2020-08-04T20:53:20+03:00
New Revision: b9266f81bc0a2b53406a84e6ef0c4989d5f7e296

URL: https://github.com/llvm/llvm-project/commit/b9266f81bc0a2b53406a84e6ef0c4989d5f7e296
DIFF: https://github.com/llvm/llvm-project/commit/b9266f81bc0a2b53406a84e6ef0c4989d5f7e296.diff

LOG: [MLIR][SPIRVToLLVM] Indentation and style fix in tests

Second patch with test fixes. Redundant `%{{.*}} = `
removed, label checks added, tabs converted to spaces and
some namings are changed to match the convention.

Fixed tests:
- constant-op-to-llvm
- func-ops-to-llvm (renamed)
- memory-ops-to-llvm
- misc-ops-to-llvm
- module-ops-to-llvm
- shift-ops-to-llvm (renamed)
- spirv-types-to-llvm-invalid (renamed)

Reviewed By: ftynse, rriddle

Differential Revision: https://reviews.llvm.org/D85206

Added: 
    mlir/test/Conversion/SPIRVToLLVM/func-ops-to-llvm.mlir
    mlir/test/Conversion/SPIRVToLLVM/shift-ops-to-llvm.mlir
    mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm-invalid.mlir

Modified: 
    mlir/test/Conversion/SPIRVToLLVM/constant-op-to-llvm.mlir
    mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir
    mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir

Removed: 
    mlir/test/Conversion/SPIRVToLLVM/func-to-llvm.mlir
    mlir/test/Conversion/SPIRVToLLVM/shifts-to-llvm.mlir
    mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm.invalid.mlir


################################################################################
diff  --git a/mlir/test/Conversion/SPIRVToLLVM/constant-op-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/constant-op-to-llvm.mlir
index dc84f404906c..90fb3afdde79 100644
--- a/mlir/test/Conversion/SPIRVToLLVM/constant-op-to-llvm.mlir
+++ b/mlir/test/Conversion/SPIRVToLLVM/constant-op-to-llvm.mlir
@@ -4,52 +4,58 @@
 // spv.constant
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @bool_constant_scalar
 func @bool_constant_scalar() {
-  // CHECK: {{.*}} = llvm.mlir.constant(true) : !llvm.i1
+  // CHECK: llvm.mlir.constant(true) : !llvm.i1
   %0 = spv.constant true
-  // CHECK: {{.*}} = llvm.mlir.constant(false) : !llvm.i1
+  // CHECK: llvm.mlir.constant(false) : !llvm.i1
   %1 = spv.constant false
   return
 }
 
+// CHECK-LABEL: @bool_constant_vector
 func @bool_constant_vector() {
-  // CHECK: {{.*}} = llvm.mlir.constant(dense<[true, false]> : vector<2xi1>) : !llvm.vec<2 x i1>
+  // CHECK: llvm.mlir.constant(dense<[true, false]> : vector<2xi1>) : !llvm.vec<2 x i1>
   %0 = constant dense<[true, false]> : vector<2xi1>
-  // CHECK: {{.*}} = llvm.mlir.constant(dense<false> : vector<3xi1>) : !llvm.vec<3 x i1>
+  // CHECK: llvm.mlir.constant(dense<false> : vector<3xi1>) : !llvm.vec<3 x i1>
   %1 = constant dense<false> : vector<3xi1>
   return
 }
 
+// CHECK-LABEL: @integer_constant_scalar
 func @integer_constant_scalar() {
-  // CHECK: {{.*}} = llvm.mlir.constant(0 : i8) : !llvm.i8
+  // CHECK: llvm.mlir.constant(0 : i8) : !llvm.i8
   %0 = spv.constant  0 : i8
-  // CHECK: {{.*}} = llvm.mlir.constant(-5 : i64) : !llvm.i64
+  // CHECK: llvm.mlir.constant(-5 : i64) : !llvm.i64
   %1 = spv.constant -5 : si64
-  // CHECK: {{.*}} = llvm.mlir.constant(10 : i16) : !llvm.i16
+  // CHECK: llvm.mlir.constant(10 : i16) : !llvm.i16
   %2 = spv.constant  10 : ui16
   return
 }
 
+// CHECK-LABEL: @integer_constant_vector
 func @integer_constant_vector() {
-  // CHECK: {{.*}} = llvm.mlir.constant(dense<[2, 3]> : vector<2xi32>) : !llvm.vec<2 x i32>
+  // CHECK: llvm.mlir.constant(dense<[2, 3]> : vector<2xi32>) : !llvm.vec<2 x i32>
   %0 = spv.constant dense<[2, 3]> : vector<2xi32>
-  // CHECK: {{.*}} = llvm.mlir.constant(dense<-4> : vector<2xi32>) : !llvm.vec<2 x i32>
+  // CHECK: llvm.mlir.constant(dense<-4> : vector<2xi32>) : !llvm.vec<2 x i32>
   %1 = spv.constant dense<-4> : vector<2xsi32>
-  // CHECK: {{.*}} = llvm.mlir.constant(dense<[2, 3, 4]> : vector<3xi32>) : !llvm.vec<3 x i32>
+  // CHECK: llvm.mlir.constant(dense<[2, 3, 4]> : vector<3xi32>) : !llvm.vec<3 x i32>
   %2 = spv.constant dense<[2, 3, 4]> : vector<3xui32>
   return
 }
 
+// CHECK-LABEL: @float_constant_scalar
 func @float_constant_scalar() {
-  // CHECK: {{.*}} = llvm.mlir.constant(5.000000e+00 : f16) : !llvm.half
+  // CHECK: llvm.mlir.constant(5.000000e+00 : f16) : !llvm.half
   %0 = spv.constant 5.000000e+00 : f16
-  // CHECK: {{.*}} = llvm.mlir.constant(5.000000e+00 : f64) : !llvm.double
+  // CHECK: llvm.mlir.constant(5.000000e+00 : f64) : !llvm.double
   %1 = spv.constant 5.000000e+00 : f64
   return
 }
 
+// CHECK-LABEL: @float_constant_vector
 func @float_constant_vector() {
-  // CHECK: {{.*}} = llvm.mlir.constant(dense<[2.000000e+00, 3.000000e+00]> : vector<2xf32>) : !llvm.vec<2 x float>
+  // CHECK: llvm.mlir.constant(dense<[2.000000e+00, 3.000000e+00]> : vector<2xf32>) : !llvm.vec<2 x float>
   %0 = spv.constant dense<[2.000000e+00, 3.000000e+00]> : vector<2xf32>
   return
 }

diff  --git a/mlir/test/Conversion/SPIRVToLLVM/func-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/func-ops-to-llvm.mlir
similarity index 71%
rename from mlir/test/Conversion/SPIRVToLLVM/func-to-llvm.mlir
rename to mlir/test/Conversion/SPIRVToLLVM/func-ops-to-llvm.mlir
index 7e7820dee6be..21d3ce43b556 100644
--- a/mlir/test/Conversion/SPIRVToLLVM/func-to-llvm.mlir
+++ b/mlir/test/Conversion/SPIRVToLLVM/func-ops-to-llvm.mlir
@@ -4,18 +4,20 @@
 // spv.Return
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @return
 func @return() {
-	// CHECK: llvm.return
-	spv.Return
+  // CHECK: llvm.return
+  spv.Return
 }
 
 //===----------------------------------------------------------------------===//
 // spv.ReturnValue
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @return_value
 func @return_value(%arg: i32) {
-	// CHECK: llvm.return %{{.*}} : !llvm.i32
-	spv.ReturnValue %arg : i32
+  // CHECK: llvm.return %{{.*}} : !llvm.i32
+  spv.ReturnValue %arg : i32
 }
 
 //===----------------------------------------------------------------------===//
@@ -24,38 +26,38 @@ func @return_value(%arg: i32) {
 
 // CHECK-LABEL: llvm.func @none()
 spv.func @none() -> () "None" {
-	spv.Return
+  spv.Return
 }
 
 // CHECK-LABEL: llvm.func @inline() attributes {passthrough = ["alwaysinline"]}
 spv.func @inline() -> () "Inline" {
-	spv.Return
+  spv.Return
 }
 
 // CHECK-LABEL: llvm.func @dont_inline() attributes {passthrough = ["noinline"]}
 spv.func @dont_inline() -> () "DontInline" {
-	spv.Return
+  spv.Return
 }
 
 // CHECK-LABEL: llvm.func @pure() attributes {passthrough = ["readonly"]}
 spv.func @pure() -> () "Pure" {
-	spv.Return
+  spv.Return
 }
 
 // CHECK-LABEL: llvm.func @const() attributes {passthrough = ["readnone"]}
 spv.func @const() -> () "Const" {
-	spv.Return
+  spv.Return
 }
 
 // CHECK-LABEL: llvm.func @scalar_types(%arg0: !llvm.i32, %arg1: !llvm.i1, %arg2: !llvm.double, %arg3: !llvm.float)
 spv.func @scalar_types(%arg0: i32, %arg1: i1, %arg2: f64, %arg3: f32) -> () "None" {
-	spv.Return
+  spv.Return
 }
 
 // CHECK-LABEL: llvm.func @vector_types(%arg0: !llvm.vec<2 x i64>, %arg1: !llvm.vec<2 x i64>) -> !llvm.vec<2 x i64>
 spv.func @vector_types(%arg0: vector<2xi64>, %arg1: vector<2xi64>) -> vector<2xi64> "None" {
-	%0 = spv.IAdd %arg0, %arg1 : vector<2xi64>
-	spv.ReturnValue %0 : vector<2xi64>
+  %0 = spv.IAdd %arg0, %arg1 : vector<2xi64>
+  spv.ReturnValue %0 : vector<2xi64>
 }
 
 //===----------------------------------------------------------------------===//
@@ -65,15 +67,15 @@ spv.func @vector_types(%arg0: vector<2xi64>, %arg1: vector<2xi64>) -> vector<2xi
 // CHECK-LABEL: llvm.func @function_calls
 // CHECK-SAME: %[[ARG0:.*]]: !llvm.i32, %[[ARG1:.*]]: !llvm.i1, %[[ARG2:.*]]: !llvm.double, %[[ARG3:.*]]: !llvm.vec<2 x i64>, %[[ARG4:.*]]: !llvm.vec<2 x float>
 spv.func @function_calls(%arg0: i32, %arg1: i1, %arg2: f64, %arg3: vector<2xi64>, %arg4: vector<2xf32>) -> () "None" {
-	// CHECK: llvm.call @void_1() : () -> ()
-	spv.FunctionCall @void_1() : () -> ()
-	// CHECK: llvm.call @void_2(%[[ARG3]]) : (!llvm.vec<2 x i64>) -> ()
-	spv.FunctionCall @void_2(%arg3) : (vector<2xi64>) -> ()
-	// CHECK: %{{.*}} = llvm.call @value_scalar(%[[ARG0]], %[[ARG1]], %[[ARG2]]) : (!llvm.i32, !llvm.i1, !llvm.double) -> !llvm.i32
-	%0 = spv.FunctionCall @value_scalar(%arg0, %arg1, %arg2) : (i32, i1, f64) -> i32
-	// CHECK: %{{.*}} = llvm.call @value_vector(%[[ARG3]], %[[ARG4]]) : (!llvm.vec<2 x i64>, !llvm.vec<2 x float>) -> !llvm.vec<2 x float>
-	%1 = spv.FunctionCall @value_vector(%arg3, %arg4) : (vector<2xi64>, vector<2xf32>) -> vector<2xf32>
-	spv.Return
+  // CHECK: llvm.call @void_1() : () -> ()
+  // CHECK: llvm.call @void_2(%[[ARG3]]) : (!llvm.vec<2 x i64>) -> ()
+  // CHECK: llvm.call @value_scalar(%[[ARG0]], %[[ARG1]], %[[ARG2]]) : (!llvm.i32, !llvm.i1, !llvm.double) -> !llvm.i32
+  // CHECK: llvm.call @value_vector(%[[ARG3]], %[[ARG4]]) : (!llvm.vec<2 x i64>, !llvm.vec<2 x float>) -> !llvm.vec<2 x float>
+  spv.FunctionCall @void_1() : () -> ()
+  spv.FunctionCall @void_2(%arg3) : (vector<2xi64>) -> ()
+  %0 = spv.FunctionCall @value_scalar(%arg0, %arg1, %arg2) : (i32, i1, f64) -> i32
+  %1 = spv.FunctionCall @value_vector(%arg3, %arg4) : (vector<2xi64>, vector<2xf32>) -> vector<2xf32>
+  spv.Return
 }
 
 spv.func @void_1() -> () "None" {

diff  --git a/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir
index 6dafab982e35..a565d396e670 100644
--- a/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir
+++ b/mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir
@@ -4,37 +4,42 @@
 // spv.Load
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @load
 func @load() {
   %0 = spv.Variable : !spv.ptr<f32, Function>
-  //  CHECK: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<float>
+  //  CHECK: llvm.load %{{.*}} : !llvm.ptr<float>
   %1 = spv.Load "Function" %0 : f32
   return
 }
 
+// CHECK-LABEL: @load_none
 func @load_none() {
   %0 = spv.Variable : !spv.ptr<f32, Function>
-  //  CHECK: %{{.*}} = llvm.load %{{.*}} : !llvm.ptr<float>
+  //  CHECK: llvm.load %{{.*}} : !llvm.ptr<float>
   %1 = spv.Load "Function" %0 ["None"] : f32
   return
 }
 
+// CHECK-LABEL: @load_with_alignment
 func @load_with_alignment() {
   %0 = spv.Variable : !spv.ptr<f32, Function>
-  // CHECK: %{{.*}} = llvm.load %{{.*}} {alignment = 4 : i64} : !llvm.ptr<float>
+  // CHECK: llvm.load %{{.*}} {alignment = 4 : i64} : !llvm.ptr<float>
   %1 = spv.Load "Function" %0 ["Aligned", 4] : f32
   return
 }
 
+// CHECK-LABEL: @load_volatile
 func @load_volatile() {
   %0 = spv.Variable : !spv.ptr<f32, Function>
-  // CHECK: %{{.*}} = llvm.load volatile %{{.*}} : !llvm.ptr<float>
+  // CHECK: llvm.load volatile %{{.*}} : !llvm.ptr<float>
   %1 = spv.Load "Function" %0 ["Volatile"] : f32
   return
 }
 
+// CHECK-LABEL: @load_nontemporal
 func @load_nontemporal() {
   %0 = spv.Variable : !spv.ptr<f32, Function>
-  // CHECK: %{{.*}} = llvm.load %{{.*}} {nontemporal} : !llvm.ptr<float>
+  // CHECK: llvm.load %{{.*}} {nontemporal} : !llvm.ptr<float>
   %1 = spv.Load "Function" %0 ["Nontemporal"] : f32
   return
 }
@@ -43,6 +48,7 @@ func @load_nontemporal() {
 // spv.Store
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @store
 func @store(%arg0 : f32) -> () {
   %0 = spv.Variable : !spv.ptr<f32, Function>
   // CHECK: llvm.store %{{.*}}, %{{.*}} : !llvm.ptr<float>
@@ -50,6 +56,7 @@ func @store(%arg0 : f32) -> () {
   return
 }
 
+// CHECK-LABEL: @store_composite
 func @store_composite(%arg0 : !spv.struct<f64>) -> () {
   %0 = spv.Variable : !spv.ptr<!spv.struct<f64>, Function>
   // CHECK: llvm.store %{{.*}}, %{{.*}} : !llvm.ptr<struct<packed (double)>>
@@ -57,6 +64,7 @@ func @store_composite(%arg0 : !spv.struct<f64>) -> () {
   return
 }
 
+// CHECK-LABEL: @store_with_alignment
 func @store_with_alignment(%arg0 : f32) -> () {
   %0 = spv.Variable : !spv.ptr<f32, Function>
   // CHECK: llvm.store %{{.*}}, %{{.*}} {alignment = 4 : i64} : !llvm.ptr<float>
@@ -64,6 +72,7 @@ func @store_with_alignment(%arg0 : f32) -> () {
   return
 }
 
+// CHECK-LABEL: @store_volatile
 func @store_volatile(%arg0 : f32) -> () {
   %0 = spv.Variable : !spv.ptr<f32, Function>
   // CHECK: llvm.store volatile %{{.*}}, %{{.*}} : !llvm.ptr<float>
@@ -71,6 +80,7 @@ func @store_volatile(%arg0 : f32) -> () {
   return
 }
 
+// CHECK-LABEL: @store_nontemporal
 func @store_nontemporal(%arg0 : f32) -> () {
   %0 = spv.Variable : !spv.ptr<f32, Function>
   // CHECK: llvm.store %{{.*}}, %{{.*}} {nontemporal} : !llvm.ptr<float>
@@ -82,16 +92,18 @@ func @store_nontemporal(%arg0 : f32) -> () {
 // spv.Variable
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @variable_scalar
 func @variable_scalar() {
   // CHECK: %[[SIZE1:.*]] = llvm.mlir.constant(1 : i32) : !llvm.i32
-  // CHECK: %{{.*}} = llvm.alloca %[[SIZE1]] x !llvm.float : (!llvm.i32) -> !llvm.ptr<float>
+  // CHECK: llvm.alloca %[[SIZE1]] x !llvm.float : (!llvm.i32) -> !llvm.ptr<float>
   %0 = spv.Variable : !spv.ptr<f32, Function>
   // CHECK: %[[SIZE2:.*]] = llvm.mlir.constant(1 : i32) : !llvm.i32
-  // CHECK: %{{.*}} = llvm.alloca %[[SIZE2]] x !llvm.i8 : (!llvm.i32) -> !llvm.ptr<i8>
+  // CHECK: llvm.alloca %[[SIZE2]] x !llvm.i8 : (!llvm.i32) -> !llvm.ptr<i8>
   %1 = spv.Variable : !spv.ptr<i8, Function>
   return
 }
 
+// CHECK-LABEL: @variable_scalar_with_initialization
 func @variable_scalar_with_initialization() {
   // CHECK: %[[VALUE:.*]] = llvm.mlir.constant(0 : i64) : !llvm.i64
   // CHECK: %[[SIZE:.*]] = llvm.mlir.constant(1 : i32) : !llvm.i32
@@ -102,13 +114,15 @@ func @variable_scalar_with_initialization() {
   return
 }
 
+// CHECK-LABEL: @variable_vector
 func @variable_vector() {
   // CHECK: %[[SIZE:.*]] = llvm.mlir.constant(1 : i32) : !llvm.i32
-  // CHECK: %{{.*}} = llvm.alloca  %[[SIZE]] x !llvm.vec<3 x float> : (!llvm.i32) -> !llvm.ptr<vec<3 x float>>
+  // CHECK: llvm.alloca  %[[SIZE]] x !llvm.vec<3 x float> : (!llvm.i32) -> !llvm.ptr<vec<3 x float>>
   %0 = spv.Variable : !spv.ptr<vector<3xf32>, Function>
   return
 }
 
+// CHECK-LABEL: @variable_vector_with_initialization
 func @variable_vector_with_initialization() {
   // CHECK: %[[VALUE:.*]] = llvm.mlir.constant(dense<false> : vector<3xi1>) : !llvm.vec<3 x i1>
   // CHECK: %[[SIZE:.*]] = llvm.mlir.constant(1 : i32) : !llvm.i32
@@ -119,9 +133,10 @@ func @variable_vector_with_initialization() {
   return
 }
 
+// CHECK-LABEL: @variable_array
 func @variable_array() {
   // CHECK: %[[SIZE:.*]] = llvm.mlir.constant(1 : i32) : !llvm.i32
-  // CHECK: %{{.*}} = llvm.alloca %[[SIZE]] x !llvm.array<10 x i32> : (!llvm.i32) -> !llvm.ptr<array<10 x i32>>
+  // CHECK: llvm.alloca %[[SIZE]] x !llvm.array<10 x i32> : (!llvm.i32) -> !llvm.ptr<array<10 x i32>>
   %0 = spv.Variable : !spv.ptr<!spv.array<10 x i32>, Function>
   return
 }

diff  --git a/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
index 60fe79c0007e..2e74485323ed 100644
--- a/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
+++ b/mlir/test/Conversion/SPIRVToLLVM/misc-ops-to-llvm.mlir
@@ -4,17 +4,19 @@
 // spv.Select
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @select_scalar
 func @select_scalar(%arg0: i1, %arg1: vector<3xi32>, %arg2: f32) {
-	// CHECK: %{{.*}} = llvm.select %{{.*}}, %{{.*}}, %{{.*}} : !llvm.i1, !llvm.vec<3 x i32>
-	%0 = spv.Select %arg0, %arg1, %arg1 : i1, vector<3xi32>
-	// CHECK: %{{.*}} = llvm.select %{{.*}}, %{{.*}}, %{{.*}} : !llvm.i1, !llvm.float
-	%1 = spv.Select %arg0, %arg2, %arg2 : i1, f32
+  // CHECK: llvm.select %{{.*}}, %{{.*}}, %{{.*}} : !llvm.i1, !llvm.vec<3 x i32>
+  %0 = spv.Select %arg0, %arg1, %arg1 : i1, vector<3xi32>
+  // CHECK: llvm.select %{{.*}}, %{{.*}}, %{{.*}} : !llvm.i1, !llvm.float
+  %1 = spv.Select %arg0, %arg2, %arg2 : i1, f32
   return
 }
 
+// CHECK-LABEL: @select_vector
 func @select_vector(%arg0: vector<2xi1>, %arg1: vector<2xi32>) {
-	// CHECK: %{{.*}} = llvm.select %{{.*}}, %{{.*}}, %{{.*}} : !llvm.vec<2 x i1>, !llvm.vec<2 x i32>
-	%0 = spv.Select %arg0, %arg1, %arg1 : vector<2xi1>, vector<2xi32>
+  // CHECK: llvm.select %{{.*}}, %{{.*}}, %{{.*}} : !llvm.vec<2 x i1>, !llvm.vec<2 x i32>
+  %0 = spv.Select %arg0, %arg1, %arg1 : vector<2xi1>, vector<2xi32>
   return
 }
 
@@ -22,14 +24,16 @@ func @select_vector(%arg0: vector<2xi1>, %arg1: vector<2xi32>) {
 // spv.Undef
 //===----------------------------------------------------------------------===//
 
+// CHECK-LABEL: @undef_scalar
 func @undef_scalar() {
-	// CHECK: %{{.*}} = llvm.mlir.undef : !llvm.float
-	%0 = spv.undef : f32
-	return
+  // CHECK: llvm.mlir.undef : !llvm.float
+  %0 = spv.undef : f32
+  return
 }
 
+// CHECK-LABEL: @undef_vector
 func @undef_vector() {
-	// CHECK: %{{.*}} = llvm.mlir.undef : !llvm.vec<2 x i32>
-	%0 = spv.undef : vector<2xi32>
-	return
+  // CHECK: llvm.mlir.undef : !llvm.vec<2 x i32>
+  %0 = spv.undef : vector<2xi32>
+  return
 }

diff  --git a/mlir/test/Conversion/SPIRVToLLVM/shift-ops-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/shift-ops-to-llvm.mlir
new file mode 100644
index 000000000000..52df231e718e
--- /dev/null
+++ b/mlir/test/Conversion/SPIRVToLLVM/shift-ops-to-llvm.mlir
@@ -0,0 +1,121 @@
+// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
+
+//===----------------------------------------------------------------------===//
+// spv.ShiftRightArithmetic
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @shift_right_arithmetic_scalar
+func @shift_right_arithmetic_scalar(%arg0: i32, %arg1: si32, %arg2 : i16, %arg3 : ui16) {
+  // CHECK: llvm.ashr %{{.*}}, %{{.*}} : !llvm.i32
+  %0 = spv.ShiftRightArithmetic %arg0, %arg0 : i32, i32
+
+  // CHECK: llvm.ashr %{{.*}}, %{{.*}} : !llvm.i32
+  %1 = spv.ShiftRightArithmetic %arg0, %arg1 : i32, si32
+
+  // CHECK: %[[SEXT:.*]] = llvm.sext %{{.*}} : !llvm.i16 to !llvm.i32
+  // CHECK: llvm.ashr %{{.*}}, %[[SEXT]] : !llvm.i32
+  %2 = spv.ShiftRightArithmetic %arg0, %arg2 : i32, i16
+
+  // CHECK: %[[ZEXT:.*]] = llvm.zext %{{.*}} : !llvm.i16 to !llvm.i32
+  // CHECK: llvm.ashr %{{.*}}, %[[ZEXT]] : !llvm.i32
+  %3 = spv.ShiftRightArithmetic %arg0, %arg3 : i32, ui16
+  return
+}
+
+// CHECK-LABEL: @shift_right_arithmetic_vector
+func @shift_right_arithmetic_vector(%arg0: vector<4xi64>, %arg1: vector<4xui64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) {
+  // CHECK: llvm.ashr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
+  %0 = spv.ShiftRightArithmetic %arg0, %arg0 : vector<4xi64>, vector<4xi64>
+
+  // CHECK: llvm.ashr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
+  %1 = spv.ShiftRightArithmetic %arg0, %arg1 : vector<4xi64>, vector<4xui64>
+
+  // CHECK: %[[SEXT:.*]] = llvm.sext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
+  // CHECK: llvm.ashr %{{.*}}, %[[SEXT]] : !llvm.vec<4 x i64>
+  %2 = spv.ShiftRightArithmetic %arg0, %arg2 : vector<4xi64>,  vector<4xi32>
+
+  // CHECK: %[[ZEXT:.*]] = llvm.zext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
+  // CHECK: llvm.ashr %{{.*}}, %[[ZEXT]] : !llvm.vec<4 x i64>
+  %3 = spv.ShiftRightArithmetic %arg0, %arg3 : vector<4xi64>, vector<4xui32>
+  return
+}
+
+//===----------------------------------------------------------------------===//
+// spv.ShiftRightLogical
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @shift_right_logical_scalar
+func @shift_right_logical_scalar(%arg0: i32, %arg1: si32, %arg2 : si16, %arg3 : ui16) {
+  // CHECK: llvm.lshr %{{.*}}, %{{.*}} : !llvm.i32
+  %0 = spv.ShiftRightLogical %arg0, %arg0 : i32, i32
+
+  // CHECK: llvm.lshr %{{.*}}, %{{.*}} : !llvm.i32
+  %1 = spv.ShiftRightLogical %arg0, %arg1 : i32, si32
+
+  // CHECK: %[[SEXT:.*]] = llvm.sext %{{.*}} : !llvm.i16 to !llvm.i32
+  // CHECK: llvm.lshr %{{.*}}, %[[SEXT]] : !llvm.i32
+  %2 = spv.ShiftRightLogical %arg0, %arg2 : i32, si16
+
+  // CHECK: %[[ZEXT:.*]] = llvm.zext %{{.*}} : !llvm.i16 to !llvm.i32
+  // CHECK: llvm.lshr %{{.*}}, %[[ZEXT]] : !llvm.i32
+  %3 = spv.ShiftRightLogical %arg0, %arg3 : i32, ui16
+  return
+}
+
+// CHECK-LABEL: @shift_right_logical_vector
+func @shift_right_logical_vector(%arg0: vector<4xi64>, %arg1: vector<4xsi64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) {
+  // CHECK: llvm.lshr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
+  %0 = spv.ShiftRightLogical %arg0, %arg0 : vector<4xi64>, vector<4xi64>
+
+  // CHECK: llvm.lshr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
+  %1 = spv.ShiftRightLogical %arg0, %arg1 : vector<4xi64>, vector<4xsi64>
+
+  // CHECK: %[[SEXT:.*]] = llvm.sext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
+  // CHECK: llvm.lshr %{{.*}}, %[[SEXT]] : !llvm.vec<4 x i64>
+  %2 = spv.ShiftRightLogical %arg0, %arg2 : vector<4xi64>,  vector<4xi32>
+
+  // CHECK: %[[ZEXT:.*]] = llvm.zext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
+  // CHECK: llvm.lshr %{{.*}}, %[[ZEXT]] : !llvm.vec<4 x i64>
+  %3 = spv.ShiftRightLogical %arg0, %arg3 : vector<4xi64>, vector<4xui32>
+  return
+}
+
+//===----------------------------------------------------------------------===//
+// spv.ShiftLeftLogical
+//===----------------------------------------------------------------------===//
+
+// CHECK-LABEL: @shift_left_logical_scalar
+func @shift_left_logical_scalar(%arg0: i32, %arg1: si32, %arg2 : i16, %arg3 : ui16) {
+  // CHECK: llvm.shl %{{.*}}, %{{.*}} : !llvm.i32
+  %0 = spv.ShiftLeftLogical %arg0, %arg0 : i32, i32
+
+  // CHECK: llvm.shl %{{.*}}, %{{.*}} : !llvm.i32
+  %1 = spv.ShiftLeftLogical %arg0, %arg1 : i32, si32
+
+  // CHECK: %[[SEXT:.*]] = llvm.sext %{{.*}} : !llvm.i16 to !llvm.i32
+  // CHECK: llvm.shl %{{.*}}, %[[SEXT]] : !llvm.i32
+  %2 = spv.ShiftLeftLogical %arg0, %arg2 : i32, i16
+
+  // CHECK: %[[ZEXT:.*]] = llvm.zext %{{.*}} : !llvm.i16 to !llvm.i32
+  // CHECK: llvm.shl %{{.*}}, %[[ZEXT]] : !llvm.i32
+  %3 = spv.ShiftLeftLogical %arg0, %arg3 : i32, ui16
+  return
+}
+
+// CHECK-LABEL: @shift_left_logical_vector
+func @shift_left_logical_vector(%arg0: vector<4xi64>, %arg1: vector<4xsi64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) {
+  // CHECK: llvm.shl %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
+  %0 = spv.ShiftLeftLogical %arg0, %arg0 : vector<4xi64>, vector<4xi64>
+
+  // CHECK: llvm.shl %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
+  %1 = spv.ShiftLeftLogical %arg0, %arg1 : vector<4xi64>, vector<4xsi64>
+
+  // CHECK: %[[SEXT:.*]] = llvm.sext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
+  // CHECK: llvm.shl %{{.*}}, %[[SEXT]] : !llvm.vec<4 x i64>
+  %2 = spv.ShiftLeftLogical %arg0, %arg2 : vector<4xi64>,  vector<4xi32>
+
+  // CHECK: %[[ZEXT:.*]] = llvm.zext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
+  // CHECK: llvm.shl %{{.*}}, %[[ZEXT]] : !llvm.vec<4 x i64>
+  %3 = spv.ShiftLeftLogical %arg0, %arg3 : vector<4xi64>, vector<4xui32>
+  return
+}

diff  --git a/mlir/test/Conversion/SPIRVToLLVM/shifts-to-llvm.mlir b/mlir/test/Conversion/SPIRVToLLVM/shifts-to-llvm.mlir
deleted file mode 100644
index 41431ea3b3b2..000000000000
--- a/mlir/test/Conversion/SPIRVToLLVM/shifts-to-llvm.mlir
+++ /dev/null
@@ -1,115 +0,0 @@
-// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
-
-//===----------------------------------------------------------------------===//
-// spv.ShiftRightArithmetic
-//===----------------------------------------------------------------------===//
-
-func @shift_right_arithmetic_scalar(%arg0: i32, %arg1: si32, %arg2 : i16, %arg3 : ui16) {
-	// CHECK: %{{.*}} = llvm.ashr %{{.*}}, %{{.*}} : !llvm.i32
-	%0 = spv.ShiftRightArithmetic %arg0, %arg0 : i32, i32
-
-    // CHECK: %{{.*}} = llvm.ashr %{{.*}}, %{{.*}} : !llvm.i32
-	%1 = spv.ShiftRightArithmetic %arg0, %arg1 : i32, si32
-
-    // CHECK: %[[EXT1:.*]] = llvm.sext %{{.*}} : !llvm.i16 to !llvm.i32
-    // CHECK: %{{.*}} = llvm.ashr %{{.*}}, %[[EXT1:.*]]: !llvm.i32
-	%2 = spv.ShiftRightArithmetic %arg0, %arg2 : i32, i16
-
-    // CHECK: %[[EXT2:.*]] = llvm.zext %{{.*}} : !llvm.i16 to !llvm.i32
-    // CHECK: %{{.*}} = llvm.ashr %{{.*}}, %[[EXT2:.*]]: !llvm.i32
-	%3 = spv.ShiftRightArithmetic %arg0, %arg3 : i32, ui16
-	return
-}
-
-func @shift_right_arithmetic_vector(%arg0: vector<4xi64>, %arg1: vector<4xui64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) {
-	// CHECK: %{{.*}} = llvm.ashr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
-	%0 = spv.ShiftRightArithmetic %arg0, %arg0 : vector<4xi64>, vector<4xi64>
-
-    // CHECK: %{{.*}} = llvm.ashr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
-	%1 = spv.ShiftRightArithmetic %arg0, %arg1 : vector<4xi64>, vector<4xui64>
-
-    // CHECK: %[[EXT1:.*]] = llvm.sext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
-    // CHECK: %{{.*}} = llvm.ashr %{{.*}}, %[[EXT1:.*]]: !llvm.vec<4 x i64>
-	%2 = spv.ShiftRightArithmetic %arg0, %arg2 : vector<4xi64>,  vector<4xi32>
-
-    // CHECK: %[[EXT2:.*]] = llvm.zext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
-    // CHECK: %{{.*}} = llvm.ashr %{{.*}}, %[[EXT2:.*]]: !llvm.vec<4 x i64>
-	%3 = spv.ShiftRightArithmetic %arg0, %arg3 : vector<4xi64>, vector<4xui32>
-	return
-}
-
-//===----------------------------------------------------------------------===//
-// spv.ShiftRightLogical
-//===----------------------------------------------------------------------===//
-
-func @shift_right_logical_scalar(%arg0: i32, %arg1: si32, %arg2 : si16, %arg3 : ui16) {
-	// CHECK: %{{.*}} = llvm.lshr %{{.*}}, %{{.*}} : !llvm.i32
-	%0 = spv.ShiftRightLogical %arg0, %arg0 : i32, i32
-
-    // CHECK: %{{.*}} = llvm.lshr %{{.*}}, %{{.*}} : !llvm.i32
-	%1 = spv.ShiftRightLogical %arg0, %arg1 : i32, si32
-
-    // CHECK: %[[EXT1:.*]] = llvm.sext %{{.*}} : !llvm.i16 to !llvm.i32
-    // CHECK: %{{.*}} = llvm.lshr %{{.*}}, %[[EXT1:.*]]: !llvm.i32
-	%2 = spv.ShiftRightLogical %arg0, %arg2 : i32, si16
-
-    // CHECK: %[[EXT2:.*]] = llvm.zext %{{.*}} : !llvm.i16 to !llvm.i32
-    // CHECK: %{{.*}} = llvm.lshr %{{.*}}, %[[EXT2:.*]]: !llvm.i32
-	%3 = spv.ShiftRightLogical %arg0, %arg3 : i32, ui16
-	return
-}
-
-func @shift_right_logical_vector(%arg0: vector<4xi64>, %arg1: vector<4xsi64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) {
-	// CHECK: %{{.*}} = llvm.lshr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
-	%0 = spv.ShiftRightLogical %arg0, %arg0 : vector<4xi64>, vector<4xi64>
-
-    // CHECK: %{{.*}} = llvm.lshr %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
-	%1 = spv.ShiftRightLogical %arg0, %arg1 : vector<4xi64>, vector<4xsi64>
-
-    // CHECK: %[[EXT1:.*]] = llvm.sext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
-    // CHECK: %{{.*}} = llvm.lshr %{{.*}}, %[[EXT1:.*]]: !llvm.vec<4 x i64>
-	%2 = spv.ShiftRightLogical %arg0, %arg2 : vector<4xi64>,  vector<4xi32>
-
-    // CHECK: %[[EXT2:.*]] = llvm.zext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
-    // CHECK: %{{.*}} = llvm.lshr %{{.*}}, %[[EXT2:.*]]: !llvm.vec<4 x i64>
-	%3 = spv.ShiftRightLogical %arg0, %arg3 : vector<4xi64>, vector<4xui32>
-	return
-}
-
-//===----------------------------------------------------------------------===//
-// spv.ShiftLeftLogical
-//===----------------------------------------------------------------------===//
-
-func @shift_left_logical_scalar(%arg0: i32, %arg1: si32, %arg2 : i16, %arg3 : ui16) {
-	// CHECK: %{{.*}} = llvm.shl %{{.*}}, %{{.*}} : !llvm.i32
-	%0 = spv.ShiftLeftLogical %arg0, %arg0 : i32, i32
-
-    // CHECK: %{{.*}} = llvm.shl %{{.*}}, %{{.*}} : !llvm.i32
-	%1 = spv.ShiftLeftLogical %arg0, %arg1 : i32, si32
-
-    // CHECK: %[[EXT1:.*]] = llvm.sext %{{.*}} : !llvm.i16 to !llvm.i32
-    // CHECK: %{{.*}} = llvm.shl %{{.*}}, %[[EXT1:.*]]: !llvm.i32
-	%2 = spv.ShiftLeftLogical %arg0, %arg2 : i32, i16
-
-    // CHECK: %[[EXT2:.*]] = llvm.zext %{{.*}} : !llvm.i16 to !llvm.i32
-    // CHECK: %{{.*}} = llvm.shl %{{.*}}, %[[EXT2:.*]]: !llvm.i32
-	%3 = spv.ShiftLeftLogical %arg0, %arg3 : i32, ui16
-	return
-}
-
-func @shift_left_logical_vector(%arg0: vector<4xi64>, %arg1: vector<4xsi64>, %arg2: vector<4xi32>, %arg3: vector<4xui32>) {
-	// CHECK: %{{.*}} = llvm.shl %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
-	%0 = spv.ShiftLeftLogical %arg0, %arg0 : vector<4xi64>, vector<4xi64>
-
-    // CHECK: %{{.*}} = llvm.shl %{{.*}}, %{{.*}} : !llvm.vec<4 x i64>
-	%1 = spv.ShiftLeftLogical %arg0, %arg1 : vector<4xi64>, vector<4xsi64>
-
-    // CHECK: %[[EXT1:.*]] = llvm.sext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
-    // CHECK: %{{.*}} = llvm.shl %{{.*}}, %[[EXT1:.*]]: !llvm.vec<4 x i64>
-	%2 = spv.ShiftLeftLogical %arg0, %arg2 : vector<4xi64>,  vector<4xi32>
-
-    // CHECK: %[[EXT2:.*]] = llvm.zext %{{.*}} : !llvm.vec<4 x i32> to !llvm.vec<4 x i64>
-    // CHECK: %{{.*}} = llvm.shl %{{.*}}, %[[EXT2:.*]]: !llvm.vec<4 x i64>
-	%3 = spv.ShiftLeftLogical %arg0, %arg3 : vector<4xi64>, vector<4xui32>
-	return
-}

diff  --git a/mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm.invalid.mlir b/mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm-invalid.mlir
similarity index 100%
rename from mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm.invalid.mlir
rename to mlir/test/Conversion/SPIRVToLLVM/spirv-types-to-llvm-invalid.mlir


        


More information about the Mlir-commits mailing list