C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fix bad thread_local codegen (using an attribute?)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 21 Jan 2026 20:39:59 -0800
On Wednesday, 21 January 2026 19:18:19 Pacific Standard Time Levo D via Std-
Proposals wrote:
> Sorry for the last email. I'm not sure what happened I don't use mutt to
> write emails that often. I meant to say the below
>
> I'm not sure how many developers would say that after looking at the
> assembly.
>
> clang (21.1) and gcc (15.2) are nowhere near the __thread codegen, it's
> almost 10x the code

No, they are not. They are *exactly* the same if you take some simple
precautions:

https://godbolt.org/z/dj6sY9oc1

> Unless you care about performance, which is why I measured and noticed this
> years ago. I was talking to this with a friend (and ran into a situation
> where __thread won't compile). I figure this may not get fixed unless it's
> discussed

Discussion over?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-01-22 04:40:06