[PATCH] D109149: [DAG] Fold select_cc setgt X, -1, C, ~C -> xor (ashr X, BW-1), C
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 2 07:00:24 PDT 2021
- Previous message: [PATCH] D109149: [DAG] Fold select_cc setgt X, -1, C, ~C -> xor (ashr X, BW-1), C
- Next message: [PATCH] D109149: [DAG] Fold select_cc setgt X, -1, C, ~C -> xor (ashr X, BW-1), C
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
arsenm added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:22873
+ DAG.getConstant(CmpOpVT.getScalarSizeInBits() - 1, DL, CmpOpVT));
+ return DAG.getNode(ISD::XOR, DL, VT, DAG.getSExtOrTrunc(ASR, DL, VT),
+ DAG.getSExtOrTrunc(CC == ISD::SETLT ? N3 : N2, DL, VT));
----------------
dmgreen wrote:
> arsenm wrote:
> > Is it really beneficial if this cast is necessary? Should this check the compared and selected types match (or maybe allow truncate, if it's free)
> Any of the selecti32i64 and selecti8i32 tests will involve sign extending, and all look like they produce less or equal numbers of instructions. I've not seen any cases where it made it unprofitable (but may not have tried all possibilities).
For AMDGPU if the compared type was 64-bits, and the selected type was 32-bits, this would be worse. The other way around would be beneficial
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109149/new/
https://reviews.llvm.org/D109149
- Previous message: [PATCH] D109149: [DAG] Fold select_cc setgt X, -1, C, ~C -> xor (ashr X, BW-1), C
- Next message: [PATCH] D109149: [DAG] Fold select_cc setgt X, -1, C, ~C -> xor (ashr X, BW-1), C
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the llvm-commits
mailing list