From: Jan Hubicka <jh@suse.cz>
To: Andrew Haley <aph-gcc@littlepinkcloud.COM>
Cc: Jan Hubicka <hubicka@ucw.cz>, Jan Hubicka <jh@suse.cz>,
gcc-patches@gcc.gnu.org, richard@codesourcery.com
Subject: Re: Lazy construction of libcalls
Date: Sat, 08 Sep 2007 16:28:00 -0000 [thread overview]
Message-ID: <20070908160844.GG10905@kam.mff.cuni.cz> (raw)
In-Reply-To: <18146.31326.53954.878500@zebedee.pink>
> Jan Hubicka writes:
> > > Jan Hubicka <jh@suse.cz> writes:
> > > >> Jan Hubicka <jh@suse.cz> writes:
> > > >> > While comparing the tables produced by new and old code, I noticed that
> > > >> > "ffs" for SI used to be called "ffssi3" but now it is "ffs".
> > > >> > I believe it was inteded to be called ffs because of:
> > > >> > optab_handler (ffs_optab, int_mode)->libfunc = init_one_libfunc ("ffs");
> > > >> > that however later get overwriten by initialization code.
> > > >>
> > > >> Actually, this was deliberate. All libgccs have word and doubleword
> > > >> ffs functions, but not all C libraries have "ffs". So we wanted the
> > > >> libgcc versions to take precedence over the C library fallback. See:
> > > >>
> > > >> http://gcc.gnu.org/ml/gcc-patches/2007-04/msg01165.html
> > > >>
> > > >> for details.
> > > >
> > > > OK, so the initialization of libgcc always overwrite the ffs
> > > > initialization, so simply removing the line above would work?
> > >
> > > Not for 64-bit targets with a 32-bit int, since __builtin_ffs() takes
> > > an int argument. We could of course add an SImode libgcc function for
> > > those targets, but the patch above was just supposed to make better
> > > use of what we already had.
> >
> > Thanks for explanation - I've now added a guard
> > if (INT_TYPE_SIZE < BITS_PER_WORD)
> > into my local copy that should do what described again. I am re-testing now,
> > OK with that change?
>
> This breaks ARM EABI. The symptom is that we generate signed instead
> of unsigned libcalls for a % b where a and b are usigned ints.
>
> The problem is here in sign_expand_binop(), where we generate a fake
> optab:
>
> /* Try widening to a signed int. Make a fake signed optab that
> hides any signed insn for direct use. */
> wide_soptab = *soptab;
> optab_handler (&wide_soptab, mode)->insn_code = CODE_FOR_nothing;
>
> We later call expand_binop (mode, &wide_soptab ... which in turn
> calls optab_libfunc (binoptab, mode) which calls optab->libcall_gen()
> and inserts the fake optab into the hash table. This means that the
> hash table ->optab points into the stack. We don't want to do this,
> I'm sure.
Uh, sure...
>
> I suspect the easiest way to fix this is by setting libcall_gen to
> NULL in the fake optab.
Thanks, that seems like correct fix to me.
Honza
next prev parent reply other threads:[~2007-09-08 16:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-21 17:13 Jan Hubicka
2007-08-24 13:44 ` Richard Sandiford
2007-08-24 14:23 ` Jan Hubicka
2007-08-24 14:46 ` Richard Sandiford
2007-09-04 8:16 ` Jan Hubicka
2007-09-04 8:28 ` Richard Guenther
2007-09-19 6:50 ` Kaveh R. GHAZI
2007-09-28 5:48 ` [PING]: fix breakage in c4x ports Kaveh R. GHAZI
2007-10-12 13:15 ` [PING x 2]: " Kaveh R. GHAZI
2007-10-12 13:16 ` Richard Guenther
2007-09-08 12:44 ` Lazy construction of libcalls Andrew Haley
2007-09-08 16:28 ` Jan Hubicka [this message]
2007-08-24 14:43 ` Jan Hubicka
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=20070908160844.GG10905@kam.mff.cuni.cz \
--to=jh@suse.cz \
--cc=aph-gcc@littlepinkcloud.COM \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
--cc=richard@codesourcery.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).