From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C75663858D35; Thu, 29 Jun 2023 12:21:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C75663858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688041281; bh=xkQ6QoadwhrWZutyL4GNCFkIKpN/UXGuYFlnsCJFgH4=; h=From:To:Subject:Date:From; b=L4z7o88OKJH6vNSOsObNdCL2XKYL8bDXFcXLFqmIMS0P2UGkYZT0sZ8peAm96x1CX F16pDWvuiTGAqY9hWCrGz1SyjtTYwfKXxzEIFH5vW5EwN+SoXvnnc0+62czz1opHi5 oCgn1QhFtVBcpjqGZ/NBPcUB/66Mcy6uUCpvQoME= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110485] New: vectorizing simd clone calls without loop masking applied Date: Thu, 29 Jun 2023 12:21:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org 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=3D110485 Bug ID: 110485 Summary: vectorizing simd clone calls without loop masking applied Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: rguenth at gcc dot gnu.org Target Milestone: --- #include double a[1024]; double b[1024]; void foo (int n) { for (int i =3D 0; i < n; ++i) a[i] =3D pow (b[i], 71.2); } with -Ofast -march=3Dznver4 --param vect-partial-vector-usage=3D1 gets us the following OK main loop .L4: vmovapd b(%rbx), %zmm0 vmovapd -112(%rbp), %zmm1 addq $64, %rbx call _ZGVeN8vv_pow vmovapd %zmm0, a-64(%rbx) cmpq %r13, %rbx jne .L4 but the following vectorized masked epilogue: movl %r12d, %eax andl $-8, %eax testb $7, %r12b je .L13 .L3: subl %eax, %r12d movl %eax, %edx vmovapd -112(%rbp), %zmm1 vpbroadcastw %r12d, %xmm0 leaq 0(,%rdx,8), %rbx vpcmpuw $6, .LC2(%rip), %xmm0, %k1 vmovapd b(,%rdx,8), %zmm0{%k1}{z} kmovb %k1, -113(%rbp) call _ZGVeN8vv_pow kmovb -113(%rbp), %k1 vmovapd %zmm0, a(%rbx){%k1} so we simply call _ZGVeN8vv_pow without any masking applied. That's possibly OK since we use zero-masking and thus actual masked argument lanes are zero but it seems this isn't the expected behavior for vectorizable_simd_clone_call. Instead it should probably unconditionally set LOOP_VINFO_CAN_USE_PARTIAL_VECTORS_P (loop_vinfo) to false? Is there a way to query which SIMD clone is "happy" with zero arguments and thus for example with -ffast-math would be OK to run unmasked?=