diff mbox

[4.7,SH] Binary compatibility with atomic_test_and_test_trueval != 1

Message ID 1330720069.2929.227.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo March 2, 2012, 8:27 p.m. UTC
On Fri, 2012-03-02 at 10:11 -0800, Richard Henderson wrote:

> For proper binary compatibility, we should probably introduce that asap.
> You forgot two things in your patch, gen_int_mode and the fact that we
> still have to return a boolean (0/1) value.

Ah, yes, of course!

> 
> Also in order for the binary compatibility to work right, you'd want to
> have the SH test-and-set-trueval set appropriately asap.  Kaz, I assume
> you'd agree that 0x80 is a good value for the "tas.b" insn?  We don't
> necessarily need to support tas.b right away, but getting trueval set
> right is imperative.
> 
> I'm in the process of sanity testing this on x86_64 with trueval set to 0x80.
> Jakub, ok for 4.7 branch if it passes?
> 

Since we're now back to stage 1 again, I'm about to commit this one ...
http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00085.html

So the SH tas.b instruction support should be there from 4.8.
Attached is the hunk from the tas.b patch for 4.8 to define
TARGET_ATOMIC_TEST_AND_SET_TRUEVAL.

Cheers,
Oleg

Comments

Richard Henderson March 2, 2012, 8:34 p.m. UTC | #1
On 03/02/2012 12:27 PM, Oleg Endo wrote:
> +   This value is used by optabs.c atomic op expansion code as well as in 
> +   sync.md.  It must be defined as signed char here or else the movqi
> +   pattern will refuse to load it as a QImode constant.  */
> +#undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
> +#define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ((signed char)0x80)

The fix to use gen_mode_int obviates the need for the (signed char) hack.


r~
Oleg Endo March 2, 2012, 8:39 p.m. UTC | #2
On Fri, 2012-03-02 at 12:34 -0800, Richard Henderson wrote:
> On 03/02/2012 12:27 PM, Oleg Endo wrote:
> > +   This value is used by optabs.c atomic op expansion code as well as in 
> > +   sync.md.  It must be defined as signed char here or else the movqi
> > +   pattern will refuse to load it as a QImode constant.  */
> > +#undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
> > +#define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ((signed char)0x80)
> 
> The fix to use gen_mode_int obviates the need for the (signed char) hack.
> 

Ah right, sorry again.
Then I'll rather wait with the whole tas.b patch until the optabs
changes are in.

Cheers,
Oleg
diff mbox

Patch

Index: gcc/config/sh/sh.h
===================================================================
--- gcc/config/sh/sh.h	(revision 184669)
+++ gcc/config/sh/sh.h	(working copy)
@@ -2475,4 +2475,11 @@ 
 /* FIXME: middle-end support for highpart optimizations is missing.  */
 #define high_life_started reload_in_progress
 
+/* The tas.b instruction sets the 7th bit in the byte, i.e. 0x80.
+   This value is used by optabs.c atomic op expansion code as well as in 
+   sync.md.  It must be defined as signed char here or else the movqi
+   pattern will refuse to load it as a QImode constant.  */
+#undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
+#define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL ((signed char)0x80)
+
 #endif /* ! GCC_SH_H */