[all-commits] [llvm/llvm-project] b2fe02: [InstCombine][test] add tests for icmp ult with co...
RotateRight via All-commits
all-commits at lists.llvm.org
Wed Jun 30 16:00:27 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b2fe025707aae780d88db2446fc1ce618e40bdb3
https://github.com/llvm/llvm-project/commit/b2fe025707aae780d88db2446fc1ce618e40bdb3
Author: Sanjay Patel <spatel at rotateright.com>
Date: 2021-06-30 (Wed, 30 Jun 2021)
Changed paths:
M llvm/test/Transforms/InstCombine/icmp-add.ll
Log Message:
-----------
[InstCombine][test] add tests for icmp ult with constant and offset; NFC
This is the 'ult' sibling pattern for:
c7b658aeb526c3e6
Commit: 0c400e8953069888315f85d62780839dccbaa33c
https://github.com/llvm/llvm-project/commit/0c400e8953069888315f85d62780839dccbaa33c
Author: Sanjay Patel <spatel at rotateright.com>
Date: 2021-06-30 (Wed, 30 Jun 2021)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
M llvm/test/Transforms/InstCombine/icmp-add.ll
Log Message:
-----------
[InstCombine] fold icmp ult of offset value with constant
This is one sibling of the fold added with c7b658aeb526 .
(X + C2) <u C --> X >s ~C2 (if C == C2 + SMIN)
I'm still not sure how to describe it best, but we're
translating 2 constants from an unsigned range comparison
to signed because that eliminates the offset (add) op.
This could be extended to handle the more general (non-constant)
pattern too:
https://alive2.llvm.org/ce/z/K-fMBf
define i1 @src(i8 %a, i8 %c2) {
%t = add i8 %a, %c2
%c = add i8 %c2, 128 ; SMIN
%ov = icmp ult i8 %t, %c
ret i1 %ov
}
define i1 @tgt(i8 %a, i8 %c2) {
%not_c2 = xor i8 %c2, -1
%ov = icmp sgt i8 %a, %not_c2
ret i1 %ov
}
Compare: https://github.com/llvm/llvm-project/compare/b41b4148e7b9...0c400e895306
More information about the All-commits
mailing list