[PATCH] D49123: [test cases] add test cases for find more abs pattern
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 9 19:19:37 PDT 2018
shchenz created this revision.
shchenz added reviewers: spatel, echristo, nemanjai.
two more abs pattern and canonicalize abs pattern
1:
"
define i64 @abs_expression64(i64 %a, i64 %b) {
%1 = sub i64 %a, %b
%2 = icmp sgt i64 %1, 0
%3 = sub i64 %b, %a
%4 = select i1 %2, i64 %1, i64 %3
ret i64 %4
}
"
this should be |a-b|.
2:
"
define i64 @test2(i64 %a) {
%tmp1neg = sub i64 0, %a
%b = icmp sgt i64 %tmp1neg, -1
%abs = select i1 %b, i64 %tmp1neg, i64 %a
ret i64 %abs
}
"
this should be |a|
https://reviews.llvm.org/D49123
Files:
llvm/test/Transforms/InstCombine/abs-1.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49123.154755.patch
Type: text/x-patch
Size: 3701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180710/125ff1b4/attachment.bin>
More information about the llvm-commits
mailing list