Date: Fri, 5 Sep 2025 22:45:03 +0200
There is an issue with the alignment of C23 _BitInt that on at least one common platform
- it is different from some existing wide vector (SIMD) types
- it is non-ideal for some wide vector types
That is important to know and to watch out for, what WG14 and the implementers are further doing about it.
But both arguments do not lessen the applicability and validness of _BitInt per se.
Arithmetic vs. special computations.
It depends on the platform and the application, what is possible and what the types are used for.
If the SHA unit does not support arithmetic operations and the user needs them, it is done with the existing arithmetic units. But the user program can just use the standardized type.
"FPGA's can get its own programming language, thank you very much, it does not grant it the right to coopt other systems programming language and force them to make such concessions." -> no words. Does anybody take something away from you?
-----Ursprüngliche Nachricht-----
Von:Tiago Freire via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Fr 05.09.2025 22:35
Betreff:Re: [std-proposals] D3666R0 Bit-precise integers
An:std-proposals_at_[hidden];
CC:Tiago Freire <tmiguelf_at_[hidden]>;
> > extended registers are a standard thing on most CPUs now a days, it's not like this is some hypothetical or anything.
> So... what hardware *are* you talking about? Is this hardware that actually exists, or are you speculating about what *might* happen?
Both things can be true.
Example: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=sha&ig_expand=5883
alignof(__m256i) = 32Bytes
alignof(__m128i) = 16Bytes
https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=AES&ig_expand=5883,223
alignof(__m512i) = 64bytes
> Can you give me a good reason to consider your ideas and expertise to be more valid than the people who invented the feature, shepherded it through the C committee, and are currently using it within that context?
Because maths! And the architecture design makes it impossible to be otherwise.
I don't need to show you the credentials of other people's opinion. I can just show it to you.
Because this how it actually works! This is publicly available information, open the specs of a couple of different CPU vendors.
Please see: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#ig_expand=5883,223,6115,6224,4031&text=_mm512_load_si512
And I don’t think you understand what __BitInt is for, it works for integer arithmetic, it does integer arithmetic and nothing else.
If that is all you do then 8byte alignment is perfectly fine (even if not as efficient as it could have been), that's what the 64bit registers that are capable of doing arithmetic need.
It doesn't do arbitrary registers because you think __BitInt(512) ought to give you access to zmm because you dreamed it would!
> And these are just the first few hits I got when I searched for this feature. So it seems pretty clear that the needs of FPGAs are in fact a core pillar of this feature. Given that fact, it seems a bit wrong-headed to ignore them when discussing the merits of that feature, yes?
I will ignore it all day. This is the C++ standard, should strive to be portable, and applicable to a wide range of platforms even if not applicable to every single platform in existence.
It's not for niche "It works on my FPGA so we are good".
FPGA's can get its own programming language, thank you very much, it does not grant it the right to coopt other systems programming language and force them to make such concessions.
__BitInt seems something like you should ask your FPGA vendor, not the C++ standard.
I don't think __BitInt made any sense to be in the C standard but then again I don't usually write C, other people disagree and they have the right to have their own opinion, this is mine.
-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_[hidden]> On Behalf Of Jason McKesson via Std-Proposals
Sent: Friday, September 5, 2025 19:33
To: std-proposals_at_[hidden]
Cc: Jason McKesson <jmckesson_at_[hidden]>
Subject: Re: [std-proposals] D3666R0 Bit-precise integers
On Fri, Sep 5, 2025 at 1:03 PM Tiago Freire <tmiguelf_at_[hidden]> wrote:
>
> This is the C++ standard mailing list, not your microcontroller implementation mailing list.
>
> Decisions affect everyone not just FPGAs.
Sure, but the need of FPGAs are one of the driving justifications for `_BitInt`. Like, it's in the very first paper for the C standard discussing it:
https://open-std.org/JTC1/SC22/WG14/www/docs/n2763%2epdf
Blog posts and forum discussions revolving around this feature frequently bring up FPGAs and other specialized hardware as a primary justification for it:
https://blog.tal.bi/posts/c23-bitint/
https://www.reddit.com/r/Compilers/comments/15az5kf/what_is_the_nature_of_bitint_in_c23_at_low_level/
And these are just the first few hits I got when I searched for this feature. So it seems pretty clear that the needs of FPGAs are in fact a core pillar of this feature. Given that fact, it seems a bit wrong-headed to ignore them when discussing the merits of that feature, yes?
> extended registers are a standard thing on most CPUs now a days, it's not like this is some hypothetical or anything.
So... what hardware *are* you talking about? Is this hardware that actually exists, or are you speculating about what *might* happen?
> And even for your microcontroller there is absolutely no reason why they would give you _BitInt- whatever to access specialized registers as opposed to giving specialized concrete types. Considering also that BitInt is to implement integer arithmetic, and you can't do general arithmetic with a sha register, so why even bother to do that instead of... you know... be optimized to use your arithmetic unit.
>
> This idea that _BitInt if available would allow you to use exotic registers is pure fantasy.
Can you give me a good reason to consider your ideas and expertise to be more valid than the people who invented the feature, shepherded it through the C committee, and are currently using it within that context? I'm not being snide here; we're talking about something that's had substantial discussion already. This isn't a hypothetical feature with a nebulous consequence; it's in the *past tense*. It's a thing people are actually using already, just in C rather than C++.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-09-05 20:56:24