diff options
Diffstat (limited to 'test/CodeGen/X86/GlobalISel/legalize-ext.mir')
-rw-r--r-- | test/CodeGen/X86/GlobalISel/legalize-ext.mir | 171 |
1 files changed, 170 insertions, 1 deletions
diff --git a/test/CodeGen/X86/GlobalISel/legalize-ext.mir b/test/CodeGen/X86/GlobalISel/legalize-ext.mir index c9add0dc4e95..c86bfd9ee96d 100644 --- a/test/CodeGen/X86/GlobalISel/legalize-ext.mir +++ b/test/CodeGen/X86/GlobalISel/legalize-ext.mir @@ -1,12 +1,28 @@ # RUN: llc -mtriple=i386-linux-gnu -global-isel -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X32 # RUN: llc -mtriple=x86_64-linux-gnu -global-isel -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X64 --- | - define i32 @test_zext_i1(i8 %a) { + + define i8 @test_zext_i1toi8(i1 %a) { + %r = zext i1 %a to i8 + ret i8 %r + } + + define i16 @test_zext_i1toi16(i1 %a) { + %r = zext i1 %a to i16 + ret i16 %r + } + + define i32 @test_zext_i1(i8 %a) { %val = trunc i8 %a to i1 %r = zext i1 %val to i32 ret i32 %r } + define i16 @test_zext_i8toi16(i8 %val) { + %r = zext i8 %val to i16 + ret i16 %r + } + define i32 @test_zext_i8(i8 %val) { %r = zext i8 %val to i32 ret i32 %r @@ -17,12 +33,27 @@ ret i32 %r } + define i8 @test_sext_i1toi8(i1 %a) { + %r = sext i1 %a to i8 + ret i8 %r + } + + define i16 @test_sext_i1toi16(i1 %a) { + %r = sext i1 %a to i16 + ret i16 %r + } + define i32 @test_sext_i1(i8 %a) { %val = trunc i8 %a to i1 %r = sext i1 %val to i32 ret i32 %r } + define i16 @test_sext_i8toi16(i8 %val) { + %r = sext i8 %val to i16 + ret i16 %r + } + define i32 @test_sext_i8(i8 %val) { %r = sext i8 %val to i32 ret i32 %r @@ -35,6 +66,52 @@ ... --- +name: test_zext_i1toi8 +# ALL-LABEL: name: test_zext_i1toi8 +alignment: 4 +legalized: false +regBankSelected: false +registers: + - { id: 0, class: _, preferred-register: '' } + - { id: 1, class: _, preferred-register: '' } +# ALL: %0(s1) = COPY %edi +# ALL-NEXT: %1(s8) = G_ZEXT %0(s1) +# ALL-NEXT: %al = COPY %1(s8) +# ALL-NEXT: RET 0, implicit %al +body: | + bb.1 (%ir-block.0): + liveins: %edi + + %0(s1) = COPY %edi + %1(s8) = G_ZEXT %0(s1) + %al = COPY %1(s8) + RET 0, implicit %al + +... +--- +name: test_zext_i1toi16 +# ALL-LABEL: name: test_zext_i1toi16 +alignment: 4 +legalized: false +regBankSelected: false +registers: + - { id: 0, class: _, preferred-register: '' } + - { id: 1, class: _, preferred-register: '' } +# ALL: %0(s1) = COPY %edi +# ALL-NEXT: %1(s16) = G_ZEXT %0(s1) +# ALL-NEXT: %ax = COPY %1(s16) +# ALL-NEXT: RET 0, implicit %ax +body: | + bb.1 (%ir-block.0): + liveins: %edi + + %0(s1) = COPY %edi + %1(s16) = G_ZEXT %0(s1) + %ax = COPY %1(s16) + RET 0, implicit %ax + +... +--- name: test_zext_i1 # ALL-LABEL: name: test_zext_i1 alignment: 4 @@ -61,6 +138,29 @@ body: | ... --- +name: test_zext_i8toi16 +# ALL-LABEL: name: test_zext_i8toi16 +alignment: 4 +legalized: false +regBankSelected: false +registers: + - { id: 0, class: _, preferred-register: '' } + - { id: 1, class: _, preferred-register: '' } +# ALL: %0(s8) = COPY %edi +# ALL-NEXT: %1(s16) = G_ZEXT %0(s8) +# ALL-NEXT: %ax = COPY %1(s16) +# ALL-NEXT: RET 0, implicit %ax +body: | + bb.1 (%ir-block.0): + liveins: %edi + + %0(s8) = COPY %edi + %1(s16) = G_ZEXT %0(s8) + %ax = COPY %1(s16) + RET 0, implicit %ax + +... +--- name: test_zext_i8 # ALL-LABEL: name: test_zext_i8 alignment: 4 @@ -107,6 +207,52 @@ body: | ... --- +name: test_sext_i1toi8 +# ALL-LABEL: name: test_sext_i1toi8 +alignment: 4 +legalized: false +regBankSelected: false +registers: + - { id: 0, class: _, preferred-register: '' } + - { id: 1, class: _, preferred-register: '' } +# ALL: %0(s1) = COPY %edi +# ALL-NEXT: %1(s8) = G_SEXT %0(s1) +# ALL-NEXT: %al = COPY %1(s8) +# ALL-NEXT: RET 0, implicit %al +body: | + bb.1 (%ir-block.0): + liveins: %edi + + %0(s1) = COPY %edi + %1(s8) = G_SEXT %0(s1) + %al = COPY %1(s8) + RET 0, implicit %al + +... +--- +name: test_sext_i1toi16 +# ALL-LABEL: name: test_sext_i1toi16 +alignment: 4 +legalized: false +regBankSelected: false +registers: + - { id: 0, class: _, preferred-register: '' } + - { id: 1, class: _, preferred-register: '' } +# ALL: %0(s1) = COPY %edi +# ALL-NEXT: %1(s16) = G_SEXT %0(s1) +# ALL-NEXT: %ax = COPY %1(s16) +# ALL-NEXT: RET 0, implicit %ax +body: | + bb.1 (%ir-block.0): + liveins: %edi + + %0(s1) = COPY %edi + %1(s16) = G_SEXT %0(s1) + %ax = COPY %1(s16) + RET 0, implicit %ax + +... +--- name: test_sext_i1 # ALL-LABEL: name: test_sext_i1 alignment: 4 @@ -133,6 +279,29 @@ body: | ... --- +name: test_sext_i8toi16 +# ALL-LABEL: name: test_sext_i8toi16 +alignment: 4 +legalized: false +regBankSelected: false +registers: + - { id: 0, class: _, preferred-register: '' } + - { id: 1, class: _, preferred-register: '' } +# ALL: %0(s8) = COPY %edi +# ALL-NEXT: %1(s16) = G_SEXT %0(s8) +# ALL-NEXT: %ax = COPY %1(s16) +# ALL-NEXT: RET 0, implicit %ax +body: | + bb.1 (%ir-block.0): + liveins: %edi + + %0(s8) = COPY %edi + %1(s16) = G_SEXT %0(s8) + %ax = COPY %1(s16) + RET 0, implicit %ax + +... +--- name: test_sext_i8 # ALL-LABEL: name: test_sext_i8 alignment: 4 |