cvs commit: src/sys/sparc64/include in_cksum.h

2008-07-05 Thread Marius Strobl
marius 2008-07-05 15:28:30 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180297 on 2008-07-05 15:28:30Z by marius Revert the addition of __volatile to __asm done in r180011, since the condition codes where added to the clobber

cvs commit: src/sys/sparc64/include in_cksum.h

2008-07-05 Thread Marius Strobl
marius 2008-07-05 16:28:08 UTC FreeBSD src repository Modified files:(Branch: RELENG_7) sys/sparc64/include in_cksum.h Log: SVN rev 180300 on 2008-07-05 16:28:08Z by marius MFC: r180073 Add the condition codes to the clobber list. Revision Changes

cvs commit: src/sys/sparc64/include in_cksum.h

2008-07-05 Thread Marius Strobl
marius 2008-07-05 16:28:52 UTC FreeBSD src repository Modified files:(Branch: RELENG_6) sys/sparc64/include in_cksum.h Log: SVN rev 180301 on 2008-07-05 16:28:52Z by marius MFC: r180073 Add the condition codes to the clobber list. Revision Changes

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-07-01 Thread Marius Strobl
On Sat, Jun 28, 2008 at 03:52:16PM +0200, Christoph Mallon wrote: Marius Strobl wrote: On Sat, Jun 28, 2008 at 02:08:10PM +0200, Christoph Mallon wrote: Marius Strobl wrote: On a related note: Is inline assembler really necessary here? For example couldn't in_addword() be written as static

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-29 Thread Christoph Mallon
Bruce Evans wrote: I think the bug was the following: subcc %foo, %bar, %g0 /* SPARC compare */ #APP /* inline assembler of in_addword() here, which modifies the condition codes */ #NO_APP bpl $somewhere /* condition branch depending on condition code */ Is the non-#APP part all from C code?

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-29 Thread Christoph Mallon
Bruce Evans wrote: Right. Though I've never seen unnecessary's __volatiles significantly affecting i386 code. This is because the code in the asms can't be removed completely, and can't be moved much either. With out of order execution, the type of moves that are permitted (not across

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-29 Thread Bruce Evans
On Sun, 29 Jun 2008, Christoph Mallon wrote: Bruce Evans wrote: I have to disagree. Where does the GCC documentation state, that cc has no effect on x86? It is the other way round: The compiler assumes, the Well, in gcc-1.40, gcc.info says nothing about cc, apparently because cc didn't

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-29 Thread Bruce Evans
On Sun, 29 Jun 2008, Christoph Mallon wrote: Bruce Evans wrote: Right. Though I've never seen unnecessary's __volatiles significantly affecting i386 code. This is because the code in the asms can't be removed completely, and can't be moved much either. With out of order execution, the type

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Christoph Mallon
Bruce Evans wrote: On Fri, 27 Jun 2008, Christoph Mallon wrote: Marius Strobl wrote: marius 2008-06-25 21:04:59 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180011 on 2008-06-25 21:04:59Z by marius Use __asm __volatile rather

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Christoph Mallon
Bruce Evans wrote: On Sat, 28 Jun 2008, Christoph Mallon wrote: I still think, using __volatile only works by accident. volatile for an assembler block mostly means this asm statement has an effect, even though the register specification looks otherwise, so do not optimise this away (i.e.

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Marius Strobl
On Sat, Jun 28, 2008 at 12:09:13PM +1000, Bruce Evans wrote: On Sat, 28 Jun 2008, Marius Strobl wrote: On Fri, Jun 27, 2008 at 09:58:31PM +0200, Christoph Mallon wrote: This approach seems wrong to me and I think it works only by chance. The I wasn't aware that the clobber list allows to

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Marius Strobl
On Sat, Jun 28, 2008 at 12:57:28AM +0200, Christoph Mallon wrote: Marius Strobl wrote: I wasn't aware that the clobber list allows to explicitly specify the condition codes, thanks for the hint. Though it unfortunately took me longer than two days to verify it's effect on the generated code;

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Christoph Mallon
Marius Strobl wrote: On a related note: Is inline assembler really necessary here? For example couldn't in_addword() be written as static __inline u_short in_addword(u_short const sum, u_short const b) { u_int const t = sum + b; return t + (t 16); } ? This should at least produce

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Christoph Mallon
Christoph Mallon wrote: As a compiler construction I can tell you, that regarding optimisation there is no such thing as certainty. Uh...right... s/construction/constructor/ ___ cvs-all@freebsd.org mailing list

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Marius Strobl
On Sat, Jun 28, 2008 at 12:56:08AM +0200, Christoph Mallon wrote: Marius Strobl wrote: marius 2008-06-27 22:17:14 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180073 on 2008-06-27 22:17:14Z by marius Improve r180011 by

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Marius Strobl
On Sat, Jun 28, 2008 at 02:08:10PM +0200, Christoph Mallon wrote: Marius Strobl wrote: On a related note: Is inline assembler really necessary here? For example couldn't in_addword() be written as static __inline u_short in_addword(u_short const sum, u_short const b) { u_int const t =

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Christoph Mallon
Marius Strobl wrote: On Sat, Jun 28, 2008 at 12:56:08AM +0200, Christoph Mallon wrote: Marius Strobl wrote: marius 2008-06-27 22:17:14 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180073 on 2008-06-27 22:17:14Z by marius Improve

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Christoph Mallon
Marius Strobl wrote: On Sat, Jun 28, 2008 at 02:08:10PM +0200, Christoph Mallon wrote: Marius Strobl wrote: On a related note: Is inline assembler really necessary here? For example couldn't in_addword() be written as static __inline u_short in_addword(u_short const sum, u_short const b) {

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Bruce Evans
On Sat, 28 Jun 2008, Christoph Mallon wrote: Bruce Evans wrote: Does sparc64 do anything good with this? Later it says that this is [cc clobber in asm statements] irrelevant for the type type of bug in in_cksum.* (expecting cc to be preserved across

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Bruce Evans
On Sat, 28 Jun 2008, Marius Strobl wrote: On Sat, Jun 28, 2008 at 12:09:13PM +1000, Bruce Evans wrote: On Sat, 28 Jun 2008, Marius Strobl wrote: I think it still only works by chance. [volatile] Besides I don't think using __volatile for this is that wrong, given that the

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-28 Thread Christoph Mallon
Bruce Evans wrote: So by now you are saying that using __volatile in this case is the wrong solution and that using cc is a style bug. How am I supposed to tell the compiler that the inline assembler alters the condition codes then, which it apparently needs to know as it at shown to otherwise

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Christoph Mallon
Marius Strobl wrote: marius 2008-06-25 21:04:59 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180011 on 2008-06-25 21:04:59Z by marius Use __asm __volatile rather than __asm for instruction sequences that modify condition

cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Marius Strobl
marius 2008-06-27 22:17:14 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180073 on 2008-06-27 22:17:14Z by marius Improve r180011 by explicitly adding the condition codes to the clobber list. Suggested by: Christoph Mallon

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Marius Strobl
On Fri, Jun 27, 2008 at 09:58:31PM +0200, Christoph Mallon wrote: Marius Strobl wrote: marius 2008-06-25 21:04:59 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180011 on 2008-06-25 21:04:59Z by marius Use __asm

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Christoph Mallon
Marius Strobl wrote: marius 2008-06-27 22:17:14 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180073 on 2008-06-27 22:17:14Z by marius Improve r180011 by explicitly adding the condition codes to the clobber list. You should

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Christoph Mallon
Marius Strobl wrote: I wasn't aware that the clobber list allows to explicitly specify the condition codes, thanks for the hint. Though it unfortunately took me longer than two days to verify it's effect on the generated code; sparc64 could still have been one of the archs where cc has no

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Bruce Evans
On Fri, 27 Jun 2008, Christoph Mallon wrote: Marius Strobl wrote: marius 2008-06-25 21:04:59 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180011 on 2008-06-25 21:04:59Z by marius Use __asm __volatile rather than __asm for

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Bruce Evans
On Sat, 28 Jun 2008, Marius Strobl wrote: On Fri, Jun 27, 2008 at 09:58:31PM +0200, Christoph Mallon wrote: This approach seems wrong to me and I think it works only by chance. The I wasn't aware that the clobber list allows to explicitly specify the condition codes, thanks for the hint.

Re: cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-27 Thread Bruce Evans
On Sat, 28 Jun 2008, Christoph Mallon wrote: I still think, using __volatile only works by accident. volatile for an assembler block mostly means this asm statement has an effect, even though the register specification looks otherwise, so do not optimise this away (i.e. no CSE, do not remove

cvs commit: src/sys/sparc64/include in_cksum.h

2008-06-25 Thread Marius Strobl
marius 2008-06-25 21:04:59 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: SVN rev 180011 on 2008-06-25 21:04:59Z by marius Use __asm __volatile rather than __asm for instruction sequences that modify condition codes (the carry bit, in

cvs commit: src/sys/sparc64/include in_cksum.h

2006-01-23 Thread Marius Strobl
marius 2006-01-23 14:45:24 UTC FreeBSD src repository Modified files:(Branch: RELENG_6) sys/sparc64/include in_cksum.h Log: MFC: 1.3 - The inline asm in this file uses output operands before all input operands are consumed so use the appropriate constraint

cvs commit: src/sys/sparc64/include in_cksum.h

2006-01-12 Thread Marius Strobl
marius 2006-01-12 11:40:39 UTC FreeBSD src repository Modified files: sys/sparc64/include in_cksum.h Log: - The inline asm in this file uses output operands before all input operands are consumed so use the appropriate constraint modifier. Before this change GCC used