Created
November 18, 2023 05:48
-
-
Save j2kun/146b190ba53ed6bf5aa2afa63f39c6c8 to your computer and use it in GitHub Desktop.
bazel run //tools:heir-opt -- --pass-pipeline='builtin.module(func.func(secret.generic(yosys-optimizer)))' $PWD/tests/yosys_optimizer/add_one_generic.mlir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module { | |
func.func @add_one(%arg0: !secret.secret<i8>) -> !secret.secret<i8> { | |
%c1_i8 = arith.constant 1 : i8 | |
%0 = secret.generic ins(%arg0, %c1_i8 : !secret.secret<i8>, i8) { | |
^bb0(%arg1: i8, %arg2: i8): | |
%1 = comb.extract %arg1 from 0 : (i8) -> i1 | |
%2 = comb.extract %arg2 from 0 : (i8) -> i1 | |
%false = arith.constant false | |
%3 = comb.truth_table %1, %2, %false -> 8 : ui8 | |
%4 = comb.extract %arg1 from 1 : (i8) -> i1 | |
%5 = comb.extract %arg2 from 1 : (i8) -> i1 | |
%6 = comb.truth_table %3, %4, %5 -> 150 : ui8 | |
%7 = comb.truth_table %3, %4, %5 -> 23 : ui8 | |
%8 = comb.extract %arg1 from 2 : (i8) -> i1 | |
%9 = comb.extract %arg2 from 2 : (i8) -> i1 | |
%10 = comb.truth_table %7, %8, %9 -> 43 : ui8 | |
%11 = comb.extract %arg1 from 3 : (i8) -> i1 | |
%12 = comb.extract %arg2 from 3 : (i8) -> i1 | |
%13 = comb.truth_table %10, %11, %12 -> 43 : ui8 | |
%14 = comb.extract %arg1 from 4 : (i8) -> i1 | |
%15 = comb.extract %arg2 from 4 : (i8) -> i1 | |
%16 = comb.truth_table %13, %14, %15 -> 43 : ui8 | |
%17 = comb.extract %arg1 from 5 : (i8) -> i1 | |
%18 = comb.extract %arg2 from 5 : (i8) -> i1 | |
%19 = comb.truth_table %16, %17, %18 -> 43 : ui8 | |
%20 = comb.extract %arg1 from 6 : (i8) -> i1 | |
%21 = comb.extract %arg2 from 6 : (i8) -> i1 | |
%22 = comb.truth_table %19, %20, %21 -> 105 : ui8 | |
%23 = comb.truth_table %19, %20, %21 -> 43 : ui8 | |
%24 = comb.extract %arg1 from 7 : (i8) -> i1 | |
%25 = comb.extract %arg2 from 7 : (i8) -> i1 | |
%26 = comb.truth_table %23, %24, %25 -> 105 : ui8 | |
%27 = comb.truth_table %1, %2, %false -> 6 : ui8 | |
%28 = comb.truth_table %7, %8, %9 -> 105 : ui8 | |
%29 = comb.truth_table %10, %11, %12 -> 105 : ui8 | |
%30 = comb.truth_table %13, %14, %15 -> 105 : ui8 | |
%31 = comb.truth_table %16, %17, %18 -> 105 : ui8 | |
%32 = comb.concat %26, %22, %31, %30, %29, %28, %6, %27 : i1, i1, i1, i1, i1, i1, i1, i1 | |
secret.yield %32 : i8 | |
} -> !secret.secret<i8> | |
return %0 : !secret.secret<i8> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment