[PATCH] sh: Add support Renesas SuperH

Lists: pgsql-patches
From: Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Cc: iwamatsu(at)nigauri(dot)org
Subject: [PATCH] sh: Add support Renesas SuperH
Date: 2008-04-05 06:08:05
Message-ID: 20080405150805.8e7585c4.iwamatsu@nigauri.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Hi, all.

I want to use Postgresql on Reneas SuperH.
However, this has not supported SuperH yet.
I wrote the patch to support it.

Please apply.

Best regards,
Nobuhiro

# please CC me, i'm not on the list.

---
This patch support slock_t and tas function for Renesas SuperH.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org>
---
src/include/storage/s_lock.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index b06bd1b..4a8da8a 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -567,6 +567,29 @@ typedef int slock_t;

#endif /* __m32r__ */

+#if defined(__sh__) /* Renesas SuperH */
+#define HAS_TEST_AND_SET
+
+typedef unsigned char slock_t;
+
+#define TAS(lock) tas(lock)
+
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+ register slock_t _res = 1;
+
+ __asm__ __volatile__(
+ "tas.b @%1\n\t"
+ "movt %0\n\t"
+ "xor #1,%0"
+: "=z"(_res)
+: "r"(lock)
+: "t","memory");
+ return (int) _res;
+}
+
+#endif /* __sh__ */

/* These live in s_lock.c, but only for gcc */

--
1.5.4.4


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] sh: Add support Renesas SuperH
Date: 2008-04-05 15:46:49
Message-ID: 14398.1207410409@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org> writes:
> +#if defined(__sh__) /* Renesas SuperH */

Do they have any longer form of that macro? This one seems dangerously
likely to trigger on unrelated systems.

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] sh: Add support Renesas SuperH
Date: 2008-04-05 15:58:21
Message-ID: 14537.1207411101@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org> writes:
> + __asm__ __volatile__(
> + "tas.b @%1\n\t"
> + "movt %0\n\t"
> + "xor #1,%0"
> +: "=z"(_res)
> +: "r"(lock)
> +: "t","memory");

Another question: this asm declaration ignores the advice given at lines
89-107 of s_lock.h, both cosmetic and substantive. Why? Are you
entirely certain it's right, and not subject to optimization problems in
versions of gcc other than whatever you tested?

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] sh: Add support Renesas SuperH
Date: 2008-04-13 05:01:19
Message-ID: 20425.1208062879@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

I wrote:
> Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org> writes:
>> +#if defined(__sh__) /* Renesas SuperH */

> Do they have any longer form of that macro?

I looked into the gcc sources, and the answer seems to be "no" :-(.
So we're stuck with __sh__.

I'm still pretty skeptical about the adequacy of the asm parameters,
though.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] sh: Add support Renesas SuperH
Date: 2008-05-10 01:22:32
Message-ID: 200805100122.m4A1MWB12773@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Where are we on this?

---------------------------------------------------------------------------

Tom Lane wrote:
> I wrote:
> > Nobuhiro Iwamatsu <iwamatsu(at)nigauri(dot)org> writes:
> >> +#if defined(__sh__) /* Renesas SuperH */
>
> > Do they have any longer form of that macro?
>
> I looked into the gcc sources, and the answer seems to be "no" :-(.
> So we're stuck with __sh__.
>
> I'm still pretty skeptical about the adequacy of the asm parameters,
> though.
>
> regards, tom lane
>
> --
> Sent via pgsql-patches mailing list (pgsql-patches(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-patches

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +