public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Wolfgang Gellerich<gellerich@de.ibm.com>
To: ubizjak@gmail.com
Cc: gelleric@tuxmaker.boeblingen.de.ibm.com, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] add insn implementing signbit to middle end and s390
Date: Mon, 30 Apr 2007 15:05:00 -0000	[thread overview]
Message-ID: <4635FDD0.mailC5U11BV35@de.ibm.com> (raw)
In-Reply-To: <5787cf470704112359m5d13a9cbsf2a5468606792f72@mail.gmail.com>

%% > However, I am uncertain as far as putting parts of the implementation of
%% > expand_builtin_signbit() into expand_builtin_interclass_mathfn() given that
%% > expand_builtin() has already identified the signbit builtin as such. That test
%% > would have to be repeated. Since that the primary purpose of my patch is to
%% > introduce the signbit pattern I would prefer to keep it in
%% > expand_builtin_signbit() for now.  This does, of course, not prevent a later
%% > reorganization.

%% Perhaps I was too terse on my proposal. My thinking was, that from
%% expand_builtin() function, we should call
%% expand_builtin_interclass_mathfn() also for BUILT_IN_SIGNBIT case.
%% e_b_i_m() function will check, if there is an appropriate optab
%% present (please note the check for icode). In case this optab is not
%% present we call expand_builtin_signbit(), just before expand_call.
%% Something like this:

%% expand_builtin_interclass_mathfn()
%% {
%% ...
%%   switch (DECL_FUNCTION_CODE (fndecl))
%%     {
%%      ...
%%     CASE_FLT_FN (BUILT_IN_SIGNBIT):
%%       builtin_optab = signbit_optab; break;
%%      ...
%%     }

%%   if (icode != CODE_FOR_nothing)
%%     {
%%       ...
%%       return target;
%%     }

%%    switch (DECL_FUNCTION_CODE (fndecl))
%%     {
%%      ...
%%     CASE_FLT_FN (BUILT_IN_SIGNBIT):
%%       rtx target1 = expand_builtin_signbit (exp, target);
%%       if (target1)
%%         return target1;
%%      ...
%%     }

%%   target = expand_call (exp, target, target == const0_rtx);

%%   return target;
%% }

I understand what you mean.  However, given that expand_builtin_signbit does a
lot of optimizations special to signbit() only, and will in fact always do
something special and never issue a call to expand_call() as found at the end
of expand_builtin_interclass_mathfn, a combined function would probably
require a lot of code to distinguish between cases. Note also that the new
version of my patch will only add very few lines.


%% > By the way, there is a chance for a new optimization. The s390 instruction I
%% > am going to exploit with this and some future patches is able to test the
%% > contents of a float register for all those IEEE special values like infinity,
%% > different kinds of NaN etc. A bit mask controls what the instruction actually
%% > looks for. This means, one instruction with an appropriate bit mask is
%% > sufficient to implement an expression like
%% >
%% >   (isnan(x) || isinf(x))
%% >

%% IMO, you can simply expand the sequence of

%% read_status
%% and_status_with_constant
%% cond_set_value

%% for each optab.  Optimizers should resolve IOR of masked values to
%% just one AND, like in following case:
%% --cut here--
%% void check(void)
%% {
%%   int a = foo();
%%   int x,y;

%%   x = a & 2;
%%   y = a & 8;

%%   if (x || y)
%%     bar();
%% }
%% --cut here--

Would surely work, however, my idea is to introduce the combined test quite
early. I'll send a patch showing the details.

With best regards, 

  Wolfgang Gellerich


---
Dr. Wolfgang Gellerich
IBM Deutschland Entwicklung GmbH
Schönaicher Strasse 220
71032 Böblingen, Germany
Tel. +49 / 7031 / 162598
gellerich@de.ibm.com

=======================

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Johann Weihen 
Geschäftsführung: Herbert Kircher 
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

  reply	other threads:[~2007-04-30 14:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-03 14:18 Uros Bizjak
2007-04-11 12:58 ` gellerich
2007-04-12  6:59   ` Uros Bizjak
2007-04-30 15:05     ` Wolfgang Gellerich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-04-03 13:35 Gellerich
2007-04-03 13:50 ` Richard Guenther
2007-04-11  7:46   ` gellerich
2007-04-11  7:46   ` gellerich
2007-04-11  7:46   ` gellerich
2007-04-11  8:54   ` gellerich
2007-04-03 14:02 ` Paolo Bonzini
2007-04-11 10:17   ` gellerich
2007-03-30  9:36 Wolfgang Gellerich
2007-03-30 14:49 ` Ulrich Weigand
2007-03-30 17:24 ` Richard Henderson
2007-04-02  7:57   ` Wolfgang Gellerich
2007-04-30 17:02     ` Wolfgang Gellerich
2007-06-11  9:25       ` Richard Guenther
2007-07-06 15:02         ` Wolfgang Gellerich
2007-07-06 15:37         ` Wolfgang Gellerich
2007-07-06 16:22           ` Richard Guenther

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=4635FDD0.mailC5U11BV35@de.ibm.com \
    --to=gellerich@de.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gelleric@tuxmaker.boeblingen.de.ibm.com \
    --cc=ubizjak@gmail.com \
    /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).