1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3
4---
5name:            insert_gprx
6legalized:       true
7regBankSelected: true
8
9body:             |
10  bb.0:
11    liveins: $x0
12
13    ; CHECK-LABEL: name: insert_gprx
14    ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
15    ; CHECK: [[DEF:%[0-9]+]]:gpr64 = IMPLICIT_DEF
16    ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gpr64 = SUBREG_TO_REG 0, [[COPY]], %subreg.sub_32
17    ; CHECK: [[BFMXri:%[0-9]+]]:gpr64 = BFMXri [[DEF]], [[SUBREG_TO_REG]], 0, 31
18    ; CHECK: [[SUBREG_TO_REG1:%[0-9]+]]:gpr64 = SUBREG_TO_REG 0, [[COPY]], %subreg.sub_32
19    ; CHECK: [[BFMXri1:%[0-9]+]]:gpr64 = BFMXri [[DEF]], [[SUBREG_TO_REG1]], 51, 31
20    ; CHECK: $x0 = COPY [[BFMXri]]
21    ; CHECK: $x1 = COPY [[BFMXri1]]
22    %0:gpr(s32) = COPY $w0
23
24    %1:gpr(s64) = G_IMPLICIT_DEF
25
26    %2:gpr(s64) = G_INSERT %1, %0, 0
27
28    %3:gpr(s64) = G_INSERT %1, %0, 13
29
30    $x0 = COPY %2
31    $x1 = COPY %3
32...
33
34---
35name:            insert_gprw
36legalized:       true
37regBankSelected: true
38
39body:             |
40  bb.0:
41    liveins: $w0, $w1
42    ; CHECK-LABEL: name: insert_gprw
43    ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
44    ; CHECK: [[DEF:%[0-9]+]]:gpr32 = IMPLICIT_DEF
45    ; CHECK: [[BFMWri:%[0-9]+]]:gpr32 = BFMWri [[DEF]], [[COPY]], 0, 15
46    ; CHECK: [[BFMWri1:%[0-9]+]]:gpr32 = BFMWri [[BFMWri]], [[COPY]], 16, 15
47    ; CHECK: [[COPY1:%[0-9]+]]:gpr32all = COPY [[BFMWri1]]
48    ; CHECK: $w0 = COPY [[COPY1]]
49    %1:gpr(s32) = COPY $w0
50    %2:gpr(s32) = COPY $w1
51    %3:gpr(s16) = G_TRUNC %1(s32)
52    %4:gpr(s16) = G_TRUNC %1(s32)
53    %5:gpr(s32) = G_IMPLICIT_DEF
54    %6:gpr(s32) = G_INSERT %5, %3(s16), 0
55    %7:gpr(s32) = G_INSERT %6, %4(s16), 16
56    %0:gpr(s32) = COPY %7(s32)
57    $w0 = COPY %0
58...
59
60---
61name:            extract_gprs
62legalized:       true
63regBankSelected: true
64
65body:             |
66  bb.0:
67    liveins: $x0
68
69    ; CHECK-LABEL: name: extract_gprs
70    ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
71    ; CHECK: [[UBFMXri:%[0-9]+]]:gpr64 = UBFMXri [[COPY]], 0, 31
72    ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY [[UBFMXri]].sub_32
73    ; CHECK: [[UBFMXri1:%[0-9]+]]:gpr64 = UBFMXri [[COPY]], 13, 44
74    ; CHECK: [[COPY2:%[0-9]+]]:gpr32 = COPY [[UBFMXri1]].sub_32
75    ; CHECK: $w0 = COPY [[COPY1]]
76    ; CHECK: $w1 = COPY [[COPY2]]
77    %0:gpr(s64) = COPY $x0
78
79    %1:gpr(s32) = G_EXTRACT %0, 0
80
81    %2:gpr(s32) = G_EXTRACT %0, 13
82
83    $w0 = COPY %1
84    $w1 = COPY %2
85...
86
87---
88name:            extract_gprw
89legalized:       true
90regBankSelected: true
91
92body:             |
93  bb.0:
94    liveins: $w0
95
96    ; CHECK-LABEL: name: extract_gprw
97    ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
98    ; CHECK: [[UBFMWri:%[0-9]+]]:gpr32 = UBFMWri [[COPY]], 0, 15
99    ; CHECK: [[UBFMWri1:%[0-9]+]]:gpr32 = UBFMWri [[COPY]], 15, 30
100    ; CHECK: [[COPY1:%[0-9]+]]:fpr32 = COPY [[UBFMWri]]
101    ; CHECK: [[COPY2:%[0-9]+]]:fpr16 = COPY [[COPY1]].hsub
102    ; CHECK: $h0 = COPY [[COPY2]]
103    ; CHECK: [[COPY3:%[0-9]+]]:fpr32 = COPY [[UBFMWri1]]
104    ; CHECK: [[COPY4:%[0-9]+]]:fpr16 = COPY [[COPY3]].hsub
105    ; CHECK: $h1 = COPY [[COPY4]]
106    %0:gpr(s32) = COPY $w0
107
108    %1:gpr(s16) = G_EXTRACT %0, 0
109
110    %2:gpr(s16) = G_EXTRACT %0, 15
111
112    $h0 = COPY %1
113    $h1 = COPY %2
114...
115