From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 6645C3858415 for ; Tue, 16 Jan 2024 10:25:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6645C3858415 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6645C3858415 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::232 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705400742; cv=none; b=TXU/6qFTuwzDPIPr/IlLNQ+l5kfff9TXCtx+XlDX/RAM1e4JjGY2HifJ5azHdYAbMOzkIc1zijcwAaqgIlLGidwwklDbBiCWSJPEltdKrPVye7hh9vYuorLlRp4RNP2sSQajEI0sDx5yeZgwRiqKwpQUsuNwfahX+oTRYJwzMMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705400742; c=relaxed/simple; bh=sVrHfYutbG6w+TjRL1NECZfIIKPnPI685GokJeGB3lg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=tEbEXXn3tf1NDzKcyLC9O3Piw/8MoATCtwHzIVWSKBtt1ck0k1xJlXtQpaa9Lj0hEUq/rwJgh0i5L3n1JAAlh9FEj6Vg9Sz6uS3uWQqsoj4Q7+PwPysgmPHP1Ir55C/YReMRCzbPEbes85fVfAtoK/xNJROSIXWcGJ/OTtxS8GY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2cda523725bso28325151fa.3 for ; Tue, 16 Jan 2024 02:25:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705400737; x=1706005537; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fhU5r0hlfzS0t1bYMPxoYwcCKHBlv0AhX/tC+3iyBNU=; b=TLa26n6muOKg/2Fh9Rg//iS+HUNUVwL1Rg6zEqTDjKjLkg2gGo0cfQqYhFFSIEwTIQ DGzZjC0dVBsPpCJzsB4RWG983X/WUCbxWt94l/oTAQlhdmfH6sidK4UgCoOW2uX8bArL QD1pvt2WhKdh+8Ssf6o1s5p4bbUUxaIs8ymlSLifKrQ0uLZGIedTCo7Wg40NZxCyeym6 zkDMgkLKytese0V/QOEgowPXvWfq4t7ovvcWEI1+3I6bcEjiW9Ewl7pxor4Vf+769S3t vOM50eRalh6jtVd3ZYf6sxYJTa1P7B/t+2dQmGFmh6U3jaExZLiWgHvyee25L2bxVllA sEgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705400737; x=1706005537; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fhU5r0hlfzS0t1bYMPxoYwcCKHBlv0AhX/tC+3iyBNU=; b=I80n4rTx60jL2XH29ooWk0vosJYVTkMcMc5sumDCEvx6SsDj+gfpI6es2jjfJPQtjG 5dYQItwhiORJ8Lxm/21cdWRwrUOoc+9Zi4Yf9fo+lK4rwOCgWbKSCO7bD9IN4Q71ibB0 /0I24pYP89loHyAIDvIBU/Pq3EO4i4V2roVU0bWsG7xj42hA9s5w2vPrDZDoJd8nNVzX /DI1SOQz5oWiQocLzjXiib/DfXZGWvhoPVdbhlVLsmuFPVQQvpparvpeR74DfuWgUMdb UW4Z4ajUSft6TWN4z63qoFNZmO7h8AlofG/Eli0nx2o0qsTKCBlpOZNJeRnCMaxrxMF4 /ALg== X-Gm-Message-State: AOJu0YyjTQ6ZmmiRzlfWUpV/085HXhL+zG1MkFa8PqyjVPKjDoubiU39 XBS8TJmJUK9GAYbXeZzo40thCgKtM39F+TfJBfU= X-Google-Smtp-Source: AGHT+IG9+EngPU54kz1puliLth+cbhF4tmdMMrp9sMOLcBPY1xcoWUB0QahMUhQtSeShHOY9sz8/PucU6y6E/8hSOhY= X-Received: by 2002:a2e:b7d4:0:b0:2cd:1e40:2902 with SMTP id p20-20020a2eb7d4000000b002cd1e402902mr2015865ljo.1.1705400736458; Tue, 16 Jan 2024 02:25:36 -0800 (PST) MIME-Version: 1.0 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> In-Reply-To: From: Richard Biener Date: Tue, 16 Jan 2024 11:20:18 +0100 Message-ID: Subject: Re: [PATCH v2] LoongArch: testsuite:Added additional vectorization "-mlsx" option. To: Xi Ruoyao Cc: chenxiaolong , YunQiang Su , gcc-patches@gcc.gnu.org, i@xen0n.name, xuchenghua@loongson.cn, chenglulu@loongson.cn, schwab@linux-m68k.org, ci_notify@linaro.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 List-Id: On Tue, Jan 16, 2024 at 5:58=E2=80=AFAM Xi Ruoyao wrot= e: > > 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: > > > > > > > > > > > > > > > > > > > > * gcc.dg/pr104992.c: Added additional "-mlsx" > > > > > > > > > > compilation > > > > > > > > > > options. > > > > > > > > > > * gcc.dg/signbit-2.c: Dito. > > > > > > > > > > * gcc.dg/tree-ssa/scev-16.c: Dito. > > > > > > > > > > * gfortran.dg/graphite/vect-pr40979.f90: Dito. > > > > > > > > > > * gfortran.dg/vect/fast-math-mgrid-resid.f: Dito. > > > > > > > > > > > > > > > > > > I don't feel it right about the changes to pr104992.c and > > > > > > > > > scev-16.c > > > > > > > > > because no other architectures add special options > > > > > > > > > there. > > > > > > > > > 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. > > > > > > > > > > > > > > But no. The default baseline of 32-bit x86 is i686, which is > > > > > > > basically > > > > > > > a Pentium III launched in 1999 without any vector > > > > > > > instructions. > > > > > > > > > > > > > > We are still missing something here. > > > > > > > > > > > > > There is a line > > > > > > #define vector > > > > > > __attribute__((vector_size(4*sizeof(int)))) > > > > > > I guess it is the syntax needs to be supported. > > > > > > > > > > This is always supported. If the target does not have vector > > > > > instructions GCC will just expand vector arithmetic as a loop. > > > > > > > > > > Maybe we should just move this test into gcc.dg/vect where the > > > > > framework > > > > > automatically add options like -mlsx or -msse2? > > > > > > > > > > > > > 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. > > > > > > Then it should use dg-additional-options instead of dg-options. > > > > > According to your advice, I have tried the following two ways: > > > > (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: > > > > 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 > > > > Note: The ISO required by the program is inconsistent with the default > > standard, resulting in an error. > > We can add -std=3Dc11 into dg-additional-options as well. > > > (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: > > > > 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. gcc.dg/tree-ssa/scev-16.c is OK to move gcc.dg/pr104992.c should simply add -fno-tree-vectorize to the used options and remove the vect_* stuff > > Summary: It is more appropriate to add the additional "-mlsx" option > > directly to the pr104992.c and scev-16.c files. This supports > > vectorization testing of the LoongArch architecture and does not > > modify the testing behavior of other architectures. > > No, "not modifying the other architectures" may not be a good thing in > some cases. > > There are only two possibilities here: > > (1) The test is broken for all architectures where vectorization needs > additional options. Then we should fix it for all the architectures. > > (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. > > For either case adding -mlsx only for LoongArch is only papering over > the real issue. > > I'll run these tests on some other architectures and see what's > happening... > > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University