@@ -1483,6 +1483,60 @@ module attributes {transform.with_named_sequence} {
1483
1483
1484
1484
// -----
1485
1485
1486
+ // expected-remark @below {{addi operand}}
1487
+ // expected-note @below {{value handle points to a block argument #0}}
1488
+ func.func @get_operand_of_op (%arg0: index , %arg1: index ) -> index {
1489
+ %r = arith.addi %arg0 , %arg1 : index
1490
+ return %r : index
1491
+ }
1492
+
1493
+ module attributes {transform.with_named_sequence } {
1494
+ transform.named_sequence @__transform_main (%arg1: !transform.any_op ) {
1495
+ %addi = transform.structured.match ops {[" arith.addi" ]} in %arg1 : (!transform.any_op ) -> !transform.any_op
1496
+ %operand = transform.get_operand %addi [0 ] : (!transform.any_op ) -> !transform.any_value
1497
+ transform.debug.emit_remark_at %operand , " addi operand" : !transform.any_value
1498
+ transform.yield
1499
+ }
1500
+ }
1501
+
1502
+ // -----
1503
+
1504
+ func.func @get_out_of_bounds_operand_of_op (%arg0: index , %arg1: index ) -> index {
1505
+ // expected-note @below {{target op}}
1506
+ %r = arith.addi %arg0 , %arg1 : index
1507
+ return %r : index
1508
+ }
1509
+
1510
+ module attributes {transform.with_named_sequence } {
1511
+ transform.named_sequence @__transform_main (%arg1: !transform.any_op ) {
1512
+ %addi = transform.structured.match ops {[" arith.addi" ]} in %arg1 : (!transform.any_op ) -> !transform.any_op
1513
+ // expected-error @below {{targeted op does not have enough operands}}
1514
+ %operand = transform.get_operand %addi [2 ] : (!transform.any_op ) -> !transform.any_value
1515
+ transform.debug.emit_remark_at %operand , " addi operand" : !transform.any_value
1516
+ transform.yield
1517
+ }
1518
+ }
1519
+
1520
+ // -----
1521
+
1522
+ func.func @get_multiple_operands_of_op (%arg0: index , %arg1: index ) -> index {
1523
+ %r = arith.addi %arg0 , %arg1 : index
1524
+ return %r : index
1525
+ }
1526
+
1527
+ module attributes {transform.with_named_sequence } {
1528
+ transform.named_sequence @__transform_main (%arg1: !transform.any_op ) {
1529
+ %addui = transform.structured.match ops {[" arith.addi" ]} in %arg1 : (!transform.any_op ) -> !transform.any_op
1530
+ %operands = transform.get_operand %addui : (!transform.any_op ) -> !transform.any_value
1531
+ %p = transform.num_associations %operands : (!transform.any_value ) -> !transform.param <i64 >
1532
+ // expected-remark @below {{2}}
1533
+ transform.debug.emit_param_as_remark %p : !transform.param <i64 >
1534
+ transform.yield
1535
+ }
1536
+ }
1537
+
1538
+ // -----
1539
+
1486
1540
func.func @get_result_of_op (%arg0: index , %arg1: index ) -> index {
1487
1541
// expected-remark @below {{addi result}}
1488
1542
// expected-note @below {{value handle points to an op result #0}}
@@ -1537,6 +1591,25 @@ module attributes {transform.with_named_sequence} {
1537
1591
1538
1592
// -----
1539
1593
1594
+ func.func @get_multiple_result_of_op (%arg0: index , %arg1: index ) -> (index , i1 ) {
1595
+ // expected-remark @below {{matched bool}}
1596
+ %r , %b = arith.addui_extended %arg0 , %arg1 : index , i1
1597
+ return %r , %b : index , i1
1598
+ }
1599
+
1600
+ module attributes {transform.with_named_sequence } {
1601
+ transform.named_sequence @__transform_main (%arg1: !transform.any_op ) {
1602
+ %addui = transform.structured.match ops {[" arith.addui_extended" ]} in %arg1 : (!transform.any_op ) -> !transform.any_op
1603
+ %results = transform.get_result %addui : (!transform.any_op ) -> !transform.any_value
1604
+ %adds = transform.get_defining_op %results : (!transform.any_value ) -> !transform.any_op
1605
+ %_ , %add_again = transform.split_handle %adds : (!transform.any_op ) -> (!transform.any_op , !transform.any_op )
1606
+ transform.debug.emit_remark_at %add_again , " matched bool" : !transform.any_op
1607
+ transform.yield
1608
+ }
1609
+ }
1610
+
1611
+ // -----
1612
+
1540
1613
// expected-note @below {{target value}}
1541
1614
func.func @get_result_of_op_bbarg (%arg0: index , %arg1: index ) -> index {
1542
1615
%r = arith.addi %arg0 , %arg1 : index
0 commit comments