Re: How to inline a huge m68k code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Haley wrote:
> ami_stuff wrote:
>>
>> Dnia 13 lipca 2009 16:35 Andrew Haley <aph@xxxxxxxxxx> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux