All of lore.kernel.org
 help / color / mirror / Atom feed
* [OpenRISC] OpenRISC GCC requirements
@ 2018-09-07 11:27 Stafford Horne
  2018-09-07 19:58 ` BAndViG
  2018-09-07 22:29 ` Samuel Holland
  0 siblings, 2 replies; 8+ messages in thread
From: Stafford Horne @ 2018-09-07 11:27 UTC (permalink / raw)
  To: openrisc

Hi All,

As many of us know OpenRISC has different classes for instructions.
i.e. Class I and Class II.

The Class I instructions are required for all implementation and Class
II instructions are optional.   For the new GCC port I have used a few
class II instructions.

Does anyone have any opinion if this would be bad or cause issues?  To
me I think its OK as I haven't seen a core without these.

Class II Instructions used:
       l.extbs  - sign extend byte
       l.extbz  - zero extend byte
       l.exths  - sign extend half-word
       l.exthz  - zero extend half-word
       l.cmov  - conditional move


The alternative would be to substitute the instructions with something
else.   But I don't expect there would be many/any cores running C
code that would be missing these instructions.

-Stafford

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OpenRISC] OpenRISC GCC requirements
  2018-09-07 11:27 [OpenRISC] OpenRISC GCC requirements Stafford Horne
@ 2018-09-07 19:58 ` BAndViG
  2018-09-07 22:29 ` Samuel Holland
  1 sibling, 0 replies; 8+ messages in thread
From: BAndViG @ 2018-09-07 19:58 UTC (permalink / raw)
  To: openrisc

Stafford,

If I remember correctly, all of these instructions are disabled by default. 
Moreover, most of mor1kx pipes support l.cmov only if FEATURE_CMOV is 
"ENABLED", while l.ext* instructions aren’t implemented at all. Even so 
FEATURE_EXT is present in source code it's only legal value is "NONE".
The only mor1kx pipe which supports l.cmov permanently is MAROCCHINO, but 
following others MAROCCHINO doesn't support l.ext* too.

WBR
Andrey 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OpenRISC] OpenRISC GCC requirements
  2018-09-07 11:27 [OpenRISC] OpenRISC GCC requirements Stafford Horne
  2018-09-07 19:58 ` BAndViG
@ 2018-09-07 22:29 ` Samuel Holland
  2018-09-08  0:29   ` Stafford Horne
  1 sibling, 1 reply; 8+ messages in thread
From: Samuel Holland @ 2018-09-07 22:29 UTC (permalink / raw)
  To: openrisc

On 09/07/18 06:27, Stafford Horne wrote:
> As many of us know OpenRISC has different classes for instructions.
> i.e. Class I and Class II.
> 
> The Class I instructions are required for all implementation and Class
> II instructions are optional.   For the new GCC port I have used a few
> class II instructions.
> 
> Does anyone have any opinion if this would be bad or cause issues?  To
> me I think its OK as I haven't seen a core without these.

I know of at least one currently-produced silicon implementation[1] based on an
old or1200 that has a broken l.cmov.

[1]: https://linux-sunxi.org/AR100

> Class II Instructions used:
>        l.extbs  - sign extend byte
>        l.extbz  - zero extend byte
>        l.exths  - sign extend half-word
>        l.exthz  - zero extend half-word
>        l.cmov  - conditional move

Looking at or1k.md, you used l.msync and l.ror, and l.sf*i as well. And l.cmov
and l.sf*i are also used in the libgcc implementation. Those also need to be
considered.

> The alternative would be to substitute the instructions with something
> else.   But I don't expect there would be many/any cores running C
> code that would be missing these instructions.
> 
> -Stafford

Thanks,
Samuel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OpenRISC] OpenRISC GCC requirements
  2018-09-07 22:29 ` Samuel Holland
@ 2018-09-08  0:29   ` Stafford Horne
  2018-09-13  4:49     ` Stafford Horne
  0 siblings, 1 reply; 8+ messages in thread
From: Stafford Horne @ 2018-09-08  0:29 UTC (permalink / raw)
  To: openrisc

On Fri, Sep 07, 2018 at 05:29:09PM -0500, Samuel Holland wrote:
> On 09/07/18 06:27, Stafford Horne wrote:
> > As many of us know OpenRISC has different classes for instructions.
> > i.e. Class I and Class II.
> > 
> > The Class I instructions are required for all implementation and Class
> > II instructions are optional.   For the new GCC port I have used a few
> > class II instructions.
> > 
> > Does anyone have any opinion if this would be bad or cause issues?  To
> > me I think its OK as I haven't seen a core without these.
> 
> I know of at least one currently-produced silicon implementation[1] based on an
> old or1200 that has a broken l.cmov.
> 
> [1]: https://linux-sunxi.org/AR100
> 
> > Class II Instructions used:
> >        l.extbs  - sign extend byte
> >        l.extbz  - zero extend byte
> >        l.exths  - sign extend half-word
> >        l.exthz  - zero extend half-word
> >        l.cmov  - conditional move
> 
> Looking at or1k.md, you used l.msync and l.ror, and l.sf*i as well. And l.cmov
> and l.sf*i are also used in the libgcc implementation. Those also need to be
> considered.

Thanks, so it looks like we will have to make a flag to enable/disable the class
II instructions to be generated in the output code.

Thanks for the details.  I didnt know it was such a large set of cores missing
those instructions.

-Stafford

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OpenRISC] OpenRISC GCC requirements
  2018-09-08  0:29   ` Stafford Horne
@ 2018-09-13  4:49     ` Stafford Horne
  2018-09-13 17:56       ` BAndViG
  0 siblings, 1 reply; 8+ messages in thread
From: Stafford Horne @ 2018-09-13  4:49 UTC (permalink / raw)
  To: openrisc

On Sat, Sep 8, 2018 at 9:29 AM, Stafford Horne <shorne@gmail.com> wrote:
> On Fri, Sep 07, 2018 at 05:29:09PM -0500, Samuel Holland wrote:

>> Looking at or1k.md, you used l.msync and l.ror, and l.sf*i as well. And l.cmov
>> and l.sf*i are also used in the libgcc implementation. Those also need to be
>> considered.
[...]
> Thanks for the details.  I didnt know it was such a large set of cores missing
> those instructions.

Hello,

I have posted a few patches to allow enabling of the class2
instructions (disabled by default).  To view the changes so far see:

     https://github.com/stffrdhrn/gcc/commits/or1k-port-1

Currently the architecture related openrisc gcc arguments are:

    -mclass2 - enable class 2 instructions (other than div/mul)
    -mhard-div - enable hardware divide instruction
    -mhard-mul - enable hardware multiply instruction

I couldn't really think of a good way to go about the naming, so that
is what I came up with.

Also, currently I didn't not add mclass2 as a 'multilib' argument.  So
libgcc will build with class2 instructions disabled.  If enabled it
would mean we would generate 8 versions of libgcc.  Maybe thats fine.
Anyone have opinions?

-Stafford

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OpenRISC] OpenRISC GCC requirements
  2018-09-13  4:49     ` Stafford Horne
@ 2018-09-13 17:56       ` BAndViG
  2018-09-14  0:43         ` Stafford Horne
  0 siblings, 1 reply; 8+ messages in thread
From: BAndViG @ 2018-09-13 17:56 UTC (permalink / raw)
  To: openrisc

>Currently the architecture related openrisc gcc arguments are:

>    -mclass2 - enable class 2 instructions (other than div/mul)
>    -mhard-div - enable hardware divide instruction
>    -mhard-mul - enable hardware multiply instruction

What about to follow the approach implemented in current GCC? I.e. use 
separate options: -mcmov, -mror, -msext, and additional to 
them: -mmac, -madrp. For example, various "multiply-accumulate" instructions 
are also Class-II, however I doubt that they are implemented elsewhere than 
simulator. I think, multilib configuration could be given just as a 
relatively simple example (with short list of variants) in commentaries in 
appropriate file ("gcc/config/or1k/t-or1k" if I remember correctly) , while 
default should be minimum set (i.e. just class-I).

WBR
Andrey


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OpenRISC] OpenRISC GCC requirements
  2018-09-13 17:56       ` BAndViG
@ 2018-09-14  0:43         ` Stafford Horne
  2018-09-17 18:44           ` BAndViG
  0 siblings, 1 reply; 8+ messages in thread
From: Stafford Horne @ 2018-09-14  0:43 UTC (permalink / raw)
  To: openrisc

On Fri, Sep 14, 2018, 2:57 AM BAndViG <bandvig@mail.ru> wrote:

> >Currently the architecture related openrisc gcc arguments are:
>
> >    -mclass2 - enable class 2 instructions (other than div/mul)
> >    -mhard-div - enable hardware divide instruction
> >    -mhard-mul - enable hardware multiply instruction
>
> What about to follow the approach implemented in current GCC? I.e. use
> separate options: -mcmov, -mror, -msext, and additional to
> them: -mmac, -madrp. For example, various "multiply-accumulate"
> instructions
> are also Class-II, however I doubt that they are implemented elsewhere
> than
> simulator. I think, multilib configuration could be given just as a
> relatively simple example (with short list of variants) in commentaries in
> appropriate file ("gcc/config/or1k/t-or1k" if I remember correctly) ,
> while
> default should be minimum set (i.e. just class-I).
>

Thanks,

That makes sense.  My though was to first have the mclass2 blanket argument
to enable everything.  Then, if anyone wants to have instruction specific
switches it should be pretty easy to add.  So I don't plan to add at first.
Is that fair?

One thing I will do now is expose these via configure as suggested by
Samuel. I.e. ./configure --enable-class2.

Note, my most recent patches have cause a few hundred tests to fail. Please
use the releases from GitHub if you want to play with the toolchain.

-stafford
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20180914/0f2b482f/attachment.html>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [OpenRISC] OpenRISC GCC requirements
  2018-09-14  0:43         ` Stafford Horne
@ 2018-09-17 18:44           ` BAndViG
  0 siblings, 0 replies; 8+ messages in thread
From: BAndViG @ 2018-09-17 18:44 UTC (permalink / raw)
  To: openrisc

>My though was to first have the mclass2 blanket argument to enable everything.  
>Then, if anyone wants to have instruction specific switches it should be pretty easy to add.  
>So I don't plan to add at first. Is that fair?

Yes, absolutely.

>One thing I will do now is expose these via configure as suggested by Samuel. 
>I.e. ./configure --enable-class2.

I think, it would be useful to implement similar ability for each “–m*” option. The approach is more elegant than editing source code to select default options configurations.

>Note, my most recent patches have cause a few hundred tests to fail. 
>Please use the releases from GitHub if you want to play with the toolchain.

It is exaclty which I do.

WBR
Andrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20180917/845be244/attachment.html>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-09-17 18:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-07 11:27 [OpenRISC] OpenRISC GCC requirements Stafford Horne
2018-09-07 19:58 ` BAndViG
2018-09-07 22:29 ` Samuel Holland
2018-09-08  0:29   ` Stafford Horne
2018-09-13  4:49     ` Stafford Horne
2018-09-13 17:56       ` BAndViG
2018-09-14  0:43         ` Stafford Horne
2018-09-17 18:44           ` BAndViG

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.