From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jack Steiner Date: Mon, 12 Feb 2001 22:25:38 +0000 Subject: [Linux-ia64] ia64_get_dcr problem Message-Id: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-ia64@vger.kernel.org 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: alloc r36=ar.pfs,0,5,2,0 mov r34=cr.dcr <<< get mov r35=rp mov r33!845 mov r32=9 nop.i 0 addl r37=-1091248,gp;; mov r38=r34 nop.i 0 ld8 r37=[r37] nop.i 0 br.call.sptk.many rp=printk;; mov cr.dcr=r33;; <<< set srlz.d adds r32=-1,r32;; cmp.lt p7,p6=r32,r0 nop.i 0 (p6) br.cond.dptk.few dcrtest+0x20 nop.m 0 mov.i ar.pfs=r36 mov rp=r35 nop.m 0 nop.i 0 br.ret.sptk.many rp;; -- Thanks Jack Steiner (651-683-5302) (vnet 233-5302) steiner@sgi.com