[llvm-bugs] [Bug 33898] New: shr <reg>, 1 sets flags in useful ways
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jul 22 14:48:01 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33898
Bug ID: 33898
Summary: shr <reg>, 1 sets flags in useful ways
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: rjmccall at apple.com
CC: llvm-bugs at lists.llvm.org
"shr <reg>, 1" sets:
ZF if (<reg> >> 1) == 0, i.e. if (<reg> & ~1) == 0
CF if (<reg> & 1) == 1
A branch predicated on (x == 0 || x == 1), ((x & ~1) == 0), or (x ULE 1) can be
emitted as shr x, 1; jz.
A branch predicated on ((x & 1) == 1) can be emitted as shr x, 1; jb. This is
not useful on its own because test x, 1 exists, but it can be combined:
A branch predicated on (x == 0 || (x & 1) == 1) can be emitted as shr x, 1;
jbe.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170722/639af19f/attachment.html>
More information about the llvm-bugs
mailing list