From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 9784D3858D28 for ; Wed, 21 Jun 2023 22:42:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9784D3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=us.ibm.com Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35LMgWqs018708; Wed, 21 Jun 2023 22:42:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=4F4SaOXDRyVO95SCbXeqJNm7F6iQQWT7vlwIFmGlUlA=; b=qLfyVn2gA3w7FUq8bC6j2E5w9I1t3AIAnPcwx7/arR2OnVE6Tc2poHzOnc44Dn96Yh5F Wc/wa7djlfPMwhyUboEz4URnpaahFfBvYxhpafv46pg06j/mYsFcP+bdOIE7EUHCyc8F fTMJejcklqXPznBSE0olBTwzPpM0HX4siRPunW+abSAhjo4s4lXAS8oAVkJo5/zKoViA kJ2UOmA0Z/mB+cbKySEtTFNMMs5A54d/e1fYsOW+fDpzQhySsq04rAylqoMHnDYafAev jtG7KxdD/xmIBD7m4sxx5eMRyQC21vRY1YyevuEH1WbjCEfpfpAOnb0uM64kX0jRdfVU 4w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rc9299ka6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 22:42:41 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35LMSQjH027779; Wed, 21 Jun 2023 22:42:40 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rc9299k9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 22:42:40 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35LKJUCQ016312; Wed, 21 Jun 2023 22:42:39 GMT Received: from smtprelay05.wdc07v.mail.ibm.com ([9.208.129.117]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3r94f66gsu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Jun 2023 22:42:39 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay05.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35LMgbNK5505746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Jun 2023 22:42:37 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A4F658052; Wed, 21 Jun 2023 22:42:37 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5B9758065; Wed, 21 Jun 2023 22:42:36 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.61.18.149]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 21 Jun 2023 22:42:36 +0000 (GMT) Message-ID: <621ac0734ae83c7ca6af00d804a3d3bc2bbbea5b.camel@us.ibm.com> Subject: Re: [PATCH] rs6000: Update the vsx-vector-6.* tests. From: Carl Love To: "Kewen.Lin" Cc: Peter Bergner , Segher Boessenkool , gcc-patches@gcc.gnu.org, David Edelsohn Date: Wed, 21 Jun 2023 15:42:36 -0700 In-Reply-To: References: <5197d0d8ab5e975ed7e1e928820769e5921f5796.camel@us.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: kxk-g30eleB1jieI4yoW1lTrARLpwtCF X-Proofpoint-ORIG-GUID: WAms2IMVcjOmK7tnB0YCcvsoFguzKc2C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-21_12,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 clxscore=1015 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306210188 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Mon, 2023-06-19 at 15:17 +0800, Kewen.Lin wrote: > Hi Carl, > > on 2023/5/31 04:46, Carl Love wrote: > > GCC maintainers: > > > > The following patch takes the tests in vsx-vector-6-p7.h, vsx- > > vector- > > 6-p8.h, vsx-vector-6-p9.h and reorganizes them into a series of > > smaller > > test files by functionality rather than processor version. > > > > 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: Update the vsx-vector-6.* tests. > > > > The vsx-vector-6.h file is included into the processor specific > > test files > > vsx-vector-6.p7.c, vsx-vector-6.p8.c, and vsx-vector-6.p9.c. The > > .h file > > contains a large number of vsx vector builtin tests. The processor > > specific files contain the number of instructions that the tests > > are > > expected to generate for that processor. The tests are compile > > only. > > > > The tests are broken up into a seriers of files for related > > tests. The > > new tests are runnable tests to verify the builtin argument types > > and the > > But the newly added test cases are all with "dg-do compile", it > doesn't > match what you said here. Ah, yea, that is wrong. Fixed. > > > functional correctness of each test rather then verifying the type > > and > > number of instructions generated. > > It's good to have more coverage with runnable case, but we miss some > test > coverages on the expected insn counts which cases p{7,8,9}.c can > provide > originally. Unless we can ensure it's already tested somewhere else > (do > we? it wasn't stated in this patch), I think we still need those > checks. Yea, I was going with a runnable test and didn't include the instruction counts. Added back in. Rather then doing by processor version (P8, P9, P10) I was able to do it by BE/LE. The instruction counts were the same for LE accross processor versions but there are a few instruction counts that vary with BE and LE. I did noticed in one of the tests that the compiler computed the answers at compile time and thus didn't actually generate the builtin code. After digging a little more I found a few more tests where the compiler was doing the calculations and just inserting the answers. So, I moved all of the tests to functions so the compiler would actually generate the desired builtin code. > > > gcc/testsuite/ > > * gcc.target/powerpc/vsx-vector-6-1op.c: New test file. > > * gcc.target/powerpc/vsx-vector-6-2lop.c: New test file. > > * gcc.target/powerpc/vsx-vector-6-2op.c: New test file. > > * gcc.target/powerpc/vsx-vector-6-3op.c: New test file. > > * gcc.target/powerpc/vsx-vector-6-cmp-all.c: New test file. > > * gcc.target/powerpc/vsx-vector-6-cmp.c: New test file. > > * gcc.target/powerpc/vsx-vector-6.h: Remove test file. > > * gcc.target/powerpc/vsx-vector-6-p7.h: Remove test file. > > * gcc.target/powerpc/vsx-vector-6-p8.h: Remove test file. > > * gcc.target/powerpc/vsx-vector-6-p9.h: Remove test file. > > --- > > .../powerpc/vsx-vector-6-func-1op.c | 319 +++++++++++++ > > .../powerpc/vsx-vector-6-func-2lop.c | 305 +++++++++++++ > > .../powerpc/vsx-vector-6-func-2op.c | 278 ++++++++++++ > > .../powerpc/vsx-vector-6-func-3op.c | 229 ++++++++++ > > .../powerpc/vsx-vector-6-func-cmp-all.c | 429 > > ++++++++++++++++++ > > .../powerpc/vsx-vector-6-func-cmp.c | 237 ++++++++++ > > .../gcc.target/powerpc/vsx-vector-6.h | 154 ------- > > .../gcc.target/powerpc/vsx-vector-6.p7.c | 43 -- > > .../gcc.target/powerpc/vsx-vector-6.p8.c | 43 -- > > .../gcc.target/powerpc/vsx-vector-6.p9.c | 42 -- > > 10 files changed, 1797 insertions(+), 282 deletions(-) > > create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector-6- > > func-1op.c > > create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector-6- > > func-2lop.c > > create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector-6- > > func-2op.c > > create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector-6- > > func-3op.c > > create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector-6- > > func-cmp-all.c > > create mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector-6- > > func-cmp.c > > delete mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector-6.h > > delete mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector- > > 6.p7.c > > delete mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector- > > 6.p8.c > > delete mode 100644 gcc/testsuite/gcc.target/powerpc/vsx-vector- > > 6.p9.c > > > > diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-func- > > 1op.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-func-1op.c > > new file mode 100644 > > index 00000000000..90a360ea158 > > --- /dev/null > > +++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-func-1op.c > > @@ -0,0 +1,319 @@ > > +/* { dg-do compile { target lp64 } } */ > > +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ > > +/* { dg-options "-O2 -mdejagnu-cpu=power7" } */ > > + > > +/* Functional test of the one operand vector builtins. */ > > + > > +#include > > +#include > > +#include > > + > > +#define DEBUG 0 > > + > > +void abort (void); > > + > > +int > > +main () { > > + int i; > > + vector float f_src = { 125.44, 23.04, -338.56, 17.64}; > > + vector float f_result; > > + vector float f_abs_expected = { 125.44, 23.04, 338.56, 17.64}; > > + vector float f_ceil_expected = { 126.0, 24.0, -338, 18.0}; > > + vector float f_floor_expected = { 125.0, 23.0, -339, 17.0}; > > + vector float f_nearbyint_expected = { 125.0, 23.0, -339, 18.0}; > > + vector float f_rint_expected = { 125.0, 23.0, -339, 18.0}; > > + vector float f_sqrt_expected = { 11.2, 4.8, 18.4, 4.2}; > > + vector float f_trunc_expected = { 125.0, 23.0, -338, 17}; > > + > > + vector double d_src = { 125.44, -338.56}; > > + vector double d_result; > > + vector double d_abs_expected = { 125.44, 338.56}; > > + vector double d_ceil_expected = { 126.0, -338.0}; > > + vector double d_floor_expected = { 125.0, -339.0}; > > + vector double d_nearbyint_expected = { 125.0, -339.0}; > > + vector double d_rint_expected = { 125.0, -339.0}; > > + vector double d_sqrt_expected = { 11.2, 18.4}; > > + vector double d_trunc_expected = { 125.0, -338.0}; > > + > > + /* Abs, float */ > > + f_result = vec_abs (f_src); > > + > > + if ((f_result[0] != f_abs_expected[0]) > > + || (f_result[1] != f_abs_expected[1]) > > + || (f_result[2] != f_abs_expected[2]) > > + || (f_result[3] != f_abs_expected[3])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_abs (float) expected value does not > > match\n"); > > + printf(" expected[0] = %f; result[0] = %f\n", > > + f_abs_expected[0], f_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + f_abs_expected[1], f_result[1]); > > + printf(" expected[2] = %f; result[2] = %f\n", > > + f_abs_expected[2], f_result[2]); > > + printf(" expected[3] = %f; result[3] = %f\n", > > + f_abs_expected[3], f_result[3]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Ceiling, float */ > > + f_result = vec_ceil (f_src); > > + > > + if ((f_result[0] != f_ceil_expected[0]) > > + || (f_result[1] != f_ceil_expected[1]) > > + || (f_result[2] != f_ceil_expected[2]) > > + || (f_result[3] != f_ceil_expected[3])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_ceil (float) expected value does not > > match\n"); > > + printf(" expected[0] = %f; result[0] = %f\n", > > + f_ceil_expected[0], f_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + f_ceil_expected[1], f_result[1]); > > + printf(" expected[2] = %f; result[2] = %f\n", > > + f_ceil_expected[2], f_result[2]); > > + printf(" expected[3] = %f; result[3] = %f\n", > > + f_ceil_expected[3], f_result[3]); > > + } > > +#else > > + abort(); > > +#endif > > It looks that you can use some macro for different floating point > functions > and its check and dumping here, since the basic skeleton are > sharable, some > thing like: > > #define > FLOAT_CHECK(NAME) > \ > f_result = > vec_##NAME(f_src); \ > > \ > if ((f_result[0] != f_##NAME##_expected[0]) > || \ > (f_result[1] != f_##NAME##_expected[1]) > || \ > (f_result[2] != f_##NAME##_expected[2]) > || \ > (f_result[3] != f_##NAME##_expected[3])) > { \ > if (DEBUG) > { \ > printf("ERROR: vec_%s (float) expected value does not match\n", > #NAME); \ > printf(" expected[0] = %f; result[0] = %f\n", > f_##NAME##_expected[0], \ > f_result[0]); > \ > printf(" expected[1] = %f; result[1] = %f\n", > f_##NAME##_expected[1], \ > f_result[1]); > \ > printf(" expected[2] = %f; result[2] = %f\n", > f_##NAME##_expected[2], \ > f_result[2]); > \ > printf(" expected[3] = %f; result[3] = %f\n", > f_##NAME##_expected[3], \ > f_result[3]); > \ > } > else > \ > abort(); > \ > } > > ... > FLOAT_CHECK(ceil) > FLOAT_CHECK(nearbyint) > ... > > I hope it can help to make it brief and avoid some copy & paste > typos. > But since you already expanded them, it's fine to me if you wanted to > keep > the expanded ones. :) Generally, I am not a big fan of large code macros. But in this case it is probably a good idea given the repetitive code. When I wrote the test cases, I had to put comments in to identify were each test started as it gets lost in the code. Use of a macro makes it much easier to see what cases are being tested. I changed to using macros for the float and double testing across all of the tests. There were a few tests where this just one test of that "type" so I didn't bother doing it with a macro. > > > + > > + /* Floor, float */ > > + f_result = vec_floor (f_src); > > + > > + if ((f_result[0] != f_floor_expected[0]) > > + || (f_result[1] != f_floor_expected[1]) > > + || (f_result[2] != f_floor_expected[2]) > > + || (f_result[3] != f_floor_expected[3])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_floor (float) expected value does not > > match\n"); > > + printf(" expected[0] = %f; result[0] = %f\n", > > + f_floor_expected[0], f_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + f_floor_expected[1], f_result[1]); > > + printf(" expected[2] = %f; result[2] = %f\n", > > + f_floor_expected[2], f_result[2]); > > + printf(" expected[3] = %f; result[3] = %f\n", > > + f_floor_expected[3], f_result[3]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Nearby int, float */ > > + f_result = vec_nearbyint (f_src); > > + > > + if ((f_result[0] != f_nearbyint_expected[0]) > > + || (f_result[1] != f_nearbyint_expected[1]) > > + || (f_result[2] != f_nearbyint_expected[2]) > > + || (f_result[3] != f_nearbyint_expected[3])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_nearby (float) expected value does not > > match\n"); > > + printf(" expected[0] = %f; result[0] = %f\n", > > + f_nearbyint_expected[0], f_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + f_nearbyint_expected[1], f_result[1]); > > + printf(" expected[2] = %f; result[2] = %f\n", > > + f_nearbyint_expected[2], f_result[2]); > > + printf(" expected[3] = %f; result[3] = %f\n", > > + f_nearbyint_expected[3], f_result[3]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Round, float */ > > + f_result = vec_rint (f_src); > > + > > + if ((f_result[0] != f_rint_expected[0]) > > + || (f_result[1] != f_rint_expected[1]) > > + || (f_result[2] != f_rint_expected[2]) > > + || (f_result[3] != f_rint_expected[3])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_rint (float) expected value does not > > match\n"); > > + printf(" expected[0] = %f; result[0] = %f\n", > > + f_rint_expected[0], f_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + f_rint_expected[1], f_result[1]); > > + printf(" expected[2] = %f; result[2] = %f\n", > > + f_rint_expected[2], f_result[2]); > > + printf(" expected[3] = %f; result[3] = %f\n", > > + f_rint_expected[3], f_result[3]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Square, float */ > > + f_result = vec_sqrt (vec_abs(f_src)); > > + > > + if ((f_result[0] != f_sqrt_expected[0]) > > + || (f_result[1] != f_sqrt_expected[1]) > > + || (f_result[2] != f_sqrt_expected[2]) > > + || (f_result[3] != f_sqrt_expected[3])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_sqrt (float) expected value does not > > match\n"); > > + printf(" expected[0] = %f; result[0] = %f\n", > > + f_sqrt_expected[0], f_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + f_sqrt_expected[1], f_result[1]); > > + printf(" expected[2] = %f; result[2] = %f\n", > > + f_sqrt_expected[2], f_result[2]); > > + printf(" expected[3] = %f; result[3] = %f\n", > > + f_sqrt_expected[3], f_result[3]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Truncate, float */ > > + f_result = vec_trunc (f_src); > > + > > + if ((f_result[0] != f_trunc_expected[0]) > > + || (f_result[1] != f_trunc_expected[1]) > > + || (f_result[2] != f_trunc_expected[2]) > > + || (f_result[3] != f_trunc_expected[3])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_trunc (float) expected value does not > > match\n"); > > + printf(" expected[0] = %f; result[0] = %f\n", > > + f_trunc_expected[0], f_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + f_trunc_expected[1], f_result[1]); > > + printf(" expected[2] = %f; result[2] = %f\n", > > + f_trunc_expected[2], f_result[2]); > > + printf(" expected[3] = %f; result[3] = %f\n", > > + f_trunc_expected[3], f_result[3]); > > + } > > +#else > > + abort(); > > +#endif > > + > > > > snip ... > > > + > > + /* Vector select */ > > + d_result = vec_sel (d_src_a, d_src_b, ull_src_c); > > + > > + if ((d_result[0] != d_selectu_expected[0]) > > + || (d_result[1] != d_selectu_expected[1])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_msub (double, unsigned) expected value > > does not match\n"); > > Copy & paste typo. Fixed that bug. The vector select test are still inline code as there is only one of that type so a macro would only have one use. > > > + printf(" expected[0] = %f; result[0] = %f\n", > > + d_selectu_expected[0], d_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + d_selectu_expected[1], d_result[1]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + d_result = vec_sel (d_src_a, d_src_b, bll_src_c); > > + > > + if ((d_result[0] != d_selectb_expected[0]) > > + || (d_result[1] != d_selectb_expected[1])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_msub (double, bool) expected value does > > not match\n"); > > Ditto > Ditto above comment. > > + printf(" expected[0] = %f; result[0] = %f\n", > > + d_selectb_expected[0], d_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + d_selectb_expected[1], d_result[1]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Vector permute */ > > + d_result = vec_perm (d_src_a, d_src_b, uc_src_c); > > + > > + if ((d_result[0] != d_perm_expected[0]) > > + || (d_result[1] != d_perm_expected[1])) > > +#if DEBUG > > + { > > + printf("ERROR: vec_perf (unsigned char) expected value does > > not match\n"); > > perf -> perm > > > + printf(" expected[0] = %f; result[0] = %f\n", > > + d_perm_expected[0], d_result[0]); > > + printf(" expected[1] = %f; result[1] = %f\n", > > + d_perm_expected[1], d_result[1]); > > + } > > +#else > > + abort(); > > +#endif > > + > > + return 0; > > +} > > diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-func- > > cmp-all.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-func-cmp- > > all.c > > new file mode 100644 > > index 00000000000..4558918058e > > --- /dev/null > > +++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6-func-cmp-all.c > > @@ -0,0 +1,429 @@ > > +/* { dg-do compile { target lp64 } } */ > > +/* { dg-skip-if "" { powerpc*-*-darwin* } } */ > > +/* { dg-options "-O2 -mdejagnu-cpu=power7" } */ > > + > > +/* Functional test of the vector compare all builtins. */ > > + > > +#include > > +#include > > +#include > > +#include > > + > > +#define DEBUG 0 > > + > > +void abort (void); > > + > > +int > > +main () { > > + int i; > > + vector float f_src_a = {126.0, 23.0, -338.0, 17.0}; > > + vector float f_src_b = {2.00, 23.0, 1.0, 4.0}; > > + bool f_result; > > + bool f_all_eq_expected = 0; > > + bool f_all_gt_expected = 0; > > + bool f_all_ge_expected = 0; > > + bool f_all_lt_expected = 0; > > + bool f_all_le_expected = 0; > > + bool f_all_nan_expected = 0; > > + bool f_all_numeric_expected = 1; > > + bool f_any_eq_expected = 1; > > + bool f_any_gt_expected = 1; > > + bool f_any_ge_expected = 1; > > + bool f_any_lt_expected = 1; > > + bool f_any_le_expected = 1; > > + bool f_any_nan_expected = 0; > > + bool f_any_numeric_expected = 1; > > + > > + vector double d_src_a = { 125.44, -338.56}; > > + vector double d_src_b = d_src_a; > > + bool d_result; > > + bool d_all_eq_expected = 1; > > + bool d_all_gt_expected = 0; > > + bool d_all_ge_expected = 1; > > + bool d_all_lt_expected = 0; > > + bool d_all_le_expected = 1; > > + bool d_all_nan_expected = 0; > > + bool d_all_numeric_expected = 1; > > + bool d_any_eq_expected = 1; > > + bool d_any_gt_expected = 0; > > + bool d_any_ge_expected = 1; > > + bool d_any_lt_expected = 0; > > + bool d_any_le_expected = 1; > > + bool d_any_nan_expected = 0; > > + bool d_any_numeric_expected = 1; > > + > > + /* Compare all equal, float */ > > + f_result = vec_all_eq (f_src_a, f_src_b); > > + > > + if (f_result != f_all_eq_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_all_eq (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", > > + f_all_eq_expected, f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare all greater than, float */ > > + f_result = vec_all_gt (f_src_a, f_src_b); > > + > > + if (f_result != f_all_gt_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_all_gt (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", > > + f_all_gt_expected, f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare all greater than or equal, float */ > > + f_result = vec_all_ge (f_src_a, f_src_b); > > + > > + if (f_result != f_all_ge_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_all_ge(float) expected value does not > > match\n"); > > inconsistent style (missing one space after vec_all_ge). Eliminated via the use of a macro. > > > + printf(" expected] = %d; result = %d\n", > > f_all_ge_expected, f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare all less than, float */ > > + f_result = vec_all_lt (f_src_a, f_src_b); > > + > > + if (f_result != f_all_lt_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_all_lt (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", f_all_lt_expected, > > f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare all less than or equal, float */ > > + f_result = vec_all_le (f_src_a, f_src_b); > > + > > + if (f_result != f_all_le_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_all_le (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", f_all_le_expected, > > f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* All NaN, float */ > > + f_result = vec_all_nan (f_src_a); > > + > > + if (f_result != f_all_nan_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_all_le (float) expected value does not > > match\n"); > > copy & paste typo. > Using macro to generate this test now. So typo should be gone. > > + printf(" expected = %d; result = %d\n", > > f_all_nan_expected, f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* All numeric, float */ > > + f_result = vec_all_numeric (f_src_a); > > + > > + if (f_result != f_all_numeric_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_all_numeric (float) expected value does > > not match\n"); > > + printf(" expected = %d; result = %d\n", > > f_all_numeric_expected, > > + f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + > > + /* Compare any equal, float */ > > + f_result = vec_any_eq (f_src_a, f_src_b); > > + > > + if (f_result != f_any_eq_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_any_eq (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", > > + f_any_eq_expected, f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare any greater than, float */ > > + f_result = vec_any_gt (f_src_a, f_src_b); > > + > > + if (f_result != f_any_gt_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_any_gt (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", > > + f_any_gt_expected, f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare any greater than or equal, float */ > > + f_result = vec_any_ge (f_src_a, f_src_b); > > + > > + if (f_result != f_any_ge_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_any_ge(float) expected value does not > > match\n"); > > missing one space. Using macro now. > > > + printf(" expected] = %d; result = %d\n", > > f_any_ge_expected, f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare any less than, float */ > > + f_result = vec_any_lt (f_src_a, f_src_b); > > + > > + if (f_result != f_any_lt_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_any_lt (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", f_any_lt_expected, > > f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Compare any less than or equal, float */ > > + f_result = vec_any_le (f_src_a, f_src_b); > > + > > + if (f_result != f_any_le_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_any_le (float) expected value does not > > match\n"); > > + printf(" expected = %d; result = %d\n", f_any_le_expected, > > f_result); > > + } > > +#else > > + abort(); > > +#endif > > + > > + /* Any NaN, float */ > > + f_result = vec_any_nan (f_src_a); > > + > > + if (f_result != f_any_nan_expected) > > +#if DEBUG > > + { > > + printf("ERROR: vec_any_le (float) expected value does not > > match\n"); > > typo, s/vec_any_le/vec_any_nan/ Using macro now. Carl