Handle an inline assembly feature of GCC: code prefixed with "%v", e. g. "%vpcmpestri" is transformed into "vpcmpestri" instruction if target supports AVX and into "pcmpestri" otherwise.
Given the code:
void f(void* arg) { __asm__ ("%vpcmpestri $0, (%1), %2" : "=c"(arg) : "r"(arg), "x"(arg)); }
"gcc -c test.c -o test.o" produces
movq -0x10(%rbp),%xmm0 pcmpestri $0x0,(%rax),%xmm0
While "gcc -c -march=corei7-avx test.c -o test.o" produces
vmovq %rdx,%xmm0 vpcmpestri $0x0,(%rax),%xmm0
This should probably check the feature set based on the function rather than the feature set of the base compile yes? What does gcc do if you put it in an attribute((target("..."))) function?