[PATCH] D87936: [GISel] Add new combines for G_ADD

Michael Kitzan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 13:14:05 PDT 2020


mkitzan created this revision.
mkitzan added reviewers: arsenm, paquette, aditya_nandakumar, volkan, dsanders.
mkitzan added a project: LLVM.
Herald added subscribers: llvm-commits, kerbowa, hiraditya, kristof.beyls, tpr, nhaehnle, jvesely.
mkitzan requested review of this revision.
Herald added a subscriber: wdng.

Patch adds four new `GICombineRule`s for `G_ADD`:

- `G_ADD(x, -cst)` -> `G_SUB(x, cst)`
- `G_ADD(x, G_SUB(y, x))` -> `y`
- `G_ADD(G_SUB(y, x), x)` -> `y`
- `G_ADD(x, y)` -> `G_OR(x, y)` (iff `x` and `y` share no common bits)

Patch additionally adds new combine tests for AArch64 target for these new rules, as well as updating AMDGPU GISel tests. A new `GlobalISel/Utils.h` helper function was added to check if two vregs have no common bits set.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87936

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/CodeGen/GlobalISel/Utils.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/lib/CodeGen/GlobalISel/Utils.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/combine-add.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/add.v2i16.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.i128.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/extractelement.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/saddsat.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/sdiv.i64.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/srem.i64.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/ssubsat.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/udiv.i64.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i32.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87936.292884.patch
Type: text/x-patch
Size: 95882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200918/828c8bf5/attachment-0001.bin>


More information about the llvm-commits mailing list