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