mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
7840990de8
LDtocL, and other loads that roughly correspond to the TOC_ENTRY SDAG node, represent loads from the TOC, which is invariant. As a result, these loads can be hoisted out of loops, etc. In order to do this, we need to generate GOT-style MMOs for TOC_ENTRY, which requires treating it as a legitimate memory intrinsic node type. Once this is done, the MMO transfer is automatically handled for TableGen-driven instruction selection, and for nodes generated directly in PPCISelDAGToDAG, we need to transfer the MMOs manually. Also, we were not transferring MMOs associated with pre-increment loads, so do that too. Lastly, this fixes an exposed bug where R30 was not added as a defined operand of UpdateGBR. This problem was highlighted by an example (used to generate the test case) posted to llvmdev by Francois Pichet. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230553 91177308-0d34-0410-b5e6-96231b3b80d8
35 lines
1.2 KiB
LLVM
35 lines
1.2 KiB
LLVM
; RUN: llc -march=ppc64 -mcpu=pwr7 -O2 -relocation-model=pic < %s | FileCheck %s
|
|
|
|
target datalayout = "e-m:e-i64:64-n32:64"
|
|
target triple = "powerpc64le-unknown-linux-gnu"
|
|
|
|
; Test back-to-back stores of TLS variables to ensure call sequences no
|
|
; longer overlap.
|
|
|
|
@__once_callable = external thread_local global i8**
|
|
@__once_call = external thread_local global void ()*
|
|
|
|
define i64 @call_once(i64 %flag, i8* %ptr) {
|
|
entry:
|
|
%var = alloca i8*, align 8
|
|
store i8* %ptr, i8** %var, align 8
|
|
store i8** %var, i8*** @__once_callable, align 8
|
|
store void ()* @__once_call_impl, void ()** @__once_call, align 8
|
|
ret i64 %flag
|
|
}
|
|
|
|
; CHECK-LABEL: call_once:
|
|
; CHECK: addi 3, {{[0-9]+}}, __once_callable@got@tlsgd@l
|
|
; CHECK: bl __tls_get_addr(__once_callable@tlsgd)
|
|
; CHECK-NEXT: nop
|
|
; FIXME: We could check here for 'std {{[0-9]+}}, 0(3)', but that no longer
|
|
; works because, with new scheduling freedom, we create a copy of R3 based on the
|
|
; initial scheduling, but don't coalesce it again after we move the instructions
|
|
; so that the copy is no longer necessary.
|
|
; CHECK: addi 3, {{[0-9]+}}, __once_call@got@tlsgd@l
|
|
; CHECK: bl __tls_get_addr(__once_call@tlsgd)
|
|
; CHECK-NEXT: nop
|
|
; CHECK: std {{[0-9]+}}, 0(3)
|
|
|
|
declare void @__once_call_impl()
|