Skip to content

All Vector<T> operators use software fallbacks when AVX is not presented #89408

Description

@EgorBo

Filing an issue on @stephentoub's behalf:

intCount()=>Vector<int>.Count;Vector<int>Add(Vector<int>a,Vector<int>b)=>a+b;

Codegen on a CPU with AVX2:

; Method Tests:Count():int:this (FullOpts)moveax,8ret; Method Tests:Addvmovupsymm0, ymmword ptr [r8]vpadddymm0,ymm0, ymmword ptr [r9]vmovups ymmword ptr [rdx],ymm0movrax,rdxvzeroupperret

Looks perfect, Vector<> is 256bit as expected. Now we if compile it without AVX (e.g. DOTNET_EnableAVX=0):

; Method Tests:Count():int:this (FullOpts)moveax,4ret; Method Tests:AddG_M64079_IG01: ;; offset=0000Hpushrdipushrsipushrbppushrbxsubrsp,88movrsi,rdxG_M64079_IG02: ;; offset=000BHmovupsxmm0, xmmword ptr [r8]movups xmmword ptr [rsp+38H],xmm0movupsxmm0, xmmword ptr [r9]movups xmmword ptr [rsp+28H],xmm0xoredi,ediG_M64079_IG03: ;; offset=001FHtestedi,edijl SHORT G_M64079_IG05G_M64079_IG04: ;; offset=0023Hxorecx,ecxcmpedi,4 setl cltestcl,cljne SHORT G_M64079_IG06G_M64079_IG05: ;; offset=002FHmovrdx,0x1EB80200008 ; ''movrcx,rdxcall[System.Diagnostics.Debug:Fail(System.String,System.String)]G_M64079_IG06: ;; offset=0042Hlearcx, bword ptr [rsp+38H]movsxdrbx,edimovebp, dword ptr [rcx+4*rbx]testedi,edijl SHORT G_M64079_IG08G_M64079_IG07: ;; offset=0051Hxorecx,ecxcmpedi,4 setl cltestcl,cljne SHORT G_M64079_IG09G_M64079_IG08: ;; offset=005DHmovrdx,0x1EB80200008 ; ''movrcx,rdxcall[System.Diagnostics.Debug:Fail(System.String,System.String)]G_M64079_IG09: ;; offset=0070Hlearcx, bword ptr [rsp+28H]addebp, dword ptr [rcx+4*rbx]testedi,edijl SHORT G_M64079_IG11G_M64079_IG10: ;; offset=007CHxorecx,ecxcmpedi,4 setl cltestcl,cljne SHORT G_M64079_IG12G_M64079_IG11: ;; offset=0088Hmovrdx,0x1EB80200008 ; ''movrcx,rdxcall[System.Diagnostics.Debug:Fail(System.String,System.String)]G_M64079_IG12: ;; offset=009BHlearax, bword ptr [rsp+48H]mov dword ptr [rax+4*rbx],ebpincedicmpedi,4jl G_M64079_IG03G_M64079_IG13: ;; offset=00AEHmovupsxmm0, xmmword ptr [rsp+48H]movups xmmword ptr [rsi],xmm0movrax,rsiG_M64079_IG14: ;; offset=00B9Haddrsp,88poprbxpoprbppoprsipoprdiret

we get 128-bit Vector<T> (expected) and software fallback for all operators - it feels like they're marked as "needs avx2".

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions