110 lines · plain
1# RUN: llc -mtriple arm-- -run-pass=legalizer %s -o - | FileCheck %s2# RUN: llc -mtriple thumb-- -mattr=+v6t2 -run-pass=legalizer %s -o - | FileCheck %s3--- |4 define void @test_inttoptr_s32() { ret void }5 define void @test_ptrtoint_s32() { ret void }6 7 define void @test_inttoptr_s16() { ret void }8 define void @test_ptrtoint_s8() { ret void }9...10---11name: test_inttoptr_s3212# CHECK-LABEL: name: test_inttoptr_s3213legalized: false14# CHECK: legalized: true15regBankSelected: false16selected: false17tracksRegLiveness: true18registers:19 - { id: 0, class: _ }20 - { id: 1, class: _ }21body: |22 bb.0:23 liveins: $r024 25 %0(s32) = COPY $r026 %1(p0) = G_INTTOPTR %0(s32)27 ; G_INTTOPTR with s32 is legal, so we should find it unchanged in the output28 ; CHECK: {{%[0-9]+}}:_(p0) = G_INTTOPTR {{%[0-9]+}}29 $r0 = COPY %1(p0)30 BX_RET 14, $noreg, implicit $r031...32---33name: test_ptrtoint_s3234# CHECK-LABEL: name: test_ptrtoint_s3235legalized: false36# CHECK: legalized: true37regBankSelected: false38selected: false39tracksRegLiveness: true40registers:41 - { id: 0, class: _ }42 - { id: 1, class: _ }43body: |44 bb.0:45 liveins: $r046 47 %0(p0) = COPY $r048 %1(s32) = G_PTRTOINT %0(p0)49 ; G_PTRTOINT with s32 is legal, so we should find it unchanged in the output50 ; CHECK: {{%[0-9]+}}:_(s32) = G_PTRTOINT {{%[0-9]+}}51 $r0 = COPY %1(s32)52 BX_RET 14, $noreg, implicit $r053...54---55name: test_inttoptr_s1656# CHECK-LABEL: name: test_inttoptr_s1657legalized: false58# CHECK: legalized: true59regBankSelected: false60selected: false61tracksRegLiveness: true62registers:63 - { id: 0, class: _ }64 - { id: 1, class: _ }65 - { id: 2, class: _ }66body: |67 bb.0:68 liveins: $r069 70 %0(s32) = COPY $r071 %1(s16) = G_TRUNC %0(s32)72 %2(p0) = G_INTTOPTR %1(s16)73 ; G_INTTOPTR with s16 should zero extend74 ; CHECK-NOT: G_INTTOPTR {{%[0-9]+}}(s16)75 ; CHECK: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 6553576 ; CHECK: [[X32:%[0-9]+]]:_(s32) = G_AND {{%[0-9]+}}, [[BITS]]77 ; CHECK: {{%[0-9]+}}:_(p0) = G_INTTOPTR [[X32]](s32)78 ; CHECK-NOT: G_INTTOPTR {{%[0-9]+}}(s16)79 $r0 = COPY %2(p0)80 BX_RET 14, $noreg, implicit $r081...82---83name: test_ptrtoint_s884# CHECK-LABEL: name: test_ptrtoint_s885legalized: false86# CHECK: legalized: true87regBankSelected: false88selected: false89tracksRegLiveness: true90registers:91 - { id: 0, class: _ }92 - { id: 1, class: _ }93 - { id: 2, class: _ }94body: |95 bb.0:96 liveins: $r097 98 %0(p0) = COPY $r099 %1(s8) = G_PTRTOINT %0(p0)100 ; G_PTRTOINT with s8 should truncate101 ; CHECK-NOT: {{%[0-9]+}}(s8) = G_PTRTOINT102 ; CHECK: [[X32:%[0-9]+]]:_(s32) = G_PTRTOINT {{%[0-9]+}}(p0)103 ; CHECK: [[BITS:%[0-9]+]]:_(s32) = G_CONSTANT i32 255104 ; CHECK: {{%[0-9]+}}:_(s32) = G_AND [[X32]], [[BITS]]105 ; CHECK-NOT: {{%[0-9]+}}(s8) = G_PTRTOINT106 %2(s32) = G_ZEXT %1(s8)107 $r0 = COPY %2(s32)108 BX_RET 14, $noreg, implicit $r0109...110