public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Trouble with GAS halfword extraction on PPC
@ 1997-08-20 18:51 Peter Barada
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Barada @ 1997-08-20 18:51 UTC (permalink / raw)
  To: egcs

>Use \() to escape a sequence of characters.

Gross. Why does gas convert '&' into '\\' in a macro anyway?

The following was extracted from expand_macro_body:

      if (in->ptr[src] == '&')
	{
	  sb_reset (&t);
	  if (macro_mri)
	    {
	      if (src + 1 < in->len && in->ptr[src + 1] == '&')
		src = sub_actual (src + 2, in, &t, formal_hash, '\'', out, 1);
	      else
		sb_add_char (out, in->ptr[src++]);
	    }
	  else
	    {
	      /* FIXME: Why do we do this?  It prevents people from
                 using the & operator in a macro.  */
	      src = sub_actual (src + 1, in, &t, formal_hash, '&', out, 0);
	    }
	}

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

* Re: Trouble with GAS halfword extraction on PPC
@ 1997-08-20 17:11 Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 1997-08-20 17:11 UTC (permalink / raw)
  To: egcs

> or using shifts and mods (since gas does not like & in macros!)

Use \() to escape a sequence of characters.

 	.macro	LWI	reg, value
 	lis	\reg, (\value)>>16
 	ori	\reg, \reg, (\value)\(&)0xffff
 	.endm


r~

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

* Re: Trouble with GAS halfword extraction on PPC
  1997-08-20 16:37 Peter Barada
@ 1997-08-20 16:37 ` Jeffrey A Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeffrey A Law @ 1997-08-20 16:37 UTC (permalink / raw)
  To: egcs

  In message <199708201602.MAA02660@miacomet.wavemark.com>you write:
  > So does anyone have a clue how one does this as constants (Yes I know
  > I can stick it in memory and then load the value, but i'd rather waste
  > two insns to save the cache load).
I believe this is happening because the assembler doesn't know the
value for RAM1 or RAM2.

Jeff

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

* Trouble with GAS halfword extraction on PPC
@ 1997-08-20 16:37 Peter Barada
  1997-08-20 16:37 ` Jeffrey A Law
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Barada @ 1997-08-20 16:37 UTC (permalink / raw)
  To: egcs

I'm using binutils-2.8/gas configures as follows:

# ./configure  --host=i586-linux-gnu --target=ppc-rtems-eabi --prefix=/usr/local/wave --exec-prefix=/usr/local/wave/ppc --program-prefix=ppc_ --with-gnu-as --with-gnu-ld --nfp --cache-file=../config.cache

And I'm trying to use a macro that concatenates a large number of
constants and then loads it into a register by using lis/ori pair to
get the halfword constants, or using shifts and mods (since gas does
not like & in macros!), but if I try:


        .text
	.align		4
	.extern  	boot_main
	.globl		_START, _boot


	.macro	LWI	reg, value
	lis	\reg, (\value)>>16
	ori	\reg, \reg, (\value)%0x10000
	.endm

	.macro	LWI2	reg, value
	lis	\reg, \value@h
	ori	\reg, \reg, \value@l
	.endm

	.equ	CONST_VALUE	(RAM1<<20)|(RAM2<<16)
_boot:

	addis	r3, 0, (CONST_VALUE)>>16
	ori	r3, CONST_VALUE%0x10000

	LWI	r4, CONST_VALUE
	LWI2	r5, CONST_VALUE
	b	$
	.end


When I pass this through gas, I get:

/tmp/boot2.s: Assembler messages:
/tmp/boot2.s:22: Error: unsupported relocation type
/tmp/boot2.s:23: Error: unsupported relocation type
/tmp/boot2.s:23: Error: unsupported relocation type
/tmp/boot2.s:25: Error: unsupported relocation type
/tmp/boot2.s:25: Error: unsupported relocation type
/tmp/boot2.s:25: Error: unsupported relocation type
/tmp/boot2.s:26: Error: unsupported relocation type
/tmp/boot2.s:26: Error: unsupported relocation type
/tmp/boot2.s:26: Error: unsupported relocation type

So does anyone have a clue how one does this as constants (Yes I know
I can stick it in memory and then load the value, but i'd rather waste
two insns to save the cache load).

THanx in advance,

- -- 
Peter Barada				pbarada@wavemark.com
Wizard					617-270-7098 x1226
WaveMark Technologies, Inc.		617-270-0193 (fax)

"Real men know that you should never attempt to accomplish with words
what you can do with a flame thrower" --Bruce Ferstein

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

end of thread, other threads:[~1997-08-20 18:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-20 18:51 Trouble with GAS halfword extraction on PPC Peter Barada
  -- strict thread matches above, loose matches on Subject: below --
1997-08-20 17:11 Richard Henderson
1997-08-20 16:37 Peter Barada
1997-08-20 16:37 ` Jeffrey A Law

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 read-only IMAP folder(s) and NNTP newsgroup(s).