1 // RUN: mlir-opt -convert-spirv-to-llvm %s | FileCheck %s
3 //===----------------------------------------------------------------------===//
5 //===----------------------------------------------------------------------===//
7 // CHECK-LABEL: @logical_equal_scalar
8 spirv.func @logical_equal_scalar(%arg0: i1, %arg1: i1) "None" {
9 // CHECK: llvm.icmp "eq" %{{.*}}, %{{.*}} : i1
10 %0 = spirv.LogicalEqual %arg0, %arg1 : i1
14 // CHECK-LABEL: @logical_equal_vector
15 spirv.func @logical_equal_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
16 // CHECK: llvm.icmp "eq" %{{.*}}, %{{.*}} : vector<4xi1>
17 %0 = spirv.LogicalEqual %arg0, %arg1 : vector<4xi1>
21 //===----------------------------------------------------------------------===//
22 // spirv.LogicalNotEqual
23 //===----------------------------------------------------------------------===//
25 // CHECK-LABEL: @logical_not_equal_scalar
26 spirv.func @logical_not_equal_scalar(%arg0: i1, %arg1: i1) "None" {
27 // CHECK: llvm.icmp "ne" %{{.*}}, %{{.*}} : i1
28 %0 = spirv.LogicalNotEqual %arg0, %arg1 : i1
32 // CHECK-LABEL: @logical_not_equal_vector
33 spirv.func @logical_not_equal_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
34 // CHECK: llvm.icmp "ne" %{{.*}}, %{{.*}} : vector<4xi1>
35 %0 = spirv.LogicalNotEqual %arg0, %arg1 : vector<4xi1>
39 //===----------------------------------------------------------------------===//
41 //===----------------------------------------------------------------------===//
43 // CHECK-LABEL: @logical_not_scalar
44 spirv.func @logical_not_scalar(%arg0: i1) "None" {
45 // CHECK: %[[CONST:.*]] = llvm.mlir.constant(true) : i1
46 // CHECK: llvm.xor %{{.*}}, %[[CONST]] : i1
47 %0 = spirv.LogicalNot %arg0 : i1
51 // CHECK-LABEL: @logical_not_vector
52 spirv.func @logical_not_vector(%arg0: vector<4xi1>) "None" {
53 // CHECK: %[[CONST:.*]] = llvm.mlir.constant(dense<true> : vector<4xi1>) : vector<4xi1>
54 // CHECK: llvm.xor %{{.*}}, %[[CONST]] : vector<4xi1>
55 %0 = spirv.LogicalNot %arg0 : vector<4xi1>
59 //===----------------------------------------------------------------------===//
61 //===----------------------------------------------------------------------===//
63 // CHECK-LABEL: @logical_and_scalar
64 spirv.func @logical_and_scalar(%arg0: i1, %arg1: i1) "None" {
65 // CHECK: llvm.and %{{.*}}, %{{.*}} : i1
66 %0 = spirv.LogicalAnd %arg0, %arg1 : i1
70 // CHECK-LABEL: @logical_and_vector
71 spirv.func @logical_and_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
72 // CHECK: llvm.and %{{.*}}, %{{.*}} : vector<4xi1>
73 %0 = spirv.LogicalAnd %arg0, %arg1 : vector<4xi1>
77 //===----------------------------------------------------------------------===//
79 //===----------------------------------------------------------------------===//
81 // CHECK-LABEL: @logical_or_scalar
82 spirv.func @logical_or_scalar(%arg0: i1, %arg1: i1) "None" {
83 // CHECK: llvm.or %{{.*}}, %{{.*}} : i1
84 %0 = spirv.LogicalOr %arg0, %arg1 : i1
88 // CHECK-LABEL: @logical_or_vector
89 spirv.func @logical_or_vector(%arg0: vector<4xi1>, %arg1: vector<4xi1>) "None" {
90 // CHECK: llvm.or %{{.*}}, %{{.*}} : vector<4xi1>
91 %0 = spirv.LogicalOr %arg0, %arg1 : vector<4xi1>