[PATCH] D120899: [RISCV] Fix vslide1up/down intrinsics overflow bug for SEW=64 on RV32

Tintin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 05:44:08 PST 2022


lhtin created this revision.
lhtin added a reviewer: craig.topper.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
Herald added a project: All.
lhtin requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.

When left-shifting the incoming VL parameter, it may cause overflow
when the vl >= 0x80000000, resulting in the wrong VL length setting.
For example this code and the output:

  #include <riscv_vector.h>
  
  vint64m1_t
  test (vint64m1_t a, int64_t b)
  {
      return vslide1up_vx_i64m1(a, b, 0x80000000);
  }
  /* assembly output:
  test: 
          vsetivli        zero, 0, e32, m1, ta, mu
          vslide1up.vx    v9, v8, a1
          vslide1up.vx    v8, v9, a0
          ret
  */

The bug was caused by this commit <https://reviews.llvm.org/D99910>


https://reviews.llvm.org/D120899

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/RISCV/rvv/masked-vslide1down-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/unmasked-tu.ll
  llvm/test/CodeGen/RISCV/rvv/vslide1down-rv32.ll
  llvm/test/CodeGen/RISCV/rvv/vslide1up-rv32.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120899.412684.patch
Type: text/x-patch
Size: 17300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220303/f49ddc44/attachment.bin>


More information about the llvm-commits mailing list