[AArch64][GlobalISel] Select G_SADDO and G_SSUBO
authorJessica Paquette <jpaquette@apple.com>
Thu, 3 Dec 2020 22:31:43 +0000 (14:31 -0800)
committerJessica Paquette <jpaquette@apple.com>
Tue, 8 Dec 2020 17:18:28 +0000 (09:18 -0800)
commitb15491eb333809e907e51d1b05da2a6a6344a427
tree97b957d7aa28511ab68224c6751577624ef0a1e7
parent4a0528e4a0e3e4504db8650bf2bf7d6977ffa018
[AArch64][GlobalISel] Select G_SADDO and G_SSUBO

We didn't have selector support for these.

Selection code is similar to `getAArch64XALUOOp` in AArch64ISelLowering. Similar
to that code, this returns the AArch64CC and the instruction produced. In SDAG,
this is used to optimize select + overflow and condition branch + overflow
pairs. (See `AArch64TargetLowering::LowerBR_CC` and
`AArch64TargetLowering::LowerSelect`)

(G_USUBO should be easy to add here, but it isn't legalized right now.)

This also factors out the existing G_UADDO selection code, and removes an
unnecessary check for s32/s64. AFAIK, we shouldn't ever get anything other than
s32/s64. It makes more sense for this to be handled by the type assertion in
`emitAddSub`.

Differential Revision: https://reviews.llvm.org/D92610
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/lib/Target/AArch64/GISel/select-saddo.mir [new file with mode: 0644]
llvm/lib/Target/AArch64/GISel/select-ssubo.mir [new file with mode: 0644]