LLVM  8.0.1
CMP;CCMP matching

These functions deal with the formation of CMP;CCMP;... More...

These functions deal with the formation of CMP;CCMP;...

sequences. The CCMP/CCMN/FCCMP/FCCMPE instructions allow the conditional execution of a comparison. They set the NZCV flags to a predefined value if their predicate is false. This allows to express arbitrary conjunctions, for example "cmp 0 (and (setCA (cmp A)) (setCB (cmp B)))" expressed as: cmp A ccmp B, inv(CB), CA check for CB flags

This naturally lets us implement chains of AND operations with SETCC operands. And we can even implement some other situations by transforming them:

As complete example: or (or (setCA (cmp A)) (setCB (cmp B))) (and (setCC (cmp C)) (setCD (cmp D)))" can be reassociated to: or (and (setCC (cmp C)) setCD (cmp D))