#define CPUID_LEAF1_ECX_XSAVE_MASK     (1 << 26)
 #define CPUID_LEAF1_ECX_OSXSAVE_MASK   (1 << 27)
-static inline void check_cpuid_xsave(void)
-{
-       uint32_t eax, ebx, ecx, edx;
-
-       /*
-        * CPUID.1:ECX.XSAVE[bit 26] enumerates general
-        * support for the XSAVE feature set, including
-        * XGETBV.
-        */
-       __cpuid_count(1, 0, eax, ebx, ecx, edx);
-       if (!(ecx & CPUID_LEAF1_ECX_XSAVE_MASK))
-               fatal_error("cpuid: no CPU xsave support");
-       if (!(ecx & CPUID_LEAF1_ECX_OSXSAVE_MASK))
-               fatal_error("cpuid: no OS xsave support");
-}
 
 static uint32_t xbuf_size;
 
 
 /* arch_prctl() and sigaltstack() test */
 
+#define ARCH_GET_XCOMP_SUPP    0x1021
 #define ARCH_GET_XCOMP_PERM    0x1022
 #define ARCH_REQ_XCOMP_PERM    0x1023
 
 
 int main(void)
 {
-       /* Check hardware availability at first */
-       check_cpuid_xsave();
+       unsigned long features;
+       long rc;
+
+       rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_SUPP, &features);
+       if (rc || (features & XFEATURE_MASK_XTILE) != XFEATURE_MASK_XTILE) {
+               ksft_print_msg("no AMX support\n");
+               return KSFT_SKIP;
+       }
+
        check_cpuid_xtiledata();
 
        init_stashed_xsave();