All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [parisc-linux] input constraints in atomic.h too loose ?
       [not found] <119aab440702110918k1aca7744rc8abb50949a22069@mail.gmail.com>
@ 2007-02-11 17:36 ` John David Anglin
  0 siblings, 0 replies; 6+ messages in thread
From: John David Anglin @ 2007-02-11 17:36 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: parisc-linux

> > /tmp/ccvCRbqg.s:43: Error: bad expression

> What *is* the bad assembly here. Please don't make me count assembly
> line numbers, just point me at the bad asm.

The problem is the "m" constraint is too broad for ldw and stw insns.
These instructions don't accept any memory address.  As suggested,
the "o" constraint should work.  Alternatively, the address of the
variables could be forced to a register.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

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

* Re: [parisc-linux] input constraints in atomic.h too loose ?
       [not found] <119aab440702111029h147c9ad5u602262ede5ea64d6@mail.gmail.com>
@ 2007-02-11 18:48 ` John David Anglin
  0 siblings, 0 replies; 6+ messages in thread
From: John David Anglin @ 2007-02-11 18:48 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: parisc-linux

> They are not global. They are local variables which are the rvalue in
> an assignment to something else.

Ok, then a register should be fine except you may have to make sure
that you have the appropriate clobbers for the syscall.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

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

* Re: [parisc-linux] input constraints in atomic.h too loose ?
       [not found] <119aab440702110947u418c907eu19c3044230874df4@mail.gmail.com>
@ 2007-02-11 17:59 ` John David Anglin
  0 siblings, 0 replies; 6+ messages in thread
From: John David Anglin @ 2007-02-11 17:59 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: parisc-linux

> There was a reason I didn't force them to a register, but I can't
> remember. At this very moment I don't see why they couldn't have been
> "=r".

> Did you want to test "=r" and change the two stw's to copy's?

That won't work.  If these are global variables, you need the
*address* of the variables in registers and to use stw %rX,0(%Y)
instead of stw %rX,%Y.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

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

* Re: [parisc-linux] input constraints in atomic.h too loose ?
       [not found] <200702102101.l1AL11Ai017315@hiauly1.hia.nrc.ca>
@ 2007-02-11  4:42 ` Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2007-02-11  4:42 UTC (permalink / raw)
  To: John David Anglin; +Cc: parisc-linux


[-- Attachment #1.1: Type: text/plain, Size: 1211 bytes --]

On Saturday 10 February 2007, John David Anglin wrote:
> > static void __lll_mutex_lock(int *futex)
> > {
> > 	int lws_errno = 14;
> > 	int lws_ret;
> > 	asm (
> > "0:					\n\t"
> > "copy	%3, %%r26			\n\t"
> > "copy	%4, %%r25			\n\t"
> > "copy	%5, %%r24			\n\t"
> > "ble	" "0xb0" "(%%sr2, %%r0)		\n\t"
> > "ldi	" "0" ", %%r20		\n\t"
> > "cmpib,=,n " "11" ",%%r21,0b	\n\t"
> > "nop					\n\t"
> > "stw	%%r28, %0			\n\t"
> > "sub	%%r0, %%r21, %%r21		\n\t"
> > "stw	%%r21, %1			\n\t"
> >
> > : "=m" (lws_ret), "=m"(lws_errno), "=m"(*futex)
> > : "r"(futex), "r"(0), "r"(1)
> > :"r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31",
> > : "memory"
> >
> > );
> > }
>
> Aren't lws_errno and lws_ret supposed to be global?  As is, they
> are just local variables and do nothing.

right, as they should be i think ... the sample here is reduced preprocessed 
code so you lose the visibility that ___lll_mutex_lock() is really just an 
expanded macro from the atomic.h header and you lose a lot of the actual code 
(i removed the stuff that wasnt involved with the bad code generation)

lws_ret for sure should not be a local variable as that is the return value
-mike

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

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

* Re: [parisc-linux] input constraints in atomic.h too loose ?
       [not found] <200702022215.50914.vapier@gentoo.org>
@ 2007-02-10 21:01 ` John David Anglin
  0 siblings, 0 replies; 6+ messages in thread
From: John David Anglin @ 2007-02-10 21:01 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: parisc-linux

> static void __lll_mutex_lock(int *futex)
> {
> 	int lws_errno = 14; 
> 	int lws_ret;
> 	asm (
> "0:					\n\t" 
> "copy	%3, %%r26			\n\t" 
> "copy	%4, %%r25			\n\t" 
> "copy	%5, %%r24			\n\t" 
> "ble	" "0xb0" "(%%sr2, %%r0)		\n\t" 
> "ldi	" "0" ", %%r20		\n\t" 
> "cmpib,=,n " "11" ",%%r21,0b	\n\t" 
> "nop					\n\t" 
> "stw	%%r28, %0			\n\t" 
> "sub	%%r0, %%r21, %%r21		\n\t" 
> "stw	%%r21, %1			\n\t"
> : "=m" (lws_ret), "=m"(lws_errno), "=m"(*futex)
> : "r"(futex), "r"(0), "r"(1)
> :"r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory"
> );
> }

Aren't lws_errno and lws_ret supposed to be global?  As is, they
are just local variables and do nothing.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)
_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

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

* [parisc-linux] input constraints in atomic.h too loose ?
@ 2007-02-03  3:15 Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2007-02-03  3:15 UTC (permalink / raw)
  To: parisc-linux


[-- Attachment #1.1: Type: text/plain, Size: 903 bytes --]

while building glibc-2.5/cvs with gcc-4.1.1, i hit an error about invalid 
operands in the locking code ... looks like the declared constraints for the 
inputs in atomic.h are too loose ?

$ hppa2.0-unknown-linux-gnu-gcc -O1 -fPIC vfprintf.i -c
/tmp/ccvCRbqg.s: Assembler messages:
/tmp/ccvCRbqg.s:41: Error: bad expression
/tmp/ccvCRbqg.s:41: Error: bad expression
/tmp/ccvCRbqg.s:41: Error: bad expression
/tmp/ccvCRbqg.s:41: Error: bad expression
/tmp/ccvCRbqg.s:41: Error: bad expression
/tmp/ccvCRbqg.s:41: Error: bad expression
/tmp/ccvCRbqg.s:41: Error: Invalid operands 
/tmp/ccvCRbqg.s:43: Error: bad expression
/tmp/ccvCRbqg.s:43: Error: bad expression
/tmp/ccvCRbqg.s:43: Error: bad expression
/tmp/ccvCRbqg.s:43: Error: bad expression
/tmp/ccvCRbqg.s:43: Error: bad expression
/tmp/ccvCRbqg.s:43: Error: bad expression
/tmp/ccvCRbqg.s:43: Error: Invalid operands 
-mike

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: vfprintf.i --]
[-- Type: text/x-objcsrc, Size: 834 bytes --]

static void __lll_mutex_lock(int *futex)
{
	int lws_errno = 14; 
	int lws_ret;
	asm (
"0:					\n\t" 
"copy	%3, %%r26			\n\t" 
"copy	%4, %%r25			\n\t" 
"copy	%5, %%r24			\n\t" 
"ble	" "0xb0" "(%%sr2, %%r0)		\n\t" 
"ldi	" "0" ", %%r20		\n\t" 
"cmpib,=,n " "11" ",%%r21,0b	\n\t" 
"nop					\n\t" 
"stw	%%r28, %0			\n\t" 
"sub	%%r0, %%r21, %%r21		\n\t" 
"stw	%%r21, %1			\n\t"
: "=m" (lws_ret), "=m"(lws_errno), "=m"(*futex)
: "r"(futex), "r"(0), "r"(1)
:"r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory"
);
}
typedef struct {
	char *_IO_write_end;
	int lock;
} _IO_FILE;
__attribute__ ((__nothrow__)) __attribute__ ((noinline))
static int buffered_vfprintf(_IO_FILE *s)
{
	char buf[8192];
	_IO_FILE *hp;
	hp->_IO_write_end = buf;
	__lll_mutex_lock(&s->lock);
}
void foo(_IO_FILE *s)
{
	buffered_vfprintf(s);
}

[-- Attachment #3: vfprintf.s --]
[-- Type: text/plain, Size: 1348 bytes --]

	.LEVEL 1.1
	.text
	.align 4
	.type	buffered_vfprintf, @function
buffered_vfprintf:
	.PROC
	.CALLINFO FRAME=8320,CALLS,SAVE_RP,ENTRY_GR=7
	.ENTRY
	stw %r2,-20(%r30)
	addil L'8320,%r30
	ldo R'8320(%r1),%r30
	stw %r8,-112(%r30)
	stw %r7,-108(%r30)
	stw %r6,-104(%r30)
	stw %r5,-100(%r30)
	stw %r4,-96(%r30)
	stw %r19,-32(%r30)
	copy %r26,%r8
	ldil L'-16384,%r28
	ldo 8072(%r28),%r28
	addl %r30,%r28,%r6
	stw %r6,0(%r28)
	ldo 4(%r26),%r5
	ldil L'8192,%r7
	addl %r6,%r7,%r20
	ldi 14,%r28
	stw %r28,0(%r20)
	ldi 0,%r2
	ldi 1,%r29
	ldil L'16384,%r4
	ldo -8188(%r4),%r4
#APP
	0:					
	copy	%r5, %r26			
	copy	%r2, %r25			
	copy	%r29, %r24			
	ble	0xb0(%sr2, %r0)		
	ldi	0, %r20		
	cmpib,=,n 11,%r21,0b	
	nop					
	stw	%r28, %r6(%r4)			
	sub	%r0, %r21, %r21		
	stw	%r21, %r6(%r7)			
	
#NO_APP
	ldw -112(%r30),%r8
	ldw -108(%r30),%r7
	ldw -104(%r30),%r6
	ldw -100(%r30),%r5
	ldw -96(%r30),%r4
	addil L'-8320,%r30
	ldo R'-8320(%r1),%r30
	ldw -20(%r30),%r2
	bv,n %r0(%r2)
	.EXIT
	.PROCEND
	.size	buffered_vfprintf, .-buffered_vfprintf
	.align 4
.globl foo
	.type	foo, @function
foo:
	.PROC
	.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3
	.ENTRY
	stw %r2,-20(%r30)
	stwm %r4,64(%r30)
	bl buffered_vfprintf,%r2
	stw %r19,-32(%r30)
	ldw -84(%r30),%r2
	bv %r0(%r2)
	ldwm -64(%r30),%r4
	.EXIT
	.PROCEND
	.size	foo, .-foo
	.ident	"GCC: (GNU) 4.1.1 (Gentoo 4.1.1-r3)"

[-- Attachment #4: Type: text/plain, Size: 169 bytes --]

_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

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

end of thread, other threads:[~2007-02-11 18:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <119aab440702110918k1aca7744rc8abb50949a22069@mail.gmail.com>
2007-02-11 17:36 ` [parisc-linux] input constraints in atomic.h too loose ? John David Anglin
     [not found] <119aab440702111029h147c9ad5u602262ede5ea64d6@mail.gmail.com>
2007-02-11 18:48 ` John David Anglin
     [not found] <119aab440702110947u418c907eu19c3044230874df4@mail.gmail.com>
2007-02-11 17:59 ` John David Anglin
     [not found] <200702102101.l1AL11Ai017315@hiauly1.hia.nrc.ca>
2007-02-11  4:42 ` Mike Frysinger
     [not found] <200702022215.50914.vapier@gentoo.org>
2007-02-10 21:01 ` John David Anglin
2007-02-03  3:15 Mike Frysinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.