From: Keith Owens <kaos@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take 2
Date: Thu, 02 Nov 2006 07:17:57 +0000 [thread overview]
Message-ID: <22464.1162451877@kao2.melbourne.sgi.com> (raw)
In-Reply-To: <454961EE.4070608@intel.com>
"bibo,mao" (on Thu, 02 Nov 2006 14:51:18 +0800) wrote:
>Keith Owens wrote:
>> "bibo,mao" (on Thu, 02 Nov 2006 11:11:42 +0800) wrote:
>>> +#define ia64_ld16(low, addr) \
>>> + asm volatile(";;ld16 %0=[%1];;":"=r"(low):"r"(addr):"memory")
>>> +#define ia64_st16(low, addr) \
>>> + asm volatile(";;st16 [%1]=%0;;"::"r"(low),"r"(addr):"memory")
>>> ...
>>> +#define ia64_st16(low, addr) __st16(__sttype_none, __sthint_none, addr, low)
>>> +#define ia64_ld16(low, addr) \
>>> + low = __ld16(__ldtype_none, __ldtype_none, addr)
>>> +
>>
>> ld16 clobbers ar.csd, that needs to be added to the definition of
>> ia64_ld16.
>It seems that gcc does not support inline asm clobber for ar.csd register,
>so here I leave clobber register as empty.
In that case I strongly recommend against using inline asm for ld16 and
st16. If we cannot tell gcc what the side effects are then inline asm
is not safe. Use a small assembler function instead, and accept that
we are calling an external function which stops gcc from optimizing
register usage in the C code.
Using a separate assembler function also gets around a dodgy bit of C
code. Strictly speaking, you should not rely on running two inline asm
statements together, i.e. ia64_ld16() followed by ia64_st16() is not
guaranteed to work. From 'info gcc':
"Similarly, you can't expect a sequence of volatile `asm'
instructions to remain perfectly consecutive. If you want
consecutive output, use a single `asm'".
This should do the job. No prologue or alloc because it is a leaf
function, which means no in0/in1, use r32/r33 instead.
extern ld16_st16(src, dest);
ENTRY(ld16_st16)
ld16 r15=[r33] // dest
;;
st16 [r32]=r15 // src
br.ret.sptk.many rp
EXIT(ld16_st16)
next prev parent reply other threads:[~2006-11-02 7:17 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-02 3:11 [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take 2 bibo,mao
2006-11-02 3:39 ` Keith Owens
2006-11-02 5:04 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take bibo,mao
2006-11-02 6:51 ` bibo,mao
2006-11-02 7:17 ` Keith Owens [this message]
2006-11-02 7:22 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take 2 Keith Owens
2006-11-02 7:25 ` Keith Owens
2006-11-02 7:27 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take bibo,mao
2006-11-02 7:32 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take 2 Keith Owens
2006-11-02 7:38 ` Chen, Kenneth W
2006-11-02 7:45 ` Chen, Kenneth W
2006-11-02 7:52 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take bibo,mao
2006-11-02 8:17 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take 2 Chen, Kenneth W
2006-11-02 8:56 ` Chen, Kenneth W
2006-11-02 9:05 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take bibo,mao
2006-11-02 9:22 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take 2 Chen, Kenneth W
2006-11-02 19:50 ` Chen, Kenneth W
2006-11-02 19:57 ` Luck, Tony
2006-11-02 20:29 ` Chen, Kenneth W
2006-11-03 1:25 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take bibo,mao
2006-11-03 1:55 ` [PATCH]IA64 trap code 16 bytes atomic copy on montecito, take 2 Chen, Kenneth W
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=22464.1162451877@kao2.melbourne.sgi.com \
--to=kaos@sgi.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