[PATCH] D137932: [GlobalIsel][AMDGPU] Changing legalize rule for G_{UADDO|UADDE|USUBO|USUBE|SADDE|SSUBE}

Yashwant Singh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 03:39:08 PST 2022


yassingh created this revision.
yassingh added reviewers: arsenm, foad, rampitec, AMDGPU.
yassingh added a project: AMDGPU.
Herald added subscribers: kosarev, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
yassingh requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137932

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137932.475096.patch
Type: text/x-patch
Size: 184285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221114/0f868c35/attachment-0001.bin>


More information about the llvm-commits mailing list