From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BCD053858CD1; Tue, 10 Oct 2023 03:19:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCD053858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696907942; bh=CQv7XUiANYsCUjRGCpdEVP27r823c9/wTyL1Rb/YiT8=; h=From:To:Subject:Date:From; b=rPBFhmY0n1oPj0XrKR/CEP1P8BVAsUrFRnZ2sHP815DPM8ZC7wExeZLAnqkRW1oJp SQujf0Qv+xTHX52I343Xev/ajuj0VefggPEw16fmPMaHMkxrR1JTunxlYKO2xRseyp hVTOYWnRJqCVFG+0V6JimguYBctgWoU+SvlpVYMU= From: "juzhe.zhong at rivai dot ai" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/111751] New: RISC-V: RVV unexpected vectorization Date: Tue, 10 Oct 2023 03:19:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D111751 Bug ID: 111751 Summary: RISC-V: RVV unexpected vectorization Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: juzhe.zhong at rivai dot ai Target Milestone: --- #include #define N 16 int main () { int i; char ia[N]; char ic[N] =3D {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; char ib[N] =3D {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; /* Not vectorizable, multiplication */ for (i =3D 0; i < N; i++) { ia[i] =3D ib[i] * ic[i]; } /* check results: */ for (i =3D 0; i < N; i++) { if (ia[i] !=3D (char) (ib[i] * ic[i])) abort (); } return 0; } RVV GCC ASM: main: lui a5,%hi(.LANCHOR0) addi a5,a5,%lo(.LANCHOR0) addi sp,sp,-48 ld a4,0(a5) ld a5,8(a5) sd a5,8(sp) sd a5,24(sp) sd ra,40(sp) addi a5,sp,16 sd a4,0(sp) sd a4,16(sp) vsetivli zero,16,e8,m1,ta,ma vle8.v v1,0(a5) vle8.v v2,0(sp) vmul.vv v1,v1,v2 vmv.x.s a5,v1 andi a5,a5,0xff bne a5,zero,.L2 vslidedown.vi v2,v1,1 li a4,9 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,2 li a4,36 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,3 li a4,81 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,4 li a4,144 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,5 li a4,225 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,6 li a4,68 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,7 li a4,185 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,8 li a4,64 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,9 li a4,217 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,10 li a4,132 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,11 li a4,65 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,12 li a4,16 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,13 li a4,241 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v2,v1,14 li a4,228 vmv.x.s a5,v2 andi a5,a5,0xff bne a5,a4,.L2 vslidedown.vi v1,v1,15 li a4,233 vmv.x.s a5,v1 andi a5,a5,0xff bne a5,a4,.L2 ld ra,40(sp) li a0,0 addi sp,sp,48 jr ra .L2: call abort ARM SVE GCC: main: mov w0, 0 ret=