This will be used for __builtin_thread_pointer in clang.
This is missing documentation. It *looks* like you're trying to get the
thread local storage pointer. Is that correct? This can't be reviewed
without context and documented intent.
This is indeed intended to fetch the TLS pointer: http://llvm.org/docs/LangRef.html#llvm-thread-pointer-intrinsic . For x86, this is simply the FS/GS base, ie. pointer to end of the TLS area. The intent is to support __builtin_thread_pointer() in clang, which comes useful in some strange places (eg. sanitizer_common uses it for aarch64, and could use it for x86 too if only gcc supported it as well).