[PATCH] D157476: [RISCV] Fix wrong type prototype of RVVSlideOneBuiltinSet

Wang Pengcheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 10 01:59:56 PDT 2023


wangpc added a comment.

In D157476#4575656 <https://reviews.llvm.org/D157476#4575656>, @eopXD wrote:

> You do agree with my latest comment that `long` is the righteous fix, right? :)

Oh sorry, somwhow I missed it.
I still think that using the element type is the right way. Because user will know the range of effective inserted value.
For example:

  vint16m1_t __riscv_vslide1up_vx_i16m1 (vint16m1_t src, int16_t value, size_t vl);
  vint16m1_t __riscv_vslide1up_vx_i16m1 (vint16m1_t src, long value, size_t vl);

We can know the range is [-32768, 32767] for the first intrinsic. When the user pass an argument larger than that(e.g. `__riscv_vslide1up_vx_i16m1(src, 0xFFFFFFFF, vl)`), the compiler can warn the user and may avoid unexpected behaviors.
For the second intrinsic, we can pass a `long` value. But for SEW<XLEN, the inserted value will be truncated. For example, `__riscv_vslide1up_vx_i16m1(src, 0xFFFFFFFF, vl)` won't report any warning, but the inserted value is just `0xFFFF`, which may be unexpected/confused.
That's just my thought. Issue or proposal can be raised in Github repo if we can come up with an agreement here. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157476



More information about the cfe-commits mailing list