2006-10-11 21:15:56

by Al Viro

[permalink] [raw]
Subject: [PATCH 2/2] m68k: more workarounds for recent binutils idiocy


cretinous thing doesn't believe that (%a0)+ is one macro argument and
splits it in two; worked around by quoting the argument...
---
arch/m68k/math-emu/fp_move.S | 4 ++--
arch/m68k/math-emu/fp_movem.S | 12 ++++++------
arch/m68k/math-emu/fp_scan.S | 6 +++---
arch/m68k/math-emu/fp_util.S | 6 +++---
include/asm-m68k/math-emu.h | 8 ++++++++
5 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/arch/m68k/math-emu/fp_move.S b/arch/m68k/math-emu/fp_move.S
--- a/arch/m68k/math-emu/fp_move.S
+++ b/arch/m68k/math-emu/fp_move.S
@@ -213,9 +213,9 @@ fp_format_extended:
lsl.w #1,%d0
lsl.l #7,%d0
lsl.l #8,%d0
- putuser.l %d0,(%a1)+,fp_err_ua1,%a1
+ putuser_inc %d0,%a1,fp_err_ua1
move.l (%a0)+,%d0
- putuser.l %d0,(%a1)+,fp_err_ua1,%a1
+ putuser_inc %d0,%a1,fp_err_ua1
move.l (%a0),%d0
putuser.l %d0,(%a1),fp_err_ua1,%a1
jra fp_finish_move
diff --git a/arch/m68k/math-emu/fp_movem.S b/arch/m68k/math-emu/fp_movem.S
--- a/arch/m68k/math-emu/fp_movem.S
+++ b/arch/m68k/math-emu/fp_movem.S
@@ -141,12 +141,12 @@ fpr_do_movem:
| move register from memory into fpu
jra 3f
1: printf PMOVEM,"(%p>%p)",2,%a0,%a1
- getuser.l (%a0)+,%d2,fp_err_ua1,%a0
+ getuser_inc %a0,%d2,fp_err_ua1
lsr.l #8,%d2
lsr.l #7,%d2
lsr.w #1,%d2
move.l %d2,(%a1)+
- getuser.l (%a0)+,%d2,fp_err_ua1,%a0
+ getuser_inc %a0,%d2,fp_err_ua1
move.l %d2,(%a1)+
getuser.l (%a0),%d2,fp_err_ua1,%a0
move.l %d2,(%a1)
@@ -164,9 +164,9 @@ fpr_do_movem:
lsl.w #1,%d2
lsl.l #7,%d2
lsl.l #8,%d2
- putuser.l %d2,(%a0)+,fp_err_ua1,%a0
+ putuser_inc %d2,%a0,fp_err_ua1
move.l (%a1)+,%d2
- putuser.l %d2,(%a0)+,fp_err_ua1,%a0
+ putuser_inc %d2,%a0,fp_err_ua1
move.l (%a1),%d2
putuser.l %d2,(%a0),fp_err_ua1,%a0
subq.l #8,%a1
@@ -325,7 +325,7 @@ fpc_do_movem:
| move register from memory into fpu
jra 3f
1: printf PMOVEM,"(%p>%p)",2,%a0,%a1
- getuser.l (%a0)+,%d0,fp_err_ua1,%a0
+ getuser_inc %a0,%d0,fp_err_ua1
move.l %d0,(%a1)
2: addq.l #4,%a1
3: lsl.b #1,%d1
@@ -336,7 +336,7 @@ fpc_do_movem:
| move register from fpu into memory
1: printf PMOVEM,"(%p>%p)",2,%a1,%a0
move.l (%a1),%d0
- putuser.l %d0,(%a0)+,fp_err_ua1,%a0
+ putuser_inc %d0,%a0,fp_err_ua1
2: addq.l #4,%a1
4: lsl.b #1,%d1
jcs 1b
diff --git a/arch/m68k/math-emu/fp_scan.S b/arch/m68k/math-emu/fp_scan.S
--- a/arch/m68k/math-emu/fp_scan.S
+++ b/arch/m68k/math-emu/fp_scan.S
@@ -72,7 +72,7 @@ #else
#endif
jne fp_nonstd
| first two instruction words are kept in %d2
- getuser.l (%a0)+,%d2,fp_err_ua1,%a0
+ getuser_inc %a0,%d2,fp_err_ua1
fp_put_pc %a0
fp_decode_cond: | separate conditional instr
fp_decode_cond_instr_type
@@ -262,12 +262,12 @@ fp_single:
jra fp_getdest

fp_ext:
- getuser.l (%a1)+,%d0,fp_err_ua1,%a1
+ getuser_inc %a1,%d0,fp_err_ua1
lsr.l #8,%d0
lsr.l #7,%d0
lsr.w #1,%d0
move.l %d0,(%a0)+
- getuser.l (%a1)+,%d0,fp_err_ua1,%a1
+ getuser_inc %a1,%d0,fp_err_ua1
move.l %d0,(%a0)+
getuser.l (%a1),%d0,fp_err_ua1,%a1
move.l %d0,(%a0)
diff --git a/arch/m68k/math-emu/fp_util.S b/arch/m68k/math-emu/fp_util.S
--- a/arch/m68k/math-emu/fp_util.S
+++ b/arch/m68k/math-emu/fp_util.S
@@ -163,7 +163,7 @@ #ifdef FPU_EMU_DEBUG
getuser.l %a1@(4),%d1,fp_err_ua2,%a1
printf PCONV,"d2e: %p%p -> %p(",3,%d0,%d1,%a0
#endif
- getuser.l (%a1)+,%d0,fp_err_ua2,%a1
+ getuser_inc %a1,%d0,fp_err_ua2
move.l %d0,%d1
lsl.l #8,%d0 | shift high mantissa
lsl.l #3,%d0
@@ -177,7 +177,7 @@ #endif
add.w #0x3fff-0x3ff,%d1 | re-bias the exponent.
9: move.l %d1,(%a0)+ | fp_ext.sign, fp_ext.exp
move.l %d0,(%a0)+
- getuser.l (%a1)+,%d0,fp_err_ua2,%a1
+ getuser_inc %a1,%d0,fp_err_ua2
move.l %d0,%d1
lsl.l #8,%d0
lsl.l #3,%d0
@@ -1286,7 +1286,7 @@ fp_conv_ext2double:
lsr.l #4,%d0
lsr.l #8,%d0
or.l %d2,%d0
- putuser.l %d0,(%a1)+,fp_err_ua2,%a1
+ putuser_inc %d0,%a1,fp_err_ua2
moveq #21,%d0
lsl.l %d0,%d1
move.l (%a0),%d0
diff --git a/include/asm-m68k/math-emu.h b/include/asm-m68k/math-emu.h
--- a/include/asm-m68k/math-emu.h
+++ b/include/asm-m68k/math-emu.h
@@ -226,6 +226,14 @@ #define FPS_PC2 (PT_PC+10)
.previous
.endm

+.macro getuser_inc src,dest,label
+ getuser.l "(\src)+",\dest,\label,\src
+.endm
+
+.macro putuser_inc src,dest,label
+ getuser.l \src,"(\dest)+",\label,\dest
+.endm
+
/* work around binutils idiocy */
.macro gas_fscked.x
.irp m b,w,l
--


2006-10-11 21:30:39

by Roman Zippel

[permalink] [raw]
Subject: Re: [PATCH 2/2] m68k: more workarounds for recent binutils idiocy

Hi,

On Wed, 11 Oct 2006, Al Viro wrote:

> cretinous thing doesn't believe that (%a0)+ is one macro argument and
> splits it in two; worked around by quoting the argument...

NAK, this is a bug in binutils and is fixed there already (at least in
CVS).

bye, Roman

2006-10-11 22:07:29

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 2/2] m68k: more workarounds for recent binutils idiocy

On Wed, Oct 11, 2006 at 11:30:05PM +0200, Roman Zippel wrote:
> Hi,
>
> On Wed, 11 Oct 2006, Al Viro wrote:
>
> > cretinous thing doesn't believe that (%a0)+ is one macro argument and
> > splits it in two; worked around by quoting the argument...
>
> NAK, this is a bug in binutils and is fixed there already (at least in
> CVS).

OK... Would be nice to find out which versions are broken (that's
Documentation/Changes fodder), I'll see to it.

What about the first problem? Even current binutils CVS treats
foo.bar as a single identifier, and doesn't recognize it as invocation
of foo with .bar as the first argument. Any objections against the
first patch?

2006-10-11 22:12:12

by Andreas Schwab

[permalink] [raw]
Subject: Re: [PATCH 2/2] m68k: more workarounds for recent binutils idiocy

Al Viro <[email protected]> writes:

> cretinous thing doesn't believe that (%a0)+ is one macro argument and
> splits it in two; worked around by quoting the argument...

What version are you using? Works rather fine here with 2.17.

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2006-10-12 00:49:45

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 2/2] m68k: more workarounds for recent binutils idiocy

On Thu, Oct 12, 2006 at 12:12:05AM +0200, Andreas Schwab wrote:
> Al Viro <[email protected]> writes:
>
> > cretinous thing doesn't believe that (%a0)+ is one macro argument and
> > splits it in two; worked around by quoting the argument...
>
> What version are you using? Works rather fine here with 2.17.

There are two problems; see below for the testcase covering both
.macro a x
.byte 1
.endm
a.x
a %(a0)+

Old binutils (i.e. what Roman's code expects) treat the above as
.byte 1
.byte 1

That behaviour exists in 2.16.1 and earlier. Everything starting at least
with 2.16.90.0.2 and up to current CVS generates
Error: Unknown operator -- statement `a.x' ignored
for line 4. That's the problem dealt with by the first patch (and yes,
current gas from CVS does blow on arch/m68k/math-emu/ as soon as you get
to getuser.l <something>).

_Another_ problem manifests as
Error: too many positional arguments
in line 5. That had been introduced later (in 2.16.91.0.3, if you look at
versions on kernel.org, or 2005-08-08 in mainline) and had been fixed since
then (2.16.91.0.7 or 2006-02-28 in CVS). That's what the second patch
dealt with and yes, I agree that just slapping "don't use those versions
of binutils" in Documentation/Changes is a better variant.

The first problem still needs to be dealt with.

2006-10-12 00:51:00

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH 2/2] m68k: more workarounds for recent binutils idiocy

On Wed, Oct 11, 2006 at 11:07:26PM +0100, Al Viro wrote:
> OK... Would be nice to find out which versions are broken (that's
> Documentation/Changes fodder), I'll see to it.

2.16.91.0.[3-6] are to be avoided on m68k.

> What about the first problem? Even current binutils CVS treats
> foo.bar as a single identifier, and doesn't recognize it as invocation
> of foo with .bar as the first argument. Any objections against the
> first patch?

2006-10-12 02:25:02

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH 2/2] m68k: more workarounds for recent binutils idiocy

On Wed, Oct 11, 2006 at 10:13:01PM +0100, Al Viro wrote:

> +.macro putuser_inc src,dest,label
> + getuser.l \src,"(\dest)+",\label,\dest
> +.endm

Bad cut-n-paste ?

Dave

--
http://www.codemonkey.org.uk