linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Linux/PPC assembly language documentation ?
@ 2000-11-16 13:56 Jacques MENU
  2000-11-16 19:04 ` Neil Russell
  0 siblings, 1 reply; 2+ messages in thread
From: Jacques MENU @ 2000-11-16 13:56 UTC (permalink / raw)
  To: linuxppc-dev


Hi folks,

I'm doing work on GNU Prolog that features a ppc_linux.c file, generating code the way shown below.

I'd like to find a description of ''@ha' and '@l' used in instructions like  :
	addis	9,0,.Lcont001@ha
and
	addi		9,9,.Lcont003@l

Please answer by email too since I'm not yet a member of this list. Thanks a lot !

Regards,

____________________

void
Pl_Call(char *label)
{
#ifndef MAP_REG_CP
  Inst_Printf("addis", "9,0,.Lcont%d@ha", w_label);
  Inst_Printf("addi", "9,9,.Lcont%d@l", w_label);
  Inst_Printf("stw", "9,%s", asm_reg_cp);
#else
  Inst_Printf("addis", "%s,0,.Lcont%d@ha", asm_reg_cp, w_label);
  Inst_Printf("addi", "%s,%s,.Lcont%d@l", asm_reg_cp, asm_reg_cp, w_label);
#endif

  Pl_Jump(label);
  Label_Printf(".Lcont%d:", w_label++);

#ifndef MAP_REG_E
  if (use_envir)
    Inst_Printf("lwz", "%s,%d(%s)", asm_reg_e, MAP_OFFSET_E, asm_reg_bank);
#endif
}

--
Dr Jacques MENU
CUI - Université de Genève

Tel:	++ 41 21 693 45 87
mailto:Jacques.Menu@cui.unige.ch
http://cui.unige.ch/~menu/1804

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Linux/PPC assembly language documentation ?
  2000-11-16 13:56 Linux/PPC assembly language documentation ? Jacques MENU
@ 2000-11-16 19:04 ` Neil Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Russell @ 2000-11-16 19:04 UTC (permalink / raw)
  To: Jacques.Menu; +Cc: linuxppc-dev


@l gives the lower 16-bits of the constant.
@h gives the upper 16-bits.
@ha gives the upper 16-bits adjusted so that carry from the lower 16-bits
    gives the correct result.

So, an example of correct use is:

	lis	r3, const@h
	ori	r3, r3, const@l

or

	lis	r3, const@ha
	addi	r3, r3, const@l

or

	lis	r3, addr@ha
	lbz	r4, addr@l(r3)

("lis rx, c" is "addis rx, rx, c").


Neil.



On Thu, Nov 16, 2000 at 02:56:18PM +0100, Jacques MENU wrote:
> I'm doing work on GNU Prolog that features a ppc_linux.c file, generating code the way shown below.
>
> I'd like to find a description of ''@ha' and '@l' used in instructions like  :
> 	addis	9,0,.Lcont001@ha
> and
> 	addi		9,9,.Lcont003@l
>
> Please answer by email too since I'm not yet a member of this list. Thanks a lot !
>
> Regards,
>
> ____________________
>
> void
> Pl_Call(char *label)
> {
> #ifndef MAP_REG_CP
>   Inst_Printf("addis", "9,0,.Lcont%d@ha", w_label);
>   Inst_Printf("addi", "9,9,.Lcont%d@l", w_label);
>   Inst_Printf("stw", "9,%s", asm_reg_cp);
> #else
>   Inst_Printf("addis", "%s,0,.Lcont%d@ha", asm_reg_cp, w_label);
>   Inst_Printf("addi", "%s,%s,.Lcont%d@l", asm_reg_cp, asm_reg_cp, w_label);
> #endif
>
>   Pl_Jump(label);
>   Label_Printf(".Lcont%d:", w_label++);
>
> #ifndef MAP_REG_E
>   if (use_envir)
>     Inst_Printf("lwz", "%s,%d(%s)", asm_reg_e, MAP_OFFSET_E, asm_reg_bank);
> #endif
> }
>
> --
> Dr Jacques MENU
> CUI - Université de Genève
>
> Tel:	++ 41 21 693 45 87
> mailto:Jacques.Menu@cui.unige.ch
> http://cui.unige.ch/~menu/1804
>

--
Neil Russell <caret@c-side.com>

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-11-16 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-16 13:56 Linux/PPC assembly language documentation ? Jacques MENU
2000-11-16 19:04 ` Neil Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).