summaryrefslogtreecommitdiffstats
path: root/llvm/test/TableGen/eq.td
blob: 0cbbc8270a0480b9623e5ec93f7f5df6ae151b98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RUN: llvm-tblgen %s | FileCheck %s
// XFAIL: vg_leak

// CHECK-LABEL: def FALSE {
//       CHECK:   int Value = 0;
//       CHECK: }

// CHECK-LABEL: def TRUE {
//       CHECK:   int Value = 1;
//       CHECK: }

// CHECK-LABEL: def X_NE {
//       CHECK:   bit a = 1;
//       CHECK:   bit b = 0;
//       CHECK: }

class Base<int V> {
  int Value = V;
}

class Derived<string Truth> :
  Base<!if(!eq(Truth, "true"), 1, 0)>;

def TRUE : Derived<"true">;
def FALSE : Derived<"false">;

def X_NE {
  bit a = !ne("true", "false");
  bit b = !ne("foo", "foo");
}
OpenPOWER on IntegriCloud