1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK
4 define i1 @trunc_i32toi1(i32 %a) {
5 %r = trunc i32 %a to i1
9 define i8 @trunc_i32toi8(i32 %a) {
10 %r = trunc i32 %a to i8
14 define i16 @trunc_i32toi16(i32 %a) {
15 %r = trunc i32 %a to i16
19 define i8 @trunc_i64toi8(i64 %a) {
20 %r = trunc i64 %a to i8
24 define i16 @trunc_i64toi16(i64 %a) {
25 %r = trunc i64 %a to i16
29 define i32 @trunc_i64toi32(i64 %a) {
30 %r = trunc i64 %a to i32
41 - { id: 0, class: gpr }
42 - { id: 1, class: gpr }
43 - { id: 2, class: gpr }
48 ; CHECK-LABEL: name: trunc_i32toi1
49 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
50 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
51 ; CHECK: $al = COPY [[COPY1]]
52 ; CHECK: RET 0, implicit $al
54 %1(s1) = G_TRUNC %0(s32)
55 %2(s8) = G_ANYEXT %1(s1)
66 - { id: 0, class: gpr }
67 - { id: 1, class: gpr }
72 ; CHECK-LABEL: name: trunc_i32toi8
73 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
74 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
75 ; CHECK: $al = COPY [[COPY1]]
76 ; CHECK: RET 0, implicit $al
78 %1(s8) = G_TRUNC %0(s32)
89 - { id: 0, class: gpr }
90 - { id: 1, class: gpr }
95 ; CHECK-LABEL: name: trunc_i32toi16
96 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
97 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
98 ; CHECK: $ax = COPY [[COPY1]]
99 ; CHECK: RET 0, implicit $ax
101 %1(s16) = G_TRUNC %0(s32)
110 regBankSelected: true
112 - { id: 0, class: gpr }
113 - { id: 1, class: gpr }
118 ; CHECK-LABEL: name: trunc_i64toi8
119 ; CHECK: [[COPY:%[0-9]+]]:gr64_with_sub_8bit = COPY $rdi
120 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY [[COPY]].sub_8bit
121 ; CHECK: $al = COPY [[COPY1]]
122 ; CHECK: RET 0, implicit $al
124 %1(s8) = G_TRUNC %0(s64)
133 regBankSelected: true
135 - { id: 0, class: gpr }
136 - { id: 1, class: gpr }
141 ; CHECK-LABEL: name: trunc_i64toi16
142 ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
143 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY [[COPY]].sub_16bit
144 ; CHECK: $ax = COPY [[COPY1]]
145 ; CHECK: RET 0, implicit $ax
147 %1(s16) = G_TRUNC %0(s64)
156 regBankSelected: true
158 - { id: 0, class: gpr }
159 - { id: 1, class: gpr }
164 ; CHECK-LABEL: name: trunc_i64toi32
165 ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
166 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY [[COPY]].sub_32bit
167 ; CHECK: $eax = COPY [[COPY1]]
168 ; CHECK: RET 0, implicit $eax
170 %1(s32) = G_TRUNC %0(s64)