In ARM mode, passing -mtp=cp15 forces the use of an inline MRC system register read to move the thread pointer value into a register. Currently, in Thumb2 mode, -mtp=cp15 is ignored, and a call to the __aeabi_read_tp helper is emitted instead. This is inconsistent, and breaks the Linux/ARM build for Thumb2 targets, as the Linux kernel does not provide an implementation of __aeabi_read_tp,. Reviewed By: nickdesaulniers, peter.smith Differential Revision: https://reviews.llvm.org/D112600
25 lines
769 B
LLVM
25 lines
769 B
LLVM
; RUN: llc -mtriple=armeb-linux-gnueabihf -O2 -mattr=+read-tp-hard %s -o - | FileCheck %s -check-prefix=CHECK-HARD
|
|
; RUN: llc -mtriple=armeb-linux-gnueabihf -O2 %s -o - | FileCheck %s -check-prefix=CHECK-SOFT
|
|
; RUN: llc -mtriple=thumbv7-linux-gnueabihf -O2 -mattr=+read-tp-hard %s -o - | FileCheck %s -check-prefix=CHECK-HARD
|
|
; RUN: llc -mtriple=thumbv7-linux-gnueabihf -O2 %s -o - | FileCheck %s -check-prefix=CHECK-SOFT
|
|
|
|
|
|
; __thread int counter;
|
|
; void foo() {
|
|
; counter = 5;
|
|
; }
|
|
|
|
|
|
@counter = thread_local local_unnamed_addr global i32 0, align 4
|
|
|
|
define void @foo() local_unnamed_addr #0 {
|
|
entry:
|
|
store i32 5, i32* @counter, align 4
|
|
ret void
|
|
}
|
|
|
|
|
|
; CHECK-LABEL: foo:
|
|
; CHECK-HARD: mrc p15, #0, {{r[0-9]+}}, c13, c0, #3
|
|
; CHECK-SOFT: bl __aeabi_read_tp
|