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: rs6000 machine description/assembly question


On Mon, 2002-11-25 at 14:40, David Edelsohn wrote:
> >>>>> Spundun  writes:
> 
> Spundun> I think negative of a number and a number itself will have same number
> Spundun> of leading zeros. so when you do and %0,%0,%1, %0 will have the same
> Spundun> number of leading zeros that %1 has. so whats the point of first two
> Spundun> instructions?
> Spundun> Can anyone tell what am I missing here?
> 
> 	You might want to review two's complement representation of numbers.
Thanx for your reply.
My idae about the arithmatic over here is,
-x = ~x+1 (~x is "not x")

Based on the above
say the first 1 in x is at nth position
then x is
[some stuff]1[n zeros]
~x is
[not some stuff]0[n ones]
~x+1 is
[not some stuff]1[n zeros] (the carry propagating through all ones)
now if you "and" this with the number above, you get
[some zeros]1[n zeros]. so cntlzw on this will be n (same as that on the
original x)
Can you comment on this reasoning please? I am sure there something
silly on my part.
Spundun
> 
> David



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