Skip to content

LoongArch: LSX/LASX usage in CoreCLR #113354

Open
@driver1998

Description

@driver1998

I am trying to port CoreCLR to the 2K0300 SoC, a LoongArch SoC with no LSX/LASX support.

From what I can see, SIMD JIT codegen is guarded behind FEATURE_SIMD and is not enabled by default, so that's fine.

But context switching code in PAL uses LASX xvld/xvsd instruction to load/save floating point/vector registers without any checks.

See:

xvld $xr0, $a0, CONTEXT_FPU_OFFSET + 0

This breaks on 2K0300, and I think also the 2K1000 / 2K2000 chips that do have LSX but no LASX.

I partially reverted the change (d74b524) and got a ImageSharp / dotnet-iot sample running on the 2K0300. Will still need to figure out a cleaner way to do it, like checking LSX/LASX support in runtime and use the correct instructions in each senario.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions