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