[all-commits] [llvm/llvm-project] 006807: [NVPTX] Remove `NVPTX::IMAD` opcode, and rely on i...

peterbell10 via All-commits all-commits at lists.llvm.org
Wed Jan 15 12:09:40 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0068078dca60b41ad1c7bdd4448e7de718b82a5d
      https://github.com/llvm/llvm-project/commit/0068078dca60b41ad1c7bdd4448e7de718b82a5d
  Author: peterbell10 <peterbell10 at openai.com>
  Date:   2025-01-15 (Wed, 15 Jan 2025)

  Changed paths:
    M llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
    M llvm/lib/Target/NVPTX/NVPTXISelLowering.h
    M llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
    M llvm/test/CodeGen/NVPTX/combine-mad.ll
    M llvm/test/CodeGen/NVPTX/dynamic_stackalloc.ll
    M llvm/test/CodeGen/NVPTX/i128.ll

  Log Message:
  -----------
  [NVPTX] Remove `NVPTX::IMAD` opcode, and rely on intruction selection only (#121724)

I noticed that NVPTX will sometimes emit `mad.lo` to multiply by 1, e.g.
in https://gcc.godbolt.org/z/4j47Y9W4c.

This happens when DAGCombiner operates on the add before the mul, so the
imad contraction happens regardless of whether the mul could have been
simplified.

To fix this, I remove `NVPTXISD::IMAD` and only combine to mad during
selection. This allows the default DAGCombiner patterns to simplify
the graph without any NVPTX-specific intervention.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list