• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
2
3//===----------------------------------------------------------------------===//
4// spv.BitwiseOr
5//===----------------------------------------------------------------------===//
6
7func @bitwise_or_scalar(%arg: i32) -> i32 {
8  // CHECK: spv.BitwiseOr
9  %0 = spv.BitwiseOr %arg, %arg : i32
10  return %0 : i32
11}
12
13func @bitwise_or_vector(%arg: vector<4xi32>) -> vector<4xi32> {
14  // CHECK: spv.BitwiseOr
15  %0 = spv.BitwiseOr %arg, %arg : vector<4xi32>
16  return %0 : vector<4xi32>
17}
18
19// -----
20
21func @bitwise_or_float(%arg0: f16, %arg1: f16) -> f16 {
22  // expected-error @+1 {{operand #0 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values of length 2/3/4}}
23  %0 = spv.BitwiseOr %arg0, %arg1 : f16
24  return %0 : f16
25}
26
27// -----
28
29//===----------------------------------------------------------------------===//
30// spv.BitwiseXor
31//===----------------------------------------------------------------------===//
32
33func @bitwise_xor_scalar(%arg: i32) -> i32 {
34  // CHECK: spv.BitwiseXor
35  %0 = spv.BitwiseXor %arg, %arg : i32
36  return %0 : i32
37}
38
39func @bitwise_xor_vector(%arg: vector<4xi32>) -> vector<4xi32> {
40  // CHECK: spv.BitwiseXor
41  %0 = spv.BitwiseXor %arg, %arg : vector<4xi32>
42  return %0 : vector<4xi32>
43}
44
45// -----
46
47func @bitwise_xor_float(%arg0: f16, %arg1: f16) -> f16 {
48  // expected-error @+1 {{operand #0 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values of length 2/3/4}}
49  %0 = spv.BitwiseXor %arg0, %arg1 : f16
50  return %0 : f16
51}
52
53// -----
54
55//===----------------------------------------------------------------------===//
56// spv.BitwiseAnd
57//===----------------------------------------------------------------------===//
58
59func @bitwise_and_scalar(%arg: i32) -> i32 {
60  // CHECK: spv.BitwiseAnd
61  %0 = spv.BitwiseAnd %arg, %arg : i32
62  return %0 : i32
63}
64
65func @bitwise_and_vector(%arg: vector<4xi32>) -> vector<4xi32> {
66  // CHECK: spv.BitwiseAnd
67  %0 = spv.BitwiseAnd %arg, %arg : vector<4xi32>
68  return %0 : vector<4xi32>
69}
70
71// -----
72
73func @bitwise_and_float(%arg0: f16, %arg1: f16) -> f16 {
74  // expected-error @+1 {{operand #0 must be 8/16/32/64-bit integer or vector of 8/16/32/64-bit integer values of length 2/3/4}}
75  %0 = spv.BitwiseAnd %arg0, %arg1 : f16
76  return %0 : f16
77}
78