1 ; RUN: llc -mtriple thumbv7-windows -filetype asm -o - %s | FileCheck %s 2 3 ; ModuleID = 'dllimport.c' 4 5 @var = external dllimport global i32 6 @ext = external global i32 7 declare dllimport arm_aapcs_vfpcc i32 @external() 8 declare arm_aapcs_vfpcc i32 @internal() 9 10 define arm_aapcs_vfpcc i32 @get_var() { 11 %1 = load i32, i32* @var, align 4 12 ret i32 %1 13 } 14 15 ; CHECK-LABEL: get_var 16 ; CHECK: movw r0, :lower16:__imp_var 17 ; CHECK: movt r0, :upper16:__imp_var 18 ; CHECK: ldr r0, [r0] 19 ; CHECK: ldr r0, [r0] 20 ; CHECK: bx lr 21 22 define arm_aapcs_vfpcc i32 @get_ext() { 23 %1 = load i32, i32* @ext, align 4 24 ret i32 %1 25 } 26 27 ; CHECK-LABEL: get_ext 28 ; CHECK: movw r0, :lower16:ext 29 ; CHECK: movt r0, :upper16:ext 30 ; CHECK: ldr r0, [r0] 31 ; CHECK: bx lr 32 33 define arm_aapcs_vfpcc i32* @get_var_pointer() { 34 ret i32* @var 35 } 36 37 ; CHECK-LABEL: get_var_pointer 38 ; CHECK: movw r0, :lower16:__imp_var 39 ; CHECK: movt r0, :upper16:__imp_var 40 ; CHECK: ldr r0, [r0] 41 ; CHECK: bx lr 42 43 define arm_aapcs_vfpcc i32 @call_external() { 44 %call = tail call arm_aapcs_vfpcc i32 @external() 45 ret i32 %call 46 } 47 48 ; CHECK-LABEL: call_external 49 ; CHECK: movw r0, :lower16:__imp_external 50 ; CHECK: movt r0, :upper16:__imp_external 51 ; CHECK: ldr r0, [r0] 52 ; CHECK: bx r0 53 54 define arm_aapcs_vfpcc i32 @call_internal() { 55 %call = tail call arm_aapcs_vfpcc i32 @internal() 56 ret i32 %call 57 } 58 59 ; CHECK-LABEL: call_internal 60 ; CHECK: b internal 61 62