2013-01-25 22:49:08 +08:00
|
|
|
// RUN: llvm-tblgen %s | FileCheck %s
|
2013-11-10 22:26:08 +08:00
|
|
|
// XFAIL: vg_leak
|
2013-01-25 22:49:08 +08:00
|
|
|
|
2014-07-18 01:04:27 +08:00
|
|
|
def shifts {
|
|
|
|
bits<2> b = 0b10;
|
|
|
|
int i = 2;
|
|
|
|
int shifted_b = !shl(b, 2);
|
|
|
|
int shifted_i = !shl(i, 2);
|
|
|
|
}
|
|
|
|
// CHECK: def shifts
|
|
|
|
// CHECK: shifted_b = 8
|
|
|
|
// CHECK: shifted_i = 8
|
|
|
|
|
2013-01-25 22:49:08 +08:00
|
|
|
class Int<int value> {
|
|
|
|
int Value = value;
|
|
|
|
}
|
|
|
|
|
2016-11-15 14:49:28 +08:00
|
|
|
def v1022 : Int<1022>;
|
|
|
|
|
2014-08-05 17:43:25 +08:00
|
|
|
// CHECK: def v0
|
|
|
|
// CHECK: Value = 0
|
|
|
|
|
|
|
|
// CHECK: def v1
|
|
|
|
// CHECK: Value = 1
|
|
|
|
|
2016-11-15 14:49:28 +08:00
|
|
|
// CHECK: def v1023
|
|
|
|
// CHECK: Value = 1023
|
|
|
|
def v1023 : Int<!or(v1022.Value, 1)>;
|
|
|
|
|
2013-01-25 22:49:08 +08:00
|
|
|
def v1024 : Int<1024>;
|
2013-01-26 04:29:25 +08:00
|
|
|
// CHECK: def v1024
|
2013-01-25 22:49:08 +08:00
|
|
|
// CHECK: Value = 1024
|
|
|
|
|
|
|
|
def v1025 : Int<!add(v1024.Value, 1)>;
|
2013-01-26 04:29:25 +08:00
|
|
|
// CHECK: def v1025
|
2013-01-25 22:49:08 +08:00
|
|
|
// CHECK: Value = 1025
|
|
|
|
|
2018-03-14 19:00:43 +08:00
|
|
|
// CHECK: def v1a
|
|
|
|
// CHECK: Value = 1
|
|
|
|
|
|
|
|
// CHECK: def v2
|
|
|
|
// CHECK: Value = 2
|
|
|
|
def v2 : Int<2>;
|
|
|
|
|
2013-01-25 22:49:08 +08:00
|
|
|
def v2048 : Int<!add(v1024.Value, v1024.Value)>;
|
2013-01-26 04:29:25 +08:00
|
|
|
// CHECK: def v2048
|
2013-01-25 22:49:08 +08:00
|
|
|
// CHECK: Value = 2048
|
|
|
|
|
2014-08-05 17:43:25 +08:00
|
|
|
def v0 : Int<!and(v1024.Value, v2048.Value)>;
|
|
|
|
def v1 : Int<!and(v1025.Value, 1)>;
|
2016-11-15 14:49:28 +08:00
|
|
|
|
|
|
|
// CHECK: def v3072
|
|
|
|
// CHECK: Value = 3072
|
|
|
|
def v3072 : Int<!or(v1024.Value, v2048.Value)>;
|
2018-03-14 19:00:43 +08:00
|
|
|
|
|
|
|
// CHECK: def v4
|
|
|
|
// CHECK: Value = 4
|
|
|
|
|
|
|
|
// CHECK: def v7
|
|
|
|
// CHECK: Value = 7
|
|
|
|
|
|
|
|
def v4 : Int<!add(v2.Value, 1, v1.Value)>;
|
|
|
|
def v7 : Int<!or(v1.Value, v2.Value, v4.Value)>;
|
|
|
|
def v1a : Int<!and(v7.Value, 5, v1.Value)>;
|