[all-commits] [llvm/llvm-project] e094ab: [SelectionDAG] Expand [US]CMP using arithmetic on ...
Volodymyr Vasylkun via All-commits
all-commits at lists.llvm.org
Tue Jul 16 12:56:40 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e094abde42634e38cda85a6024792f681fc58f32
https://github.com/llvm/llvm-project/commit/e094abde42634e38cda85a6024792f681fc58f32
Author: Volodymyr Vasylkun <vvmposeydon at gmail.com>
Date: 2024-07-16 (Tue, 16 Jul 2024)
Changed paths:
M llvm/include/llvm/CodeGen/TargetLowering.h
M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
M llvm/lib/Target/AArch64/AArch64ISelLowering.h
M llvm/lib/Target/SystemZ/SystemZISelLowering.h
A llvm/test/CodeGen/ARM/scmp.ll
A llvm/test/CodeGen/ARM/ucmp.ll
A llvm/test/CodeGen/LoongArch/scmp.ll
A llvm/test/CodeGen/LoongArch/ucmp.ll
A llvm/test/CodeGen/PowerPC/scmp.ll
A llvm/test/CodeGen/PowerPC/ucmp.ll
A llvm/test/CodeGen/RISCV/scmp.ll
A llvm/test/CodeGen/RISCV/ucmp.ll
A llvm/test/CodeGen/SystemZ/scmp.ll
A llvm/test/CodeGen/SystemZ/ucmp.ll
A llvm/test/CodeGen/Thumb/scmp.ll
A llvm/test/CodeGen/Thumb/ucmp.ll
A llvm/test/CodeGen/WebAssembly/scmp.ll
A llvm/test/CodeGen/WebAssembly/ucmp.ll
M llvm/test/CodeGen/X86/scmp.ll
M llvm/test/CodeGen/X86/ucmp.ll
Log Message:
-----------
[SelectionDAG] Expand [US]CMP using arithmetic on boolean values instead of selects (#98774)
The previous expansion of [US]CMP was done using two selects and two
compares. It produced decent code, but on many platforms it is better to
implement [US]CMP nodes by performing the following operation:
```
[us]cmp(x, y) = (x [us]> y) - (x [us]< y)
```
This patch adds this new expansion, as well as a hook in TargetLowering to allow some targets to still use the select-based approach. AArch64 and SystemZ are currently the only targets to prefer the former approach, but other targets may also start to use it if it provides for better codegen.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list