• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Check support for `!cond' operator as part of a `let' statement.
2// RUN: llvm-tblgen %s | FileCheck %s
3// XFAIL: vg_leak
4
5
6class C<bits<3> x, bits<4> y, bit z> {
7  bits<16> n;
8
9  let n{11}  = !cond(y{3}: 1,
10                     y{2}: x{0},
11                     y{1}: x{1},
12                     y{0}: x{2},
13                     {1} :?);
14  let n{10...9}= !cond(x{2}: y{3...2},
15                       x{1}: y{2...1},
16                       x{1}: y{1...0},
17                       {1} : ?);
18  let n{8...6} = !cond(x{2}: 0b010,  1 : 0b110);
19  let n{5...4} = !cond(x{1}: y{3...2}, 1 :  {0, 1});
20  let n{3...0} = !cond(x{0}: y{3...0}, 1 : {z, y{2}, y{1}, y{0}});
21}
22
23
24def C1 : C<{1, 0, 1}, {0, 1, 0, 1}, 0>;
25def C2 : C<{0, 1, 0}, {1, 0, 1, 0}, 1>;
26def C3 : C<{0, 0, 0}, {1, 0, 1, 0}, 0>;
27def C4 : C<{0, 0, 0}, {0, 0, 0, 0}, 0>;
28
29// CHECK: def C1
30// CHECK-NEXT: bits<16> n = { ?, ?, ?, ?, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1 };
31// CHECK: def C2
32// CHECK-NEXT: bits<16> n = { ?, ?, ?, ?, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0 };
33// CHECK: def C3
34// CHECK-NEXT: bits<16> n = { ?, ?, ?, ?, 1, ?, ?, 1, 1, 0, 0, 1, 0, 0, 1, 0 };
35// CHECK: def C4
36// CHECK-NEXT: bits<16> n = { ?, ?, ?, ?, ?, ?, ?, 1, 1, 0, 0, 1, 0, 0, 0, 0 };
37