@cputarget attribute
Set the attribute, e.g. @cputarget("sse3") to compile a particular function for a particular featureset.
Possibilities:
fn void foo() @target("sse4.1") { ... }
fn void foo() @target(sse4_1) { ... }
If string:
fn void foo() @target("v1+sse4.1+ssse3-mmx") { ... }
fn void foo() @target("cpu=v1,+sse4.1,+ssse3,-mmx") { ... }
fn void foo() @target(.cpu = "v1",.features = "sse4.1,+ssse3,-mmx") { ... }
fn void foo() @target("v1", "sse4.1", "ssse3", !"mmx") { ... }
If not:
fn void foo() @target(v1, sse4_1, ssse3, !mmx) { ... }
fn void foo() @target(v1: +sse4_1, +ssse3, -mmx) { ... }
fn void foo() @target(v1) @features(sse4_1, ssse3, !mmx) { ... }
fn void foo() @target(v1: sse4_1, ssse3, !mmx) { ... }
I think it will useful for asm-functions only.
It's intended for being able to write for multiple targets in the same compilation. ASM will always ignore instruction limitations.
It's intended for being able to write for multiple targets in the same compilation.
I don't understand what it's for. To generate multiple binaries? Or will an application detect CPU's features in runtime and use optimized functions?
For the latter, like you can use CPUID to switch between calling function A or B depending on what CPU is detected at startup.
Yes. As a former Delphi/FreePascal developer I know that their runtime can use CPU capability detection to override memory manager fastmove functions. :)
Yeah, so this was the idea. I had some thoughts of doing "target_clone" from GCC, but I think I limit myself to just "target" as there are some challenges making it work seamlessly.