[PATCH] D90723: [AArch64][GlobalISel] Select G_SELECT cc, t, (G_SUB 0, x) -> CSNEG t, x, cc

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 15:21:40 PST 2020


paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.
paquette requested review of this revision.

When we see

  %sub = G_SUB 0, %x
  %select = G_SELECT %cc, %t, %sub

Fold away the G_SUB by producing

  %select = CSNEG %t, %x, cc

Simple IR example: https://godbolt.org/z/K8TEnh

This is valid on both sides of the select, but for now, just handle one side. It may make more sense to handle swapping sides during post-legalizer lowering.


https://reviews.llvm.org/D90723

Files:
  llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/select-select.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90723.302701.patch
Type: text/x-patch
Size: 5066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201103/360d9e7f/attachment.bin>


More information about the llvm-commits mailing list