From 7c8a78e75a0f11664ddd5931ffa6a04c7e2e1395 Mon Sep 17 00:00:00 2001 From: Mathieu Fehr Date: Mon, 20 May 2024 14:27:37 +0100 Subject: [PATCH] Rename test --- pyproject.toml | 2 +- .../pdl_to_irdl_check/add_commute.mlir | 22 ++++++++ .../pdl_to_irdl_check/mulsi_extended_bug.mlir | 56 +++++++++++++++++++ ...rdl_check.py => test_pdl_to_irdl_check.py} | 3 +- 4 files changed, 81 insertions(+), 2 deletions(-) rename xdsl_pdl/tools/{pdl_to_irdl_check.py => test_pdl_to_irdl_check.py} (98%) diff --git a/pyproject.toml b/pyproject.toml index 99c73d9..777751b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/tests/filecheck/pdl_to_irdl_check/add_commute.mlir b/tests/filecheck/pdl_to_irdl_check/add_commute.mlir index a52d9e8..8723e4c 100644 --- a/tests/filecheck/pdl_to_irdl_check/add_commute.mlir +++ b/tests/filecheck/pdl_to_irdl_check/add_commute.mlir @@ -1,3 +1,5 @@ +// RUN: test-pdl-to-irdl-check %s | filecheck %s + irdl.dialect @builtin { irdl.type @index @@ -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: } diff --git a/tests/filecheck/pdl_to_irdl_check/mulsi_extended_bug.mlir b/tests/filecheck/pdl_to_irdl_check/mulsi_extended_bug.mlir index 9686d77..1867528 100644 --- a/tests/filecheck/pdl_to_irdl_check/mulsi_extended_bug.mlir +++ b/tests/filecheck/pdl_to_irdl_check/mulsi_extended_bug.mlir @@ -1,3 +1,5 @@ +// RUN: test-pdl-to-irdl-check %s | filecheck %s + irdl.dialect @builtin { irdl.type @index @@ -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: } diff --git a/xdsl_pdl/tools/pdl_to_irdl_check.py b/xdsl_pdl/tools/test_pdl_to_irdl_check.py similarity index 98% rename from xdsl_pdl/tools/pdl_to_irdl_check.py rename to xdsl_pdl/tools/test_pdl_to_irdl_check.py index f3c0f61..8c60d24 100644 --- a/xdsl_pdl/tools/pdl_to_irdl_check.py +++ b/xdsl_pdl/tools/test_pdl_to_irdl_check.py @@ -46,7 +46,8 @@ def main(): program = Parser(ctx, f.read()).parse_module() PDLToIRDLPass().apply(ctx, program) - return + + print(program) if __name__ == "__main__":