1; RUN: llc < %s -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic -enable-pie \ 2; RUN: | FileCheck -check-prefix=X32 %s 3; RUN: llc < %s -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic -enable-pie \ 4; RUN: | FileCheck -check-prefix=X64 %s 5 6@i = thread_local global i32 15 7@i2 = external thread_local global i32 8 9define i32 @f1() { 10; X32: f1: 11; X32: movl %gs:i@NTPOFF, %eax 12; X32-NEXT: ret 13; X64: f1: 14; X64: movl %fs:i@TPOFF, %eax 15; X64-NEXT: ret 16 17entry: 18 %tmp1 = load i32* @i 19 ret i32 %tmp1 20} 21 22define i32* @f2() { 23; X32: f2: 24; X32: movl %gs:0, %eax 25; X32-NEXT: leal i@NTPOFF(%eax), %eax 26; X32-NEXT: ret 27; X64: f2: 28; X64: movq %fs:0, %rax 29; X64-NEXT: leaq i@TPOFF(%rax), %rax 30; X64-NEXT: ret 31 32entry: 33 ret i32* @i 34} 35 36define i32 @f3() { 37; X32: f3: 38; X32: movl i2@INDNTPOFF, %eax 39; X32-NEXT: movl %gs:(%eax), %eax 40; X32-NEXT: ret 41; X64: f3: 42; X64: movq i2@GOTTPOFF(%rip), %rax 43; X64-NEXT: movl %fs:(%rax), %eax 44; X64-NEXT: ret 45 46entry: 47 %tmp1 = load i32* @i2 48 ret i32 %tmp1 49} 50 51define i32* @f4() { 52; X32: f4: 53; X32: movl %gs:0, %eax 54; X32-NEXT: addl i2@INDNTPOFF, %eax 55; X32-NEXT: ret 56; X64: f4: 57; X64: movq %fs:0, %rax 58; X64-NEXT: addq i2@GOTTPOFF(%rip), %rax 59; X64-NEXT: ret 60 61entry: 62 ret i32* @i2 63} 64