public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: John Worley <jworley@fc.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: Inefficient ia64 system call implementation in glibc
Date: Fri, 19 Sep 2003 21:46:24 +0000	[thread overview]
Message-ID: <marc-linux-ia64-106400819601571@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-106398916511816@msgid-missing>

H.J. Lu <hjl@lucon.org> write:

> The inline ia64 system call assumes all values passed to kernel are
> signed 64bit. It does sign extension if the incoming arg is not signed
> 64bit. In case of fxstat.c:
> 
> int
> __fxstat (int vers, int fd, struct stat *buf)
> {
>   return INLINE_SYSCALL (fstat, 2, fd, CHECK_1 (buf));
> }
>  
> it leads to
> 
> 0000000000000000 <__fxstat>:
>    0:   00 20 39 0c 80 05       [MII]       alloc r36=ar.pfs,14,6,0
>    6:   f0 e0 01 12 48 a0                   mov r15\x1212
>    c:   04 08 00 84                         mov r37=r1
>   10:   01 38 01 44 00 21       [MII]       mov r39=r34
>   16:   60 02 84 2c 00 60                   sxt4 r38=r33
> 					    ^^^^^^^^^^^^^
>   1c:   04 00 c4 00                         mov r35°;;
>   20:   0a 00 00 00 00 02       [MMI]       break.m 0x100000;;
>   26:   10 02 20 00 42 e0                   mov r33=r8

     The real inefficiency here is the compiler output. Given the
realities of the Itanium 2 implementation, the first two bundles
will require 3 cycles to execute. A better coding would be:

	{	.mmi
		alloc	r36=ar.pfs,14,6,0
		mov	r15\x1212
		mov	r35°
	}
	{	.mmi
		mov	r37=r1
		mov	r39=r34
		sxt4	r38=r33
	} ;;

     which will execute in one cycle. The sign extension, although
"unnecessary" doesn't cost any cycles. Admittedly you could use the
mi;;i bundle to pack the break instruction in the second bundle if
you didn't have to sign-extend, but I'd rather see the 3 v. 1 cycle
problem addressed first.

	Regards,
	John "I worry about this stuff way too much" Worley
	john.worley@hp.com



  parent reply	other threads:[~2003-09-19 21:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-19 16:32 Inefficient ia64 system call implementation in glibc H. J. Lu
2003-09-19 17:29 ` Grant Grundler
2003-09-19 21:46 ` John Worley [this message]
2003-09-19 23:32 ` Jim Hull
2003-09-20 13:01 ` Andreas Schwab
2003-09-21 21:04 ` Richard Henderson
2003-09-22 19:39 ` H. J. Lu
2003-09-22 21:25 ` David Mosberger
2003-09-22 23:21 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-106400819601571@msgid-missing \
    --to=jworley@fc.hp.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox