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 3--- | 4 define i1 @trunc_i32toi1(i32 %a) { 5 %r = trunc i32 %a to i1 6 ret i1 %r 7 } 8 9 define i8 @trunc_i32toi8(i32 %a) { 10 %r = trunc i32 %a to i8 11 ret i8 %r 12 } 13 14 define i16 @trunc_i32toi16(i32 %a) { 15 %r = trunc i32 %a to i16 16 ret i16 %r 17 } 18 19 define i8 @trunc_i64toi8(i64 %a) { 20 %r = trunc i64 %a to i8 21 ret i8 %r 22 } 23 24 define i16 @trunc_i64toi16(i64 %a) { 25 %r = trunc i64 %a to i16 26 ret i16 %r 27 } 28 29 define i32 @trunc_i64toi32(i64 %a) { 30 %r = trunc i64 %a to i32 31 ret i32 %r 32 } 33 34... 35--- 36name: trunc_i32toi1 37alignment: 16 38legalized: true 39regBankSelected: true 40registers: 41 - { id: 0, class: gpr } 42 - { id: 1, class: gpr } 43 - { id: 2, class: gpr } 44body: | 45 bb.1 (%ir-block.0): 46 liveins: $edi 47 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 53 %0(s32) = COPY $edi 54 %1(s1) = G_TRUNC %0(s32) 55 %2(s8) = G_ANYEXT %1(s1) 56 $al = COPY %2(s8) 57 RET 0, implicit $al 58 59... 60--- 61name: trunc_i32toi8 62alignment: 16 63legalized: true 64regBankSelected: true 65registers: 66 - { id: 0, class: gpr } 67 - { id: 1, class: gpr } 68body: | 69 bb.1 (%ir-block.0): 70 liveins: $edi 71 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 77 %0(s32) = COPY $edi 78 %1(s8) = G_TRUNC %0(s32) 79 $al = COPY %1(s8) 80 RET 0, implicit $al 81 82... 83--- 84name: trunc_i32toi16 85alignment: 16 86legalized: true 87regBankSelected: true 88registers: 89 - { id: 0, class: gpr } 90 - { id: 1, class: gpr } 91body: | 92 bb.1 (%ir-block.0): 93 liveins: $edi 94 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 100 %0(s32) = COPY $edi 101 %1(s16) = G_TRUNC %0(s32) 102 $ax = COPY %1(s16) 103 RET 0, implicit $ax 104 105... 106--- 107name: trunc_i64toi8 108alignment: 16 109legalized: true 110regBankSelected: true 111registers: 112 - { id: 0, class: gpr } 113 - { id: 1, class: gpr } 114body: | 115 bb.1 (%ir-block.0): 116 liveins: $rdi 117 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 123 %0(s64) = COPY $rdi 124 %1(s8) = G_TRUNC %0(s64) 125 $al = COPY %1(s8) 126 RET 0, implicit $al 127 128... 129--- 130name: trunc_i64toi16 131alignment: 16 132legalized: true 133regBankSelected: true 134registers: 135 - { id: 0, class: gpr } 136 - { id: 1, class: gpr } 137body: | 138 bb.1 (%ir-block.0): 139 liveins: $rdi 140 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 146 %0(s64) = COPY $rdi 147 %1(s16) = G_TRUNC %0(s64) 148 $ax = COPY %1(s16) 149 RET 0, implicit $ax 150 151... 152--- 153name: trunc_i64toi32 154alignment: 16 155legalized: true 156regBankSelected: true 157registers: 158 - { id: 0, class: gpr } 159 - { id: 1, class: gpr } 160body: | 161 bb.1 (%ir-block.0): 162 liveins: $rdi 163 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 169 %0(s64) = COPY $rdi 170 %1(s32) = G_TRUNC %0(s64) 171 $eax = COPY %1(s32) 172 RET 0, implicit $eax 173 174... 175