diff options
author | Kazu Hirata <kazu@google.com> | 2023-02-04 21:42:15 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-02-28 14:58:22 -0800 |
commit | 1e552d0c5bf1627b92ac205cab07d3e09d911750 (patch) | |
tree | 835f2ac761ff59c1c7c0bcbefbe41666cf0269ae /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | bc949f923ee37e6c71b69d0c0337d0e6b499832d (diff) | |
download | llvm-1e552d0c5bf1627b92ac205cab07d3e09d911750.zip llvm-1e552d0c5bf1627b92ac205cab07d3e09d911750.tar.gz llvm-1e552d0c5bf1627b92ac205cab07d3e09d911750.tar.bz2 |
[X86] Improve select of constants
Without this patch:
%cmp = icmp eq i32 %a, %b
%cond = select i1 %cmp, i32 1, i32 2
is compiled as:
31 c9 xor %ecx,%ecx
39 f7 cmp %esi,%edi
0f 94 c1 sete %cl
b8 02 00 00 00 mov $0x2,%eax
29 c8 sub %ecx,%eax
With this patch, the compiler generates:
31 c0 xor %eax,%eax
39 f7 cmp %esi,%edi
0f 95 c0 setne %al
ff c0 inc %eax
saving 5 bytes while reducing register usage.
This patch transforms C - setcc into inverted_setcc + (C-1) if C is a
nonzero constant.
This patch fixes:
https://github.com/llvm/llvm-project/issues/60854
Differential Revision: https://reviews.llvm.org/D144449
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
0 files changed, 0 insertions, 0 deletions