* [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS
2020-09-07 13:46 [Bug target/96955] New: Implement __builtin_thread_pointer hjl.tools at gmail dot com
@ 2020-09-07 14:05 ` jakub at gcc dot gnu.org
2020-09-08 6:54 ` crazylht at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-07 14:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And if possible, optimize, so that if one does say
int *p = (int *)__builtin_thread_pointer ();
return p[4];
or
return p[i];
it will not read %fs:0 into a register and read 16(%reg), but rather read
%fs:16
etc. (of course only if not -mno-tls-direct-seg-refs) or not read
16(%reg,%regI,4) but %fs:16(,%regI,4) etc.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS
2020-09-07 13:46 [Bug target/96955] New: Implement __builtin_thread_pointer hjl.tools at gmail dot com
2020-09-07 14:05 ` [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS jakub at gcc dot gnu.org
@ 2020-09-08 6:54 ` crazylht at gmail dot com
2020-09-08 8:15 ` crazylht at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2020-09-08 6:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
Do we also need "__builtin_set_thread_pointer" ?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS
2020-09-07 13:46 [Bug target/96955] New: Implement __builtin_thread_pointer hjl.tools at gmail dot com
2020-09-07 14:05 ` [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS jakub at gcc dot gnu.org
2020-09-08 6:54 ` crazylht at gmail dot com
@ 2020-09-08 8:15 ` crazylht at gmail dot com
2020-09-09 8:29 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2020-09-08 8:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Jakub Jelinek from comment #1)
> And if possible, optimize, so that if one does say
> int *p = (int *)__builtin_thread_pointer ();
> return p[4];
> or
> return p[i];
> it will not read %fs:0 into a register and read 16(%reg), but rather read
> %fs:16
> etc. (of course only if not -mno-tls-direct-seg-refs) or not read
> 16(%reg,%regI,4) but %fs:16(,%regI,4) etc.
This optimization already exists in i386/x86-64 backend.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS
2020-09-07 13:46 [Bug target/96955] New: Implement __builtin_thread_pointer hjl.tools at gmail dot com
` (2 preceding siblings ...)
2020-09-08 8:15 ` crazylht at gmail dot com
@ 2020-09-09 8:29 ` cvs-commit at gcc dot gnu.org
2020-09-09 8:40 ` crazylht at gmail dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-09 8:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:
https://gcc.gnu.org/g:e470d8af81d390df1166e9d9cf10b00c0692a495
commit r11-3067-ge470d8af81d390df1166e9d9cf10b00c0692a495
Author: liuhongt <hongtao.liu@intel.com>
Date: Tue Sep 8 15:44:58 2020 +0800
Implement __builtin_thread_pointer for x86 TLS.
gcc/ChangeLog:
PR target/96955
* config/i386/i386.md (get_thread_pointer<mode>): New
expander.
gcc/testsuite/ChangeLog:
* gcc.target/i386/builtin_thread_pointer.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS
2020-09-07 13:46 [Bug target/96955] New: Implement __builtin_thread_pointer hjl.tools at gmail dot com
` (3 preceding siblings ...)
2020-09-09 8:29 ` cvs-commit at gcc dot gnu.org
@ 2020-09-09 8:40 ` crazylht at gmail dot com
2020-09-09 11:05 ` hjl.tools at gmail dot com
2020-09-09 17:44 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: crazylht at gmail dot com @ 2020-09-09 8:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
--- Comment #5 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC11.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS
2020-09-07 13:46 [Bug target/96955] New: Implement __builtin_thread_pointer hjl.tools at gmail dot com
` (4 preceding siblings ...)
2020-09-09 8:40 ` crazylht at gmail dot com
@ 2020-09-09 11:05 ` hjl.tools at gmail dot com
2020-09-09 17:44 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: hjl.tools at gmail dot com @ 2020-09-09 11:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |11.0
--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for GCC 11.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/96955] Implement __builtin_thread_pointer for x86 TLS
2020-09-07 13:46 [Bug target/96955] New: Implement __builtin_thread_pointer hjl.tools at gmail dot com
` (5 preceding siblings ...)
2020-09-09 11:05 ` hjl.tools at gmail dot com
@ 2020-09-09 17:44 ` cvs-commit at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-09 17:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96955
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:
https://gcc.gnu.org/g:bf69edf8ce47ca618eff30df2308279a40b22096
commit r11-3081-gbf69edf8ce47ca618eff30df2308279a40b22096
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Sep 9 10:29:47 2020 -0700
x32: Update gcc.target/i386/builtin_thread_pointer.c
Update gcc.target/i386/builtin_thread_pointer.c for x32. For
int
foo3 (int i)
{
int* p = (int*) __builtin_thread_pointer ();
return p[i];
}
we can't generate:
movl %fs:0(,%edi,4), %eax
ret
for x32 since the address of %fs:0(,%edi,4) is %fs + zero-extended to 64
bits of 0(,%edi,4). Instead, we generate:
movl %fs:0, %eax
movl (%eax,%edi,4), %eax
PR target/96955
* gcc.target/i386/builtin_thread_pointer.c: Update scan-assembler
for x32.
^ permalink raw reply [flat|nested] 8+ messages in thread