Skip to contentSkip to conversation

Conversion between different types on IA-64

DISCUSSION CH Gowri Kumar 2 participants 3 messages Jul 29, 2003 – Jul 30, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,
Can anyone point me to a source of how to convert from a wider size to narrow size (long to int, int to char etc.) on IA-64?

For the other way round(narrow to wider), I could find SXT(sign extend) and ZXT(zero extend) instructions.

gcc seems(but not sure) to be storing the original value and loading it using the appropriate LD* instruction.

I am sorry if it's a too trivial question to be asked on this list.

Regards,
Gowri Kumar

#1 lore raw
Quoted 9 lines · CH Gowri Kumar

Hi all,
Can anyone point me to a source of how to convert from a wider size to narrow size (long to int, int to char etc.) on IA-64?

For the other way round(narrow to wider), I could find SXT(sign extend) and ZXT(zero extend) instructions.

gcc seems(but not sure) to be storing the original value and loading it using the appropriate LD* instruction.

In C just a cast ought to do it.

In asm it seems like you can either ST and then LD4/LD2/LD1, or use AND or EXTR.

Sorry if I'm misunderstanding your question.

Signature · 1 line
Martin 
#2 lore raw
In reply to CH Gowri Kumar

Hi Martin,

Quoted 1 line

In C just a cast ought to do it.

OOPS! I should have asked it as "IA-64 assembly".

Quoted 2 lines

In asm it seems like you can either ST and then LD4/LD2/LD1, or use AND or EXTR.

Seems the instructions extr and extr.u would do the work for signed and unsigned forms respectively.

Thanks for the help, Martin.

Regards,
Gowri Kumar