[PATCH] D16474: Use PC-relative address for x32 TLS address

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 13:16:41 PST 2016


On 25 January 2016 at 13:07, H.J Lu <hjl.tools at gmail.com> wrote:
> hjl.tools added a comment.
>
> Since llvm doesn't support TLS for x32:
>
> [hjl at gnu-mic-2 X86]$ cat x32-tls-1.ll
> @x = thread_local global i32 0, align 4
>
> define i32* @get_x() {
> entry:
>
>   ret i32* @x
>
> }
> [hjl at gnu-mic-2 X86]$ /export/build/gnu/llvm-clang/build-x86_64-linux/bin/llc -relocation-model=pic -mtriple=x86_64-linux-gnux32 < x32-tls-1.ll
>         .text
>         .file   "<stdin>"
> LLVM ERROR: Cannot select: 0x29507a0: ch,glue = X86ISD::TLSADDR 0x28fc140, TargetGlobalTLSAddress:i32<i32* @x> 0 [TF=7]
>
>   0x2950670: i32 = TargetGlobalTLSAddress<i32* @x> 0 [TF=7]
>
> In function: get_x
> [hjl at gnu-mic-2 X86]$
>
> I don't know how to create a test for this change.

Your patches fixes the error? If so you can add the test to
llvm/test/CodeGen/X86. Just run llc and FileCheck to see it is
printing the expected result.

Cheers,
Rafael


More information about the llvm-commits mailing list