Skip to content

Commit 7ee65a5

Browse files
committed
add test for paulirot
1 parent 0e183fe commit 7ee65a5

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

frontend/test/lit/GraphDecomposition/TestQPD.mlir renamed to frontend/test/lit/GraphDecomposition/QPD/S.mlir

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// Test that graph-decomposition is able to use compile-time python decompositions
16-
1715
// RUN: catalyst --tool=opt --pass-pipeline='builtin.module(graph-decomposition{gate-set=PhaseShift=1.0})' %s | FileCheck %s
1816

19-
20-
func.func @circuit() -> !quantum.bit {
17+
func.func @S() -> !quantum.bit {
2118
%reg = quantum.alloc(1): !quantum.reg
2219
%0 = quantum.extract %reg[0] : !quantum.reg -> !quantum.bit
2320

@@ -26,5 +23,3 @@ func.func @circuit() -> !quantum.bit {
2623
%out_qubits = quantum.custom "S"() %0 : !quantum.bit
2724
return %out_qubits : !quantum.bit
2825
}
29-
30-
// TODO: add a tests for more complicated operators once they're migrated
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2026 Xanadu Quantum Technologies Inc.
2+
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// RUN: catalyst --tool=opt --pass-pipeline='builtin.module(graph-decomposition{gate-set=Hadamard=1.0,MultiRZ=1.0})' %s | FileCheck %s
16+
17+
func.func @paulirot(%angle: f64, %q1: !quantum.bit, %q2: !quantum.bit) {
18+
// CHECK-NOT: quantum.paulirot
19+
// CHECK: Hadamard
20+
// CHECK: quantum.multirz
21+
// CHECK: Hadamard
22+
%qout:2 = quantum.paulirot ["Z", "X"](%angle) %q1, %q2 : !quantum.bit, !quantum.bit
23+
return
24+
}

0 commit comments

Comments
 (0)