Skip to content

Commit

Permalink
Rename test
Browse files Browse the repository at this point in the history
  • Loading branch information
math-fehr committed May 20, 2024
1 parent 32fc405 commit 7c8a78e
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ generate-pdl-matches = "xdsl_pdl.tools.generate_pdl_matches:main"
analyze-pdl-rewrite = "xdsl_pdl.tools.analyze_pdl_rewrite:main"
generate-table = "xdsl_pdl.tools.generate_table:main"
check-irdl-subset = "xdsl_pdl.tools.check_irdl_subset:main"
pdl-to-irdl-check = "xdsl_pdl.tools.pdl_to_irdl_check:main"
test-pdl-to-irdl-check = "xdsl_pdl.tools.test_pdl_to_irdl_check:main"

[build-system]
requires = ["setuptools>=43.0.0", "wheel"]
Expand Down
22 changes: 22 additions & 0 deletions tests/filecheck/pdl_to_irdl_check/add_commute.mlir
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: test-pdl-to-irdl-check %s | filecheck %s

irdl.dialect @builtin {
irdl.type @index

Expand Down Expand Up @@ -44,3 +46,23 @@ pdl.pattern @AddCommute : benefit(0) {
pdl.replace %op with %new_op
}
}

// CHECK: irdl_ext.check_subset {
// CHECK-NEXT: %0 = irdl.any
// CHECK-NEXT: %1 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %2 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %3 = irdl.any_of(%1, %2)
// CHECK-NEXT: irdl_ext.eq %3, %0
// CHECK-NEXT: irdl_ext.eq %3, %0
// CHECK-NEXT: irdl_ext.eq %3, %0
// CHECK-NEXT: irdl_ext.yield %0, %0, %0
// CHECK-NEXT: } of {
// CHECK-NEXT: %4 = irdl.any
// CHECK-NEXT: %5 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %6 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %7 = irdl.any_of(%5, %6)
// CHECK-NEXT: irdl_ext.eq %7, %4
// CHECK-NEXT: irdl_ext.eq %7, %4
// CHECK-NEXT: irdl_ext.eq %7, %4
// CHECK-NEXT: irdl_ext.yield %4, %4, %4
// CHECK-NEXT: }
56 changes: 56 additions & 0 deletions tests/filecheck/pdl_to_irdl_check/mulsi_extended_bug.mlir
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// RUN: test-pdl-to-irdl-check %s | filecheck %s

irdl.dialect @builtin {
irdl.type @index

Expand Down Expand Up @@ -76,3 +78,57 @@ pdl.pattern @MulSIExtendedRHSOne : benefit(0) {
pdl.replace %root with (%x, %extsi_val : !pdl.value, !pdl.value)
}
}


// CHECK: irdl_ext.check_subset {
// CHECK-NEXT: %0 = irdl.any
// CHECK-NEXT: %1 = irdl.any
// CHECK-NEXT: %2 = irdl.parametric @builtin::@integer_attr<%1, %0>
// CHECK-NEXT: %3 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %4 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %5 = irdl.any_of(%3, %4)
// CHECK-NEXT: irdl_ext.eq %5, %0
// CHECK-NEXT: %6 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %7 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %8 = irdl.any_of(%6, %7)
// CHECK-NEXT: irdl_ext.eq %8, %0
// CHECK-NEXT: irdl_ext.eq %8, %0
// CHECK-NEXT: irdl_ext.eq %8, %0
// CHECK-NEXT: irdl_ext.eq %8, %0
// CHECK-NEXT: irdl_ext.yield %0, %0, %0, %0
// CHECK-NEXT: } of {
// CHECK-NEXT: %9 = irdl.any
// CHECK-NEXT: %10 = irdl.any
// CHECK-NEXT: %11 = irdl.parametric @builtin::@integer_attr<%10, %9>
// CHECK-NEXT: %12 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %13 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %14 = irdl.any_of(%12, %13)
// CHECK-NEXT: irdl_ext.eq %14, %9
// CHECK-NEXT: %15 = irdl.any
// CHECK-NEXT: %16 = irdl.parametric @builtin::@integer_attr<%15, %9>
// CHECK-NEXT: %17 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %18 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %19 = irdl.any_of(%17, %18)
// CHECK-NEXT: irdl_ext.eq %19, %9
// CHECK-NEXT: %20 = irdl.is 2 : i64
// CHECK-NEXT: %21 = irdl.is i1
// CHECK-NEXT: %22 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %23 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %24 = irdl.any_of(%22, %23)
// CHECK-NEXT: %25 = irdl.is i1
// CHECK-NEXT: irdl_ext.eq %24, %9
// CHECK-NEXT: irdl_ext.eq %24, %9
// CHECK-NEXT: irdl_ext.eq %25, %21
// CHECK-NEXT: %26 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %27 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: irdl_ext.eq %26, %21
// CHECK-NEXT: irdl_ext.eq %27, %9
// CHECK-NEXT: %28 = irdl.base @builtin::@index {"base_ref" = @builtin::@index}
// CHECK-NEXT: %29 = irdl.base @builtin::@integer_type {"base_ref" = @builtin::@integer_type}
// CHECK-NEXT: %30 = irdl.any_of(%28, %29)
// CHECK-NEXT: irdl_ext.eq %30, %9
// CHECK-NEXT: irdl_ext.eq %30, %9
// CHECK-NEXT: irdl_ext.eq %30, %9
// CHECK-NEXT: irdl_ext.eq %30, %9
// CHECK-NEXT: irdl_ext.yield %9, %9, %9, %9
// CHECK-NEXT: }
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def main():
program = Parser(ctx, f.read()).parse_module()

PDLToIRDLPass().apply(ctx, program)
return

print(program)


if __name__ == "__main__":
Expand Down

0 comments on commit 7c8a78e

Please sign in to comment.