[TableGen] Allow shift operators to take bits<n>
[oota-llvm.git] / test / TableGen / math.td
1 // RUN: llvm-tblgen %s | FileCheck %s
2 // XFAIL: vg_leak
3
4 def shifts {
5     bits<2> b = 0b10;
6     int i = 2;
7     int shifted_b = !shl(b, 2);
8     int shifted_i = !shl(i, 2);
9 }
10 // CHECK: def shifts
11 // CHECK: shifted_b = 8
12 // CHECK: shifted_i = 8
13
14 class Int<int value> {
15   int Value = value;
16 }
17
18 def v1024   : Int<1024>;
19 // CHECK: def v1024
20 // CHECK: Value = 1024
21
22 def v1025   : Int<!add(v1024.Value, 1)>;
23 // CHECK: def v1025
24 // CHECK: Value = 1025
25
26 def v2048   : Int<!add(v1024.Value, v1024.Value)>;
27 // CHECK: def v2048
28 // CHECK: Value = 2048
29