This is the mail archive of the gcc-help@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: How to inline a huge m68k code?


Andrew Haley wrote:
> ami_stuff wrote:
>>
>> Dnia 13 lipca 2009 16:35 Andrew Haley <aph@redhat.com> napisaÅ(a):
>>
>>> ami_stuff wrote:
>>>>>> Ok, so it is a GCC's bug?
>>>>> It's perhaps an optimization that gcc doesn't do.  But then
>>>>> there is an infinite number of optimizations that gcc doesn't do.
>>>> How should I modify GCC's inline to repleace MULH function (to make it compatible)?
>>> What for?  I posted sample code that should work.
>> Could you tell me what I do wrong?
> 
> Not until you tell me about the results from the code I posted!  :-)
> 
>> #include <stdio.h>
>> #include <stdint.h>
>>
>> #define MULH_ORG(a,b) (((int64_t)(a) * (int64_t)(b))>>32)
>>
>> #define MULH_ASM(xh, xl, a, b)
> 
> This won't work because xh and xl are outputs.

Like this:

inline int xxMULH(int a, int b)
{
  uint32_t au = a;
  uint32_t bu = b;

  uint32_t resh, resl;

  umul_ppmm(resh, resl, au, bu);

  if (a < 0)
    resh -= bu;
  if (b < 0)
    resh -= au;

  return (int)resh;
}

Andrew.


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