@@ -1503,40 +1503,87 @@ func.func @test_while_tensor_list_size(%arg0: tensor<1x1x1x1x1x1x1xf32>, %arg1:
15031503
15041504// -----
15051505
1506- func.func @test_cond_if_max_nested_depth (%arg0: tensor <f32 >, %arg1: tensor <f32 >, %arg2: tensor <i1 >, %arg3: tensor <i1 >) -> tensor <f32 > {
1507- %0 = tosa.cond_if %arg2 -> (tensor <f32 >) {
1508- %1 = tosa.cond_if %arg3 -> (tensor <f32 >) {
1509- %2 = tosa.cond_if %arg2 -> (tensor <f32 >) {
1510- %3 = tosa.cond_if %arg3 -> (tensor <f32 >) {
1511- %4 = tosa.cond_if %arg2 -> (tensor <f32 >) {
1506+ func.func @test_cond_if_max_nested_depth (%arg0: tensor <f32 >, %arg1: tensor <f32 >, %arg2: tensor <i1 >, %arg3: tensor <i1 >) -> tensor <f32 > {
1507+ %0 = " tosa.cond_if" (%arg2 , %arg0 , %arg1 ) ({
1508+
1509+ // COM: then graph of IF-1
1510+ ^bb1 (%a1: tensor <f32 >, %b1: tensor <f32 >):
1511+ %cond1 = tosa.equal %a1 , %b1 : (tensor <f32 >, tensor <f32 >) -> tensor <i1 >
1512+ %1 = " tosa.cond_if" (%cond1 , %a1 , %b1 ) ({
1513+
1514+ // COM: then graph of IF-2
1515+ ^bb2 (%a2: tensor <f32 >, %b2: tensor <f32 >):
1516+ %cond2 = tosa.equal %a2 , %b2 : (tensor <f32 >, tensor <f32 >) -> tensor <i1 >
1517+ %2 = " tosa.cond_if" (%cond2 , %a2 , %b2 ) ({
1518+
1519+ // COM: then graph of IF-3
1520+ ^bb3 (%a3: tensor <f32 >, %b3: tensor <f32 >):
1521+ %cond3 = tosa.equal %a3 , %b3 : (tensor <f32 >, tensor <f32 >) -> tensor <i1 >
1522+ %3 = " tosa.cond_if" (%cond3 , %a3 , %b3 ) ({
1523+
1524+ // COM: then graph of IF-4
1525+ ^bb4 (%a4: tensor <f32 >, %b4: tensor <f32 >):
1526+ %cond4 = tosa.equal %a4 , %b4 : (tensor <f32 >, tensor <f32 >) -> tensor <i1 >
1527+ %4 = " tosa.cond_if" (%cond4 , %a4 , %b4 ) ({
1528+
1529+ // COM: then graph of IF-5
1530+ ^bb5 (%a5: tensor <f32 >, %b5: tensor <f32 >):
1531+ %cond5 = tosa.equal %a5 , %b5 : (tensor <f32 >, tensor <f32 >) -> tensor <i1 >
15121532 // expected-error@+1 {{'tosa.cond_if' op failed level check: 6 >= MAX_NESTING}}
1513- %5 = tosa.cond_if %arg3 -> (tensor <f32 >) {
1533+ %5 = " tosa.cond_if" (%cond5 , %a5 , %b5 ) ({
1534+
1535+ // COM: then graph of IF-6
1536+ ^bb6 (%a6: tensor <f32 >, %b6: tensor <f32 >):
15141537 %res = tosa.sub %arg0 , %arg1 : (tensor <f32 >, tensor <f32 >) -> tensor <f32 >
15151538 tosa.yield %res : tensor <f32 >
1516- } else {
1539+ }, {
1540+
1541+ // COM: else graph of IF-6
1542+ ^bb6 (%a6: tensor <f32 >, %b6: tensor <f32 >):
15171543 tosa.yield %arg0 : tensor <f32 >
1518- }
1544+ }) : (tensor <i1 >, tensor <f32 >, tensor <f32 >) -> tensor <f32 >
1545+
15191546 tosa.yield %5 : tensor <f32 >
1520- } else {
1547+ }, {
1548+
1549+ // COM: else graph of IF-5
1550+ ^bb5 (%a5: tensor <f32 >, %b5: tensor <f32 >):
1551+ tosa.yield %arg0 : tensor <f32 >
1552+ }) : (tensor <i1 >, tensor <f32 >, tensor <f32 >) -> tensor <f32 >
1553+
1554+ tosa.yield %4 : tensor <f32 >
1555+ }, {
1556+
1557+ // COM: else graph of IF-4
1558+ ^bb4 (%a4: tensor <f32 >, %b4: tensor <f32 >):
15211559 tosa.yield %arg0 : tensor <f32 >
1522- }
1523- tosa.yield %4 : tensor < f32 >
1524- } else {
1525- tosa.yield %arg0 : tensor < f32 >
1526- }
1527- tosa.yield %3 : tensor < f32 >
1528- } else {
1560+ }) : ( tensor < i1 >, tensor < f32 >, tensor < f32 >) -> tensor < f32 >
1561+
1562+ tosa.yield %3 : tensor < f32 >
1563+ }, {
1564+
1565+ // COM: else graph of IF-3
1566+ ^bb3 ( %a3: tensor < f32 >, %b3: tensor < f32 >):
15291567 tosa.yield %arg0 : tensor <f32 >
1530- }
1531- tosa.yield %2 : tensor <f32 >
1532- } else {
1533- tosa.yield %arg0 : tensor <f32 >
1534- }
1535- tosa.yield %1 : tensor <f32 >
1536- } else {
1537- %res = tosa.sub %arg0 , %arg1 : (tensor <f32 >, tensor <f32 >) -> tensor <f32 >
1568+ }) : (tensor <i1 >, tensor <f32 >, tensor <f32 >) -> tensor <f32 >
1569+
1570+ tosa.yield %2 : tensor <f32 >
1571+ }, {
1572+
1573+ // COM: else graph of IF-2
1574+ ^bb2 (%a2: tensor <f32 >, %b2: tensor <f32 >):
1575+ tosa.yield %arg0 : tensor <f32 >
1576+ }) : (tensor <i1 >, tensor <f32 >, tensor <f32 >) -> tensor <f32 >
1577+
1578+ tosa.yield %1 : tensor <f32 >
1579+ }, {
1580+
1581+ // COM: else graph of IF-1
1582+ ^bb1 (%a1: tensor <f32 >, %b1: tensor <f32 >):
1583+ %res = tosa.sub %a1 , %b1 : (tensor <f32 >, tensor <f32 >) -> tensor <f32 >
15381584 tosa.yield %res : tensor <f32 >
1539- }
1585+ }) : (tensor <i1 >, tensor <f32 >, tensor <f32 >) -> tensor <f32 >
1586+
15401587 return %0 : tensor <f32 >
15411588}
15421589
0 commit comments