• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
2
3//===----------------------------------------------------------------------===//
4// spv.LogicalEqual
5//===----------------------------------------------------------------------===//
6
7// CHECK-LABEL: @logical_equal_scalar
8spv.func @logical_equal_scalar(%arg0: i1, %arg1: i1) "None" {
9  // CHECK: llvm.icmp "eq" %{{.*}}, %{{.*}} : !llvm.i1
10  %0 = spv.LogicalEqual %arg0, %arg0 : i1
11  spv.Return
12}
13
14// CHECK-LABEL: @logical_equal_vector
15spv.func @logical_equal_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
16  // CHECK: llvm.icmp "eq" %{{.*}}, %{{.*}} : !llvm.vec<4 x i1>
17  %0 = spv.LogicalEqual %arg0, %arg0 : vector<4xi1>
18  spv.Return
19}
20
21//===----------------------------------------------------------------------===//
22// spv.LogicalNotEqual
23//===----------------------------------------------------------------------===//
24
25// CHECK-LABEL: @logical_not_equal_scalar
26spv.func @logical_not_equal_scalar(%arg0: i1, %arg1: i1) "None" {
27  // CHECK: llvm.icmp "ne" %{{.*}}, %{{.*}} : !llvm.i1
28  %0 = spv.LogicalNotEqual %arg0, %arg0 : i1
29  spv.Return
30}
31
32// CHECK-LABEL: @logical_not_equal_vector
33spv.func @logical_not_equal_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
34  // CHECK: llvm.icmp "ne" %{{.*}}, %{{.*}} : !llvm.vec<4 x i1>
35  %0 = spv.LogicalNotEqual %arg0, %arg0 : vector<4xi1>
36  spv.Return
37}
38
39//===----------------------------------------------------------------------===//
40// spv.LogicalNot
41//===----------------------------------------------------------------------===//
42
43// CHECK-LABEL: @logical_not_scalar
44spv.func @logical_not_scalar(%arg0: i1) "None" {
45  // CHECK: %[[CONST:.*]] = llvm.mlir.constant(true) : !llvm.i1
46  // CHECK: llvm.xor %{{.*}}, %[[CONST]] : !llvm.i1
47  %0 = spv.LogicalNot %arg0 : i1
48  spv.Return
49}
50
51// CHECK-LABEL: @logical_not_vector
52spv.func @logical_not_vector(%arg0: vector<4xi1>) "None" {
53  // CHECK: %[[CONST:.*]] = llvm.mlir.constant(dense<true> : vector<4xi1>) : !llvm.vec<4 x i1>
54  // CHECK: llvm.xor %{{.*}}, %[[CONST]] : !llvm.vec<4 x i1>
55  %0 = spv.LogicalNot %arg0 : vector<4xi1>
56  spv.Return
57}
58
59//===----------------------------------------------------------------------===//
60// spv.LogicalAnd
61//===----------------------------------------------------------------------===//
62
63// CHECK-LABEL: @logical_and_scalar
64spv.func @logical_and_scalar(%arg0: i1, %arg1: i1) "None" {
65  // CHECK: llvm.and %{{.*}}, %{{.*}} : !llvm.i1
66  %0 = spv.LogicalAnd %arg0, %arg0 : i1
67  spv.Return
68}
69
70// CHECK-LABEL: @logical_and_vector
71spv.func @logical_and_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
72  // CHECK: llvm.and %{{.*}}, %{{.*}} : !llvm.vec<4 x i1>
73  %0 = spv.LogicalAnd %arg0, %arg0 : vector<4xi1>
74  spv.Return
75}
76
77//===----------------------------------------------------------------------===//
78// spv.LogicalOr
79//===----------------------------------------------------------------------===//
80
81// CHECK-LABEL: @logical_or_scalar
82spv.func @logical_or_scalar(%arg0: i1, %arg1: i1) "None" {
83  // CHECK: llvm.or %{{.*}}, %{{.*}} : !llvm.i1
84  %0 = spv.LogicalOr %arg0, %arg0 : i1
85  spv.Return
86}
87
88// CHECK-LABEL: @logical_or_vector
89spv.func @logical_or_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
90  // CHECK: llvm.or %{{.*}}, %{{.*}} : !llvm.vec<4 x i1>
91  %0 = spv.LogicalOr %arg0, %arg0 : vector<4xi1>
92  spv.Return
93}
94