xref: /llvm-project/llvm/test/CodeGen/PowerPC/pr17354.ll (revision 5403c59c608c08c8ecd4303763f08eb046eb5e4d)
1; RUN: llc -verify-machineinstrs -mcpu=pwr7 -relocation-model=pic <%s | FileCheck %s
2
3; Test that PR17354 is fixed.  We must generate a nop following even
4; local calls when generating code for shared libraries, to permit
5; TOC fixup.
6
7target 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"
8target triple = "powerpc64-unknown-linux-gnu"
9
10%struct.CS = type { i32 }
11
12@_ZL3glb = internal global [1 x %struct.CS] zeroinitializer, align 4
13@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__I_a, ptr null }]
14
15define internal void @__cxx_global_var_init() section ".text.startup" {
16entry:
17  call void @_Z4funcv(ptr sret(%struct.CS) @_ZL3glb)
18  ret void
19}
20
21; CHECK-LABEL: __cxx_global_var_init:
22; CHECK: bl _Z4funcv
23; CHECK-NEXT: nop
24
25; Function Attrs: nounwind
26define void @_Z4funcv(ptr noalias sret(%struct.CS) %agg.result) #0 {
27entry:
28  store i32 0, ptr %agg.result, align 4
29  ret void
30}
31
32define internal void @_GLOBAL__I_a() section ".text.startup" {
33entry:
34  call void @__cxx_global_var_init()
35  ret void
36}
37
38attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
39