forked from google/heir
/
ops.mlir
35 lines (28 loc) · 1.16 KB
/
ops.mlir
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
// RUN: heir-opt %s | FileCheck %s
// This simply tests for syntax.
!bsks = !tfhe_rust_bool.server_key
!eb = !tfhe_rust_bool.eb
module {
// CHECK-LABEL: func @test_create_trivial_bool
func.func @test_create_trivial_bool(%bsks : !bsks) {
%0 = arith.constant 1 : i1
%1 = arith.constant 0 : i1
%e1 = tfhe_rust_bool.create_trivial %bsks, %0 : (!bsks, i1) -> !tfhe_rust_bool.eb
%e2 = tfhe_rust_bool.create_trivial %bsks, %1 : (!bsks, i1) -> !tfhe_rust_bool.eb
return
}
// CHECK-LABEL: func @test_and
func.func @test_and(%bsks : !bsks) {
%0 = arith.constant 1 : i1
%1 = arith.constant 1 : i1
%e1 = tfhe_rust_bool.create_trivial %bsks, %0 : (!bsks, i1) -> !tfhe_rust_bool.eb
%e2 = tfhe_rust_bool.create_trivial %bsks, %1 : (!bsks, i1) -> !tfhe_rust_bool.eb
%out = tfhe_rust_bool.and %bsks, %e1, %e2: (!bsks, !tfhe_rust_bool.eb, !tfhe_rust_bool.eb) -> !tfhe_rust_bool.eb
return
}
// CHECK-LABEL: func @test_packed_and
func.func @test_packed_and(%bsks : !bsks, %lhs : tensor<4x!eb>, %rhs : tensor<4x!eb>) {
%out = tfhe_rust_bool.and %bsks, %lhs, %rhs: (!bsks, tensor<4x!eb>, tensor<4x!eb>) -> tensor<4x!eb>
return
}
}