Skip to content

Loongarch64: Incorrect LSX/LASX CPU feature detection #5783

@looneko

Description

@looneko

These lines:

if(os_support_lsx) printf("#define HAVE_LSX\n");
if(os_support_lasx) printf("#define HAVE_LASX\n");

use the function itself instead of its call result to detect LSX/LASX features:

/* Detect whether the OS supports the LSX instruction set */
static int os_support_lsx() {
int hwcap = (int)getauxval(AT_HWCAP);
if (hwcap & LA_HWCAP_LSX)
return 1;
else
return 0;
}

This will cause the condition always returns true and enable the LSX/LASX features on unsupported loongarch64 target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions