diff options
author | Haochen Jiang <haochen.jiang@intel.com> | 2024-08-26 10:53:35 +0800 |
---|---|---|
committer | Haochen Jiang <haochen.jiang@intel.com> | 2024-08-26 11:10:47 +0800 |
commit | cba4566879192abdc54bdf76b010e22d67484129 (patch) | |
tree | 9901afea5ad32a9d3c9c16af5bad7ca125475e04 | |
parent | 17be00916e51835dcc47e30ed32fc892ee0c581d (diff) | |
download | gcc-cba4566879192abdc54bdf76b010e22d67484129.zip gcc-cba4566879192abdc54bdf76b010e22d67484129.tar.gz gcc-cba4566879192abdc54bdf76b010e22d67484129.tar.bz2 |
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.
-rw-r--r-- | gcc/testsuite/gcc.target/i386/m512-check.h | 66 |
1 files 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 68e74fc..d5d1837 100644 --- a/gcc/testsuite/gcc.target/i386/m512-check.h +++ b/gcc/testsuite/gcc.target/i386/m512-check.h @@ -63,6 +63,12 @@ typedef union typedef union { + __m512h x; + _Float16 a[32]; +} union512h; + +typedef union +{ __m128h x; _Float16 a[8]; } union128h; @@ -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 |