xref: /llvm-project/llvm/test/MachineVerifier/test_g_insert_subvector.mir (revision 009398b3b37f7d653b4371120944f74cad934992)
1# RUN: not --crash llc -o - -run-pass=none -verify-machineinstrs -mtriple=arm64 %s 2>&1 | FileCheck %s
2# REQUIRES: aarch64-registered-target
3
4---
5name:            g_splat_vector
6tracksRegLiveness: true
7liveins:
8body:             |
9  bb.0:
10    %0:_(s32) = G_CONSTANT i32 0
11    %1:_(<vscale x 2 x s32>) = G_IMPLICIT_DEF
12    %2:_(<vscale x 1 x s32>) = G_IMPLICIT_DEF
13
14    ; CHECK: generic instruction must use register operands
15    ; CHECK: G_INSERT_SUBVECTOR first source must be a register
16    %3:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR 1, %2, 0
17
18    ; CHECK: generic instruction must use register operands
19    ; CHECK: G_INSERT_SUBVECTOR second source must be a register
20    %4:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR %1, 1, 0
21
22    ; CHECK: G_INSERT_SUBVECTOR index must be an immediate
23    %5:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR %1, %2, %0
24
25    ; CHECK: Destination type must be a vector
26    %6:_(s32) = G_INSERT_SUBVECTOR %1, %2, 0
27
28    ; CHECK: Type mismatch in generic instruction
29    %7:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR %0, %2, 0
30
31    ; CHECK: Second source must be a vector
32    %8:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR %1, %0, 0
33
34    ; CHECK: Type mismatch in generic instruction
35    %9:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR %2, %1, 0
36
37    %10:_(<vscale x 1 x s16>) = G_IMPLICIT_DEF
38
39    ; CHECK: Element type of vectors must be the same
40    %11:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR %1, %10, 0
41
42    %12:_(<vscale x 4 x s32>) = G_IMPLICIT_DEF
43
44    ; CHECK: Index must be a multiple of the second source vector's minimum vector length
45    %13:_(<vscale x 4 x s32>) = G_INSERT_SUBVECTOR %12, %1, 3
46
47    ; CHECK: Index must be a multiple of the second source vector's minimum vector length
48    %14:_(<vscale x 4 x s32>) = G_INSERT_SUBVECTOR %12, %1, 1
49
50    %15:_(<vscale x 4 x s32>) = G_IMPLICIT_DEF
51
52    ; CHECK: Second source must be smaller than destination vector
53    %16:_(<vscale x 2 x s32>) = G_INSERT_SUBVECTOR %1, %15, 0
54
55    ; CHECK: Subvector type and index must not cause insert to overrun the vector being inserted into
56    %17:_(<vscale x 4 x s32>) = G_INSERT_SUBVECTOR %12, %1, 4
57
58    %18:_(<vscale x 3 x s32>) = G_IMPLICIT_DEF
59
60    ; CHECK: Subvector type and index must not cause insert to overrun the vector being inserted into
61    %19:_(<vscale x 3 x s32>) = G_INSERT_SUBVECTOR %18, %1, 2
62
63    %20:_(<2 x s32>) = G_IMPLICIT_DEF
64
65    ; CHECK: Vector types must both be fixed or both be scalable
66    %21:_(<vscale x 1 x s32>) = G_INSERT_SUBVECTOR %12, %20, 2
67...
68