xo-expression: less-than-or-equal
This commit is contained in:
parent
80dd38feb7
commit
46777633bc
4 changed files with 32 additions and 0 deletions
|
|
@ -37,6 +37,9 @@ namespace xo {
|
|||
/** create apply-expression for less-than comparison of two 64-bit integers **/
|
||||
static rp<Apply> make_cmp_lt_i64(const rp<Expression> & lhs,
|
||||
const rp<Expression> & rhs);
|
||||
/** create apply-expression for less-than-or-equal comparison of two 64-bit integers **/
|
||||
static rp<Apply> make_cmp_le_i64(const rp<Expression> & lhs,
|
||||
const rp<Expression> & rhs);
|
||||
/** create apply-expression for greater-than comparison of two 64-bit integers **/
|
||||
static rp<Apply> make_cmp_gt_i64(const rp<Expression> & lhs,
|
||||
const rp<Expression> & rhs);
|
||||
|
|
|
|||
|
|
@ -206,6 +206,8 @@ namespace xo {
|
|||
static rp<PrimitiveType> make_cmp_ne2_i64();
|
||||
/** lt2_i64: compare two 64-bit integers for lessthan **/
|
||||
static rp<PrimitiveType> make_cmp_lt2_i64();
|
||||
/** lt2_i64: compare two 64-bit integers for lessthanorequal **/
|
||||
static rp<PrimitiveType> make_cmp_le2_i64();
|
||||
/** gt2_i64: compare two 64-bit integers for greaterthan **/
|
||||
static rp<PrimitiveType> make_cmp_gt2_i64();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -56,6 +56,14 @@ namespace xo {
|
|||
{lhs, rhs});
|
||||
}
|
||||
|
||||
rp<Apply>
|
||||
Apply::make_cmp_le_i64(const rp<Expression> & lhs,
|
||||
const rp<Expression> & rhs)
|
||||
{
|
||||
return Apply::make(Primitive_cmp_i64::make_cmp_le2_i64(),
|
||||
{lhs, rhs});
|
||||
}
|
||||
|
||||
rp<Apply>
|
||||
Apply::make_cmp_gt_i64(const rp<Expression> & lhs,
|
||||
const rp<Expression> & rhs)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,11 @@ extern "C" {
|
|||
return x < y;
|
||||
}
|
||||
|
||||
bool
|
||||
cmp_le2_i64(std::int64_t x, std::int64_t y) {
|
||||
return x <= y;
|
||||
}
|
||||
|
||||
bool
|
||||
cmp_gt2_i64(std::int64_t x, std::int64_t y) {
|
||||
return x > y;
|
||||
|
|
@ -117,6 +122,20 @@ namespace xo {
|
|||
return s_retval;
|
||||
}
|
||||
|
||||
auto
|
||||
Primitive_cmp_i64::make_cmp_le2_i64() -> rp<PrimitiveType>
|
||||
{
|
||||
static rp<PrimitiveType> s_retval;
|
||||
|
||||
if (!s_retval)
|
||||
s_retval = Primitive::make("cmp_le2_i64",
|
||||
&cmp_le2_i64,
|
||||
true /*explicit_symbol_def*/,
|
||||
llvmintrinsic::i_sle);
|
||||
|
||||
return s_retval;
|
||||
}
|
||||
|
||||
auto
|
||||
Primitive_cmp_i64::make_cmp_gt2_i64() -> rp<PrimitiveType>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue