From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66D493858D37; Thu, 25 Jan 2024 03:06:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66D493858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706152011; bh=L5XqWCSXHFkQbL0EbR9kcP/QbeljTdMDp4oxSsAaOpg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ViRwRCjgLXbUEpka4nvhAv/65Omry6hA3hxY6AatJHzN/agn2wKmQwqzEL3mR/n6u tNxkmjlBK7eKyu2AGFsdTagucDtJMsuI4cgwwM2Zh8FXsiX0jcUGvYBz8VQd5xKsxS FTjHBVQ4w6vDz64GVuuGDmW3yttTuMTkF0axGEuQ= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113583] Main loop in 519.lbm not vectorized. Date: Thu, 25 Jan 2024 03:06:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: juzhe.zhong at rivai dot ai X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113583 --- Comment #4 from JuzheZhong --- OK. Confirm on X86 GCC failed to vectorize it, wheras Clang X86 can vectori= ze it. https://godbolt.org/z/EaTjGbPGW X86 Clang and RISC-V Clang IR are same: %12 =3D tail call <8 x double> @llvm.masked.gather.v8f64.v8p0(<8 x ptr> %= 11, i32 8, <8 x i1> , <8 x double> poison), !dbg !62 %13 =3D or disjoint <8 x i64> %10, , !dbg !72 %14 =3D getelementptr inbounds double, ptr %0, <8 x i64> %13, !dbg !72 %15 =3D tail call <8 x double> @llvm.masked.gather.v8f64.v8p0(<8 x ptr> %= 14, i32 8, <8 x i1> , <8 x double> poison), !dbg !72 %16 =3D or disjoint <8 x i64> %10, , !dbg !73 %17 =3D getelementptr inbounds double, ptr %0, <8 x i64> %16, !dbg !73 %18 =3D tail call <8 x double> @llvm.masked.gather.v8f64.v8p0(<8 x ptr> %= 17, i32 8, <8 x i1> , <8 x double> poison), !dbg !73 %19 =3D fadd <8 x double> %15, %18, !dbg !74 %20 =3D fmul <8 x double> %19, , !dbg !75 %21 =3D fadd <8 x double> %12, , !dbg !76 %22 =3D tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %21, <8 x double> , <8 x double> %12), !dbg !77 %23 =3D getelementptr inbounds double, ptr %1, <8 x i64> %10, !dbg !77 tail call void @llvm.masked.scatter.v8f64.v8p0(<8 x double> %22, <8 x ptr> %23, i32 8, <8 x i1> ), !dbg !78 %24 =3D tail call <8 x double> @llvm.masked.gather.v8f64.v8p0(<8 x ptr> %= 14, i32 8, <8 x i1> , <8 x double> poison), !dbg !81 %25 =3D fadd <8 x double> %20, , !dbg !82 %26 =3D tail call <8 x double> @llvm.fmuladd.v8f64(<8 x double> %25, <8 x double> , <8 x double> %24), !dbg !83 %27 =3D fadd <8 x double> %26, , !dbg !84 %28 =3D getelementptr double, <8 x ptr> %23, i64 2001, !dbg !84 tail call void @llvm.masked.scatter.v8f64.v8p0(<8 x double> %27, <8 x ptr> %28, i32 8, <8 x i1> ), !dbg !85 Hi, Richard. Do you have suggestions about this issue ? Thanks.=