[InstCombine] Signed saturation patterns
[llvm-core.git] / test / TableGen / MultiClass-defm.td
blobd0a83e716ad30afc2ce5c4250b53b911f7babefc
1 // RUN: llvm-tblgen %s | FileCheck %s
2 // XFAIL: vg_leak
4 class A {}
5 class B<A a> {
6   A ba = a;
9 multiclass M0<string s> {
10   def _m0 : B<!cast<A>(s)>;
12   // Uncomment to test that !cast will eventually fail if the record it refers
13   // to does not exist by the time we instantiate this record from the top
14   // level.
15   //def _m1 : B<!cast<A>(s#"X")>;
18 multiclass M1<string s> {
19   def _r1 : A;
20   // It would be nice if we could refer to _r1's name without having to pass it
21   // explicitly via 's'.
22   defm _m1: M0<s # "_r1">;
25 multiclass M2 {
26   def _x : A {
27     string n = NAME;
28   }
30   def _y : B<!cast<A>(NAME # "_x")>;
32   // This used to throw an error during multiclass parsing as NAME was not
33   // recognized when parsing the template arguments.
34   defm NAME: M1<NAME>;
36 defm d0: M2;
37 // CHECK-LABEL: def d0_m1_m0
38 // CHECK: A ba = d0_r1;
40 // CHECK-LABEL: def d0_x {
41 // CHECK: string n = "d0";
43 // CHECK-LABEL: def d0_y {
44 // CHECK: A ba = d0_x;
46 // This always works, because d1_r1 is instantiated before d1_m1 which would
47 // attempt to !cast to it.
48 defm d1: M1<"d1">;
49 // CHECK-LABEL: def d1_m1_m0
50 // CHECK: A ba = d1_r1;