Jakob Stoklund Olesen | a2da788 | 2012-03-07 16:39:35 +0000 | [diff] [blame] | 1 | // RUN: llvm-tblgen %s | FileCheck %s |
NAKAMURA Takumi | a22657f | 2013-11-10 14:26:08 +0000 | [diff] [blame] | 2 | // XFAIL: vg_leak |
Jakob Stoklund Olesen | a2da788 | 2012-03-07 16:39:35 +0000 | [diff] [blame] | 3 | |
| 4 | class Type<string name, int length, int width> { |
| 5 | string Name = name; |
| 6 | int Length = length; |
| 7 | int Width = width; |
| 8 | } |
| 9 | |
| 10 | multiclass OT1<string ss, int l, int w> { |
| 11 | def _#NAME# : Type<ss, l, w>; |
| 12 | } |
| 13 | multiclass OT2<string ss, int w> { |
| 14 | defm v1#NAME# : OT1<!strconcat( "v1", ss), 1, w>; |
| 15 | defm v2#NAME# : OT1<!strconcat( "v2", ss), 2, w>; |
| 16 | defm v3#NAME# : OT1<!strconcat( "v3", ss), 3, w>; |
| 17 | defm v4#NAME# : OT1<!strconcat( "v4", ss), 4, w>; |
| 18 | defm v8#NAME# : OT1<!strconcat( "v8", ss), 8, w>; |
| 19 | defm v16#NAME# : OT1<!strconcat("v16", ss), 16, w>; |
| 20 | } |
| 21 | |
| 22 | defm i8 : OT2<"i8", 8>; |
| 23 | |
Craig Topper | b3379c3 | 2016-01-13 07:53:11 +0000 | [diff] [blame] | 24 | multiclass OT3<string ss, int w> { |
| 25 | defm v32#NAME : OT1<!strconcat("v32", ss), 32, w>; |
| 26 | } |
| 27 | |
| 28 | multiclass OT4<string ss, int w> { |
| 29 | defm v64#NAME : OT1<!strconcat("v64", ss), 64, w>; |
| 30 | } |
| 31 | |
| 32 | multiclass OT5<string ss, int w> { |
| 33 | defm NAME : OT3<ss, w>; |
| 34 | defm NAME : OT4<ss, w>; |
| 35 | } |
| 36 | |
| 37 | defm i16 : OT5<"i16", 16>; |
| 38 | |
Jakob Stoklund Olesen | a2da788 | 2012-03-07 16:39:35 +0000 | [diff] [blame] | 39 | // CHECK: _v16i8 |
| 40 | // CHECK: Length = 16 |
| 41 | // CHECK: Width = 8 |
| 42 | |
| 43 | // CHECK: _v1i8 |
| 44 | // CHECK: Length = 1 |
| 45 | // CHECK: Width = 8 |
| 46 | |
| 47 | // CHECK: _v2i8 |
| 48 | // CHECK: Length = 2 |
| 49 | // CHECK: Width = 8 |
| 50 | |
Craig Topper | b3379c3 | 2016-01-13 07:53:11 +0000 | [diff] [blame] | 51 | // CHECK: def _v32i16 |
| 52 | // CHECK: Length = 32 |
| 53 | // CHECK: Width = 16 |
| 54 | |
Jakob Stoklund Olesen | a2da788 | 2012-03-07 16:39:35 +0000 | [diff] [blame] | 55 | // CHECK: _v3i8 |
| 56 | // CHECK: Length = 3 |
| 57 | // CHECK: Width = 8 |
| 58 | |
| 59 | // CHECK: _v4i8 |
| 60 | // CHECK: Length = 4 |
| 61 | // CHECK: Width = 8 |
| 62 | |
Craig Topper | b3379c3 | 2016-01-13 07:53:11 +0000 | [diff] [blame] | 63 | // CHECK: _v64i16 |
| 64 | // CHECK: Length = 64 |
| 65 | // CHECK: Width = 16 |
| 66 | |
Jakob Stoklund Olesen | a2da788 | 2012-03-07 16:39:35 +0000 | [diff] [blame] | 67 | // CHECK: _v8i8 |
| 68 | // CHECK: Length = 8 |
| 69 | // CHECK: Width = 8 |
Craig Topper | b3379c3 | 2016-01-13 07:53:11 +0000 | [diff] [blame] | 70 | |