This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [4.7][SH] Binary compatibility with atomic_test_and_test_trueval != 1
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Richard Henderson <rth at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, kkojima at gcc dot gnu dot org
- Date: Fri, 02 Mar 2012 21:27:49 +0100
- Subject: Re: [4.7][SH] Binary compatibility with atomic_test_and_test_trueval != 1
- References: <4F21D3AC.2030500@redhat.com> <1330442171.2929.150.camel@yam-132-YW-E178-FTW> <4F510D55.4090803@redhat.com>
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
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 */