Port-sparc64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
%hi vs %lm for 64-bit constants
Hi, I'm confused about sparc assembly language %hi and %lm operators
when used on sparcv9. Both of the operators extract 22 bits, which are
bits 10 to 31.
%hi(addr) which does (addr) >> 10
%lm(addr) which does ((addr) >> 10) & 0x3fffff
Assuming that 'addr' is a 64-bit memory address, from which I need to
extract bits 10 to 31, then it looks like %hi and %lm are duplicates of
each other.
I think %hi treats addr as a 32-bit constant and extracts bits 10 to 31
by shifting right 10 places.
And %lm treats addr as a 64-bit constant and extracts bits 10 to 31 by
shifting right 10 places and masking least significant 22 bits.
Why have both then?
Home |
Main Index |
Thread Index |
Old Index