Peter Collingbourne | 7f7f2e9 | 2011-10-06 13:39:59 +0000 | [diff] [blame] | 1 | // RUN: llvm-tblgen %s | FileCheck %s |
NAKAMURA Takumi | 5c0be2f | 2013-11-10 14:26:08 +0000 | [diff] [blame] | 2 | // XFAIL: vg_leak |
Bruno Cardoso Lopes | 23f8321 | 2010-06-18 19:53:41 +0000 | [diff] [blame] | 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); |
Bruno Cardoso Lopes | dc883cf | 2010-06-22 20:30:50 +0000 | [diff] [blame] | 19 | int check = !if(hasVEX_4VPrefix, 0, 10); |
Bruno Cardoso Lopes | 23f8321 | 2010-06-18 19:53:41 +0000 | [diff] [blame] | 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 | |
Bruno Cardoso Lopes | dc883cf | 2010-06-22 20:30:50 +0000 | [diff] [blame] | 37 | // CHECK: int check = 0; |
Bruno Cardoso Lopes | 23f8321 | 2010-06-18 19:53:41 +0000 | [diff] [blame] | 38 | defm Instr : Y, VEX; |
Chris Lattner | 7538ed8 | 2010-10-05 22:51:56 +0000 | [diff] [blame] | 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>; |