* [Linux-ia64] ia64_get_dcr problem
@ 2001-02-12 22:25 Jack Steiner
2001-02-12 23:17 ` Jim Wilson
2001-02-12 23:42 ` David Mosberger
0 siblings, 2 replies; 3+ messages in thread
From: Jack Steiner @ 2001-02-12 22:25 UTC (permalink / raw)
To: linux-ia64
Is this a GCC problem or a problem with the asm/ia64/processor.h
inline functions??
I used the ia64_set_dcr & ia64_get_dcr functions in
a loop & got bad code. I had references to both ia64_get_dcr
in ia64_set_dcr in the loop. The "get" was optimized out of the loop &
did not see the result of the "set".
If I add "volatile" to the ia64_get_dcr asm statement, I can
avoid the problem. But I am not sure whether this is the correct
solution. (I hit a similar problem with ia64_get_irr0() earlier too).
I am using the "2.96-ia64-000717 snap 001117" compiler.
Source (stupid test but illustrates the problem):
void
dcrtest() {
long i, dcr;
for (i=0; i<10; i++) {
printk("0x%lx\n", ia64_get_dcr());
ia64_set_dcr(0x5555);
}
}
Generated code:
<dcrtest.0> alloc r36=ar.pfs,0,5,2,0
<dcrtest.1> mov r34=cr.dcr <<< get
<dcrtest.2> mov r35=rp
<dcrtest+0x10.0> mov r33!845
<dcrtest+0x10.1> mov r32=9
<dcrtest+0x10.2> nop.i 0
<dcrtest+0x20.0> addl r37=-1091248,gp;;
<dcrtest+0x20.1> mov r38=r34
<dcrtest+0x20.2> nop.i 0
<dcrtest+0x30.0> ld8 r37=[r37]
<dcrtest+0x30.1> nop.i 0
<dcrtest+0x30.2> br.call.sptk.many rp=printk;;
<dcrtest+0x40.0> mov cr.dcr=r33;; <<< set
<dcrtest+0x40.1> srlz.d
<dcrtest+0x40.2> adds r32=-1,r32;;
<dcrtest+0x50.0> cmp.lt p7,p6=r32,r0
<dcrtest+0x50.1> nop.i 0
<dcrtest+0x50.2> (p6) br.cond.dptk.few dcrtest+0x20
<dcrtest+0x60.0> nop.m 0
<dcrtest+0x60.1> mov.i ar.pfs=r36
<dcrtest+0x60.2> mov rp=r35
<dcrtest+0x70.0> nop.m 0
<dcrtest+0x70.1> nop.i 0
<dcrtest+0x70.2> br.ret.sptk.many rp;;
--
Thanks
Jack Steiner (651-683-5302) (vnet 233-5302) steiner@sgi.com
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Linux-ia64] ia64_get_dcr problem
2001-02-12 22:25 [Linux-ia64] ia64_get_dcr problem Jack Steiner
@ 2001-02-12 23:17 ` Jim Wilson
2001-02-12 23:42 ` David Mosberger
1 sibling, 0 replies; 3+ messages in thread
From: Jim Wilson @ 2001-02-12 23:17 UTC (permalink / raw)
To: linux-ia64
It is a kernel problem. Your testcase can not work as intended without the
volatile in the definition of ia64_get_dcr. It looks like the kernel doesn't
actually use ia64_get_dcr, which is why the problem wasn't noticed before.
Jim
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Linux-ia64] ia64_get_dcr problem
2001-02-12 22:25 [Linux-ia64] ia64_get_dcr problem Jack Steiner
2001-02-12 23:17 ` Jim Wilson
@ 2001-02-12 23:42 ` David Mosberger
1 sibling, 0 replies; 3+ messages in thread
From: David Mosberger @ 2001-02-12 23:42 UTC (permalink / raw)
To: linux-ia64
>>>>> On Mon, 12 Feb 2001 16:25:38 -0600 (CST), Jack Steiner <steiner@sgi.com> said:
Jack> Is this a GCC problem or a problem with the
Jack> asm/ia64/processor.h inline functions??
Jack> I used the ia64_set_dcr & ia64_get_dcr functions in a loop &
Jack> got bad code. I had references to both ia64_get_dcr in
Jack> ia64_set_dcr in the loop. The "get" was optimized out of the
Jack> loop & did not see the result of the "set".
Jack> If I add "volatile" to the ia64_get_dcr asm statement, I can
Jack> avoid the problem. But I am not sure whether this is the
Jack> correct solution. (I hit a similar problem with
Jack> ia64_get_irr0() earlier too).
Thanks for the report.
I fixed this now, along with a couple of other *get* macros in
processor.h.
--david
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-02-12 23:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-12 22:25 [Linux-ia64] ia64_get_dcr problem Jack Steiner
2001-02-12 23:17 ` Jim Wilson
2001-02-12 23:42 ` David Mosberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox