From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 259843858D1E for ; Tue, 16 Jan 2024 09:51:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 259843858D1E Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 259843858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705398700; cv=none; b=XNRNG4hoHVjrrcwc6mYwjAQg1RQO/KWhjvh4VZmNPi0U+nKPgBEUzRGCNz0Ql1o0q69noAMWKNLac86hAP1FgMTW73Pwm96ECFfVONNMeryz1zAur1MLD+XSDIx8HxAf9WdNZlMx1doynhf6x4f7FviY4k4FdY9uzSywS/Oc9EA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705398700; c=relaxed/simple; bh=FNLIwDQvH61x+mtQLkGLtAWRdLDHxBu4DKpqHpzT7Fk=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=kY0JGaoKKa+avC0OnO46oCcyRJq6dHt5sW3phtKjXPJjupSHeoC5xVpQ0ZCYNfYLWIXTc4zX2aOp2zUMFbDGYg323aISiDT/sb0LNyfiPWpopT0CiXztpM+Nk0eHxb2fK57jXRK8CDtW0G4NcXncVWXh6yUgbBOwZe1/yu+9gbE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1705398697; bh=FNLIwDQvH61x+mtQLkGLtAWRdLDHxBu4DKpqHpzT7Fk=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=OsiGZmz9I3p5Yop6GkMhz4hhEqvPJwFqBU44d1aKkCZBSG7qSqWYeePVtfRvLkIE8 EeT38HPg+jW8rhuBBFcYdUaZJ2jf936cqnr8kUGx5YCJFFeIYvreAnPUzEfd/w/Rh7 bWI5LAp2mPJJDLQMig/XUD1kX2SrQwJfUlSksItg= Received: from [127.0.0.1] (unknown [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id B392566F59; Tue, 16 Jan 2024 04:51:35 -0500 (EST) Message-ID: Subject: Re: [PATCH v2] LoongArch: testsuite:Added additional vectorization "-mlsx" option. From: Xi Ruoyao To: chenxiaolong , YunQiang Su Cc: gcc-patches@gcc.gnu.org, i@xen0n.name, xuchenghua@loongson.cn, chenglulu@loongson.cn, schwab@linux-m68k.org, ci_notify@linaro.org Date: Tue, 16 Jan 2024 17:51:34 +0800 In-Reply-To: References: <20240113072817.31932-1-chenxiaolong@loongson.cn> <36fa3e47dfb106a150f113a300ecff6a7c869237.camel@xry111.site> <8654a1de861c86eda083dced141bc928df3930f4.camel@loongson.cn> <7b74e3f09cd083e489850774f2c85079bd470301.camel@xry111.site> <72675360c53a3d73a2171ca9e45d7e3049025c25.camel@loongson.cn> <870c3b36f3d88d56f38cbdeeb7c4301e6fa32cb2.camel@xry111.site> <6e608699db17a4f37b4bddf156d5c59759672e34.camel@loongson.cn> Autocrypt: addr=xry111@xry111.site; prefer-encrypt=mutual; keydata=mDMEYnkdPhYJKwYBBAHaRw8BAQdAsY+HvJs3EVKpwIu2gN89cQT/pnrbQtlvd6Yfq7egugi0HlhpIFJ1b3lhbyA8eHJ5MTExQHhyeTExMS5zaXRlPoiTBBMWCgA7FiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQrKrSDhnnEOPHFgD8D9vUToTd1MF5bng9uPJq5y3DfpcxDp+LD3joA3U2TmwA/jZtN9xLH7CGDHeClKZK/ZYELotWfJsqRcthOIGjsdAPuDgEYnkdPhIKKwYBBAGXVQEFAQEHQG+HnNiPZseiBkzYBHwq/nN638o0NPwgYwH70wlKMZhRAwEIB4h4BBgWCgAgFiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwwACgkQrKrSDhnnEOPjXgD/euD64cxwqDIqckUaisT3VCst11RcnO5iRHm6meNIwj0BALLmWplyi7beKrOlqKfuZtCLbiAPywGfCNg8LOTt4iMD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, 2024-01-16 at 12:58 +0800, Xi Ruoyao wrote: > On Tue, 2024-01-16 at 10:57 +0800, chenxiaolong wrote: > > =E5=9C=A8 2024-01-15=E4=B8=80=E7=9A=84 15:50 +0800=EF=BC=8CXi Ruoyao=E5= =86=99=E9=81=93=EF=BC=9A > > > On Mon, 2024-01-15 at 15:10 +0800, chenxiaolong wrote: > > > > At 14:42 +0800 on the first day of 2024-01-15, Xi Ruoyao wrote=EF= =BC=9A > > > > > On Mon, 2024-01-15 at 14:32 +0800, YunQiang Su wrote: > > > > > > Xi Ruoyao wrote at 12:11pm on Monday, > > > > > > January > > > > > > 15, 2024=EF=BC=9A > > > > > > > On Mon, 2024-01-15 at 09:29 +0800, chenxiaolong wrote: > > > > > > > > At 21:13 +0800 on Saturday, 2024-01-13, Xi Ruoyao wrote=EF= =BC=9A > > > > > > > > > At 15:28 +0800 on Saturday 2024-01-13, chenxiaolong > > > > > > > > > wrote=EF=BC=9A > > > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > > >=20 > > > > > > > > > > =C2=A0=C2=A0=C2=A0 * gcc.dg/pr104992.c: Added additiona= l "-mlsx" > > > > > > > > > > compilation > > > > > > > > > > options. > > > > > > > > > > =C2=A0=C2=A0=C2=A0 * gcc.dg/signbit-2.c: Dito. > > > > > > > > > > =C2=A0=C2=A0=C2=A0 * gcc.dg/tree-ssa/scev-16.c: Dito. > > > > > > > > > > =C2=A0=C2=A0=C2=A0 * gfortran.dg/graphite/vect-pr40979.= f90: Dito. > > > > > > > > > > =C2=A0=C2=A0=C2=A0 * gfortran.dg/vect/fast-math-mgrid-r= esid.f: Dito. > > > > > > > > >=20 > > > > > > > > > I don't feel it right about the changes to pr104992.c and > > > > > > > > > scev-16.c > > > > > > > > > because no other architectures add special options > > > > > > > > > there.=20 > > > > > > > > > Why are we > > > > > > > > > so special? > > > > > > > > Because on the LoongArch architecture, GCC requires the > > > > > > > > addition of > > > > > > > > vectorization options in order to generate vector code. Use > > > > > > > > the > > > > > > > > check_effective_target_vect_cmdline_needed command in the > > > > > > > > lib/target- > > > > > > > > supports.exp file to set whether the command line option is > > > > > > > > needed to > > > > > > > > enable vectorizations. For example, ia64,x86,aarch64, and > > > > > > > > riscv > > > > > > > > architectures, vectorization is enabled by default. > > > > > > >=20 > > > > > > > But no.=C2=A0 The default baseline of 32-bit x86 is i686, whi= ch is > > > > > > > basically > > > > > > > a Pentium III launched in 1999 without any vector > > > > > > > instructions. > > > > > > >=20 > > > > > > > We are still missing something here. > > > > > > >=20 > > > > > > There is a line > > > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #define vector > > > > > > __attribute__((vector_size(4*sizeof(int)))) > > > > > > I guess it is the syntax needs to be supported. > > > > >=20 > > > > > This is always supported.=C2=A0 If the target does not have vecto= r > > > > > instructions GCC will just expand vector arithmetic as a loop. > > > > >=20 > > > > > Maybe we should just move this test into gcc.dg/vect where the > > > > > framework > > > > > automatically add options like -mlsx or -msse2? > > > > >=20 > > > >=20 > > > > The "-mlsx" option is turned on by default after vectorization > > > > testing > > > > is turned on. However, the use of dg-options in some files resets > > > > the > > > > compilation options for testing this file. Therefore, to detect > > > > vectorization on LoongArch, it is necessary to add an additional "- > > > > mlsx" option. > > >=20 > > > Then it should use dg-additional-options instead of dg-options. > > >=20 > > According to your advice, I have tried the following two ways: > >=20 > > (1)Replace dg-options directly with dg-additional-options. The "-ansi- > > pedantic-errors" set in the dg.exp file is used, and the following > > problems occur: > >=20 > > gcc.dg/pr104992.c:ISO C90 does not support complex types. > > gcc.dg/tree-ssa/scev-16.c:=E2=80=98for=E2=80=99 loop initial declaratio= ns are only > > allowed in C99 or C11 mode > >=20 > > Note: The ISO required by the program is inconsistent with the default > > standard, resulting in an error. >=20 > We can add -std=3Dc11 into dg-additional-options as well. >=20 > > (2)Move pr104992.c and scev-16.c to the gcc.dg/vect directory and > > replace dg-options with dg-additional-options. The problems are as > > follows: > >=20 > > gcc.dg/vect/scev-16.c: Because there is no test rule starting with > > scev* in the vect.exp file, you need to add a new test rule or change > > the file name before the test can be performed. > >=20 > > Summary: It is more appropriate to add the additional "-mlsx" option > > directly to the pr104992.c and scev-16.c files. This supports > > vectorization=C2=A0 testing of the LoongArch architecture and does not > > modify the testing behavior of other architectures. >=20 > No, "not modifying the other architectures" may not be a good thing in > some cases. >=20 > There are only two possibilities here: >=20 > (1) The test is broken for all architectures where vectorization needs > additional options.=C2=A0 Then we should fix it for all the architectures= . >=20 > (2) The test is only broken on LoongArch, then on other architectures > some mechanism is already adding the proper options for vectorization. > Then we should implement the same mechanism for LoongArch. >=20 > For either case adding -mlsx only for LoongArch is only papering over > the real issue. >=20 > I'll run these tests on some other architectures and see what's > happening... Alright, now to me using vect_* out of vect directories is simply wrong. Instead of fixing up all the tests one by one, target by target, we should just stop this nonsense. Spreading target-specific vectorization options everywhere is pretty unmaintainable. https://gcc.gnu.org/PR113418 --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University