From f3a70a6cd9841a824a186891cbe169919e4e9005 Mon Sep 17 00:00:00 2001
From: Reid Spencer
+
<result> = frem float 4.0, %var ; yields {float}:result = 4.0 % %var- - - - -
<result> = seteq <ty> <var1>, <var2> ; yields {bool}:result - <result> = setne <ty> <var1>, <var2> ; yields {bool}:result - <result> = setlt <ty> <var1>, <var2> ; yields {bool}:result - <result> = setgt <ty> <var1>, <var2> ; yields {bool}:result - <result> = setle <ty> <var1>, <var2> ; yields {bool}:result - <result> = setge <ty> <var1>, <var2> ; yields {bool}:result --
The 'setcc' family of instructions returns a boolean -value based on a comparison of their two operands.
-The two arguments to the 'setcc' instructions must -be of first class type (it is not possible -to compare 'label's, 'array's, 'structure' -or 'void' values, etc...). Both arguments must have identical -types.
-The 'seteq' instruction yields a true 'bool'
-value if both operands are equal.
-The 'setne' instruction yields a true 'bool'
-value if both operands are unequal.
-The 'setlt' instruction yields a true 'bool'
-value if the first operand is less than the second operand.
-The 'setgt' instruction yields a true 'bool'
-value if the first operand is greater than the second operand.
-The 'setle' instruction yields a true 'bool'
-value if the first operand is less than or equal to the second operand.
-The 'setge' instruction yields a true 'bool'
-value if the first operand is greater than or equal to the second
-operand.
<result> = seteq int 4, 5 ; yields {bool}:result = false - <result> = setne float 4, 5 ; yields {bool}:result = true - <result> = setlt uint 4, 5 ; yields {bool}:result = true - <result> = setgt sbyte 4, 5 ; yields {bool}:result = false - <result> = setle sbyte 4, 5 ; yields {bool}:result = true - <result> = setge sbyte 4, 5 ; yields {bool}:result = false -
For example, let's consider a C code fragment and how it gets compiled to LLVM:
@@ -2578,7 +2535,7 @@ compiled to LLVM:The index types specified for the 'getelementptr' instruction depend on the pointer type that is being indexed into. Pointer -and array types require uint, int, +and array types require int, ulong, or long values, and structure types require uint constants.
@@ -3083,6 +3040,163 @@ other types, use the inttoptr orThe instructions in this category are the "miscellaneous" instructions, which defy better classification.
+ + + +<result> = icmp <cond> <ty> <var1>, <var2> ; yields {bool}:result ++
The 'icmp' instruction returns a boolean value based on comparison +of its two integer operands.
+The 'icmp' instruction takes three operands. The first operand is +the condition code which indicates the kind of comparison to perform. It is not +a value, just a keyword. The possibilities for the condition code are: +
The remaining two arguments must be of integral, +pointer or a packed integral +type. They must have identical types.
+The 'icmp' compares var1 and var2 according to +the condition code given as cond. The comparison performed always +yields a bool result, as follows: +
If the operands are pointer typed, the pointer +values are treated as integers and then compared.
+If the operands are packed typed, the elements of +the vector are compared in turn and the predicate must hold for all elements. +While this is of dubious use for predicates other than eq and +ne, the other predicates can be used with packed types.
+ +<result> = icmp eq int 4, 5 ; yields: result=false + <result> = icmp ne float* %X, %X ; yields: result=false + <result> = icmp ult short 4, 5 ; yields: result=true + <result> = icmp sgt sbyte 4, 5 ; yields: result=false + <result> = icmp ule sbyte -4, 5 ; yields: result=false + <result> = icmp sge sbyte 4, 5 ; yields: result=false ++
<result> = fcmp <cond> <ty> <var1>, <var2> ; yields {bool}:result ++
The 'fcmp' instruction returns a boolean value based on comparison +of its floating point operands.
+The 'fcmp' instruction takes three operands. The first operand is +the condition code which indicates the kind of comparison to perform. It is not +a value, just a keyword. The possibilities for the condition code are: +
The val1 and val2 arguments must be of +floating point, or a packed +floating point type. They must have identical types.
+The 'fcmp' compares var1 and var2 according to +the condition code given as cond. The comparison performed always +yields a bool result, as follows: +
If the operands are packed typed, the elements of +the vector are compared in turn and the predicate must hold for all elements. +While this is of dubious use for predicates other than eq and +ne, the other predicates can be used with packed types.
+ +<result> = fcmp oeq float 4.0, 5.0 ; yields: result=false + <result> = icmp one float 4.0, 5.0 ; yields: result=true + <result> = icmp olt float 4.0, 5.0 ; yields: result=true + <result> = icmp ueq double 1.0, 2.0 ; yields: result=false ++