Bill Schmidt | 3d9674c | 2014-11-11 20:44:09 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=ppc64 -mcpu=pwr7 -O2 -relocation-model=pic < %s | FileCheck %s |
| 2 | |
| 3 | target datalayout = "e-m:e-i64:64-n32:64" |
| 4 | target triple = "powerpc64le-unknown-linux-gnu" |
| 5 | |
| 6 | ; Test back-to-back stores of TLS variables to ensure call sequences no |
| 7 | ; longer overlap. |
| 8 | |
| 9 | @__once_callable = external thread_local global i8** |
| 10 | @__once_call = external thread_local global void ()* |
| 11 | |
| 12 | define i64 @call_once(i64 %flag, i8* %ptr) { |
| 13 | entry: |
| 14 | %var = alloca i8*, align 8 |
| 15 | store i8* %ptr, i8** %var, align 8 |
| 16 | store i8** %var, i8*** @__once_callable, align 8 |
| 17 | store void ()* @__once_call_impl, void ()** @__once_call, align 8 |
| 18 | ret i64 %flag |
| 19 | } |
| 20 | |
| 21 | ; CHECK-LABEL: call_once: |
Bill Schmidt | 82f1c77 | 2015-02-10 19:09:05 +0000 | [diff] [blame] | 22 | ; CHECK: addi 3, {{[0-9]+}}, __once_callable@got@tlsgd@l |
Bill Schmidt | 3d9674c | 2014-11-11 20:44:09 +0000 | [diff] [blame] | 23 | ; CHECK: bl __tls_get_addr(__once_callable@tlsgd) |
| 24 | ; CHECK-NEXT: nop |
Hal Finkel | cf59921 | 2015-02-25 21:36:59 +0000 | [diff] [blame] | 25 | ; FIXME: We could check here for 'std {{[0-9]+}}, 0(3)', but that no longer |
| 26 | ; works because, with new scheduling freedom, we create a copy of R3 based on the |
| 27 | ; initial scheduling, but don't coalesce it again after we move the instructions |
| 28 | ; so that the copy is no longer necessary. |
Bill Schmidt | 82f1c77 | 2015-02-10 19:09:05 +0000 | [diff] [blame] | 29 | ; CHECK: addi 3, {{[0-9]+}}, __once_call@got@tlsgd@l |
Bill Schmidt | 3d9674c | 2014-11-11 20:44:09 +0000 | [diff] [blame] | 30 | ; CHECK: bl __tls_get_addr(__once_call@tlsgd) |
| 31 | ; CHECK-NEXT: nop |
Hal Finkel | 8acae52 | 2015-07-14 20:02:02 +0000 | [diff] [blame] | 32 | ; FIXME: We don't really need the copy here either, we could move the store up. |
| 33 | ; CHECK: mr [[REG1:[0-9]+]], 3 |
| 34 | ; CHECK: std {{[0-9]+}}, 0([[REG1]]) |
Bill Schmidt | 3d9674c | 2014-11-11 20:44:09 +0000 | [diff] [blame] | 35 | |
| 36 | declare void @__once_call_impl() |