1 // RUN: llvm-tblgen %s | FileCheck %s
4 // Tests evaluation of !foreach operator.
13 dag r1 = !foreach(tmp, d, !subst(d1, d0, !subst(d2, d0,
15 !subst(d4, d0, tmp)))));
17 list<dag> r2 = !foreach(tmp2, dl,
18 !foreach(tmp, tmp2, !subst(d1, d0,
21 !subst(d4, d0, tmp))))));
25 // CHECK: dag r1 = (d0 d0, d0, d0, d0);
26 // CHECK: list<dag> r2 = [(d0 d0, d0, d0, d0)];
27 def d : D <(d0 d1, d2, d3, d4)>;
29 class I<list<int> i> {
30 list<int> r1 = !foreach(tmp, i, !add(3, !add(4, tmp)));
32 list<list<int>> li = [i];
33 list<list<int>> r2 = !foreach(tmp2, li,
34 !foreach(tmp, tmp2, !add(3, !add(4, tmp))));
38 // CHECK: list<int> r1 = [8, 9, 10];
39 // CHECK: list<list<int>> r2 = [{{[[]}}8, 9, 10]];
42 class J0<list<dag> pattern> {
43 list<dag> Pattern = pattern;
46 : J0<[!foreach(tmp, pattern, !subst(d1, d0,
49 !subst(d4, d0, tmp)))))]>;
50 class J2<list<dag> patterns>
51 : J0<!foreach(t0, patterns,
52 !foreach(t1, t0, !subst(d1, d0,
55 !subst(d4, d0, t1))))))>;
56 // CHECK-LABEL: def j1
57 // CHECK: list<dag> Pattern = [(d0 d0:$dst, (d0 d0:$src1))];
58 def j1 : J1< (d1 d2:$dst, (d3 d4:$src1))>;
59 // CHECK-LABEL: def j2
60 // CHECK: list<dag> Pattern = [(d0 d0:$dst, (d0 d0:$src1))];
61 def j2 : J2< [(d1 d2:$dst, (d3 d4:$src1))]>;