[RISCV] Check isFixedLengthVector before calling getVectorNumElements in getSingleShu...
[llvm-project.git] / llvm / test / TableGen / invalid-type-cast-patfrags.td
blob49d8a73b810788ba82c48003b3142f587df18213
1 // RUN: not llvm-tblgen -gen-dag-isel -I %p/../../include -I %p/Common -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
2 // RUN: not llvm-tblgen -gen-dag-isel -I %p/../../include -I %p/Common -DERROR2 %s 2>&1 | FileCheck --check-prefix=ERROR2 %s
3 // RUN: not llvm-tblgen -gen-dag-isel -I %p/../../include -I %p/Common -DERROR3 %s 2>&1 | FileCheck --check-prefix=ERROR3 %s
4 // RUN: not llvm-tblgen -gen-dag-isel -I %p/../../include -I %p/Common -DERROR4 %s 2>&1 | FileCheck --check-prefix=ERROR4 %s
6 include "llvm/Target/Target.td"
7 include "GlobalISelEmitterCommon.td"
9 def int_foo : Intrinsic<[llvm_anyint_ty, llvm_anyint_ty], [llvm_i32_ty]>;
10 def int_bar : Intrinsic<[], []>;
12 def INSTR_FOO : Instruction {
13   let OutOperandList = (outs GPR32:$a, GPR32:$b);
14   let InOperandList = (ins GPR32:$c);
16 def INSTR_BAR : Instruction {
17   let OutOperandList = (outs);
18   let InOperandList = (ins);
21 #ifdef ERROR1
22 // ERROR1: [[@LINE+1]]:1: error: {{.*}} Invalid number of type casts!
23 def : Pat<([i32, i32, i32] (int_foo (i32 GPR32:$a))), ([i32, i32, i32] (INSTR_FOO $a))>;
24 #endif
26 #ifdef ERROR2
27 // ERROR2: [[@LINE+1]]:1: error: {{.*}} Invalid number of type casts!
28 def : Pat<([]<ValueType> (int_bar)), ([]<ValueType> (INSTR_BAR))>;
29 #endif
31 #ifdef ERROR3
32 // ERROR3: [[@LINE+1]]:1: error: {{.*}} Type cast only takes one operand!
33 def : Pat<([i32, i32] (int_foo), (int_foo)), ([i32, i32] (INSTR_FOO))>;
34 #endif
36 #ifdef ERROR4
37 // ERROR4: [[@LINE+1]]:1: error: {{.*}} Type cast should not have a name!
38 def : Pat<([i32, i32] ([i32, i32] (int_foo)):$name), ([i32, i32] (INSTR_FOO))>;
39 #endif