- 
                Notifications
    
You must be signed in to change notification settings  - Fork 92
 
Description
I'm not sure if this is within scope of avo, but does there exist any polyfill-like support for converting, eg AVX512 instructions to AVX2?
For example, I am (actually) a new asm developer and I recently spent an hour trying to figure out why VMULPS.BCST(Imm(...), x y) resulted in a SIGILL before I realized that the m32bcst version is only available on AVX512F/AVX512VL.
I then thought about the compilation target and while my CPU doesn't support AVX512F, I'd like to be able to generate an AVX512F version of code that would conditionally execute for processors that do support it and fall back to the AVX2 version (VBROADCASTSS first and then VMULPS) for those that don't.
I can do this manually by conditionally generating the instructions but was wondering if there's a more pragmatic solution, similar to polyfilling, or maybe a high level directive similar to @supports? Maybe the API I'm envisioning is something like:
ctx := NewContext()
ctx.VMULPS_BCST(...)
if ctx.IsSupported(<some user-provided capabilities set>) {
  globalCtx.Add(ctx)
} else {
  // fallback implementation
}