http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #6 from Marc Glisse glisse at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #4)
Anyway, you definitely don't want
to use inline asm in this case, if there is some code GCC doesn't optimize
as good as you'd like to,
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #7 from Jakub Jelinek jakub at gcc dot gnu.org ---
(In reply to Marc Glisse from comment #6)
(In reply to Jakub Jelinek from comment #4)
Anyway, you definitely don't want
to use inline asm in this case, if there is some code GCC
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #8 from Marc Glisse glisse at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #7)
They are modelled in the .md files now, we just don't have general purpose
builtins for this yet in GCC 4.9, it is only used for
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #5 from H. Peter Anvin hpa at zytor dot com ---
Please don't get hung up on the specific example; I just picked one that was
small and self-contained.
The biggest reason we can't use gcc's native bits in the kernel are items where
we
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
Jakub Jelinek jakub at gcc dot gnu.org changed:
What|Removed |Added
CC||jakub at gcc dot
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #2 from Uroš Bizjak ubizjak at gmail dot com ---
Looking at the assembly, you probably want:
--cut here--
int test (int a, int b, int c)
{
unsigned r = a + b;
if (r (unsigned) a)
return 1;
else if (r c)
return 1;
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #3 from Uroš Bizjak ubizjak at gmail dot com ---
(In reply to Uroš Bizjak from comment #2)
if (r (unsigned) a)
Explicit cast is not needed here, the compiler will do it for you.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59615
--- Comment #4 from Jakub Jelinek jakub at gcc dot gnu.org ---
But it would warn about it with -Wsign-compare. You want unsigned r =
(unsigned) a + b; or similar to avoid undefined behavior if there is a
possibility of signed integer overflow.