[PATCH] D87870: [GISel] Add new combines for G_FMUL

Michael Kitzan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 16:20:21 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 eight new `GICombineRule`s for `G_FMUL`:

- `G_FMUL(x, 0.0)` -> `0.0`
- `G_FMUL(x, 1.0)` -> `x`
- `G_FMUL(x, -1.0)` -> `G_FNEG(x)`
- `G_FMUL(G_FNEG(x), G_FNEG(y))` -> `G_FMUL(x, y)`
- `G_FMUL(G_FMUL(x, c0), c1)` -> `G_FMUL(x, c0 * c1)` (unsafe fp math only)
- `G_FMUL(G_FADD(x, x), c)` -> `G_FMUL(x, c * 2.0)` (unsafe fp math only)
- `G_FMUL(x, G_SELECT(G_FCMP(x > 0.0), -1.0, 1.0)` -> `G_FNEG(G_FABS(x))`
- `G_FMUL(x, G_SELECT(G_FCMP(x > 0.0), 1.0, -1.0))` -> `G_FABS(x)`

Patch additionally adds new combine tests for AArch64 target for these new rules, as well as updating AMDGPU GISel tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87870

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
  llvm/include/llvm/Target/GlobalISel/Combine.td
  llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/combine-fmul.mir
  llvm/test/CodeGen/AArch64/GlobalISel/combine-unsafe-fp-math.mir
  llvm/test/CodeGen/AMDGPU/GlobalISel/fmul.v2f16.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87870.292654.patch
Type: text/x-patch
Size: 31648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200917/dc9af7a3/attachment.bin>


More information about the llvm-commits mailing list