public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Oleg Endo <oleg.endo@t-online.de>
To: Rich Felker <dalias@libc.org>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] add initial support for J2 core to sh target
Date: Tue, 01 Sep 2015 13:45:00 -0000	[thread overview]
Message-ID: <1E36CED7-DB4B-4381-998D-01181D40F4FD@t-online.de> (raw)
In-Reply-To: <20150831174909.GA6317@brightrain.aerifal.cx>

Hi Rich,

On 01 Sep 2015, at 02:49, Rich Felker <dalias@libc.org> wrote:

> The J2 Core is an open hardware cpu implementing the SH-2 instruction
> set, with the addition of barrel shift instructions and an atomic
> compare-and-swap instruction. This patch adds a cpu model option -mj2
> to the sh target. Presently all it does is enable use of the barrel
> shift instructions (and turns off assembler checking of the ISA via
> --isa=any) but I will eventually add support for the new CAS
> instruction as a new -matomic-model for use by the __sync and __atomic
> builtins.

It seems that this J2 atomic instruction(s ?) is not available to the public.  I've skimmed through the currently available J2 hardware sources, but couldn't find anything about it.  So it's just speculation, but probably you'll require a copyright assignment for the atomics parts.

> I've used the the name "J2" and "-mj2" rather than treating it as a
> submodel variant of "sh2" ("SH2J" and "-m2j") because the official
> name of this cpu model is "J2", with the intent of not misrepresenting
> it as a Renesas product.

But then, why do you add "shj2" in config.gcc?
I guess having an SH variant which doesn't match sh*-*-* would be odd.  I'd rather name it "SHJ2" everywhere (except the -m options which don't have the "sh" prefix).  Technically it really is just another SH variant so I'd suggest to treat it like that.  Might be simpler and less confusing for other things than GCC, too.

Also you might want to add the new option to that block in config.gcc

	echo "Unknown CPU used in --with-cpu=$with_cpu, known values:"  1>&2
	echo "m1 m2 m2e m3 m3e m4 m4-single m4-single-only m4-nofpu" 1>&2
	echo "m4a m4a-single m4a-single-only m4a-nofpu m4al" 1>&2
	echo "m2a m2a-single m2a-single-only m2a-nofpu" 1>&2
	exit 1
	;;

> The --isa=any passed to the assembler probably needs to be fixed
> before this patch is ready for upstream (although I'd really just
> prefer _always_ passing --isa=any to the assembler, since the current
> behavior breaks runtime-switching implementations, which I need).

I've added the --isa thing because LD also checks (or at least tries) compatibility of modules being linked together.  Also, it makes it easier to detect wrong/unexpected instructions in the output, which can happen sometimes by a bug in GCC or with inline-asm.  If you have other suggestions, please share.

> One
> complication is that passing --isa=j2 will fail with old binutils; I'm
> not sure if this should be detected and handled or if we should just
> require up-to-date binutils to use -mj2. In any case, I don't yet have
> an assembler-side patch to add the --isa level.

I'd say requiring new binutils is acceptable.  But that'd require being able to get a new binutils to begin with :)

Binutils will most likely require patches for the J2 atomic insn.  Thus maybe it's better to start with binutils first.

> I know this isn't ready for upstream yet but I'd appreciate feedback
> on the patch so far and anything that I need to change in order for it
> to be acceptable.

A changelog entry and documentation (new -m options etc) would be good.

Cheers,
Oleg

  reply	other threads:[~2015-09-01 13:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 17:52 Rich Felker
2015-09-01 13:45 ` Oleg Endo [this message]
2015-09-01 14:18   ` Rich Felker
2015-09-01 16:25     ` Oleg Endo
2015-09-01 17:09       ` Rich Felker
2015-09-02 15:17         ` Oleg Endo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1E36CED7-DB4B-4381-998D-01181D40F4FD@t-online.de \
    --to=oleg.endo@t-online.de \
    --cc=dalias@libc.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).