[all-commits] [llvm/llvm-project] 8523fb: [DAG] Fold select_cc setgt X, -1, C, ~C -> xor (as...
David Green via All-commits
all-commits at lists.llvm.org
Sun Sep 5 08:04:17 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8523fb96a63e9c517cb4d2d849fdde1ed65d3d26
https://github.com/llvm/llvm-project/commit/8523fb96a63e9c517cb4d2d849fdde1ed65d3d26
Author: David Green <david.green at arm.com>
Date: 2021-09-05 (Sun, 05 Sep 2021)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
M llvm/test/CodeGen/AArch64/select-constant-xor.ll
M llvm/test/CodeGen/AMDGPU/select-constant-xor.ll
M llvm/test/CodeGen/ARM/select-constant-xor.ll
M llvm/test/CodeGen/PowerPC/select-constant-xor.ll
M llvm/test/CodeGen/RISCV/select-constant-xor.ll
M llvm/test/CodeGen/X86/pr16031.ll
M llvm/test/CodeGen/X86/select-constant-xor.ll
M llvm/test/CodeGen/X86/smul_fix_sat.ll
Log Message:
-----------
[DAG] Fold select_cc setgt X, -1, C, ~C -> xor (ashr X, BW-1), C
Given a select_cc producing a constant and a invertion of the constant
for a comparison more than zero, we can produce an xor with ashr
instead, which produces smaller code. The ashr either sets all bits or
clear all bits depending on if the value is negative. This is then xor'd
with the constant to optionally negate the value.
https://alive2.llvm.org/ce/z/DTFaBZ
This includes a OneUseCheck on the Cmp, which seems to make thinks a
little worse and will be removed in a followup.
Differential Revision: https://reviews.llvm.org/D109149
More information about the All-commits
mailing list