Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* AXP advice on code for byte parsing??
@ 1996-02-07  5:00 Curt Smith
  1996-02-11  5:00 ` Peter Mayne
  1996-02-15  5:00 ` Joe Mario
  0 siblings, 2 replies; 4+ messages in thread
From: Curt Smith @ 1996-02-07  5:00 UTC (permalink / raw)


Hi,

We need to optimize the most performance out of a function that
does mostly byte addressing and moving / converting data types.

No consideration for CPU specific issues where given to this function
till; bad-boy-function VS picky-as-heck-RISC-CPU face off had the CPU
on the winning side.

We are now fully aware of un-aligned int/long issues but surely there 
are more tricks to performing the following type of operations:

General todo; 

- Convert a 400 byte record of structure ABC to 500 byte record of
  structure DEF.

- Structures ABC and DEF, have fields of ASCII, BCD, binary and oddly 
  encoded date values on all sorts of address boundaries.

Question mostly pertains to:

- ?? Tricks to picking up a 5 byte BCD field from struct offset = 101,
  in the MOST CPU efficient way possible??  I.E. picking up 8 bytes at
  at time into an auto long variable spanning the field in question??

- ?? The bad-boy-var is now in an auto var, char buf, or if int, in and
  int variable.  I suppose there's no AXP/RISC tricks at this point...

- ?? Am I correct to assume that the most efficient way to write a auto
  variable, int, to a non-aligned struct address is via memcpy()?

Thanks!!!
-- 

Curt Smith
curts@compgen.com

-- 

Curt Smith
curts@compgen.com




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

* Re: AXP advice on code for byte parsing??
  1996-02-07  5:00 AXP advice on code for byte parsing?? Curt Smith
@ 1996-02-11  5:00 ` Peter Mayne
  1996-02-13  5:00   ` Curt Smith
  1996-02-15  5:00 ` Joe Mario
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Mayne @ 1996-02-11  5:00 UTC (permalink / raw)


In article <4f8s6v$91v@nntp.atlanta.com>, curts@compgen.com says...
>
>Hi,
>
>We need to optimize the most performance out of a function that
>does mostly byte addressing and moving / converting data types.

Byte loads/stores have been added to the architecture. You could wait for an 
implementation that includes them... 8-)
-- 
PJDM
Peter Mayne
Digital Equipment Corporation (Australia)
Canberra, ACT
----
These are my opinions, and have nothing to do with Digital.
The truth is out there, but not necessarily in here.




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

* Re: AXP advice on code for byte parsing??
  1996-02-11  5:00 ` Peter Mayne
@ 1996-02-13  5:00   ` Curt Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Curt Smith @ 1996-02-13  5:00 UTC (permalink / raw)
  Cc: Peter.Mayne

Peter Mayne (Peter.Mayne@cao.mts.dec.com) wrote:
: In article <4f8s6v$91v@nntp.atlanta.com>, curts@compgen.com says...
: >
: >Hi,
: >
: >We need to optimize the most performance out of a function that
: >does mostly byte addressing and moving / converting data types.
: 
: Byte loads/stores have been added to the architecture. You could wait for an 
: implementation that includes them... 8-)

Do you mean a soon to be released Alpha chip version?  Or O.S. / Compiler
support in a version of DEC Unix?

Any more specifics available and benchmarks (any)?

BTW: we have a customer install in September for a 4 box 8400 cluster
running DEC Unix 4.0 with other cluster goodies.  Will the features
you hint at be released and in a system shipped in this time frame?

Thanks.

Curt Smith
curts@compgen.com




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

* Re: AXP advice on code for byte parsing??
  1996-02-07  5:00 AXP advice on code for byte parsing?? Curt Smith
  1996-02-11  5:00 ` Peter Mayne
@ 1996-02-15  5:00 ` Joe Mario
  1 sibling, 0 replies; 4+ messages in thread
From: Joe Mario @ 1996-02-15  5:00 UTC (permalink / raw)
  To: curts

RE: AXP advice on code for byte parsing??

A couple of things to consider:

> We are now fully aware of un-aligned int/long issues but surely there
> are more tricks to performing the following type of operations:

        To prevent getting the unaligned access faults, use the
        __unaligned keyword on pointer declarations that you know will
        be pointing to unaligned data.   The code generated will
        be more pesimistic than the default code but it will run several
        orders of magnitude faster than code that is getting unaligned
        access faults.

> We need to optimize the most performance out of a function that
> does mostly byte addressing and moving / converting data types.
> No consideration for CPU specific issues where given to this function
> till; bad-boy-function VS picky-as-heck-RISC-CPU face off had the CPU
> on the winning side.
>
> We are now fully aware of un-aligned int/long issues but surely there
> are more tricks to performing the following type of operations:
>
> General todo;
>
> - Convert a 400 byte record of structure ABC to 500 byte record of
>   structure DEF.
>
> - Structures ABC and DEF, have fields of ASCII, BCD, binary and oddly
>   encoded date values on all sorts of address boundaries.
>
> Question mostly pertains to:
>
> - ?? Tricks to picking up a 5 byte BCD field from struct offset = 101,
>   in the MOST CPU efficient way possible??  I.E. picking up 8 bytes at
>   at time into an auto long variable spanning the field in question??
>
> - ?? The bad-boy-var is now in an auto var, char buf, or if int, in and
>   int variable.  I suppose there's no AXP/RISC tricks at this point...
>
> - ?? Am I correct to assume that the most efficient way to write a auto
>   variable, int, to a non-aligned struct address is via memcpy()?

        For a 5-byte field, use the intrinsic version of memcpy()
        **with a size the compiler can determine at compile time**.
        That way, you'll likely get reasonable code.  To get the intrinsic
	version of memcpy(), include /usr/include/string.h and
        add -D_INTRINSIC to your compile line.  Both cc and cc -migrate
        support this.

        One "trick" (that memcpy uses for long moves) is to pick up an
        aligned piece of source, shift as needed, combine with the piece
        you picked up last time, and store it to an aligned place in the
        destination.

        If you need to expand a structure by adding a spare byte in every
        5th slot, or something, this might be a better way to structure
        the code than moving each field independently.




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

end of thread, other threads:[~1996-02-15  5:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-02-07  5:00 AXP advice on code for byte parsing?? Curt Smith
1996-02-11  5:00 ` Peter Mayne
1996-02-13  5:00   ` Curt Smith
1996-02-15  5:00 ` Joe Mario

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox