https://gcc.gnu.org/g:cba4566879192abdc54bdf76b010e22d67484129
commit r15-3175-gcba4566879192abdc54bdf76b010e22d67484129 Author: Haochen Jiang <haochen.ji...@intel.com> Date: Mon Aug 26 10:53:35 2024 +0800 i386: Refactor m512-check.h After AVX10 introduction, we still want to use AVX512 helper functions to avoid duplicate code. In order to reuse them, we need to do some refactor to make sure each function define happen under correct ISA to avoid ABI warnings. gcc/testsuite/ChangeLog: * gcc.target/i386/m512-check.h: Wrap the function define with correct vector size. Diff: --- gcc/testsuite/gcc.target/i386/m512-check.h | 66 ++++++++++++++++-------------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/m512-check.h b/gcc/testsuite/gcc.target/i386/m512-check.h index 68e74fce68d2..d5d183729473 100644 --- a/gcc/testsuite/gcc.target/i386/m512-check.h +++ b/gcc/testsuite/gcc.target/i386/m512-check.h @@ -61,6 +61,12 @@ typedef union unsigned long long a[8]; } union512i_uq; +typedef union +{ + __m512h x; + _Float16 a[32]; +} union512h; + typedef union { __m128h x; @@ -73,27 +79,6 @@ typedef union _Float16 a[16]; } union256h; -typedef union -{ - __m512h x; - _Float16 a[32]; -} union512h; - -CHECK_EXP (union512i_b, char, "%d") -CHECK_EXP (union512i_w, short, "%d") -CHECK_EXP (union512i_d, int, "0x%x") -CHECK_EXP (union512i_q, long long, "0x%llx") -CHECK_EXP (union512, float, "%f") -CHECK_EXP (union512d, double, "%f") -CHECK_EXP (union512i_ub, unsigned char, "%d") -CHECK_EXP (union512i_uw, unsigned short, "%d") -CHECK_EXP (union512i_ud, unsigned int, "0x%x") -CHECK_EXP (union512i_uq, unsigned long long, "0x%llx") - - -CHECK_FP_EXP (union512, float, ESP_FLOAT, "%f") -CHECK_FP_EXP (union512d, double, ESP_DOUBLE, "%f") - #define CHECK_ROUGH_EXP(UNION_TYPE, VALUE_TYPE, FMT) \ static int \ __attribute__((noinline, unused)) \ @@ -126,28 +111,47 @@ check_rough_##UNION_TYPE (UNION_TYPE u, const VALUE_TYPE *v, \ return err; \ } -CHECK_ROUGH_EXP (union512, float, "%f") -CHECK_ROUGH_EXP (union512d, double, "%f") +#ifndef ESP_FLOAT16 +#define ESP_FLOAT16 0.27 +#endif + CHECK_ROUGH_EXP (union256, float, "%f") CHECK_ROUGH_EXP (union256d, double, "%f") CHECK_ROUGH_EXP (union128, float, "%f") CHECK_ROUGH_EXP (union128d, double, "%f") -#ifdef AVX512FP16 +#ifndef AVX512F_LEN +CHECK_EXP (union512i_b, char, "%d") +CHECK_EXP (union512i_w, short, "%d") +CHECK_EXP (union512i_d, int, "0x%x") +CHECK_EXP (union512i_q, long long, "0x%llx") +CHECK_EXP (union512, float, "%f") +CHECK_EXP (union512d, double, "%f") +CHECK_EXP (union512i_ub, unsigned char, "%d") +CHECK_EXP (union512i_uw, unsigned short, "%d") +CHECK_EXP (union512i_ud, unsigned int, "0x%x") +CHECK_EXP (union512i_uq, unsigned long long, "0x%llx") + +CHECK_FP_EXP (union512, float, ESP_FLOAT, "%f") +CHECK_FP_EXP (union512d, double, ESP_DOUBLE, "%f") -CHECK_EXP (union128h, _Float16, "%f") -CHECK_EXP (union256h, _Float16, "%f") -CHECK_EXP (union512h, _Float16, "%f") +CHECK_ROUGH_EXP (union512, float, "%f") +CHECK_ROUGH_EXP (union512d, double, "%f") -#ifndef ESP_FLOAT16 -#define ESP_FLOAT16 0.27 +#if defined(AVX512FP16) +CHECK_EXP (union512h, _Float16, "%f") +CHECK_FP_EXP (union512h, _Float16, ESP_FLOAT16, "%f") +CHECK_ROUGH_EXP (union512h, _Float16, "%f") +#endif #endif +#if defined(AVX512FP16) +CHECK_EXP (union128h, _Float16, "%f") +CHECK_EXP (union256h, _Float16, "%f") + CHECK_FP_EXP (union128h, _Float16, ESP_FLOAT16, "%f") CHECK_FP_EXP (union256h, _Float16, ESP_FLOAT16, "%f") -CHECK_FP_EXP (union512h, _Float16, ESP_FLOAT16, "%f") CHECK_ROUGH_EXP (union128h, _Float16, "%f") CHECK_ROUGH_EXP (union256h, _Float16, "%f") -CHECK_ROUGH_EXP (union512h, _Float16, "%f") #endif