38 lines · plain
1 2// RUN: not llvm-tblgen %s 2>&1 | FileCheck %s -DFILE=%s3 4def a {5 bits<2> opc = { 0, 1 };6 bits<2> opc2 = { 1, 0 };7 bits<1> opc3 = { 1 };8 // CHECK: [[FILE]]:[[@LINE+1]]:15: error: Field 'a' of type 'bits<2>' is incompatible with value '{ opc{1}, opc{0}, opc2{1}, opc2{0} }' of type bit initializer with length 49 bits<2> a = { opc, opc2 }; // error!10}11 12def {13 // CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'B1' of type 'bits<2>' is incompatible with value '{ 0, 1, 1 }' of type bit initializer with length 314 bits<2> B1 = 0b011; // bitfield is too small, reject15 16 // CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'C1' of type 'bits<2>' is incompatible with value '{ 1, 1, 1 }' of type bit initializer with length 317 bits<2> C1 = 0b111; // bitfield is too small, reject18 19 // CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'D3' of type 'bits<3>' is incompatible with value '{ 0, 0 }' of type bit initializer with length 220 bits<3> D3 = { 0, 0 }; // type mismatch. RHS doesn't have enough bits21 22 // CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'D4' of type 'bits<3>' is incompatible with value '{ 0, 0 }' of type bit initializer with length 223 bits<3> D4 = { 0b00 }; // type mismatch. RHS doesn't have enough bits24 25 bits<1> D7 = { 3 }; // type mismatch. LHS doesn't have enough bits26 27 // CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'D8' of type 'bits<2>' is incompatible with value '{ 0 }' of type bit initializer with length 128 bits<2> D8 = { 0 }; // type mismatch. RHS doesn't have enough bits29 30 // CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'F2' of type 'bits<7>' is incompatible with value '{ 0, 1, 1, 0, 0, 1, 0, 0 }' of type bit initializer with length 831 bits<7> F2 = { 0, 1, 0b1001, 0, 0b0 }; // LHS doesn't have enough bits32 33 // CHECK: [[FILE]]:[[@LINE+1]]:16: error: Field 'F3' of type 'bits<9>' is incompatible with value '{ 0, 1, 1, 0, 0, 1, 0, 0 }' of type bit initializer with length 834 bits<9> F3 = { 0, 1, 0b1001, 0, 0b0 }; // RHS doesn't have enough bits35 36 // CHECK: Initializer of 'D7' in 'anonymous_0' could not be fully resolved: { !cast<bit>(3) }37}38