mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[PowerPC][test] Improve .got2 and .toc tests
There is no .got2 test for powerpc32. There is no comdat variable test for powerpc{32,64}.
This commit is contained in:
parent
27ac9a2711
commit
346697cf46
@ -7,7 +7,11 @@
|
||||
target 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"
|
||||
target triple = "powerpc64-unknown-linux-gnu"
|
||||
|
||||
$fi = comdat any
|
||||
|
||||
@ei = external global i32
|
||||
@fi = global i32 0, align 4, comdat($fi)
|
||||
@gi = global i32 0, align 4, comdat($fi)
|
||||
|
||||
define signext i32 @test_external() nounwind {
|
||||
entry:
|
||||
@ -17,11 +21,25 @@ entry:
|
||||
ret i32 %0
|
||||
}
|
||||
|
||||
define i32 @load() {
|
||||
entry:
|
||||
%0 = load i32, i32* @gi, align 4
|
||||
%1 = load i32, i32* @fi, align 4
|
||||
%2 = add i32 %0, %1
|
||||
ret i32 %2
|
||||
}
|
||||
|
||||
; CHECK-LABEL: test_external:
|
||||
; CHECK: addis [[REG1:[0-9]+]], 2, .LC[[TOCNUM:[0-9]+]]@toc@ha
|
||||
; CHECK: ld [[REG2:[0-9]+]], .LC[[TOCNUM]]@toc@l([[REG1]])
|
||||
; CHECK: lwz {{[0-9]+}}, 0([[REG2]])
|
||||
; CHECK: stw {{[0-9]+}}, 0([[REG2]])
|
||||
; CHECK: .section .toc
|
||||
; CHECK: .LC[[TOCNUM]]:
|
||||
; CHECK: .tc {{[a-z0-9A-Z_.]+}}[TC],{{[a-z0-9A-Z_.]+}}
|
||||
|
||||
|
||||
; CHECK: .section .toc,"aw",@progbits
|
||||
; CHECK-NEXT: .LC0:
|
||||
; CHECK-NEXT: .tc ei[TC],ei
|
||||
; CHECK-NEXT: .LC1:
|
||||
; CHECK-NEXT: .tc fi[TC],fi
|
||||
; CHECK-NEXT: .LC2:
|
||||
; CHECK-NEXT: .tc gi[TC],gi
|
||||
|
@ -1,12 +1,16 @@
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck -check-prefix=LARGE-BSS %s
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck --check-prefixes=LARGE,LARGE-BSS %s
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck --check-prefixes=LARGE,LARGE-SECUREPLT %s
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-netbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
|
||||
; RUN: llc < %s -mtriple=powerpc-unknown-openbsd -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
|
||||
; RUN: llc < %s -mtriple=powerpc-linux-musl -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
|
||||
; RUN: llc < %s -mtriple=powerpc-linux-musl -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
|
||||
$bar1 = comdat any
|
||||
|
||||
@bar = common global i32 0, align 4
|
||||
@bar1 = global i32 0, align 4, comdat($bar1)
|
||||
@bar2 = global i32 0, align 4, comdat($bar1)
|
||||
|
||||
declare i32 @call_foo(i32, ...)
|
||||
|
||||
@ -17,6 +21,14 @@ entry:
|
||||
ret i32 %0
|
||||
}
|
||||
|
||||
define i32 @load() {
|
||||
entry:
|
||||
%0 = load i32, i32* @bar1
|
||||
%1 = load i32, i32* @bar2
|
||||
%2 = add i32 %0, %1
|
||||
ret i32 %2
|
||||
}
|
||||
|
||||
!llvm.module.flags = !{!0}
|
||||
!0 = !{i32 1, !"PIC Level", i32 2}
|
||||
; LARGE-BSS: [[POFF:\.L[0-9]+\$poff]]:
|
||||
@ -33,10 +45,19 @@ entry:
|
||||
; LARGE-BSS-DAG: lwz {{[0-9]+}}, 0([[VREG]])
|
||||
; LARGE-BSS-DAG: stw {{[0-9]+}}, 8(1)
|
||||
; LARGE-BSS: lwz 30, 24(1)
|
||||
; LARGE-BSS: .section .got2,"aw",@progbits
|
||||
; LARGE-BSS-NEXT: .p2align 2
|
||||
; LARGE-BSS-NEXT: [[VREF]]:
|
||||
; LARGE-BSS-NEXT: .long bar
|
||||
; LARGE-SECUREPLT: addis 30, 30, .LTOC-.L0$pb@ha
|
||||
; LARGE-SECUREPLT: addi 30, 30, .LTOC-.L0$pb@l
|
||||
; LARGE-SECUREPLT: bl call_foo@PLT+32768
|
||||
|
||||
; LARGE: .section .bss.bar1,"aGw",@nobits,bar1,comdat
|
||||
; LARGE: bar1:
|
||||
; LARGE: .section .bss.bar2,"aGw",@nobits,bar1,comdat
|
||||
; LARGE: bar2:
|
||||
; LARGE: .section .got2,"aw",@progbits
|
||||
; LARGE-NEXT: .p2align 2
|
||||
; LARGE-NEXT: .LC0:
|
||||
; LARGE-NEXT: .long bar
|
||||
; LARGE-NEXT: .LC1:
|
||||
; LARGE-NEXT: .long bar1
|
||||
; LARGE-NEXT: .LC2:
|
||||
; LARGE-NEXT: .long bar2
|
||||
|
Loading…
x
Reference in New Issue
Block a user