This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
question about optab_libfunc() returning bogus libfuncs for sdivmod_optab
- From: Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 22 Aug 2016 17:05:52 +0530
- Subject: question about optab_libfunc() returning bogus libfuncs for sdivmod_optab
- Authentication-results: sourceware.org; auth=none
Hi,
While implementing divmod transform:
https://gcc.gnu.org/ml/gcc-patches/2016-05/msg01757.html
I ran into an issue with optab_libfunc().
It appears optab_libfunc (sdivmod_optab, DImode) returns
a libfunc with name "__divmoddi4", even though such a libfunc
does not exist in libgcc. This happens because in optabs.def
the entry for sdivmod_optab has gen_int_libfunc,
and call to optab_libfunc (sdivmo_optab, DImode) lazily
creates a bogus libfunc "__divmoddi4" by calling gen_int_libfunc().
Jim has given a better explanation for it here:
https://gcc.gnu.org/ml/gcc-patches/2016-06/msg00314.html
To work around this issue I set libfunc entry for sdivmod_optab to NULL
and verified that optab_libfunc (sdivmod_optab, DImode) returns NULL_RTX
instead of a bogus libfunc if it's not overriden by the target.
Patch posted for that here:
https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01015.html
It passes bootstrap+test on x86_64-unknown-linux-gnu, ppc64le-linux-gnu,
and cross-tested on arm*-*-* and aarch64*-*-*.
Is that change OK ?
This issue is the main blocker for divmod patch, any suggestions for resolving
it would be greatly appreciated.
Thanks,
Prathamesh