[all-commits] [llvm/llvm-project] 505933: [NVPTX] Fix lowering of frem for negative values

Thomas via All-commits all-commits at lists.llvm.org
Mon May 24 07:46:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 505933a489206fc4b27f4fb4292c52097faa294e
      https://github.com/llvm/llvm-project/commit/505933a489206fc4b27f4fb4292c52097faa294e
  Author: thomasraoux <thomasraoux at google.com>
  Date:   2021-05-24 (Mon, 24 May 2021)

  Changed paths:
    M llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
    M llvm/test/CodeGen/NVPTX/f16-instructions.ll
    M llvm/test/CodeGen/NVPTX/f16x2-instructions.ll

  Log Message:
  -----------
  [NVPTX] Fix lowering of frem for negative values

to match fmod frem result must have the dividend sign. Previous implementation
had the wrong sign when passing negative numbers. For ex: frem(-16, 7) was
returning 5 instead of -2. We should just a ftrunc instead of floor when
lowering to get the right behavior.

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




More information about the All-commits mailing list