From patchwork Tue Feb 20 17:58:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 1901614 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=qV91GvQ0; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TfS3K4trSz20RF for ; Wed, 21 Feb 2024 05:04:29 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A08AE3858014 for ; Tue, 20 Feb 2024 18:04:27 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 0E2D9385C413 for ; Tue, 20 Feb 2024 18:01:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0E2D9385C413 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0E2D9385C413 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708452074; cv=none; b=Uksp0XJcfqK9MurfO/ScY5320Wp/nd/WFl/WpONuHARA0JZ+85h37/RqK5DfAlI/2uQ4cxpZ1YxBSQsqq4g+mTpPokTIln1osf3nXSKI11D8ng3YUAwDRRJUbWvjiMxkxsDPgta+L74bZlT26pUSZ90bMRk0p0BHKRrPVapxrX8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708452074; c=relaxed/simple; bh=vxREoUFzc7eKNZcm8iNrONc24WLf4rgjxIXdVzfBkv0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=dAXTKpfXMJxN+Rm4DGJ87QHrpz7UfnGW4pX3TrpNko/H8+qeyvnzih6RYhvqU4dbLGP9FKTvWy1ouOm1GpXD9gnN7Y+f/YOifav8f3Q8cYFagczFFbS59SQaE5J4KfxCK5ZIzOEpeobLcqG/VVlH8uUcFaFe/6qfIRTBe+TIgTo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41KHDo2p000686; Tue, 20 Feb 2024 18:01:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=ukKTE7T5FGx4aV3kqS09fZZJr+T5tFONALzvsWgP5T0=; b=qV91GvQ0PU+0IZSpsz5QpQ5T2nYT2DSxfAFN9JXbl2hrmYyAO4RnLsA8fH94aWTG03Ui tRwJufxRENwi+6qVoZ8mLVJBMyFF0fismKwl8+chq5BQE3N3Px08pk69OqYZD3BHGemN VIIE+t4J/B4yWbYEVBsEmwPMg0VnVm3W+Vd+gAqo+hb5hM7Frgm2Bnatx0RnbjemsPgf SmAVUOd0qjXgtBbOivROVHZRuqVRGawnpQMkeaEqdiOUPJLSeAlzyszmxV80uJmlEbfG AbL3wcM8DilVAPWYadpz4euBD2XjTyt7s5WR8m2mHTca0ApbiNCjwJlaCjcZMxYsE7Ph pg== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wd0a012k3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Feb 2024 18:01:08 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41KG4vCp014347; Tue, 20 Feb 2024 17:58:13 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb9u2h8k0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Feb 2024 17:58:13 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41KHwAdB7078548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Feb 2024 17:58:13 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E8A058056; Tue, 20 Feb 2024 17:58:10 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E514358054; Tue, 20 Feb 2024 17:58:09 +0000 (GMT) Received: from [9.67.96.239] (unknown [9.67.96.239]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 20 Feb 2024 17:58:09 +0000 (GMT) Message-ID: Date: Tue, 20 Feb 2024 09:58:09 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: PATCH 11/11] rs6000, make test vec-cmpne.c a runnable test Content-Language: en-US To: gcc-patches@gcc.gnu.org, "bergner@linux.ibm.com" , Segher Boessenkool , "Kewen.Lin" References: <41290fb1-e2e8-4779-b76f-2208c2dadedd@linux.ibm.com> From: Carl Love In-Reply-To: <41290fb1-e2e8-4779-b76f-2208c2dadedd@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: HeMLePescsQMc1MLbA4Xb9mgre4VwQVf X-Proofpoint-GUID: HeMLePescsQMc1MLbA4Xb9mgre4VwQVf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-20_06,2024-02-20_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=757 spamscore=0 clxscore=1015 adultscore=0 priorityscore=1501 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402200129 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+incoming=patchwork.ozlabs.org@gcc.gnu.org GCC maintainers: The patch changes the vec-cmpne.c from a compile only test to a runnable test. The macros to create the functions needed to test the built-ins and verify the restults are all there in the include file. The .c file just needed to have the macro definitions inserted and change the header from compile to run. The test can now do functional verification of the results in addition to verifying the expected instructions are generated. The patch has been tested on Power 10 with no regressions. Please let me know if this patch is acceptable for mainline. Thanks. Carl ------------------------------------------------------------ rs6000, make test vec-cmpne.c a runnable test The macros in vec-cmpne.h define test functions. They also setup test value functions, verification functions and execute test functions. The test is setup as a compile only test so none of the verification and execute functions are being used. The patch adds the macro definitions to create the intialization, verfiy and execute functions to a main program so not only can the test verify the correct instructions are generated but also run the tests and verify the results. The test is then changed from a compile to a run test. gcc/testsuite/ChangeLog: * gcc.target/powerpc/vec-cmple.c (main): Add main function with macro calls to define the test functions, create the verify functions and execute functions. Update scan-assembler-times (vcmpequ): Updated count to include instructions used to generate expected test results. * gcc.target/powerpc/vec-cmple.h (vector_tests_##NAME): Remove line continuation after closing bracket. Remove extra blank line. --- gcc/testsuite/gcc.target/powerpc/vec-cmpne.c | 41 +++++++++++++++----- gcc/testsuite/gcc.target/powerpc/vec-cmpne.h | 3 +- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c index b57e0ac8638..2c369976a44 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.c @@ -1,20 +1,41 @@ -/* { dg-do compile } */ +/* { dg-do run } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -O2" } */ +/* { dg-options "-maltivec -O2 -save-temps" } */ /* Test that the vec_cmpne builtin generates the expected Altivec instructions. */ #include "vec-cmpne.h" -define_test_functions (int, signed int, signed int, si); -define_test_functions (int, unsigned int, unsigned int, ui); -define_test_functions (short, signed short, signed short, ss); -define_test_functions (short, unsigned short, unsigned short, us); -define_test_functions (char, signed char, signed char, sc); -define_test_functions (char, unsigned char, unsigned char, uc); -define_test_functions (int, signed int, float, ff); +int main () +{ + define_test_functions (int, signed int, signed int, si); + define_test_functions (int, unsigned int, unsigned int, ui); + define_test_functions (short, signed short, signed short, ss); + define_test_functions (short, unsigned short, unsigned short, us); + define_test_functions (char, signed char, signed char, sc); + define_test_functions (char, unsigned char, unsigned char, uc); + define_test_functions (int, signed int, float, ff); + + define_init_verify_functions (int, signed int, signed int, si); + define_init_verify_functions (int, unsigned int, unsigned int, ui); + define_init_verify_functions (short, signed short, signed short, ss); + define_init_verify_functions (short, unsigned short, unsigned short, us); + define_init_verify_functions (char, signed char, signed char, sc); + define_init_verify_functions (char, unsigned char, unsigned char, uc); + define_init_verify_functions (int, signed int, float, ff); + + execute_test_functions (int, signed int, signed int, si); + execute_test_functions (int, unsigned int, unsigned int, ui); + execute_test_functions (short, signed short, signed short, ss); + execute_test_functions (short, unsigned short, unsigned short, us); + execute_test_functions (char, signed char, signed char, sc); + execute_test_functions (char, unsigned char, unsigned char, uc); + execute_test_functions (int, signed int, float, ff); + + return 0; +} /* { dg-final { scan-assembler-times {\mvcmpequb\M} 2 } } */ /* { dg-final { scan-assembler-times {\mvcmpequh\M} 2 } } */ -/* { dg-final { scan-assembler-times {\mvcmpequw\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mvcmpequw\M} 32 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.h b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.h index a304de01d86..374cca360b3 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-cmpne.h +++ b/gcc/testsuite/gcc.target/powerpc/vec-cmpne.h @@ -33,7 +33,7 @@ __attribute__((noinline)) void vector_tests_##NAME () \ tmp_##NAME = vec_cmpne (v1_##NAME, v2_##NAME); \ vec_vsx_st (tmp_##NAME, 0, &result_ne_##NAME[i]); \ } \ -} \ +} #define define_init_verify_functions(VBTYPE, RTYPE, STYPE, NAME) \ __attribute__((noinline)) void init_##NAME () \ @@ -80,7 +80,6 @@ __attribute__((noinline)) void verify_results_##NAME () \ } \ } - #define execute_test_functions(VBTYPE, RTYPE, STYPE, NAME) \ { \ init_##NAME (); \