diff options
author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-12-13 15:50:30 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-12-13 15:50:30 +0000 |
commit | 584940e3c65aca9e8329cae7b3ffda8ea51da81d (patch) | |
tree | f141feacb23e1c3a331b58c72b1b42472c194daa /test | |
parent | 5f65b24e4df944e0dbab75aa4ee7efd12a1f820e (diff) | |
download | llvm-584940e3c65aca9e8329cae7b3ffda8ea51da81d.tar.gz llvm-584940e3c65aca9e8329cae7b3ffda8ea51da81d.tar.bz2 llvm-584940e3c65aca9e8329cae7b3ffda8ea51da81d.tar.xz |
[SystemZ] Optimize X [!=]= Y in cases where X - Y or Y - X is also computed
In those cases it's better to compare the result of the subtraction
against zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197239 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/SystemZ/int-cmp-44.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/int-cmp-44.ll b/test/CodeGen/SystemZ/int-cmp-44.ll index 7f537e9de7..8ab67f70e6 100644 --- a/test/CodeGen/SystemZ/int-cmp-44.ll +++ b/test/CodeGen/SystemZ/int-cmp-44.ll @@ -845,3 +845,23 @@ store: exit: ret i64 %ext } + +; Try a form of f7 in which the subtraction operands are compared directly. +define i32 @f41(i32 %a, i32 %b, i32 *%dest) { +; CHECK-LABEL: f41: +; CHECK: s %r2, 0(%r4) +; CHECK-NEXT: jne .L{{.*}} +; CHECK: br %r14 +entry: + %cur = load i32 *%dest + %res = sub i32 %a, %cur + %cmp = icmp ne i32 %a, %cur + br i1 %cmp, label %exit, label %store + +store: + store i32 %b, i32 *%dest + br label %exit + +exit: + ret i32 %res +} |