Home | History | Annotate | Download | only in TableGen
      1 // RUN: llvm-tblgen %s | FileCheck %s
      2 // XFAIL: vg_leak
      3 
      4 class XD { bits<4> Prefix = 11; }
      5 // CHECK: Prefix = { 1, 1, 0, 0 };
      6 class XS { bits<4> Prefix = 12; }
      7 class VEX { bit hasVEX_4VPrefix = 1; }
      8 
      9 def xd : XD;
     10 
     11 class BaseI {
     12   bits<4> Prefix = 0;
     13   bit hasVEX_4VPrefix = 0;
     14 }
     15 
     16 class I<bits<4> op> : BaseI {
     17   bits<4> opcode = op;
     18   int val = !if(!eq(Prefix, xd.Prefix), 7, 21);
     19   int check = !if(hasVEX_4VPrefix, 0, 10);
     20 }
     21 
     22 multiclass R {
     23   def rr : I<4>;
     24 }
     25 
     26 multiclass M {
     27   def rm : I<2>;
     28 }
     29 
     30 multiclass Y {
     31   defm SS : R, M, XD;
     32 // CHECK: Prefix = { 1, 1, 0, 0 };
     33 // CHECK: Prefix = { 1, 1, 0, 0 };
     34   defm SD : R, M, XS;
     35 }
     36 
     37 // CHECK: int check = 0;
     38 defm Instr : Y, VEX;
     39 
     40 
     41 // Anonymous defm.
     42 
     43 multiclass SomeAnonymous<int x> {
     44   def rm;
     45   def mr;
     46 }
     47 
     48 // These multiclasses shouldn't conflict.
     49 defm : SomeAnonymous<1>;
     50 defm : SomeAnonymous<2>;