[PATCH] D82239: RISC-V machine attribute to disable floating-point division and square root instructions in codegen

Bandhav Veluri via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 19:41:24 PDT 2020


vb000 added a comment.

In D82239#2171186 <https://reviews.llvm.org/D82239#2171186>, @jrtc27 wrote:

> In D82239#2124411 <https://reviews.llvm.org/D82239#2124411>, @vb000 wrote:
>
> > Hi @jrtc27,
> >
> > `fdiv` and `fsqrt` are rarely used instructions for many applications, but are beasts in terms of HW area consumption. While most of the `F` extension needs incremental additions to core FPU, `fdiv` and `fsqrt` need separate blocks of HW. Often this special purpose HW (whose sole purpose is to support two rarely used instructions) is not worth it in embedded applications. So, it's often fine to emulate those two instructions. So, there's definite value in having this option.
> >
> > (Also, this is not implemented just because GCC has this. We need this option to use LLVM on an already taped-out chip. I'm just trying to make it easy to transition from GCC to LLVM for ourselves, as well for other who might find this useful.)
>
>
> Ok, but I object to saying F is enabled. It’s not. What’s implemented is a subset of it. So what you really want is a non-standard extension Xfnodivsqrt or something. If F is in my arch string I can always use fdiv and fsqrt, and those shouldn’t trap (provided mstatus.FS is suitably set).


I agree with this. But this a practically useful feature, especially for an open source ISA like RISC-V, because different organizations, groups or individuals with different budgets develops chips for one standard ISA. I hope these arguments convinces you with the usefulness of the feature. If usefulness of this feature is agreed upon, the remaining discussion would be about downsides of having this feature.

One downside of having this feature you mentioned is the //divergence from the spec of 'F' standard extension//. The only stakeholders that would be affected by the divergence from the spec are the very people that explicitly enabled this feature by passing the flag to `llc`. Since they know what to expect when they enable this feature and that the reasons are very much practical as I explained in my past comment, this doesn't seem to be an actual downside.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82239/new/

https://reviews.llvm.org/D82239





More information about the llvm-commits mailing list