Encode a icmp predicate into a three bit mask. These bits are carefully arranged to allow folding of expressions such as:

Synopsis

Declared in <llvm/Analysis/CmpInstAnalysis.h>

unsigned int
getICmpCode(CmpInst::Predicate Pred);

Description

(A < B) | (A > B) ‐‐> (A != B)

Note that this is only valid if the first and second predicates have the same sign. It is illegal to do: (A u< B) | (A s> B)

Three bits are used to represent the condition, as follows: 0 A > B 1 A == B 2 A < B

<=> Value Definition 000 0 Always false 001 1 A > B 010 2 A == B 011 3 A >= B 100 4 A < B 101 5 A != B 110 6 A <= B 111 7 Always true

Return Value

Three‐bit predicate encoding for Pred.

Parameters

Name

Description

Pred

ICmp predicate to encode into the three‐bit mask.

Created with MrDocs