public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amodra at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/57836] New: large constants evaluated inline Date: Sat, 06 Jul 2013 11:58:00 -0000 [thread overview] Message-ID: <bug-57836-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57836 Bug ID: 57836 Summary: large constants evaluated inline Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: amodra at gmail dot com On powerpc64 with -mcmodel=small -O1, this int x; void f1 (long long hx) { if (hx < 0x3ff0000000000000LL) x++; } results in .L.f1: lis 9,0x3fef ori 9,9,65535 sldi 9,9,32 oris 9,9,0xffff ori 9,9,65535 cmpd 7,3,9 bgtlr 7 ld 9,.LC1@toc(2) lwz 10,0(9) addi 10,10,1 stw 10,0(9) blr The -mcmodel isn't significant, just there to make comparison with older compilers easy. Prior to gcc-4.5 we generated .L.f1: ld 0,.LC0@toc(2) cmpd 7,3,0 bgtlr 7 ld 9,.LC1@toc(2) lwz 11,0(9) addi 0,11,1 stw 0,0(9) blr Both pre- and post-4.5 compilers initially expand rtl using the constant load from toc, but 4.5 and later substitute the constant in the first cse pass. The problem stems from rtx cost for the load from toc being the same as the inline constant form. The costs are the same both pre- and post-4.5. The reason pre-4.5 does not substitute the constant is related to this comment is cse.c: /* Find cheapest and skip it for the next time. For items of equal cost, use this order: src_folded, src, src_eqv, src_related and hash table entry. */ Pre-4.5 src_folded is NULL, src is a mem, src_eqv the constant. Post-4.5 src_folded is the constant, src is a mem, src_eqv the constant again. Pre-4.5, rs6000.c lacked delegitimize_address. src_folded is set by fold_rtx, which calls equiv_constant, which calls avoid_constant_pool_reference, which calls targetm.delegitimize_address. When this is missing, we don't get to see the constant..
next reply other threads:[~2013-07-06 11:58 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-06 11:58 amodra at gmail dot com [this message] 2013-11-09 22:25 ` [Bug target/57836] " pinskia at gcc dot gnu.org 2014-05-12 6:38 ` amodra at gmail dot com 2014-05-15 0:14 ` dje at gcc dot gnu.org 2015-04-22 11:59 ` jakub at gcc dot gnu.org 2015-07-16 9:16 ` rguenth at gcc dot gnu.org 2020-04-01 23:17 ` amodra at gmail dot com
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-57836-4@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: linkBe 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).