You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
compiler-rt: omit symbols that are not needed because of machine instructions #11884
As an optimization, our compiler-rt can check if generating a given symbol would be redundant, because it would never be called due to a machine code instruction being available, and avoid calling @export for that symbol. This will make 2 small improvements:
Faster compiler-rt build from cold cache (fewer functions to optimize)
Faster link against compiler-rt (since the static archive will be smaller)
A compiler-rt symbol is unnecessary if the target architecture has a native machine code instruction for that operation. For example __multi3 multiplies two 128-bit integers producing a new 128-bit integer, so if the target architecture has a machine code instruction that also does this multiplication then __multi3 is unnecessary.
You could also try writing zig code and see if it lowers to a compiler-rt function call instead of machine code instructions. You do need to be mindful of CPU feature sets, however, and unfortunately we don't have a section in the language reference about this yet.
Activity
Vexu commentedon Jul 14, 2022
A compiler-rt symbol is unnecessary if the target architecture has a native machine code instruction for that operation. For example
__multi3multiplies two 128-bit integers producing a new 128-bit integer, so if the target architecture has a machine code instruction that also does this multiplication then__multi3is unnecessary.Vexu commentedon Jul 15, 2022
I'd recommend the architecture's Instruction Set Architecture manual or some equivalent document.
andrewrk commentedon Jul 15, 2022
You could also try writing zig code and see if it lowers to a compiler-rt function call instead of machine code instructions. You do need to be mindful of CPU feature sets, however, and unfortunately we don't have a section in the language reference about this yet.