mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 12:15:09 -05:00
feat(compiler): Add operation HLFHE.zero generating an encrypted zero
This commit is contained in:
committed by
Quentin Bourgerie
parent
8796754513
commit
cb580f16d2
@@ -18,6 +18,12 @@ include "zamalang/Dialect/HLFHE/IR/HLFHETypes.td"
|
||||
class HLFHE_Op<string mnemonic, list<OpTrait> traits = []> :
|
||||
Op<HLFHE_Dialect, mnemonic, traits>;
|
||||
|
||||
// Generates an encrypted zero constant
|
||||
def ZeroOp : HLFHE_Op<"zero"> {
|
||||
let arguments = (ins);
|
||||
let results = (outs EncryptedIntegerType:$out);
|
||||
}
|
||||
|
||||
def AddEintIntOp : HLFHE_Op<"add_eint_int"> {
|
||||
let arguments = (ins EncryptedIntegerType:$a, AnyInteger:$b);
|
||||
let results = (outs EncryptedIntegerType);
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
// RUN: zamacompiler --round-trip %s 2>&1| FileCheck %s
|
||||
|
||||
// CHECK-LABEL: func @zero() -> !HLFHE.eint<2>
|
||||
func @zero() -> !HLFHE.eint<2> {
|
||||
// CHECK-NEXT: %[[RET:.*]] = "HLFHE.zero"() : () -> !HLFHE.eint<2>
|
||||
// CHECK-NEXT: return %[[RET]] : !HLFHE.eint<2>
|
||||
|
||||
%1 = "HLFHE.zero"() : () -> !HLFHE.eint<2>
|
||||
return %1: !HLFHE.eint<2>
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2>
|
||||
func @add_eint_int(%arg0: !HLFHE.eint<2>) -> !HLFHE.eint<2> {
|
||||
// CHECK-NEXT: %[[V1:.*]] = constant 1 : i3
|
||||
|
||||
Reference in New Issue
Block a user