From: Jeff Law <law@redhat.com>
To: Pitchumani Sivanupandi <pitchumani.sivanupandi@microchip.com>,
rguenther@suse.de, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC, tentative patch] Adjust cost for conversion expression
Date: Mon, 28 Nov 2016 22:40:00 -0000 [thread overview]
Message-ID: <1c766faf-1b50-a6f7-edca-79131d8d8994@redhat.com> (raw)
In-Reply-To: <90583097-cd60-0152-66a5-e32d6830b776@microchip.com>
On 11/24/2016 03:58 AM, Pitchumani Sivanupandi wrote:
> GCC inlines small functions if the code size after expansion is not
> excedded.
> For test case (inline.c, avr-gcc -Os -S inline.c) code size become
> higher if
> 'func2' is inlined. It happens because the CONVERT_EXPR/ NOP_EXPR are
> considered
> as zero cost expression.
>
> Few conversions will cost additional instructions. For targets like AVR
> it will cost considerably as it's register size is just one byte.
>
> Attached the tentative patch that changes the CONVERT_EXPR/ NOP_EXPR cost
> to 1 if the LHS is bigger than RHS and target's word_mode.
>
> Is this Ok?
>
> Would it be reasonable if cost evaluated as below instead of constant 1?
> if (LHS PRECISION > RHS PRECISION)
> cost = LHS_PRECISION / word_mode - 1
> else
> cost = 0
>
> Built GCC for native with bootstrap enabled. No issues.
My high level worry here is that this introduces a target dependency
into the early part of the tree optimization pipeline (the test against
word_mode).
I'd be more open to giving a cost to any widening conversion. That
kind of change might have a wide reaching impact though.
jeff
prev parent reply other threads:[~2016-11-28 22:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 10:58 Pitchumani Sivanupandi
2016-11-24 11:24 ` Richard Biener
2016-11-28 13:10 ` Pitchumani Sivanupandi
2016-11-28 13:36 ` Richard Biener
2016-11-28 22:40 ` Jeff Law [this message]
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=1c766faf-1b50-a6f7-edca-79131d8d8994@redhat.com \
--to=law@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=pitchumani.sivanupandi@microchip.com \
--cc=rguenther@suse.de \
/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).