public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/54680] [SH] Unnecessary int-float-int conversion of fsca fixed point input
Date: Tue, 09 Oct 2012 19:57:00 -0000	[thread overview]
Message-ID: <bug-54680-4-TIu4Xgkp6p@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54680-4@http.gcc.gnu.org/bugzilla/>


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

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-10-09 19:57:35 UTC ---
(In reply to comment #0)
> 
> Another scenario that does not work however is:
> 
> float test03 (int x)
> {
>   return sinf ( x * 2 * pi / 65536 );
> }
> 
> (Notice the missing ( ) around 2 * pi).
> 
> It seems this is caused by the fact that the fsca pattern checks for a valid
> scaling constant by doing:
> 
>    && operands[2] == sh_fsca_int2sf ()"
> 
> .. instead of looking at the values of the const_double rtx.

No, that's not the reason.  The reason is that in the above case 'x * 2' is
expanded as an integer multiplication.  Thus the fsca scale factor changes and
is not pi / 2**15 as expected by the fsca pattern.
This could be fixed by inspecting the fpul operand in detail, but it doesn't
seem worth doing so.  Anyway user code that will use the standard sinf / cosf
functions with fixed-point inputs will be aware of SH4 fsca specifics.


  parent reply	other threads:[~2012-10-09 19:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-23 12:25 [Bug target/54680] New: " olegendo at gcc dot gnu.org
2012-09-23 12:40 ` [Bug target/54680] " olegendo at gcc dot gnu.org
2012-10-09 19:57 ` olegendo at gcc dot gnu.org [this message]
2012-10-12 23:19 ` olegendo at gcc dot gnu.org
2012-10-30  1:28 ` olegendo at gcc dot gnu.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-54680-4-TIu4Xgkp6p@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).