Skip to content

Commit

Permalink
fixes ezpc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkenlegend committed May 30, 2023
1 parent 90fa7d8 commit 9b72396
Show file tree
Hide file tree
Showing 19 changed files with 421 additions and 409 deletions.
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,16 @@ bin/
mpc_venv
# Vim c_tags files
c_*
SEAL
SEAL
*.onnx
.idea/
.vscode/
*.sh
*.dat
*.npy
*.txt
*Zone.Identifier
*.zip
*.dot
*.csv
*.out
98 changes: 49 additions & 49 deletions EzPC/EzPC/test_suite/precompiled_output/binop0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ share* __tac_var2 = put_cons32_gate(ycirc, __tac_var1);

share* signBitX = ycirc->PutANDGate(x, __tac_var2);
/* Temporary variable for sub-expression on source location: (26,28-26,33) */
int32_t __tac_var3 = __tac_var1;
int32_t __tac_var3 = ( (int32_t)1 << (int32_t)31);
/* Temporary variable for sub-expression on source location: (26,28-26,33) */
share* __tac_var4 = __tac_var2;
share* __tac_var4 = put_cons32_gate(ycirc, __tac_var3);

share* signBitY = ycirc->PutANDGate(y, __tac_var2);
share* signBitY = ycirc->PutANDGate(y, __tac_var4);
/* Temporary variable for sub-expression on source location: (27,10-27,29) */
share* __tac_var5 = ycirc->PutXORGate(signBitX, signBitY);
/* Temporary variable for sub-expression on source location: (27,33-27,35) */
share* __tac_var6 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (27,9-27,35) */
share* __tac_var7 = ycirc->PutGTGate(__tac_var5, __tac_var6);
/* Temporary variable for sub-expression on source location: (27,52-27,54) */
share* __tac_var8 = __tac_var6;
share* __tac_var8 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (27,41-27,54) */
share* __tac_var9 = ycirc->PutGTGate(signBitX, __tac_var6);
share* __tac_var9 = ycirc->PutGTGate(signBitX, __tac_var8);
/* Temporary variable for sub-expression on source location: (27,58-27,63) */
share* __tac_var10 = put_cons1_gate(ycirc, 0);
/* Temporary variable for sub-expression on source location: (27,66-27,70) */
Expand Down Expand Up @@ -110,15 +110,15 @@ share* __tac_var17 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (36,10-36,23) */
share* __tac_var18 = ycirc->PutGTGate(signBitX, __tac_var17);
/* Temporary variable for sub-expression on source location: (36,28-36,30) */
share* __tac_var19 = __tac_var17;
share* __tac_var19 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (36,35-36,37) */
share* __tac_var20 = __tac_var17;
share* __tac_var20 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (36,35-36,42) */
share* __tac_var21 = ycirc->PutSUBGate(__tac_var17, ux);
share* __tac_var21 = ycirc->PutSUBGate(__tac_var20, ux);
/* Temporary variable for sub-expression on source location: (36,34-36,48) */
share* __tac_var22 = arithmetic_right_shift(ycirc, __tac_var21, y);
/* Temporary variable for sub-expression on source location: (36,28-36,49) */
share* __tac_var23 = ycirc->PutSUBGate(__tac_var17, __tac_var22);
share* __tac_var23 = ycirc->PutSUBGate(__tac_var19, __tac_var22);
/* Temporary variable for sub-expression on source location: (36,54-36,61) */
share* __tac_var24 = arithmetic_right_shift(ycirc, ux, y);
/* Temporary variable for sub-expression on source location: (36,9-36,62) */
Expand Down Expand Up @@ -202,7 +202,7 @@ share* longDivision(share* x, share* y, uint32_t getQuotient){

share* q = put_cons32_gate(ycirc, (uint32_t)0);

share* divisor = q;
share* divisor = put_cons32_gate(ycirc, (uint32_t)0);

share* cond = put_cons1_gate(ycirc, 0);
for (uint32_t iter = (int32_t)0; iter < (int32_t)32; iter++){
Expand Down Expand Up @@ -256,19 +256,19 @@ share* __tac_var56 = put_cons32_gate(ycirc, (int32_t)0);

share* isXNeg = signedltbl(x, __tac_var56);
/* Temporary variable for sub-expression on source location: (100,23-100,24) */
share* __tac_var57 = __tac_var56;
share* __tac_var57 = put_cons32_gate(ycirc, (int32_t)0);

share* isYNeg = signedltbl(y, __tac_var56);
share* isYNeg = signedltbl(y, __tac_var57);
/* Temporary variable for sub-expression on source location: (101,26-101,27) */
share* __tac_var58 = __tac_var56;
share* __tac_var58 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (101,26-101,31) */
share* __tac_var59 = ycirc->PutSUBGate(__tac_var56, x);
share* __tac_var59 = ycirc->PutSUBGate(__tac_var58, x);

share* ux = ycirc->PutMUXGate(__tac_var59, x, isXNeg);
/* Temporary variable for sub-expression on source location: (102,26-102,27) */
share* __tac_var60 = __tac_var56;
share* __tac_var60 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (102,26-102,31) */
share* __tac_var61 = ycirc->PutSUBGate(__tac_var56, y);
share* __tac_var61 = ycirc->PutSUBGate(__tac_var60, y);

share* uy = ycirc->PutMUXGate(__tac_var61, y, isYNeg);

Expand Down Expand Up @@ -316,19 +316,19 @@ share* __tac_var68 = put_cons32_gate(ycirc, (int32_t)0);

share* isXNeg = signedltbl(x, __tac_var68);
/* Temporary variable for sub-expression on source location: (127,23-127,24) */
share* __tac_var69 = __tac_var68;
share* __tac_var69 = put_cons32_gate(ycirc, (int32_t)0);

share* isYNeg = signedltbl(y, __tac_var68);
share* isYNeg = signedltbl(y, __tac_var69);
/* Temporary variable for sub-expression on source location: (128,26-128,27) */
share* __tac_var70 = __tac_var68;
share* __tac_var70 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (128,26-128,31) */
share* __tac_var71 = ycirc->PutSUBGate(__tac_var68, x);
share* __tac_var71 = ycirc->PutSUBGate(__tac_var70, x);

share* ux = ycirc->PutMUXGate(__tac_var71, x, isXNeg);
/* Temporary variable for sub-expression on source location: (129,26-129,27) */
share* __tac_var72 = __tac_var68;
share* __tac_var72 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (129,26-129,31) */
share* __tac_var73 = ycirc->PutSUBGate(__tac_var68, y);
share* __tac_var73 = ycirc->PutSUBGate(__tac_var72, y);

share* uy = ycirc->PutMUXGate(__tac_var73, y, isYNeg);

Expand Down Expand Up @@ -386,38 +386,38 @@ share* __tac_var79 = ycirc->PutA2YGate(b);
share* __tac_var80 = arithmetic_right_shift(ycirc, __tac_var79, (uint32_t)2);
c = acirc->PutY2AGate(__tac_var80, bcirc);
/* Temporary variable for sub-expression on source location: (173,5-173,6) */
share* __tac_var81 = __tac_var79;
share* __tac_var81 = ycirc->PutA2YGate(b);
/* Temporary variable for sub-expression on source location: (173,5-173,10) */
share* __tac_var82 = left_shift(ycirc, __tac_var79, (uint32_t)2);
share* __tac_var82 = left_shift(ycirc, __tac_var81, (uint32_t)2);
c = acirc->PutY2AGate(__tac_var82, bcirc);
/* Temporary variable for sub-expression on source location: (174,5-174,6) */
share* __tac_var83 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (174,7-174,8) */
share* __tac_var84 = __tac_var79;
share* __tac_var84 = ycirc->PutA2YGate(b);
/* Temporary variable for sub-expression on source location: (174,5-174,8) */
share* __tac_var85 = ycirc->PutXORGate(__tac_var83, __tac_var79);
share* __tac_var85 = ycirc->PutXORGate(__tac_var83, __tac_var84);
c = acirc->PutY2AGate(__tac_var85, bcirc);
/* Temporary variable for sub-expression on source location: (175,5-175,6) */
share* __tac_var86 = __tac_var83;
share* __tac_var86 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (175,7-175,8) */
share* __tac_var87 = __tac_var79;
share* __tac_var87 = ycirc->PutA2YGate(b);
/* Temporary variable for sub-expression on source location: (175,5-175,8) */
share* __tac_var88 = ycirc->PutANDGate(__tac_var83, __tac_var79);
share* __tac_var88 = ycirc->PutANDGate(__tac_var86, __tac_var87);
c = acirc->PutY2AGate(__tac_var88, bcirc);
/* Temporary variable for sub-expression on source location: (176,5-176,6) */
share* __tac_var89 = __tac_var83;
share* __tac_var89 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (176,7-176,8) */
share* __tac_var90 = __tac_var79;
share* __tac_var90 = ycirc->PutA2YGate(b);
/* Temporary variable for sub-expression on source location: (176,5-176,8) */
share* __tac_var91 = ((BooleanCircuit *) ycirc)->PutORGate(__tac_var83, __tac_var79);
share* __tac_var91 = ((BooleanCircuit *) ycirc)->PutORGate(__tac_var89, __tac_var90);
c = acirc->PutY2AGate(__tac_var91, bcirc);
/* Temporary variable for sub-expression on source location: (177,5-177,10) */
int32_t __tac_var92 = (pow( (int32_t)2, (int32_t)10));
c = put_cons32_gate(acirc, __tac_var92);
/* Temporary variable for sub-expression on source location: (178,5-178,6) */
share* __tac_var93 = __tac_var79;
share* __tac_var93 = ycirc->PutA2YGate(b);
/* Temporary variable for sub-expression on source location: (178,5-178,11) */
share* __tac_var94 = logical_right_shift(ycirc, __tac_var79, (uint32_t)2);
share* __tac_var94 = logical_right_shift(ycirc, __tac_var93, (uint32_t)2);
c = acirc->PutY2AGate(__tac_var94, bcirc);
/* Temporary variable for sub-expression on source location: (179,5-179,16) */
uint32_t __tac_var95 = (1 && 0);
Expand All @@ -429,30 +429,30 @@ e = put_cons1_gate(ycirc, __tac_var96);
uint32_t __tac_var97 = (0 ^ 1);
e = put_cons1_gate(ycirc, __tac_var97);
/* Temporary variable for sub-expression on source location: (182,5-182,6) */
share* __tac_var98 = __tac_var83;
share* __tac_var98 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (182,7-182,8) */
share* __tac_var99 = __tac_var79;
e = ycirc->PutGTGate(__tac_var83, __tac_var79);
share* __tac_var99 = ycirc->PutA2YGate(b);
e = ycirc->PutGTGate(__tac_var98, __tac_var99);
/* Temporary variable for sub-expression on source location: (183,6-183,7) */
share* __tac_var100 = __tac_var83;
share* __tac_var100 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (183,9-183,10) */
share* __tac_var101 = __tac_var79;
e = unsignedequalsbl(__tac_var83, __tac_var79);
share* __tac_var101 = ycirc->PutA2YGate(b);
e = unsignedequalsbl(__tac_var100, __tac_var101);
/* Temporary variable for sub-expression on source location: (184,5-184,6) */
share* __tac_var102 = __tac_var83;
share* __tac_var102 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (184,8-184,9) */
share* __tac_var103 = __tac_var79;
e = unsignedgeqbl(__tac_var83, __tac_var79);
share* __tac_var103 = ycirc->PutA2YGate(b);
e = unsignedgeqbl(__tac_var102, __tac_var103);
/* Temporary variable for sub-expression on source location: (185,5-185,6) */
share* __tac_var104 = __tac_var83;
share* __tac_var104 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (185,8-185,9) */
share* __tac_var105 = __tac_var79;
e = unsignedleqbl(__tac_var83, __tac_var79);
share* __tac_var105 = ycirc->PutA2YGate(b);
e = unsignedleqbl(__tac_var104, __tac_var105);
/* Temporary variable for sub-expression on source location: (186,5-186,6) */
share* __tac_var106 = __tac_var83;
share* __tac_var106 = ycirc->PutA2YGate(a);
/* Temporary variable for sub-expression on source location: (186,7-186,8) */
share* __tac_var107 = __tac_var79;
e = unsignedltbl(__tac_var83, __tac_var79);
share* __tac_var107 = ycirc->PutA2YGate(b);
e = unsignedltbl(__tac_var106, __tac_var107);
party->ExecCircuit();
flush_output_queue(out_q, role, bitlen);
return 0;
Expand Down
46 changes: 23 additions & 23 deletions EzPC/EzPC/test_suite/precompiled_output/decl0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ share* __tac_var2 = put_cons32_gate(ycirc, __tac_var1);

share* signBitX = ycirc->PutANDGate(x, __tac_var2);
/* Temporary variable for sub-expression on source location: (26,28-26,33) */
int32_t __tac_var3 = __tac_var1;
int32_t __tac_var3 = ( (int32_t)1 << (int32_t)31);
/* Temporary variable for sub-expression on source location: (26,28-26,33) */
share* __tac_var4 = __tac_var2;
share* __tac_var4 = put_cons32_gate(ycirc, __tac_var3);

share* signBitY = ycirc->PutANDGate(y, __tac_var2);
share* signBitY = ycirc->PutANDGate(y, __tac_var4);
/* Temporary variable for sub-expression on source location: (27,10-27,29) */
share* __tac_var5 = ycirc->PutXORGate(signBitX, signBitY);
/* Temporary variable for sub-expression on source location: (27,33-27,35) */
share* __tac_var6 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (27,9-27,35) */
share* __tac_var7 = ycirc->PutGTGate(__tac_var5, __tac_var6);
/* Temporary variable for sub-expression on source location: (27,52-27,54) */
share* __tac_var8 = __tac_var6;
share* __tac_var8 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (27,41-27,54) */
share* __tac_var9 = ycirc->PutGTGate(signBitX, __tac_var6);
share* __tac_var9 = ycirc->PutGTGate(signBitX, __tac_var8);
/* Temporary variable for sub-expression on source location: (27,58-27,63) */
share* __tac_var10 = put_cons1_gate(ycirc, 0);
/* Temporary variable for sub-expression on source location: (27,66-27,70) */
Expand Down Expand Up @@ -110,15 +110,15 @@ share* __tac_var17 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (36,10-36,23) */
share* __tac_var18 = ycirc->PutGTGate(signBitX, __tac_var17);
/* Temporary variable for sub-expression on source location: (36,28-36,30) */
share* __tac_var19 = __tac_var17;
share* __tac_var19 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (36,35-36,37) */
share* __tac_var20 = __tac_var17;
share* __tac_var20 = put_cons32_gate(ycirc, (uint32_t)0);
/* Temporary variable for sub-expression on source location: (36,35-36,42) */
share* __tac_var21 = ycirc->PutSUBGate(__tac_var17, ux);
share* __tac_var21 = ycirc->PutSUBGate(__tac_var20, ux);
/* Temporary variable for sub-expression on source location: (36,34-36,48) */
share* __tac_var22 = arithmetic_right_shift(ycirc, __tac_var21, y);
/* Temporary variable for sub-expression on source location: (36,28-36,49) */
share* __tac_var23 = ycirc->PutSUBGate(__tac_var17, __tac_var22);
share* __tac_var23 = ycirc->PutSUBGate(__tac_var19, __tac_var22);
/* Temporary variable for sub-expression on source location: (36,54-36,61) */
share* __tac_var24 = arithmetic_right_shift(ycirc, ux, y);
/* Temporary variable for sub-expression on source location: (36,9-36,62) */
Expand Down Expand Up @@ -202,7 +202,7 @@ share* longDivision(share* x, share* y, uint32_t getQuotient){

share* q = put_cons32_gate(ycirc, (uint32_t)0);

share* divisor = q;
share* divisor = put_cons32_gate(ycirc, (uint32_t)0);

share* cond = put_cons1_gate(ycirc, 0);
for (uint32_t iter = (int32_t)0; iter < (int32_t)32; iter++){
Expand Down Expand Up @@ -256,19 +256,19 @@ share* __tac_var56 = put_cons32_gate(ycirc, (int32_t)0);

share* isXNeg = signedltbl(x, __tac_var56);
/* Temporary variable for sub-expression on source location: (100,23-100,24) */
share* __tac_var57 = __tac_var56;
share* __tac_var57 = put_cons32_gate(ycirc, (int32_t)0);

share* isYNeg = signedltbl(y, __tac_var56);
share* isYNeg = signedltbl(y, __tac_var57);
/* Temporary variable for sub-expression on source location: (101,26-101,27) */
share* __tac_var58 = __tac_var56;
share* __tac_var58 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (101,26-101,31) */
share* __tac_var59 = ycirc->PutSUBGate(__tac_var56, x);
share* __tac_var59 = ycirc->PutSUBGate(__tac_var58, x);

share* ux = ycirc->PutMUXGate(__tac_var59, x, isXNeg);
/* Temporary variable for sub-expression on source location: (102,26-102,27) */
share* __tac_var60 = __tac_var56;
share* __tac_var60 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (102,26-102,31) */
share* __tac_var61 = ycirc->PutSUBGate(__tac_var56, y);
share* __tac_var61 = ycirc->PutSUBGate(__tac_var60, y);

share* uy = ycirc->PutMUXGate(__tac_var61, y, isYNeg);

Expand Down Expand Up @@ -316,19 +316,19 @@ share* __tac_var68 = put_cons32_gate(ycirc, (int32_t)0);

share* isXNeg = signedltbl(x, __tac_var68);
/* Temporary variable for sub-expression on source location: (127,23-127,24) */
share* __tac_var69 = __tac_var68;
share* __tac_var69 = put_cons32_gate(ycirc, (int32_t)0);

share* isYNeg = signedltbl(y, __tac_var68);
share* isYNeg = signedltbl(y, __tac_var69);
/* Temporary variable for sub-expression on source location: (128,26-128,27) */
share* __tac_var70 = __tac_var68;
share* __tac_var70 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (128,26-128,31) */
share* __tac_var71 = ycirc->PutSUBGate(__tac_var68, x);
share* __tac_var71 = ycirc->PutSUBGate(__tac_var70, x);

share* ux = ycirc->PutMUXGate(__tac_var71, x, isXNeg);
/* Temporary variable for sub-expression on source location: (129,26-129,27) */
share* __tac_var72 = __tac_var68;
share* __tac_var72 = put_cons32_gate(ycirc, (int32_t)0);
/* Temporary variable for sub-expression on source location: (129,26-129,31) */
share* __tac_var73 = ycirc->PutSUBGate(__tac_var68, y);
share* __tac_var73 = ycirc->PutSUBGate(__tac_var72, y);

share* uy = ycirc->PutMUXGate(__tac_var73, y, isYNeg);

Expand Down Expand Up @@ -374,7 +374,7 @@ int32_t x4 = (int32_t)2;

share* x5 = put_cons32_gate(ycirc, (int32_t)2);

share* x6 = x5;
share* x6 = put_cons32_gate(ycirc, (int32_t)2);

share* x7 = put_cons1_gate(ycirc, 0);
party->ExecCircuit();
Expand Down
Loading

0 comments on commit 9b72396

Please sign in to comment.