All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH v3 3/3] or1k: gcc: initial support for openrisc
Date: Tue, 30 Oct 2018 21:18:06 +0900	[thread overview]
Message-ID: <20181030121806.GB2843@lianli.shorne-pla.net> (raw)
In-Reply-To: <ced5813d-aef7-1454-de4b-da327a4c2ff7@twiddle.net>

On Sun, Oct 28, 2018 at 01:56:29AM +0000, Richard Henderson wrote:
> On 10/27/18 5:37 AM, Stafford Horne wrote:
> > +(define_insn "zero_extendhisi2"
> > +  [(set (match_operand:SI 0 "register_operand"                    "=r,r")
> > +	(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
> > +  ""
> > +  "@
> > +   l.exthz\t%0, %1
> > +   l.lhz\t%0, %1"
> > +  [(set_attr "insn_support" "sext,*")])
> > +
> > +(define_insn "zero_extendqisi2"
> > +  [(set (match_operand:SI 0 "register_operand"                    "=r,r")
> > +	(zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
> > +  ""
> > +  "@
> > +   l.extbz\t%0, %1
> > +   l.lbz\t%0, %1"
> > +  [(set_attr "insn_support" "sext,*")])
> 
> The !sext r/r case is just l.andi.

OK.

> > +;; Sign extension patterns
> > +
> > +;; We can do memory extensions with a single load
> > +(define_insn "extendhisi2"
> > +  [(set (match_operand:SI 0 "register_operand"                     "=r,r")
> > +	(sign_extend:SI (match_operand:HI 1 "nonimmediate_operand"  "r,m")))]
> > +  ""
> > +  "@
> > +   l.exths\t%0, %1
> > +   l.lhs\t%0, %1"
> > +  [(set_attr "insn_support" "sext,*")])
> > +
> > +(define_insn "extendqisi2"
> > +  [(set (match_operand:SI 0 "register_operand"                     "=r,r")
> > +	(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand"  "r,m")))]
> > +  ""
> > +  "@
> > +   l.extbs\t%0, %1
> > +   l.lbs\t%0, %1"
> > +  [(set_attr "insn_support" "sext,*")])
> 
> You don't really want to give the register allocator no choice but to spill to
> memory in the !sext case.  Another r/r case with a splitter that is conditional
> on !sext would work.

OK, I was just being lazy allowing the spill.  Do you think the split/expand
would be an RTL using left shift / right shift?  Can you think of something
more clever?  Since "real" hardware does not usually support shifts with an
immediate we will need 1 instruction to load shift amount. i.e.

  l.ori %0, r0, 24
  l.sll %1, %1, %0
  l.sra %0, %1, %0

If we support shift with immediate it would just be:

  l.slli %1, %1, 24
  l.srai %0, %1, 24

But, I cant think of anything better.

> Otherwise, OK.

Thanks,

I am submitting patches on my git branch or1k-port-4. Just in case you want to
track progress.

 - Stafford

  reply	other threads:[~2018-10-30 12:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27  4:36 [OpenRISC] [PATCH v3 0/3] OpenRISC port Stafford Horne
2018-10-27  4:37 ` [OpenRISC] [PATCH v3 1/3] or1k: libgcc: initial support for openrisc Stafford Horne
2018-10-27 23:25   ` Segher Boessenkool
2018-10-28  0:37     ` Stafford Horne
2018-10-28  1:25   ` Richard Henderson
2018-10-29 13:44     ` Stafford Horne
2018-10-27  4:37 ` [OpenRISC] [PATCH v3 2/3] or1k: testsuite: " Stafford Horne
2018-10-28  1:27   ` Richard Henderson
2018-10-27  4:37 ` [OpenRISC] [PATCH v3 3/3] or1k: gcc: " Stafford Horne
2018-10-28  1:56   ` Richard Henderson
2018-10-30 12:18     ` Stafford Horne [this message]
2018-10-30 15:57       ` Richard Henderson
2018-10-30 22:44         ` Stafford Horne
2018-10-28  2:57   ` Segher Boessenkool
2018-10-28 21:47     ` Stafford Horne
2018-10-28 22:54       ` Segher Boessenkool
2018-10-30 12:49         ` Stafford Horne
2018-10-30 15:49           ` Segher Boessenkool
2018-10-30 22:35             ` Stafford Horne
2018-10-31 14:39               ` Jeff Law
2018-10-28 23:16     ` Richard Henderson
2018-10-29 13:34       ` Stafford Horne
2018-10-29 16:34         ` Segher Boessenkool
2018-10-29 16:42           ` Richard Henderson
2018-10-30 11:26             ` Stafford Horne
2018-10-30 15:41               ` Segher Boessenkool
2018-10-29 14:28   ` Szabolcs Nagy
2018-11-04  9:05     ` Stafford Horne
2018-11-05 11:13       ` Szabolcs Nagy
2018-11-05 15:10         ` Rich Felker
2018-11-05 20:58           ` Stafford Horne
2018-11-05 20:52         ` Stafford Horne
2018-11-05 19:45       ` Richard Henderson
2018-11-05 20:14         ` Christophe Lyon
2018-10-28  1:29 ` [OpenRISC] [PATCH v3 0/3] OpenRISC port Richard Henderson

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=20181030121806.GB2843@lianli.shorne-pla.net \
    --to=shorne@gmail.com \
    --cc=openrisc@lists.librecores.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.