public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* register allocation on IA64
@ 2005-03-17 20:44 john.gill
  2005-03-18  0:36 ` How do I find a GNU Developer with experiance of WEB libs johnrobinson
  0 siblings, 1 reply; 2+ messages in thread
From: john.gill @ 2005-03-17 20:44 UTC (permalink / raw)
  To: gcc-help

I have a simple piece of code:

long
addem (long *ptr)
{
    return (ptr[0] + ptr[1] + ptr[2] + ptr[3] + ptr[4] + ptr[5]);   
}

This generates interleaved load and add instructions in a fairly 
efficient way using a different register to hold a loaded value.
However, the additions of the loaded values are serialized through
r8 (the return value register).
These are the relevant instructions from the assembler output below:
	add r8 = r8, r16
	add r8 = r8, r17
	add r8 = r8, r18
	add r8 = r8, r15
	add r8 = r8, r14

This does not seem to be the most efficient method because if I could
pair intermediate add results using a different (or reuse a) register 
for the result I could obtain better packing of the insns in the VLIW slots. 
However, this probably means using more registers to hold the 
intermediate added values. 

It seems to me that the insn scheduler has done the best
job it can given the registers allocation scheme it has inherited.
Is there any way to get gcc to be more aggressive with its register
allocation? Is there a compile time flag that I'm missing? I guess 
this is something that would be of generic benefit to all machines 
with lots of registers (I have noticed a similar problem for SPARC code). 

I can of course rewrite the code so that gcc emits more efficient insns
but this is ugly and a nightmare to support long term ... 

long
addem2 (long *ptr)
{
    register long val0 = ptr[0];
    register long val1 = ptr[1];
    register long val2 = ptr[2];
    register long val3 = ptr[3];
    register long val4 = ptr[4];
    register long val5 = ptr[5];

    register long val6 = val0+val1;
    register long val7 = val2+val3;
    register long val8 = val4+val5;

    register long val9 = val6+val7;

    return (val8 + val9);   
}


Thanks in advance

John



compiled with gcc -O2 -S add.c -o add.s gives:

add.s
==================================
	.file	"add.c"
	.pred.safe_across_calls p1-p5,p16-p63
.text
	.align 16
	.global addem#
	.proc addem#
addem:
	.prologue
	.body
	adds r15 = 8, r32
	adds r14 = 16, r32
	ld8 r8 = [r32]
	;;
	ld8 r16 = [r15]
	ld8 r17 = [r14]
	adds r15 = 24, r32
	;;
	add r8 = r8, r16      
	adds r14 = 32, r32
	ld8 r18 = [r15]
	;;
	add r8 = r8, r17       <<<<< serialized add
	adds r32 = 40, r32
	ld8 r15 = [r14]
	;;
	add r8 = r8, r18       <<<<< serialized add
	ld8 r14 = [r32]
	;;
	add r8 = r8, r15       <<<<< serialized add
	;;
	add r8 = r8, r14       <<<<< serialized add
	br.ret.sptk.many b0
	.endp addem#
	.global addem2#
	.proc addem2#
addem2:
	.prologue
	.body
	adds r18 = 24, r32
	mov r14 = r32
	adds r17 = 16, r32
	;;
	ld8 r19 = [r18]
	ld8 r15 = [r14], 8
	ld8 r16 = [r17]
	adds r18 = 40, r32
	;;
	ld8 r17 = [r14]
	add r16 = r16, r19       <<<<< paired add
	adds r32 = 32, r32
	;;
	add r15 = r15, r17       <<<<< paired add
	ld8 r14 = [r18]
	ld8 r8 = [r32]
	;;
	add r15 = r15, r16       <<<<< paired add
	add r8 = r8, r14         <<<<< paired add
	;;
	add r8 = r8, r15
	br.ret.sptk.many b0
	.ident	"GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.2 2.96-128.7.2)"

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

* How do I find a GNU Developer with experiance of WEB libs
  2005-03-17 20:44 register allocation on IA64 john.gill
@ 2005-03-18  0:36 ` johnrobinson
  0 siblings, 0 replies; 2+ messages in thread
From: johnrobinson @ 2005-03-18  0:36 UTC (permalink / raw)
  To: john.gill, gcc-help

Please email me at: john@formcompelete.biz


We are looking for a developer to integrate the GNU web parser (from the GNU
Web browser).  I have written a library that downloads a web site to local
files (although I suspect this library may not be needed).

I have tried to quickly summarise what we are looking for below, Ive typed
this up quickly so if this leaves any questions you need answering please
ask.

We are also looking for a fix price quote.

We are looking for a function webparse that you pass a website to and it
returns the fields relate to and the field name, type and contents (as well
has the form they relate to) in a linked list.

Webparse takes a localfile name (or if poss a URL) and extracts the
field_name, type and contents into the linked_list.

Websubmit takes a linked list and performs a submit of form.


struct linked_list
{
char *field_name;
char field_type;
char *field_contents;
char *form;
}

Webparse (URL or localfile,struct *link_list);

Websubmit (struct *link_list);

 

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

end of thread, other threads:[~2005-03-17 20:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 20:44 register allocation on IA64 john.gill
2005-03-18  0:36 ` How do I find a GNU Developer with experiance of WEB libs johnrobinson

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).