1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O1 -mcpu=pwr7 -code-model=medium -filetype=obj %s -o - | \ 2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-readobj -r | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; FIXME: When asm-parse is available, could make this an assembly test. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workertarget datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64" 7*9880d681SAndroid Build Coastguard Workertarget triple = "powerpc64-unknown-linux-gnu" 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker@test_fn_static.si = internal global i32 0, align 4 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard Workerdefine signext i32 @test_fn_static() nounwind { 12*9880d681SAndroid Build Coastguard Workerentry: 13*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* @test_fn_static.si, align 4 14*9880d681SAndroid Build Coastguard Worker %inc = add nsw i32 %0, 1 15*9880d681SAndroid Build Coastguard Worker store i32 %inc, i32* @test_fn_static.si, align 4 16*9880d681SAndroid Build Coastguard Worker ret i32 %0 17*9880d681SAndroid Build Coastguard Worker} 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard Worker; Verify generation of R_PPC64_TOC16_HA and R_PPC64_TOC16_LO for 20*9880d681SAndroid Build Coastguard Worker; accessing function-scoped variable si. 21*9880d681SAndroid Build Coastguard Worker; 22*9880d681SAndroid Build Coastguard Worker; CHECK: Relocations [ 23*9880d681SAndroid Build Coastguard Worker; CHECK: Section {{.*}} .rela.text { 24*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM2:[^ ]+]] 25*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO_DS [[SYM2]] 26*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM2]] 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard Worker@gi = global i32 5, align 4 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Workerdefine signext i32 @test_file_static() nounwind { 31*9880d681SAndroid Build Coastguard Workerentry: 32*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* @gi, align 4 33*9880d681SAndroid Build Coastguard Worker %inc = add nsw i32 %0, 1 34*9880d681SAndroid Build Coastguard Worker store i32 %inc, i32* @gi, align 4 35*9880d681SAndroid Build Coastguard Worker ret i32 %0 36*9880d681SAndroid Build Coastguard Worker} 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker; Verify generation of R_PPC64_TOC16_HA and R_PPC64_TOC16_LO for 39*9880d681SAndroid Build Coastguard Worker; accessing file-scope variable gi. 40*9880d681SAndroid Build Coastguard Worker; 41*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM3:[^ ]+]] 42*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO_DS [[SYM3]] 43*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM3]] 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Workerdefine double @test_double_const() nounwind { 46*9880d681SAndroid Build Coastguard Workerentry: 47*9880d681SAndroid Build Coastguard Worker ret double 0x3F4FD4920B498CF0 48*9880d681SAndroid Build Coastguard Worker} 49*9880d681SAndroid Build Coastguard Worker 50*9880d681SAndroid Build Coastguard Worker; Verify generation of R_PPC64_TOC16_HA and R_PPC64_TOC16_LO for 51*9880d681SAndroid Build Coastguard Worker; accessing a constant. 52*9880d681SAndroid Build Coastguard Worker; 53*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA [[SYM4:[^ ]+]] 54*9880d681SAndroid Build Coastguard Worker; CHECK: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO [[SYM4]] 55