Added initial intvec/floatvec operator

This commit is contained in:
Christoffer Lerno
2022-09-11 02:28:12 +02:00
committed by Christoffer Lerno
parent 3d110850df
commit 3a09f71830
15 changed files with 265 additions and 71 deletions

View File

@@ -3,7 +3,7 @@ module std::bits;
/**
* @require types::is_intlike($typeof(i)) `The input must be an integer or integer vector`
**/
macro popcount(i)
macro popcount(i) @operator(intvec)
{
return $$popcount(i);
}
@@ -27,7 +27,7 @@ macro bswap(i) @builtin
/**
* @require types::is_intlike($typeof(i)) `The input must be an integer or integer vector`
**/
macro ctz(i) @builtin
macro ctz(i) @operator(intvec) @builtin
{
return $$ctz(i);
}
@@ -35,15 +35,14 @@ macro ctz(i) @builtin
/**
* @require types::is_intlike($typeof(i)) `The input must be an integer or integer vector`
**/
macro clz(i) @builtin
macro clz(i) @operator(intvec) @builtin
{
return $$clz(i);
}
/**
* @require types::is_intlike($typeof(hi)) && types::is_intlike($typeof(lo)) && types::is_intlike($typeof(shift)) `The input must be an integer or integer vector`
* @require types::is_same_type(hi, lo) `Hi and low arguments must have the same type`
* @require types::is_same_type(hi, shift) `The shift value must have the same type as shifted types`
* @require types::@has_same(hi, lo, shift) `Hi, low and shift arguments must have the same type`
**/
macro fshl(hi, lo, shift) @builtin
{
@@ -52,8 +51,7 @@ macro fshl(hi, lo, shift) @builtin
/**
* @require types::is_intlike($typeof(hi)) && types::is_intlike($typeof(lo)) && types::is_intlike($typeof(shift)) `The input must be an integer or integer vector`
* @require types::is_same_type(hi, lo) `Hi and low arguments must have the same type`
* @require types::is_same_type(hi, shift) `The shift value must have the same type as shifted types`
* @require types::@has_same(hi, lo, shift) `Hi, low and shift arguments must have the same type`
**/
macro fshr(hi, lo, shift) @builtin
{
@@ -62,18 +60,18 @@ macro fshr(hi, lo, shift) @builtin
/**
* @require types::is_intlike($typeof(i)) && types::is_intlike($typeof(shift)) `The input must be an integer or integer vector`
* @require types::is_same_type(i, shift) `The shift value must have the same type as shifted types`
* @require types::@has_same(i, shift) `The shift value must have the same type as shifted types`
**/
macro rotl(i, shift) @builtin
macro rotl(i, shift) @operator(intvec) @builtin
{
return $$fshl(i, i, shift);
}
/**
* @require types::is_intlike($typeof(i)) && types::is_intlike($typeof(shift)) `The input must be an integer or integer vector`
* @require types::is_same_type(i, shift) `The shift value must have the same type as shifted types`
* @require types::@has_same(i, shift) `The shift value must have the same type as shifted types`
**/
macro rotr(i, shift) @builtin
macro rotr(i, shift) @operator(intvec) @builtin
{
return $$fshr(i, i, shift);
}