[all-commits] [llvm/llvm-project] 7b9b81: [RISCV][test] Combine comparison and logic ops
iabg-sc via All-commits
all-commits at lists.llvm.org
Fri Dec 23 06:10:47 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7b9b81a245827261ce9d2adad0cd429589e8d5e7
https://github.com/llvm/llvm-project/commit/7b9b81a245827261ce9d2adad0cd429589e8d5e7
Author: Ilya Andreev <ilya.andreev at syntacore.com>
Date: 2022-12-23 (Fri, 23 Dec 2022)
Changed paths:
A llvm/test/CodeGen/RISCV/zbb-cmp-combine.ll
Log Message:
-----------
[RISCV][test] Combine comparison and logic ops
Two comparison operations and a logical operation are combined into selection using MIN or MAX and comparison operation.
For optimization to be applied conditions have to be satisfied:
1. In comparison operations has to be the one common operand.
2. Supports only signed or unsigned integers.
3. Comparison has to be the same with respect to common operand.
4. There are no more users of comparison except logic operation.
5. Every combination of comparison and AND, OR are supported.
It will convert
%l0 = %a < %c
%l1 = %b < %c
%res = %l0 or %l1
into
%sel = min(%a, %b)
%res = %sel < %c
It supports several comparison operations (<, <=, >, >=), signed, unsigned values and different order of operands if they do not violate conditions.
Commit: 550d93ab1d2ec27efe5c5791f16ef31e3f74a6a6
https://github.com/llvm/llvm-project/commit/550d93ab1d2ec27efe5c5791f16ef31e3f74a6a6
Author: Ilya Andreev <ilya.andreev at syntacore.com>
Date: 2022-12-23 (Fri, 23 Dec 2022)
Changed paths:
M llvm/lib/Target/RISCV/RISCVISelLowering.cpp
M llvm/test/CodeGen/RISCV/zbb-cmp-combine.ll
Log Message:
-----------
[RISCV] Combine comparison and logic ops
Two comparison operations and a logical operation are combined into selection using MIN or MAX and comparison operation.
For optimization to be applied conditions have to be satisfied:
1. In comparison operations has to be the one common operand.
2. Supports only signed and unsigned integers.
3. Comparison has to be the same with respect to common operand.
4. There are no more users of comparison except logic operation.
5. Every combination of comparison and AND, OR are supported.
It will convert
%l0 = %a < %c
%l1 = %b < %c
%res = %l0 or %l1
into
%sel = min(%a, %b)
%res = %sel < %c
It supports several comparison operations (<, <=, >, >=), signed, unsigned values and different order of operands if they do not violate conditions.
Differential Revision: https://reviews.llvm.org/D134277
Compare: https://github.com/llvm/llvm-project/compare/a09e222fd5f2...550d93ab1d2e
More information about the All-commits
mailing list