This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, x86_64]: Provide longlong.h definitions for 128bit operations



On May 18, 2007, at 12:58 PM, Uros Bizjak wrote:


Chris Lattner wrote:

_now_ and follows what master copy of longlong.h does. Also, there is
no simple solution for 128bit "mul" and "div" insns, which are of most
interest here.

What is the issue here?
unsigned long long int t(unsigned int a, unsigned int b)
{
       return a * b;
}

doesn't compile to "mul" as one would expect (but to "imul"):

gcc -O2 -m32 -fomit-frame-pointer:

t:
       movl    8(%esp), %eax
       xorl    %edx, %edx
       imull   4(%esp), %eax
       ret

Don't you want:


unsigned long long int t2(unsigned int a, unsigned int b)
{
       return (unsigned long long)a * b;
}

which produces (gcc 4.0.1):

_t2:
        movl    8(%esp), %eax
        mull    4(%esp)
        ret

?

-Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]