llvm/test/CodeGen/X86/break-avx-dep.ll: Relax an expression to be matched to also...
[oota-llvm.git] / test / TableGen / 2010-03-24-PrematureDefaults.td
1 // RUN: llvm-tblgen %s | FileCheck %s
2
3 class A<int k, bits<2> x = 1> {
4   int K = k;
5   bits<2> Bits = x;
6 }
7
8 // CHECK: def a1
9 // CHECK: Bits = { 0, 1 }
10 def a1 : A<12>;
11
12 // CHECK: def a2
13 // CHECK: Bits = { 1, 0 }
14 def a2 : A<13, 2>;
15
16 // Here was the bug: X.Bits would get resolved to the default a1.Bits while
17 // resolving the first template argument. When the second template argument
18 // was processed, X would be set correctly, but Bits retained the default
19 // value.
20 class B<int k, A x = a1> {
21   A X = x;
22   bits<2> Bits = X.Bits;
23 }
24
25 // CHECK: def b1
26 // CHECK: Bits = { 0, 1 }
27 def b1 : B<27>;
28
29 // CHECK: def b2
30 // CHECK: Bits = { 1, 0 }
31 def b2 : B<28, a2>;
32
33 class C<A x = a1> {
34   bits<2> Bits = x.Bits;
35 }
36
37 // CHECK: def c1
38 // CHECK: Bits = { 0, 1 }
39 def c1 : C;
40
41 // CHECK: def c2
42 // CHECK: Bits = { 1, 0 }
43 def c2 : C<a2>;