flat assembler
Message board for the users of flat assembler.

Index > Programming Language Design > [speculative execution] compilers are worse than I thought

Author
Thread Post new topic Reply to topic
sylware



Joined: 23 Oct 2020
Posts: 719
Location: Marseille/France
sylware 20 Nov 2026, 16:03
Even if you tag the logical branches with some syntax extensions, the compiler will generate meh branching code based on what you know of the program in order to be friendly towards speculative execution, and I don't even talk about the "runtime".

It is a new level of inefficiency.

On the other side, writting assembly code friendly all the way to this speculative execution requires significantly more time.


EDIT:

High level languages should have explicit branching keywords: neutral branching, favored/likely branching, unfavored/unlikely branching.
Namely, while writing code, one must be picked. Since speculative execution is so ubiquitous, that should be the default syntax and not some "extension", that way programers will have an incentive to care about that.


Last edited by sylware on 23 Nov 2026, 13:00; edited 1 time in total
Post 20 Nov 2026, 16:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 21220
Location: In your JS exploiting you and your system
revolution 20 Nov 2026, 20:25
Wrong assumption about the purpose of HLL compilers maybe. HLL compilers aren't suitable for high performance code. That isn't their main purpose. They are meant to be used for "human readable" or "portable" code. Performance is an afterthought, an add-on.

HLL compilers will try to generate code that performs well, and many of them succeed in that goal. But forget about using HLL to create high performance code, they just aren't there.

GCC has an even worse option when generating code: -O3. They claim is it can create better performance, but with a lesser guarantee that the code will be correct. IMO that's the worst possible type of code to make, code that doesn't even do its job. There is no point in running faster if it runs in the wrong direction.
Post 20 Nov 2026, 20:25
View user's profile Send private message Visit poster's website Reply with quote
sylware



Joined: 23 Oct 2020
Posts: 719
Location: Marseille/France
sylware 21 Nov 2026, 01:21
But I know "human readable" is actually not really true: Proper assembly code does the same, and I know also "code readability" is not a guarantee with "HLL"s... Often the most important is to embrace the whole data model and be able to navigate thru it.


Portability, yeah, the only reason... but if everything goes RISC-V since it is a non IP locked standard, a lot of code paths may be significantly re-usable from one µarchitecture to another one.

EDIT: it is getting worse, it seems inlining 'basic functions' is almost "chaotic", as there is all the time enough semantic variations to make the machine code different while pleasing the speculative execution basic rule and doing a bit of branchless logic. Aka, nearly no small/generic set of patterns.
Post 21 Nov 2026, 01:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.