[all-commits] [llvm/llvm-project] 1c9a93: [GlobalIsel][AMDGPU] Changing legalize rule for G_...

yashssh via All-commits all-commits at lists.llvm.org
Mon Nov 14 10:13:09 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1c9a93ae3ad0d8d085efe3af38ca65e4a7b2f307
      https://github.com/llvm/llvm-project/commit/1c9a93ae3ad0d8d085efe3af38ca65e4a7b2f307
  Author: Yashwant Singh <Yashwant.Singh at amd.com>
  Date:   2022-11-14 (Mon, 14 Nov 2022)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/addo.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sadde.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-ssube.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-uadde.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-uaddo.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-uaddsat.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-usube.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-usubo.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-usubsat.mir
    M llvm/test/CodeGen/AMDGPU/GlobalISel/subo.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/uaddsat.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/usubsat.ll

  Log Message:
  -----------
  [GlobalIsel][AMDGPU] Changing legalize rule for G_{UADDO|UADDE|USUBO|USUBE|SADDE|SSUBE}

Generic add and sub with carry are now legalized in a way to explicitly calculate carry/borrow output. i.e
%6:_(s64), %7:_(s1) = G_UADDO %0, %1
becomes,
%13:_(s32), %14:_(s1) = G_UADDO %2, %4
%15:_(s32), %16:_(s1) = G_UADDE %3, %5, %14
%6:_(s64) = G_MERGE_VALUES %13(s32), %15(s32)
%7:_(s1) = G_ICMP intpred(ult), %6(s64), %1

Here G_MERGE and G_ICMP instructions are redundant for recalculating carry output. (Similar case for sub with borrow)
This change fix this.

Reviewed By: arsenm, #amdgpu

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




More information about the All-commits mailing list