xref: /llvm-project/llvm/test/CodeGen/AArch64/GlobalISel/select-trunc.mir (revision 02769f2b3fdebb5066d7a973b171d2873a804560)
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -global-isel-abort=1 -verify-machineinstrs %s -o - | FileCheck %s
3
4--- |
5  target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
6
7  define void @trunc_s32_s64() { ret void }
8  define void @trunc_s8_s64() { ret void }
9  define void @trunc_s8_s32() { ret void }
10  define void @trunc_s64_s128() { ret void }
11  define void @trunc_s32_s128() { ret void }
12...
13
14---
15name:            trunc_s32_s64
16legalized:       true
17regBankSelected: true
18
19registers:
20  - { id: 0, class: gpr }
21  - { id: 1, class: gpr }
22
23body:             |
24  bb.0:
25    liveins: $x0
26
27    ; CHECK-LABEL: name: trunc_s32_s64
28    ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
29    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32sp = COPY [[COPY]].sub_32
30    ; CHECK-NEXT: $w0 = COPY [[COPY1]]
31    %0(s64) = COPY $x0
32    %1(s32) = G_TRUNC %0
33    $w0 = COPY %1(s32)
34...
35
36---
37name:            trunc_s8_s64
38legalized:       true
39regBankSelected: true
40
41registers:
42  - { id: 0, class: gpr }
43  - { id: 1, class: gpr }
44
45body:             |
46  bb.0:
47    liveins: $x0
48
49    ; CHECK-LABEL: name: trunc_s8_s64
50    ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
51    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY [[COPY]].sub_32
52    ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32all = COPY [[COPY1]]
53    ; CHECK-NEXT: $w0 = COPY [[COPY2]]
54    %0(s64) = COPY $x0
55    %1(s8) = G_TRUNC %0
56    %2:gpr(s32) = G_ANYEXT %1
57    $w0 = COPY %2(s32)
58...
59
60---
61name:            trunc_s8_s32
62legalized:       true
63regBankSelected: true
64
65registers:
66  - { id: 0, class: gpr }
67  - { id: 1, class: gpr }
68
69body:             |
70  bb.0:
71    liveins: $w0
72
73    ; CHECK-LABEL: name: trunc_s8_s32
74    ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
75    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[COPY]]
76    ; CHECK-NEXT: $w0 = COPY [[COPY1]]
77    %0(s32) = COPY $w0
78    %1(s8) = G_TRUNC %0
79    %2:gpr(s32) = G_ANYEXT %1
80    $w0 = COPY %2(s32)
81...
82
83---
84name:            trunc_s64_s128
85legalized:       true
86regBankSelected: true
87registers:
88  - { id: 0, class: fpr }
89  - { id: 1, class: fpr }
90
91body:             |
92  bb.0:
93    liveins: $q0
94
95    ; CHECK-LABEL: name: trunc_s64_s128
96    ; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
97    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY [[COPY]].dsub
98    ; CHECK-NEXT: $x0 = COPY [[COPY1]]
99    %0(s128) = COPY $q0
100    %1(s64) = G_TRUNC %0
101    $x0 = COPY %1(s64)
102...
103
104---
105name:            trunc_s32_s128
106legalized:       true
107regBankSelected: true
108registers:
109  - { id: 0, class: fpr }
110  - { id: 1, class: fpr }
111
112body:             |
113  bb.0:
114    liveins: $q0
115
116    ; CHECK-LABEL: name: trunc_s32_s128
117    ; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
118    ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr32 = COPY [[COPY]].ssub
119    ; CHECK-NEXT: $w0 = COPY [[COPY1]]
120    %0(s128) = COPY $q0
121    %1(s32) = G_TRUNC %0
122    $w0 = COPY %1(s32)
123...
124