1 ;; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -O3 \
2 ;; RUN: -filetype=obj %s -o - | \
3 ;; RUN: elf-dump --dump-section-data | FileCheck %s
5 ;; FIXME: this file need to be in .s form, change when asm parse is done.
7 @number64 = global i64 10, align 8
9 define i64 @access_int64(i64 %a) nounwind readonly {
11 %0 = load i64* @number64, align 8
12 %cmp = icmp eq i64 %0, %a
13 %conv1 = zext i1 %cmp to i64
17 declare double @sin(double) nounwind
19 define double @test_branch24 (double %x) nounwind readonly {
21 %add = call double @sin(double %x) nounwind
25 ;; The relocations in .rela.text are the 'number64' load using a
26 ;; R_PPC64_TOC16_DS against the .toc and the 'sin' external function
27 ;; address using a R_PPC64_REL24
28 ;; CHECK: '.rela.text'
29 ;; CHECK: Relocation 0
30 ;; CHECK-NEXT: 'r_offset',
31 ;; CHECK-NEXT: 'r_sym', 0x00000006
32 ;; CHECK-NEXT: 'r_type', 0x0000003f
33 ;; CHECK: Relocation 1
34 ;; CHECK-NEXT: 'r_offset',
35 ;; CHECK-NEXT: 'r_sym', 0x0000000a
36 ;; CHECK-NEXT: 'r_type', 0x0000000a
38 ;; The .opd entry for the 'access_int64' function creates 2 relocations:
39 ;; 1. A R_PPC64_ADDR64 against the .text segment plus addend (the function
41 ;; 2. And a R_PPC64_TOC against no symbol (the linker will replace for the
42 ;; module's TOC base).
44 ;; CHECK: Relocation 0
45 ;; CHECK-NEXT: 'r_offset',
46 ;; CHECK-NEXT: 'r_sym', 0x00000002
47 ;; CHECK-NEXT: 'r_type', 0x00000026
48 ;; CHECK: Relocation 1
49 ;; CHECK-NEXT: 'r_offset',
50 ;; CHECK-NEXT: 'r_sym', 0x00000000
51 ;; CHECK-NEXT: 'r_type', 0x00000033
53 ;; Finally the TOC creates the relocation for the 'number64'.
55 ;; CHECK: Relocation 0
56 ;; CHECK-NEXT: 'r_offset',
57 ;; CHECK-NEXT: 'r_sym', 0x00000008
58 ;; CHECK-NEXT: 'r_type', 0x00000026
60 ;; Check if the relocation references are for correct symbols.
62 ;; CHECK-NEXT: 'access_int64'
64 ;; CHECK-NEXT: 'number64'