@@ -45,73 +45,3 @@ func.func @test_canonicalize_sub(%poly0 : !sub_ty, %poly1 : !sub_ty) -> !sub_ty
45
45
return %0 : !sub_ty
46
46
}
47
47
48
- // CHECK-LABEL: test_canonicalize_fold_add_through_ntt
49
- // CHECK: polynomial.add
50
- // CHECK-NOT: polynomial.ntt
51
- // CHECK-NOT: polynomial.intt
52
- func.func @test_canonicalize_fold_add_through_ntt (
53
- %poly0 : !ntt_poly_ty ,
54
- %poly1 : !ntt_poly_ty ) -> !ntt_poly_ty {
55
- %0 = polynomial.ntt %poly0 {root =#root } : !ntt_poly_ty -> !tensor_ty
56
- %1 = polynomial.ntt %poly1 {root =#root } : !ntt_poly_ty -> !tensor_ty
57
- %a_plus_b = arith.addi %0 , %1 : !tensor_ty
58
- %out = polynomial.intt %a_plus_b {root =#root } : !tensor_ty -> !ntt_poly_ty
59
- return %out : !ntt_poly_ty
60
- }
61
-
62
- // CHECK-LABEL: test_canonicalize_fold_add_through_intt
63
- // CHECK: arith.addi
64
- // CHECK-NOT: polynomial.intt
65
- // CHECK-NOT: polynomial.iintt
66
- func.func @test_canonicalize_fold_add_through_intt (
67
- %tensor0 : !tensor_ty ,
68
- %tensor1 : !tensor_ty ) -> !tensor_ty {
69
- %0 = polynomial.intt %tensor0 {root =#root } : !tensor_ty -> !ntt_poly_ty
70
- %1 = polynomial.intt %tensor1 {root =#root } : !tensor_ty -> !ntt_poly_ty
71
- %a_plus_b = polynomial.add %0 , %1 : !ntt_poly_ty
72
- %out = polynomial.ntt %a_plus_b {root =#root } : !ntt_poly_ty -> !tensor_ty
73
- return %out : !tensor_ty
74
- }
75
-
76
- // CHECK-LABEL: test_canonicalize_fold_sub_through_ntt
77
- // CHECK: polynomial.mul_scalar
78
- // CHECK: polynomial.add
79
- // CHECK-NOT: polynomial.ntt
80
- // CHECK-NOT: polynomial.intt
81
- func.func @test_canonicalize_fold_sub_through_ntt (
82
- %poly0 : !ntt_poly_ty ,
83
- %poly1 : !ntt_poly_ty ) -> !ntt_poly_ty {
84
- %0 = polynomial.ntt %poly0 {root =#root } : !ntt_poly_ty -> !tensor_ty
85
- %1 = polynomial.ntt %poly1 {root =#root } : !ntt_poly_ty -> !tensor_ty
86
- %a_plus_b = arith.subi %0 , %1 : !tensor_ty
87
- %out = polynomial.intt %a_plus_b {root =#root } : !tensor_ty -> !ntt_poly_ty
88
- return %out : !ntt_poly_ty
89
- }
90
-
91
- // CHECK-LABEL: test_canonicalize_fold_sub_through_intt
92
- // CHECK: arith.subi
93
- // CHECK-NOT: polynomial.intt
94
- // CHECK-NOT: polynomial.iintt
95
- func.func @test_canonicalize_fold_sub_through_intt (
96
- %tensor0 : !tensor_ty ,
97
- %tensor1 : !tensor_ty ) -> !tensor_ty {
98
- %0 = polynomial.intt %tensor0 {root =#root } : !tensor_ty -> !ntt_poly_ty
99
- %1 = polynomial.intt %tensor1 {root =#root } : !tensor_ty -> !ntt_poly_ty
100
- %a_plus_b = polynomial.sub %0 , %1 : !ntt_poly_ty
101
- %out = polynomial.ntt %a_plus_b {root =#root } : !ntt_poly_ty -> !tensor_ty
102
- return %out : !tensor_ty
103
- }
104
-
105
-
106
- // CHECK-LABEL: test_canonicalize_do_not_fold_different_roots
107
- // CHECK: arith.addi
108
- func.func @test_canonicalize_do_not_fold_different_roots (
109
- %poly0 : !ntt_poly_ty ,
110
- %poly1 : !ntt_poly_ty ) -> !ntt_poly_ty {
111
- %0 = polynomial.ntt %poly0 {root =#polynomial.primitive_root <value =31 :i32 , degree =8 :index >} : !ntt_poly_ty -> !tensor_ty
112
- %1 = polynomial.ntt %poly1 {root =#polynomial.primitive_root <value =33 :i32 , degree =8 :index >} : !ntt_poly_ty -> !tensor_ty
113
- %a_plus_b = arith.addi %0 , %1 : !tensor_ty
114
- %out = polynomial.intt %a_plus_b {root =#root } : !tensor_ty -> !ntt_poly_ty
115
- return %out : !ntt_poly_ty
116
- }
117
-
0 commit comments