This is the mail archive of the gcc@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: Optimizations on long long multiply/divide on PowerPC32 don't work


Franz Sirl wrote:

> On Monday 10 December 2001 18:08, Linus Torvalds wrote:
> 
>>On Mon, 10 Dec 2001, Franz Sirl wrote:
>>
>>>Ah, now that is nice, I always wondered which codepath produced the
>>>signeddivide64-by-exactlog2constant to shift conversion on x86, but
>>>couldn't find anything in i386.md :-(. I'll try that one on 3.0.3pre and
>>>see if the FAT FS compiles again (I wonder if my ashrdi3_nopower pattern
>>>will get used then?).
>>>
>>Which part of FAT-FS actually tries to do a signed division?
>>
> 
> It's this code fragment:
> 
>         inode->i_blocks = ((inode->i_size + inode->i_blksize - 1)
>                            & ~(inode->i_blksize - 1)) / 512;



I believe inode->i_blksize is always a multiple of 512. So the least 
significant 9 bits are guaranteed to be zero and you can safely replace 
the divide by a shift.


> It calculates the number of blocks here, so the rounding up might be wanted...


There is already a round-up to the next multiple of inode->i_blksize by 
the addition and masking.

> Hehe, yeah, exactly :-). Anyway, Richard's patch works fine and gcc3 now is 
> able to optimize the divdi3 call away.


Great, does it also work for unsigned (more interesting for me).	

	Gabriel.





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