From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id E72E9393F835 for ; Wed, 12 Jan 2022 10:33:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E72E9393F835 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9637C1FB; Wed, 12 Jan 2022 02:33:32 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 016E13F5A1; Wed, 12 Jan 2022 02:33:31 -0800 (PST) From: Richard Sandiford To: Richard Biener Mail-Followup-To: Richard Biener , "Andre Vieira \(lists\)" , "gcc-patches\@gcc.gnu.org" , richard.sandiford@arm.com Cc: "Andre Vieira \(lists\)" , "gcc-patches\@gcc.gnu.org" Subject: Re: [vect] PR103971, PR103977: Fix epilogue mode selection for autodetect only References: <9n4q13-4330-20p3-5q25-4rns99s265n8@fhfr.qr> Date: Wed, 12 Jan 2022 10:33:30 +0000 In-Reply-To: <9n4q13-4330-20p3-5q25-4rns99s265n8@fhfr.qr> (Richard Biener's message of "Wed, 12 Jan 2022 11:29:27 +0100 (CET)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Jan 2022 10:33:34 -0000 Richard Biener writes: > On Wed, 12 Jan 2022, Andre Vieira (lists) wrote: > >> Hi, >> >> This a fix for the regression caused by '[vect] Re-analyze all modes for >> epilogues'. The earlier patch assumed there was always at least one other mode >> than VOIDmode, but that does not need to be the case. >> If we are dealing with a target that does not define more modes for >> 'autovectorize_vector_modes', the behaviour before the patch would be to try >> to create an epilogue for the same autodetected_vector_mode, which unless the >> target supported partial vectors would always fail. So as a fix I suggest >> trying to vectorize the epilogue with the preferred_simd_mode for QI, >> mimicking autovectorize_vector_mode, which will be skipped if it is not a >> vector_mode (since that already should indicate partial vectors aren't >> possible) or if no partial vectors are supported and its pessimistic NUNITS is >> larger than the main loop's VF. >> >> Currently bootstrapping and regression testing, otherwise OK for trunk? Can >> someone verify this fixes the issue for PR103971 on powerpc? > > Why not simply start at mode_i = 0 which means autodetecting the mode > to use for the epilogue? That appears to be a much simpler solution to > me, including for targets where there are more than one element in the > vector. VOIDmode doesn't tell us anything about what the autodetected mode will be, so current short-circuit: /* If the target does not support partial vectors we can shorten the number of modes to analyze for the epilogue as we know we can't pick a mode that has at least as many NUNITS as the main loop's vectorization factor, since that would imply the epilogue's vectorization factor would be at least as high as the main loop's and we would be vectorizing for more scalar iterations than there would be left. */ if (!supports_partial_vectors && maybe_ge (GET_MODE_NUNITS (vector_modes[mode_i]), first_vinfo_vf)) { mode_i++; if (mode_i == vector_modes.length ()) break; continue; } wouldn't be effective. Thanks, Richard