I've started using gcc target attributes and Intel intrinsics to make hardware specific implementations of certain functions. I'm unsure how to go about testing the different implementations easily. Given the example below, how can I, at either compile time or runtime, target/test the default case when executed on a machine that supports sse3?
#include <iostream>
__attribute__((target("default")))
void hello() {
std::cout << "Hello default wolrld" << std::endl;
}
__attribute__((target("sse3")))
void hello() {
std::cout << "Hello SSE3 world" << std::endl;
}
int main() {
hello();
}