|
| 1 | +// RUN: heir-opt --operation-balancer %s | FileCheck %s |
| 2 | + |
| 3 | +// CHECK: func.func @main(%arg0: !secret.secret<i32>, %arg1: !secret.secret<i32>, %arg2: !secret.secret<i32>, %arg3: !secret.secret<i32>, %arg4: !secret.secret<i32>) -> !secret.secret<i32> { |
| 4 | +// CHECK-NEXT: %0 = secret.generic(%arg0: !secret.secret<i32>, %arg1: !secret.secret<i32>, %arg2: !secret.secret<i32>, %arg3: !secret.secret<i32>, %arg4: !secret.secret<i32>) { |
| 5 | +// CHECK-NEXT: ^body(%input0: i32, %input1: i32, %input2: i32, %input3: i32, %input4: i32): |
| 6 | +// CHECK-NEXT: %1 = arith.addi %input0, %input1 : i32 |
| 7 | +// CHECK-NEXT: %2 = arith.addi %input2, %input3 : i32 |
| 8 | +// CHECK-NEXT: %3 = arith.addi %2, %input4 : i32 |
| 9 | +// CHECK-NEXT: %4 = arith.addi %1, %3 : i32 |
| 10 | +// CHECK-NEXT: secret.yield %4 : i32 |
| 11 | +// CHECK-NEXT: } -> !secret.secret<i32> |
| 12 | +// CHECK-NEXT: return %0 : !secret.secret<i32> |
| 13 | +// CHECK-NEXT: } |
| 14 | +func.func @main(%arg0 : !secret.secret<i32>, %arg1 : !secret.secret<i32>, %arg2 : !secret.secret<i32>, %arg3 : !secret.secret<i32>, %arg4 : !secret.secret<i32>) -> !secret.secret<i32> { |
| 15 | + %0 = secret.generic(%arg0 : !secret.secret<i32>, %arg1 : !secret.secret<i32>, %arg2 : !secret.secret<i32>, %arg3 : !secret.secret<i32>, %arg4 : !secret.secret<i32>) { |
| 16 | + ^body(%input0 : i32, %input1 : i32, %input2 : i32, %input3 : i32, %input4 : i32): |
| 17 | + %a = arith.addi %input0, %input1 : i32 |
| 18 | + %b = arith.addi %a, %input2 : i32 |
| 19 | + %c = arith.addi %b, %input3 : i32 |
| 20 | + %d = arith.addi %c, %input4 : i32 |
| 21 | + secret.yield %d : i32 |
| 22 | + } -> !secret.secret<i32> |
| 23 | + return %0 : !secret.secret<i32> |
| 24 | +} |
0 commit comments