From patchwork Wed Sep 18 07:47:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiang, Haochen" X-Patchwork-Id: 97633 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF7643858D34 for ; Wed, 18 Sep 2024 07:47:50 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by sourceware.org (Postfix) with ESMTPS id 16F6F3858D26 for ; Wed, 18 Sep 2024 07:47:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16F6F3858D26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 16F6F3858D26 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726645641; cv=none; b=np9y9s0n7QuK/PlFBZwjikiHj46YiUefALV0nUtipP+l4pUp/6pSWuPZCWaPm25FK+NVRL6M4sDNsHLwvfNSrP6LzYC2sPqzAJRebq65jYiMbzsRtnvTxcfeVkPXFvfwtA7zRJWEN4jj+egPSERWeCjivJugmT4T0TDtDOs5jmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1726645641; c=relaxed/simple; bh=DaTPDCPLTBWSyzPVOHipTvl797F9OPE6WjhgTdl2gQw=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=onh2IOWuD6L4ALeDZxudtyiGdRju/j/siQaj3QOoVKiZS55BRXY6CxlLMttX2SxlTahi8HL7omzoiT8LsZcfCp45KBuWaPJWAkJpllq8paci+CdZTI7ReMxdcRdgVvImsMmQoVf5fCFun8mXpE0NjmPq7OfPinRxg3I9HU1AFew= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1726645638; x=1758181638; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=DaTPDCPLTBWSyzPVOHipTvl797F9OPE6WjhgTdl2gQw=; b=FNmQOQW0by1MjJ1wqBL0m6JNy+0YiJtfBGdai7FRE15RYM9BdxPMpdPK 161EmUFlc7pabR62/KD6SPK0Zhc3NZVNy3hfBPo7ECJss5F43x0yH1JRj k2t9Rahnew9ePTPmf/oAljtOH0kZCIhgH2kZteqB+6jdvSBoufzwQIK4R yN1WGO25eCqYsqKwr9F53VxE15Bu+i5xbBT9OgryWTGBj1iw7tZxYwnvq BzWT61wfqnP3+k9qOPp9izbYuQfXyGvi9Vosj2UtXCovyAVTwPYJbdPY7 9DN59+htwRJE+WtY1vC4R992HPGCBQKN4u5u0TB5qEUVKv1QWGExWZQx5 w==; X-CSE-ConnectionGUID: Tq9VZklBQaizBjXHaKNxiw== X-CSE-MsgGUID: qNB6Kpw4QbOlmEha2Gim5g== X-IronPort-AV: E=McAfee;i="6700,10204,11198"; a="29284124" X-IronPort-AV: E=Sophos;i="6.10,238,1719903600"; d="scan'208";a="29284124" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2024 00:47:16 -0700 X-CSE-ConnectionGUID: HjnePsa9RkCc2UfFyCnhRA== X-CSE-MsgGUID: NR18DdL6S3+dDIuixdnPEg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,238,1719903600"; d="scan'208";a="74009448" Received: from shliclel4217.sh.intel.com ([10.239.240.127]) by fmviesa004.fm.intel.com with ESMTP; 18 Sep 2024 00:47:14 -0700 From: Haochen Jiang To: gcc-patches@gcc.gnu.org Cc: hongtao.liu@intel.com, ubizjak@gmail.com Subject: [PATCH v2] i386: Enhance AVX10.2 convert tests Date: Wed, 18 Sep 2024 15:47:13 +0800 Message-Id: <20240918074713.847318-1-haochen.jiang@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Hi all, For AVX10.2 convert tests, all of them are missing mask tests previously, this patch will add them in the tests. Tested on sde with assembler with corresponding insts. Ok for trunk? Thx, Haochen gcc/testsuite/ChangeLog: * gcc.target/i386/avx10_2-512-vcvt2ps2phx-2.c: Enhance mask test. * gcc.target/i386/avx10_2-512-vcvtbiasph2bf8-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtbiasph2bf8s-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtbiasph2hf8-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtbiasph2hf8s-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvthf82ph-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtne2ph2bf8-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtne2ph2bf8s-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtne2ph2hf8-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtne2ph2hf8s-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtneph2bf8-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtneph2bf8s-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtneph2hf8-2.c: Ditto. * gcc.target/i386/avx10_2-512-vcvtneph2hf8s-2.c: Ditto. * gcc.target/i386/avx512f-helper.h: Fix a typo in macro define. --- .../i386/avx10_2-512-vcvt2ps2phx-2.c | 35 ++++++++++++------- .../i386/avx10_2-512-vcvtbiasph2bf8-2.c | 25 ++++++++++--- .../i386/avx10_2-512-vcvtbiasph2bf8s-2.c | 28 ++++++++++++--- .../i386/avx10_2-512-vcvtbiasph2hf8-2.c | 25 ++++++++++--- .../i386/avx10_2-512-vcvtbiasph2hf8s-2.c | 25 ++++++++++--- .../i386/avx10_2-512-vcvthf82ph-2.c | 27 ++++++++++---- .../i386/avx10_2-512-vcvtne2ph2bf8-2.c | 25 ++++++++++--- .../i386/avx10_2-512-vcvtne2ph2bf8s-2.c | 25 ++++++++++--- .../i386/avx10_2-512-vcvtne2ph2hf8-2.c | 25 ++++++++++--- .../i386/avx10_2-512-vcvtne2ph2hf8s-2.c | 25 ++++++++++--- .../i386/avx10_2-512-vcvtneph2bf8-2.c | 29 ++++++++++----- .../i386/avx10_2-512-vcvtneph2bf8s-2.c | 27 ++++++++++---- .../i386/avx10_2-512-vcvtneph2hf8-2.c | 27 ++++++++++---- .../i386/avx10_2-512-vcvtneph2hf8s-2.c | 27 ++++++++++---- .../gcc.target/i386/avx512f-helper.h | 2 +- 15 files changed, 295 insertions(+), 82 deletions(-) diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvt2ps2phx-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvt2ps2phx-2.c index 40dbe18abbe..5e355ae53d4 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvt2ps2phx-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvt2ps2phx-2.c @@ -10,24 +10,25 @@ #include "avx10-helper.h" #include -#define SIZE_RES (AVX512F_LEN / 16) +#define SIZE (AVX512F_LEN / 16) +#include "avx512f-mask-type.h" static void CALC (_Float16 *res_ref, float *src1, float *src2) { float fp32; int i; - for (i = 0; i < SIZE_RES / 2; i++) + for (i = 0; i < SIZE / 2; i++) { fp32 = (float) 2 * i + 7 + i * 0.5; res_ref[i] = fp32; src2[i] = fp32; } - for (i = SIZE_RES / 2; i < SIZE_RES; i++) + for (i = SIZE / 2; i < SIZE; i++) { fp32 = (float)2 * i + 7 + i * 0.5; res_ref[i] = fp32; - src1[i - (SIZE_RES / 2)] = fp32; + src1[i - (SIZE / 2)] = fp32; } } @@ -35,17 +36,27 @@ void TEST (void) { int i; - UNION_TYPE (AVX512F_LEN, h) res1; + UNION_TYPE (AVX512F_LEN, h) res1, res2, res3; UNION_TYPE (AVX512F_LEN, ) src1, src2; - _Float16 res_ref[SIZE_RES]; - float fp32; - - for (i = 0; i < SIZE_RES; i++) - res1.a[i] = 5; - + MASK_TYPE mask = MASK_VALUE; + _Float16 res_ref[SIZE]; + + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC (res_ref, src1.a, src2.a); - + res1.x = INTRINSIC (_cvtx2ps_ph) (src1.x, src2.x); if (UNION_CHECK (AVX512F_LEN, h) (res1, res_ref)) abort (); + + res2.x = INTRINSIC (_mask_cvtx2ps_ph) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, h) (res2, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtx2ps_ph) (mask, src1.x, src2.x); + MASK_ZERO (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, h) (res3, res_ref)) + abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8-2.c index 9ce3c9059f1..08450418dae 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8-2.c @@ -15,6 +15,9 @@ #define SRC_F16 (AVX512F_LEN / 16) #define DST_F8_I8 (AVX512F_LEN_HALF / 8) #define DST_F16 (AVX512F_LEN_HALF / 16) +#define SIZE SRC_F16 + +#include "avx512f-mask-type.h" void CALC (unsigned char *r, char *src1, _Float16 *src2) @@ -39,9 +42,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, i_b) src1; UNION_TYPE (AVX512F_LEN, h) src2; + MASK_TYPE mask = MASK_VALUE; unsigned char res_ref[DST_F8_I8]; sign = 1; @@ -51,9 +55,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtbiasph_pbf8) (src1.x, src2.x); - CALC(res_ref, src1.a, src2.a); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + + CALC (res_ref, src1.a, src2.a); + + res1.x = INTRINSIC (_cvtbiasph_pbf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res1, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtbiasph_pbf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res2, res_ref)) + abort (); - if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + res3.x = INTRINSIC (_maskz_cvtbiasph_pbf8) (mask, src1.x, src2.x); + MASK_ZERO (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res3, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8s-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8s-2.c index 5e33b8dc498..07d5130d4bc 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8s-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2bf8s-2.c @@ -15,6 +15,9 @@ #define SRC_F16 (AVX512F_LEN / 16) #define DST_F8_I8 (AVX512F_LEN_HALF / 8) #define DST_F16 (AVX512F_LEN_HALF / 16) +#define SIZE SRC_F16 + +#include "avx512f-mask-type.h" void CALC (unsigned char *r, char *src1, _Float16 *src2) @@ -39,9 +42,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, i_b) src1; UNION_TYPE (AVX512F_LEN, h) src2; + MASK_TYPE mask = MASK_VALUE; unsigned char res_ref[DST_F8_I8]; sign = 1; @@ -51,9 +55,23 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtbiassph_pbf8) (src1.x, src2.x); - CALC(res_ref, src1.a, src2.a); - - if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + + CALC (res_ref, src1.a, src2.a); + + + res1.x = INTRINSIC (_cvtbiassph_pbf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res1, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtbiassph_pbf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res2, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtbiassph_pbf8) (mask, src1.x, src2.x); + MASK_ZERO (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res3, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8-2.c index 96d1a33adcd..2f825a6cbeb 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8-2.c @@ -15,6 +15,9 @@ #define SRC_F16 (AVX512F_LEN / 16) #define DST_F8_I8 (AVX512F_LEN_HALF / 8) #define DST_F16 (AVX512F_LEN_HALF / 16) +#define SIZE SRC_F16 + +#include "avx512f-mask-type.h" void CALC (unsigned char *r, char *src1, _Float16 *src2) @@ -39,9 +42,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, i_b) src1; UNION_TYPE (AVX512F_LEN, h) src2; + MASK_TYPE mask = MASK_VALUE; unsigned char res_ref[DST_F8_I8]; sign = 1; @@ -51,9 +55,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtbiasph_phf8) (src1.x, src2.x); - CALC(res_ref, src1.a, src2.a); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + + CALC (res_ref, src1.a, src2.a); + + res1.x = INTRINSIC (_cvtbiasph_phf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res1, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtbiasph_phf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res2, res_ref)) + abort (); - if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + res3.x = INTRINSIC (_maskz_cvtbiasph_phf8) (mask, src1.x, src2.x); + MASK_ZERO (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res3, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8s-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8s-2.c index e66b952a45e..5fdc8709f11 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8s-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtbiasph2hf8s-2.c @@ -15,6 +15,9 @@ #define SRC_F16 (AVX512F_LEN / 16) #define DST_F8_I8 (AVX512F_LEN_HALF / 8) #define DST_F16 (AVX512F_LEN_HALF / 16) +#define SIZE SRC_F16 + +#include "avx512f-mask-type.h" void CALC (unsigned char *r, char *src1, _Float16 *src2) @@ -39,9 +42,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, i_b) src1; UNION_TYPE (AVX512F_LEN, h) src2; + MASK_TYPE mask = MASK_VALUE; unsigned char res_ref[DST_F8_I8]; sign = 1; @@ -51,9 +55,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtbiassph_phf8) (src1.x, src2.x); - CALC(res_ref, src1.a, src2.a); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + + CALC (res_ref, src1.a, src2.a); + + res1.x = INTRINSIC (_cvtbiassph_phf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res1, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtbiassph_phf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res2, res_ref)) + abort (); - if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + res3.x = INTRINSIC (_maskz_cvtbiassph_phf8) (mask, src1.x, src2.x); + MASK_ZERO (i_b) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res3, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvthf82ph-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvthf82ph-2.c index 6b9f07ff86a..1aa5daa6c58 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvthf82ph-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvthf82ph-2.c @@ -12,13 +12,14 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN_HALF / 8) -#define SIZE_RES (AVX512F_LEN / 16) +#define SIZE (AVX512F_LEN / 16) +#include "avx512f-mask-type.h" void CALC (_Float16 *r, unsigned char *s) { int i; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) r[i] = convert_hf8_to_fp16(s[i]); } @@ -26,9 +27,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN, h) res; + UNION_TYPE (AVX512F_LEN, h) res1, res2, res3; UNION_TYPE (AVX512F_LEN_HALF, i_b) src; - _Float16 res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + _Float16 res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -37,9 +39,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvthf8_ph) (src.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src.a); - if (UNION_ROUGH_CHECK (AVX512F_LEN, h) (res, res_ref, 0.0009765625)) + res1.x = INTRINSIC (_cvthf8_ph) (src.x); + if (UNION_ROUGH_CHECK (AVX512F_LEN, h) (res1, res_ref, 0.0009765625)) + abort (); + + res2.x = INTRINSIC (_mask_cvthf8_ph) (res2.x, mask, src.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_ROUGH_CHECK (AVX512F_LEN, h) (res2, res_ref, 0.0009765625)) + abort (); + + res3.x = INTRINSIC (_maskz_cvthf8_ph) (mask, src.x); + MASK_ZERO (h) (res_ref, mask, SIZE); + if (UNION_ROUGH_CHECK (AVX512F_LEN, h) (res3, res_ref, 0.0009765625)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8-2.c index 96fa7c1634d..69d5ae2a9e0 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8-2.c @@ -12,7 +12,8 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN / 8) +#define SIZE (AVX512F_LEN / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) @@ -24,7 +25,7 @@ CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) hf8_bf8 = 1; saturate = 0; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -45,9 +46,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN, i_b) res; + UNION_TYPE (AVX512F_LEN, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src1, src2; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -57,9 +59,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtne2ph_pbf8) (src1.x, src2.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src1.a, src2.a); + res1.x = INTRINSIC (_cvtne2ph_pbf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtne2ph_pbf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtne2ph_pbf8) (mask, src1.x, src2.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8s-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8s-2.c index cead411e178..fee2272c1d4 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8s-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2bf8s-2.c @@ -12,7 +12,8 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN / 8) +#define SIZE (AVX512F_LEN / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) @@ -24,7 +25,7 @@ CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) hf8_bf8 = 1; saturate = 1; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -45,9 +46,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN, i_b) res; + UNION_TYPE (AVX512F_LEN, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src1, src2; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -57,9 +59,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtnes2ph_pbf8) (src1.x, src2.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src1.a, src2.a); + res1.x = INTRINSIC (_cvtnes2ph_pbf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtnes2ph_pbf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtnes2ph_pbf8) (mask, src1.x, src2.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8-2.c index 6887b4085f5..73c09adf14e 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8-2.c @@ -12,7 +12,8 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN / 8) +#define SIZE (AVX512F_LEN / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) @@ -24,7 +25,7 @@ CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) hf8_bf8 = 0; saturate = 0; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -45,9 +46,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN, i_b) res; + UNION_TYPE (AVX512F_LEN, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src1, src2; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -57,9 +59,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtne2ph_phf8) (src1.x, src2.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src1.a, src2.a); + res1.x = INTRINSIC (_cvtne2ph_phf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtne2ph_phf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtne2ph_phf8) (mask, src1.x, src2.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8s-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8s-2.c index 6637d5e726f..84a4140adcf 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8s-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtne2ph2hf8s-2.c @@ -12,7 +12,8 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN / 8) +#define SIZE (AVX512F_LEN / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) @@ -24,7 +25,7 @@ CALC (unsigned char *r, _Float16 *s1, _Float16 *s2) hf8_bf8 = 0; saturate = 1; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -45,9 +46,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN, i_b) res; + UNION_TYPE (AVX512F_LEN, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src1, src2; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -57,9 +59,22 @@ TEST (void) sign *= -1; } - res.x = INTRINSIC (_cvtnes2ph_phf8) (src1.x, src2.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src1.a, src2.a); + res1.x = INTRINSIC (_cvtnes2ph_phf8) (src1.x, src2.x); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtnes2ph_phf8) (res2.x, mask, src1.x, src2.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtnes2ph_phf8) (mask, src1.x, src2.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8-2.c index 253b8424ee2..9c62d41da44 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8-2.c @@ -6,15 +6,14 @@ #define AVX10_2 #define AVX10_2_512 #define AVX10_512BIT -#define AVX512F_LEN 512 -#define AVX512F_LEN_HALF 256 #endif #include "avx10-helper.h" #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN_HALF / 8) +#define SIZE (AVX512F_LEN_HALF / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s) @@ -24,7 +23,7 @@ CALC (unsigned char *r, _Float16 *s) hf8_bf8 = 1; saturate = 0; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -39,9 +38,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -50,9 +50,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtneph_pbf8) (src.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src.a); - + + res1.x = INTRINSIC (_cvtneph_pbf8) (src.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtneph_pbf8) (res2.x, mask, src.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtneph_pbf8) (mask, src.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8s-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8s-2.c index b7f9944f1c9..00e32500767 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8s-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2bf8s-2.c @@ -12,7 +12,8 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN_HALF / 8) +#define SIZE (AVX512F_LEN_HALF / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s) @@ -22,7 +23,7 @@ CALC (unsigned char *r, _Float16 *s) hf8_bf8 = 1; saturate = 1; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -37,9 +38,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -48,9 +50,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtnesph_pbf8) (src.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src.a); - + + res1.x = INTRINSIC (_cvtnesph_pbf8) (src.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtnesph_pbf8) (res2.x, mask, src.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtnesph_pbf8) (mask, src.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8-2.c index 75f1292a33c..5bb008988f8 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8-2.c @@ -12,7 +12,8 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN_HALF / 8) +#define SIZE (AVX512F_LEN_HALF / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s) @@ -22,7 +23,7 @@ CALC (unsigned char *r, _Float16 *s) hf8_bf8 = 0; saturate = 0; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -37,9 +38,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -48,9 +50,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtneph_phf8) (src.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src.a); - + + res1.x = INTRINSIC (_cvtneph_phf8) (src.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtneph_phf8) (res2.x, mask, src.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtneph_phf8) (mask, src.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8s-2.c b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8s-2.c index b0f3cb07019..3d2d39602bc 100644 --- a/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8s-2.c +++ b/gcc/testsuite/gcc.target/i386/avx10_2-512-vcvtneph2hf8s-2.c @@ -12,7 +12,8 @@ #include "fp8-helper.h" #define SIZE_SRC (AVX512F_LEN / 16) -#define SIZE_RES (AVX512F_LEN_HALF / 8) +#define SIZE (AVX512F_LEN_HALF / 8) +#include "avx512f-mask-type.h" void CALC (unsigned char *r, _Float16 *s) @@ -22,7 +23,7 @@ CALC (unsigned char *r, _Float16 *s) hf8_bf8 = 0; saturate = 1; - for (i = 0; i < SIZE_RES; i++) + for (i = 0; i < SIZE; i++) { r[i] = 0; if (i < SIZE_SRC) @@ -37,9 +38,10 @@ void TEST (void) { int i,sign; - UNION_TYPE (AVX512F_LEN_HALF, i_b) res; + UNION_TYPE (AVX512F_LEN_HALF, i_b) res1, res2, res3; UNION_TYPE (AVX512F_LEN, h) src; - unsigned char res_ref[SIZE_RES]; + MASK_TYPE mask = MASK_VALUE; + unsigned char res_ref[SIZE]; sign = 1; for (i = 0; i < SIZE_SRC; i++) @@ -48,9 +50,22 @@ TEST (void) sign = -sign; } - res.x = INTRINSIC (_cvtnesph_phf8) (src.x); + for (i = 0; i < SIZE; i++) + res2.a[i] = DEFAULT_VALUE; + CALC(res_ref, src.a); - + + res1.x = INTRINSIC (_cvtnesph_phf8) (src.x); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res2.x = INTRINSIC (_mask_cvtnesph_phf8) (res2.x, mask, src.x); + MASK_MERGE (h) (res_ref, mask, SIZE); + if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) + abort (); + + res3.x = INTRINSIC (_maskz_cvtnesph_phf8) (mask, src.x); + MASK_ZERO (h) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN_HALF, i_b) (res, res_ref)) abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-helper.h b/gcc/testsuite/gcc.target/i386/avx512f-helper.h index 21f691b8441..41f09e36c83 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-helper.h +++ b/gcc/testsuite/gcc.target/i386/avx512f-helper.h @@ -97,7 +97,7 @@ MAKE_MASK_ZERO(bf16_bf, __bf16) /* Function which calculates result. */ #define CALC EVAL(calc_, AVX512F_LEN,) -#if !defined(AVX512VL) || defined(AVX10_512) +#if !defined(AVX512VL) || defined(AVX10_512BIT) #define AVX512F_LEN 512 #define AVX512F_LEN_HALF 256 #endif