xref: /llvm-project/llvm/test/MachineVerifier/test_g_insert.mir (revision d20190e68413634b87f0f9426312a0e9d8456d18)
1# RUN: not --crash llc -mtriple=aarch64 -o /dev/null -run-pass=none -verify-machineinstrs %s 2>&1 | FileCheck %s
2# REQUIRES: aarch64-registered-target
3
4---
5name:            test_insert
6legalized:       true
7tracksRegLiveness: true
8liveins:
9body:             |
10  bb.0:
11
12    ; CHECK: Bad machine code: Too few operands
13    %0:_(s32) = G_INSERT
14
15    ; CHECK: Bad machine code: Too few operands
16    ; CHECK: Bad machine code: generic instruction must use register operands
17    %1:_(s32) = G_INSERT 0
18
19    ; CHECK: Bad machine code: generic instruction must use register operands
20    ; CHECK: Bad machine code: generic instruction must use register operands
21    ; CHECK: Bad machine code: insert source must be a register
22    %2:_(s32) = G_INSERT 0, 0, 0
23
24    %3:_(s32) = G_IMPLICIT_DEF
25    %4:_(s1) = G_IMPLICIT_DEF
26
27    ; CHECK: Bad machine code: insert writes past end of register
28    %5:_(s32) = G_INSERT %3, %4, 32
29
30    ; CHECK: Bad machine code: insert offset must be a constant
31    %5:_(s32) = G_INSERT %3, %4, %3
32
33    ; CHECK: Bad machine code: insert offset must be a constant
34    %6:_(s32) = G_INSERT %3, %4, i32 4
35
36    %7:_(s64) = G_IMPLICIT_DEF
37
38    ; CHECK: Bad machine code: inserted size must be smaller than total register
39    %8:_(s32) = G_INSERT %3, %7, 0
40
41    ; CHECK: Bad machine code: inserted size must be smaller than total register
42    %9:_(s32) = G_INSERT %3, %3, 0
43
44...
45