[all-commits] [llvm/llvm-project] 9174a5: [NVPTX] SHL.64 $r, 31 cannot be converted to a mul...

Dmitry Vasilyev via All-commits all-commits at lists.llvm.org
Wed Aug 24 02:40:31 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9174a5e9a84514b61a76c0077bd4454e8545d3d9
  Author: Dmitry Vassiliev <dvassiliev at accesssoftek.com>
  Date:   2022-08-24 (Wed, 24 Aug 2022)

  Changed paths:
    M llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
    M llvm/test/CodeGen/NVPTX/mulwide.ll

  Log Message:
  [NVPTX] SHL.64 $r, 31 cannot be converted to a mulwide.s32

In order to convert to mulwide.s32, we compute the 2nd operand as MulWide.32 $r, (1 << 31).
(1 << 31) is interpreted as a negative number, and is not equivalent to the original instruction.
The code `int64_t r = (int64_t)a << 31;` incorrectly compiled to `mul.wide.s32 %rd7, %r1, -2147483648;`

Reviewed By: jchlanda

Differential Revision: https://reviews.llvm.org/D132516

More information about the All-commits mailing list