public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crrodriguez at opensuse dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/36041] Speed up builtin_popcountll
Date: Thu, 27 Jun 2013 06:14:00 -0000	[thread overview]
Message-ID: <bug-36041-4-UUl9ZIfoeX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-36041-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36041

--- Comment #19 from Cristian Rodríguez <crrodriguez at opensuse dot org> ---
(In reply to Jakub Jelinek from comment #18)
> I think it is a bad idea to introduce the IFUNC into libgcc_s, because then
> while you speed up the few users of this builtin, you slow down all users of
> libgcc_s (pretty much all C++ programs and lots of C programs), because they
> will need to resolve the ifunc.  For a very heavily used builtin perhaps,
> but for a rarely used one it just isn't a good idea.  User's can just use
> multi-versioning themselves and use __builtin_popcount* in the
> multi-versioned function.

Hold on..Apparently I used ambiguous language in my comment.. adding ifuncs to
libgcc* was not my real suggestion, but to EMIT such IFUNC s in the resulting
final user code when the target environment allows it. One generic, one
hardware/arch specific.
>From gcc-bugs-return-425262-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 27 06:43:39 2013
Return-Path: <gcc-bugs-return-425262-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 9727 invoked by alias); 27 Jun 2013 06:43:39 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 9639 invoked by uid 48); 27 Jun 2013 06:43:35 -0000
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/36041] Speed up builtin_popcountll
Date: Thu, 27 Jun 2013 06:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.2.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: glisse at gcc dot gnu.org
X-Bugzilla-Status: NEW
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: <bug-36041-4-imZZwc3kCu@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-36041-4@http.gcc.gnu.org/bugzilla/>
References: <bug-36041-4@http.gcc.gnu.org/bugzilla/>
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
X-SW-Source: 2013-06/txt/msg01641.txt.bz2
Content-length: 1533

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36041

--- Comment #20 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #18)
> I think it is a bad idea to introduce the IFUNC into libgcc_s, because then
> while you speed up the few users of this builtin, you slow down all users of
> libgcc_s (pretty much all C++ programs and lots of C programs), because they
> will need to resolve the ifunc.

I assume it is only those that use the builtin at least once, no? At least
LD_DEBUG seems to say so. I have no idea how heavy the ifunc resolution is, so
ok. We are back to only considering the non-table version... (By the way,
shouldn't these builtins act like C99 inline functions, so we can sometimes
inline them at -O3 (it could also enable vectorization)? Or maybe they already
do and it's just that I didn't test hard enough)


(In reply to Cristian Rodríguez from comment #19)
> Hold on..Apparently I used ambiguous language in my comment.. adding ifuncs
> to libgcc* was not my real suggestion, but to EMIT such IFUNC s in the
> resulting final user code when the target environment allows it. One
> generic, one hardware/arch specific.

Not sure if that's much better. Ideally we'd clone the hot loop that uses it
and propagate the versioning to that, not just the instruction, but I don't
think we have any code for that. Although if gcc saw the full code:
if(__builtin_cpu_supports("popcnt"))_mm_popcnt_u64(x);else{call lib}, it might
already manage to clone the loop.
>From gcc-bugs-return-425263-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jun 27 07:12:00 2013
Return-Path: <gcc-bugs-return-425263-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19810 invoked by alias); 27 Jun 2013 07:12:00 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19761 invoked by uid 48); 27 Jun 2013 07:11:54 -0000
From: "jbeulich at novell dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57725] conflicting language extensions
Date: Thu, 27 Jun 2013 07:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jbeulich at novell dot com
X-Bugzilla-Status: UNCONFIRMED
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: <bug-57725-4-ytV2gfwD6i@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-57725-4@http.gcc.gnu.org/bugzilla/>
References: <bug-57725-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-06/txt/msg01642.txt.bz2
Content-length: 922

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW725

--- Comment #5 from jbeulich at novell dot com ---
How that? How is code supposed to find out then?

Perhaps briefly explaining where this is coming from originally might help: The
Xen hypervisor (as much as Linux) has a number of linker script constructs like

  .xsm_initcall.init : {
       __xsm_initcall_start = .;
       *(.xsm_initcall.init)
       __xsm_initcall_end = .;
  } :text

If there's no matching input section at all, the two boundary symbols will end
up equal. How would C code be supposed to find out if the comparison result is
unspecified?

And remember, this is not a problem with default visibility (presumably because
the code needs to be prepared for link time overrides of the symbols), but Xen
likes to get built with non-default visibility in order to avoid expensive GOT
indirections when accessing data despite the necessary use of -fPIC.


  parent reply	other threads:[~2013-06-27  6:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-36041-4@http.gcc.gnu.org/bugzilla/>
2012-09-05 10:40 ` jsalavert at gmail dot com
2012-09-05 15:21 ` paolo.carlini at oracle dot com
2012-10-26 15:51 ` gpiez at web dot de
2013-06-26 18:52 ` crrodriguez at opensuse dot org
2013-06-26 23:28 ` glisse at gcc dot gnu.org
2013-06-26 23:31 ` pinskia at gcc dot gnu.org
2013-06-26 23:38 ` crrodriguez at opensuse dot org
2013-06-26 23:49 ` glisse at gcc dot gnu.org
2013-06-27  5:34 ` jakub at gcc dot gnu.org
2013-06-27  6:14 ` crrodriguez at opensuse dot org [this message]
2013-06-27  7:13 ` jakub at gcc dot gnu.org
2013-06-28 12:50 ` glisse at gcc dot gnu.org
2013-06-28 13:01 ` jakub at gcc dot gnu.org
2021-08-16 23:28 ` pinskia at gcc dot gnu.org
2008-04-25  0:35 [Bug c/36041] New: " intvnut at gmail dot com
2008-04-25  0:40 ` [Bug middle-end/36041] " intvnut at gmail dot com
2008-04-25  8:45 ` rguenth at gcc dot gnu dot org
2008-04-25 12:29 ` intvnut at gmail dot com
2008-04-25 14:52 ` rguenth at gcc dot gnu dot org
2008-04-29  3:42 ` intvnut at gmail dot com
2010-02-21  1:34 ` manu at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-36041-4-UUl9ZIfoeX@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).