|
| 1 | +# RUN: llc -mtriple=i386-linux-gnu -global-isel -run-pass=instruction-select %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X32 |
| 2 | +# RUN: llc -mtriple=x86_64-linux-gnu -global-isel -run-pass=instruction-select %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X64 |
| 3 | + |
| 4 | +--- | |
| 5 | + define i32 @test_zext_i8(i8 %val) { |
| 6 | + %r = zext i8 %val to i32 |
| 7 | + ret i32 %r |
| 8 | + } |
| 9 | + |
| 10 | + define i32 @test_zext_i16(i16 %val) { |
| 11 | + %r = zext i16 %val to i32 |
| 12 | + ret i32 %r |
| 13 | + } |
| 14 | + |
| 15 | + define i32 @test_sext_i8(i8 %val) { |
| 16 | + %r = sext i8 %val to i32 |
| 17 | + ret i32 %r |
| 18 | + } |
| 19 | + |
| 20 | + define i32 @test_sext_i16(i16 %val) { |
| 21 | + %r = sext i16 %val to i32 |
| 22 | + ret i32 %r |
| 23 | + } |
| 24 | + |
| 25 | +... |
| 26 | +--- |
| 27 | +name: test_zext_i8 |
| 28 | +# ALL-LABEL: name: test_zext_i8 |
| 29 | +alignment: 4 |
| 30 | +legalized: true |
| 31 | +regBankSelected: true |
| 32 | +# ALL: registers: |
| 33 | +# ALL-NEXT: - { id: 0, class: gr8 } |
| 34 | +# ALL-NEXT: - { id: 1, class: gr32 } |
| 35 | +registers: |
| 36 | + - { id: 0, class: gpr } |
| 37 | + - { id: 1, class: gpr } |
| 38 | +# ALL: %0 = COPY %dil |
| 39 | +# ALL-NEXT: %1 = MOVZX32rr8 %0 |
| 40 | +# ALL-NEXT: %eax = COPY %1 |
| 41 | +# ALL-NEXT: RET 0, implicit %eax |
| 42 | +body: | |
| 43 | + bb.1 (%ir-block.0): |
| 44 | + liveins: %edi |
| 45 | +
|
| 46 | + %0(s8) = COPY %edi |
| 47 | + %1(s32) = G_ZEXT %0(s8) |
| 48 | + %eax = COPY %1(s32) |
| 49 | + RET 0, implicit %eax |
| 50 | +
|
| 51 | +... |
| 52 | +--- |
| 53 | +name: test_zext_i16 |
| 54 | +# ALL-LABEL: name: test_zext_i16 |
| 55 | +alignment: 4 |
| 56 | +legalized: true |
| 57 | +regBankSelected: true |
| 58 | +# ALL: registers: |
| 59 | +# ALL-NEXT: - { id: 0, class: gr16 } |
| 60 | +# ALL-NEXT: - { id: 1, class: gr32 } |
| 61 | +registers: |
| 62 | + - { id: 0, class: gpr } |
| 63 | + - { id: 1, class: gpr } |
| 64 | +# ALL: %0 = COPY %di |
| 65 | +# ALL-NEXT: %1 = MOVZX32rr16 %0 |
| 66 | +# ALL-NEXT: %eax = COPY %1 |
| 67 | +# ALL-NEXT: RET 0, implicit %eax |
| 68 | +body: | |
| 69 | + bb.1 (%ir-block.0): |
| 70 | + liveins: %edi |
| 71 | +
|
| 72 | + %0(s16) = COPY %edi |
| 73 | + %1(s32) = G_ZEXT %0(s16) |
| 74 | + %eax = COPY %1(s32) |
| 75 | + RET 0, implicit %eax |
| 76 | +
|
| 77 | +... |
| 78 | +--- |
| 79 | +name: test_sext_i8 |
| 80 | +# ALL-LABEL: name: test_sext_i8 |
| 81 | +alignment: 4 |
| 82 | +legalized: true |
| 83 | +regBankSelected: true |
| 84 | +# ALL: registers: |
| 85 | +# ALL-NEXT: - { id: 0, class: gr8 } |
| 86 | +# ALL-NEXT: - { id: 1, class: gr32 } |
| 87 | +registers: |
| 88 | + - { id: 0, class: gpr } |
| 89 | + - { id: 1, class: gpr } |
| 90 | +# ALL: %0 = COPY %dil |
| 91 | +# ALL-NEXT: %1 = MOVSX32rr8 %0 |
| 92 | +# ALL-NEXT: %eax = COPY %1 |
| 93 | +# ALL-NEXT: RET 0, implicit %eax |
| 94 | +body: | |
| 95 | + bb.1 (%ir-block.0): |
| 96 | + liveins: %edi |
| 97 | +
|
| 98 | + %0(s8) = COPY %edi |
| 99 | + %1(s32) = G_SEXT %0(s8) |
| 100 | + %eax = COPY %1(s32) |
| 101 | + RET 0, implicit %eax |
| 102 | +
|
| 103 | +... |
| 104 | +--- |
| 105 | +name: test_sext_i16 |
| 106 | +# ALL-LABEL: name: test_sext_i16 |
| 107 | +alignment: 4 |
| 108 | +legalized: true |
| 109 | +regBankSelected: true |
| 110 | +# ALL: registers: |
| 111 | +# ALL-NEXT: - { id: 0, class: gr16 } |
| 112 | +# ALL-NEXT: - { id: 1, class: gr32 } |
| 113 | +registers: |
| 114 | + - { id: 0, class: gpr } |
| 115 | + - { id: 1, class: gpr } |
| 116 | +# ALL: %0 = COPY %di |
| 117 | +# ALL-NEXT: %1 = MOVSX32rr16 %0 |
| 118 | +# ALL-NEXT: %eax = COPY %1 |
| 119 | +# ALL-NEXT: RET 0, implicit %eax |
| 120 | +body: | |
| 121 | + bb.1 (%ir-block.0): |
| 122 | + liveins: %edi |
| 123 | +
|
| 124 | + %0(s16) = COPY %edi |
| 125 | + %1(s32) = G_SEXT %0(s16) |
| 126 | + %eax = COPY %1(s32) |
| 127 | + RET 0, implicit %eax |
| 128 | +
|
| 129 | +... |
0 commit comments