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