This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000 machine description/assembly question
- From: Spundun <spundun at ISI dot EDU>
- To: David Edelsohn <dje at watson dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 25 Nov 2002 15:07:34 -0800
- Subject: Re: rs6000 machine description/assembly question
- References: <200211252240.RAA23556@makai.watson.ibm.com>
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