{"id":2230223,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2230223/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260429133156.8F3994BB3BE5@sourceware.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260429133156.8F3994BB3BE5@sourceware.org>","date":"2026-04-29T13:31:19","name":"[x86,v2] override vector_costs::better_epilogue_loop_than_p","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1bfea2635054d9b572aba01890c324f5135bcbf6","submitter":{"id":4338,"url":"http://patchwork.ozlabs.org/api/1.1/people/4338/?format=json","name":"Richard Biener","email":"rguenther@suse.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260429133156.8F3994BB3BE5@sourceware.org/mbox/","series":[{"id":502061,"url":"http://patchwork.ozlabs.org/api/1.1/series/502061/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=502061","date":"2026-04-29T13:31:19","name":"[x86,v2] override vector_costs::better_epilogue_loop_than_p","version":2,"mbox":"http://patchwork.ozlabs.org/series/502061/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230223/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230223/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=a4DqbqK1;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=hkJZeZDi;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=Pl5EJ/m1;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=Oq1JY/wD;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=a4DqbqK1;\n\tdkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=hkJZeZDi;\n\tdkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de\n header.a=rsa-sha256 header.s=susede2_rsa header.b=Pl5EJ/m1;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=Oq1JY/wD","sourceware.org;\n dmarc=pass (p=none dis=none) header.from=suse.de","sourceware.org; spf=pass smtp.mailfrom=suse.de","server2.sourceware.org;\n arc=none smtp.remote-ip=195.135.223.130","smtp-out1.suse.de;\n\tnone"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5JB646K7z1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 23:31:58 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 8F3994BB3BE5\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 13:31:56 +0000 (GMT)","from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])\n by sourceware.org (Postfix) with ESMTPS id 0F1524BA799D\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 13:31:29 +0000 (GMT)","from murzim.nue2.suse.org (unknown [10.168.4.243])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id DDB996A883;\n Wed, 29 Apr 2026 13:31:19 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 8F3994BB3BE5","OpenDKIM Filter v2.11.0 sourceware.org 0F1524BA799D"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 0F1524BA799D","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 0F1524BA799D","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777469489; cv=none;\n b=wzNLWswYn4MZ2TFQVOeq2cHR5L46uvZAQlfYZjQl1bj8S8hyUwcSQ+WT/Fm1U5KO/JpJx2oQAXppwFljmayMMWuoAY2xpwxmQPzLZiY53RMO4I55rS9KdDsrayb/m1McdpaJA0ffGc+YVXgFE0BwKL28tVFI9tE68iZ8uNT3o3w=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777469489; c=relaxed/simple;\n bh=oojOzhIwdcIe19mxl5Eakazbxo2hg6EY22GJsADZqb0=;\n h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date:\n From:To:Subject:MIME-Version;\n b=Uzq8LFJCHPXk1OQjX0GOYyInSJvN19oxU88/4tWrNDDvPsf9+h3zPcJyEZ5mkZNXS95V9Y3OlawNNxPCEVqdc8FGXX27sSx+hi0SUO1Ye9FpUqjtZ6Lu1c05kxVTPrrpXcFwotb5/Ghcju1TSthvsOtNUES93Zk69+cZQ57Kvyc=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777469484;\n h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type; bh=Ti72Seq6OwgL5jb+EHSprGqeCyZZ0T+bwDe2UM8GELE=;\n b=a4DqbqK1EQtWXK4qyECwMvb8hlGL7KaGV8LQ/tqfWj1jXpLtGP/z7eWUixMpfiTGc2Kvmj\n wWiJmsb0Ve1AWhas8B5UU6PKbn3v3JRdcD9wxpkxkVV03h6Qy8YUoeaRQ4AXqFL+/7pJbs\n /7WbpJA+pLfb0ZBVHkvUHJkcNHMvTLU=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777469484;\n h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type; bh=Ti72Seq6OwgL5jb+EHSprGqeCyZZ0T+bwDe2UM8GELE=;\n b=hkJZeZDio7DC2GLe+JSihRuAh2GB7a7CCohLaVv76zDCIMOWu+wUG5dKcgOHupPFirYv+8\n kBJsmDdMcSUrOQCA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1777469479;\n h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type; bh=Ti72Seq6OwgL5jb+EHSprGqeCyZZ0T+bwDe2UM8GELE=;\n b=Pl5EJ/m1fLxSzFYJzPyEWFEVS45pcXDXF+jzxO516ATMHFDmDPo3KZkvQ0e0NavNuJZFuH\n V/g8yQOOXi+p6uffTfIes407fZDk7tNrR5YEfchZGbyPDpol/ULznGfrcj71fuXVbq1bEo\n kgpfj1LP0zYJOB7dcKe+PS8B/VeNIVw=","v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1777469479;\n h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type; bh=Ti72Seq6OwgL5jb+EHSprGqeCyZZ0T+bwDe2UM8GELE=;\n b=Oq1JY/wD33B3/WAubPL3eMglATgpaYjeb7LDpBkYwZpZUoWbuy92UFjz5sW+822JzN8uvB\n JOJntB5DwxXjmEAg=="],"Date":"Wed, 29 Apr 2026 15:31:19 +0200 (CEST)","From":"Richard Biener <rguenther@suse.de>","To":"gcc-patches@gcc.gnu.org","cc":"hongtao.liu@intel.com","Subject":"[PATCH][x86][v2] override\n vector_costs::better_epilogue_loop_than_p","MIME-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","X-Spamd-Result":"default: False [-1.80 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n MISSING_MID(2.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000];\n NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain];\n RCVD_COUNT_ZERO(0.00)[0]; MISSING_XM_UA(0.00)[];\n ARC_NA(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[];\n TO_MATCH_ENVRCPT_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[];\n MIME_TRACE(0.00)[0:+]","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org","Message-Id":"<20260429133156.8F3994BB3BE5@sourceware.org>"},"content":"The following resolves the gcc.target/i386/vect-epilogues-3.c failure\nwhen --param ix86-vect-compare-costs=1 is specified.  When the target\nrequests multiple epilogues to be used and the new candidate is the\nepilogue of choice of the currently prevailing epilogue keep that.\n\nv2:\n\nBut avoid doing so if the new candidate uses a vectorization factor\nof one which should be an optimal vector epilog.  This avoids\nregressing gcc.dg/vect/costmodel/x86_64/costmodel-pr122573.c\n\nBootstrapped and tested on x86_64-unknown-linux-gnu.\n\nRichard.\n\n\t* config/i386/i386.cc (ix86_vector_costs::better_epilogue_loop_than_p):\n\tNew.  If the other loop suggests this as epilog prefer other.\n---\n gcc/config/i386/i386.cc | 21 +++++++++++++++++++++\n 1 file changed, 21 insertions(+)","diff":"diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc\nindex 6d34b23c2d6..e6aa31b6b24 100644\n--- a/gcc/config/i386/i386.cc\n+++ b/gcc/config/i386/i386.cc\n@@ -26126,6 +26126,8 @@ public:\n \t\t\t      vect_cost_model_location where) override;\n   void finish_cost (const vector_costs *) override;\n   bool better_main_loop_than_p (const vector_costs *) const override;\n+  bool better_epilogue_loop_than_p (const vector_costs *other,\n+\t\t\t\t    loop_vec_info main_loop) const;\n \n private:\n \n@@ -27007,6 +27009,25 @@ ix86_vector_costs::better_main_loop_than_p (const vector_costs *other) const\n   return vector_costs::better_main_loop_than_p (other);\n }\n \n+/* Return true if THIS should be preferred over OTHER as epilog vector\n+   loop when vectorizing MAIN_LOOP.  */\n+\n+bool\n+ix86_vector_costs::better_epilogue_loop_than_p (const vector_costs *other,\n+\t\t\t\t\t\tloop_vec_info main_loop) const\n+{\n+  loop_vec_info this_loop_info = as_a <loop_vec_info> (this->vinfo ());\n+  /* The x86 target allows for multiple vector epilogues, if THIS is\n+     the suggested epilog mode of OTHER then keep the latter unless\n+     THIS has a VF of one which means no further epilog needed.  */\n+  int tem;\n+  if (known_gt (LOOP_VINFO_VECT_FACTOR (this_loop_info), 1U)\n+      && (GET_MODE_SIZE (other->suggested_epilogue_mode (tem))\n+\t  == GET_MODE_SIZE (this_loop_info->vector_mode)))\n+    return false;\n+  return vector_costs::better_epilogue_loop_than_p (other, main_loop);\n+}\n+\n /* Validate target specific memory model bits in VAL. */\n \n static unsigned HOST_WIDE_INT\n","prefixes":["x86","v2"]}