Bug 15228 – Expose architecture specific feature sets at compile-time

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-10-20T08:32:20Z
Last change time
2024-12-13T18:45:24Z
Assigned to
No Owner
Creator
Marco Leise
Moved to GitHub: dmd#17729 →

Comments

Comment #0 by Marco.Leise — 2015-10-20T08:32:20Z
GDC and LLVM allow you to target a specific CPU model or activate additional feature sets like SSE4 on the command line. This allows them to use different instructions for intrinsics internally and better optimize the code. For example some newer x86 CPUs have a "count-leading-zeroes" instruction that other models need to emulate. If these were exposed in D at compile-time we could replace indirect function calls to either a generic or SSE4 based function with an inlinable call to the SSE4 function on later CPUs. This can come into effect everywhere a program is compiled from source for local use as in Vibe.d, Source only Linux distributions or personal projects, but also when distributing "SSE enhanced versions" of programs. As these flags are only relevant to subsets of the supported architectures they should probably be implemented as "version(SSE4_2)" etc. Existing code using -version=SSE4_2 on the command-line will in all likeliness continue to work as intended. I understand that since DMD always creates generic builds it is mostly a matter of documenting the version defines on http://dlang.org/version.html#PredefinedVersions. Though "extensions" available on all x64 CPUs like SSE2 should still be advertised when building with -m64, adding some benefit even there.
Comment #1 by robert.schadek — 2024-12-13T18:45:24Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17729 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB