Add the vec4 %subi instruction
This commit is contained in:
parent
03198356a5
commit
409f8c5823
|
|
@ -138,6 +138,9 @@ static void draw_binary_vec4_arith(ivl_expr_t expr)
|
|||
case '+':
|
||||
draw_immediate_vec4(re, "%addi");
|
||||
return;
|
||||
case '-':
|
||||
draw_immediate_vec4(re, "%subi");
|
||||
return;
|
||||
case '*':
|
||||
draw_immediate_vec4(re, "%muli");
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ extern bool of_STORE_STRA(vthread_t thr, vvp_code_t code);
|
|||
extern bool of_STORE_VEC4(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_STORE_VEC4A(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SUB(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SUBI(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SUB_WR(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SUBSTR(vthread_t thr, vvp_code_t code);
|
||||
extern bool of_SUBSTR_VEC4(vthread_t thr, vvp_code_t code);
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ static const struct opcode_table_s opcode_table[] = {
|
|||
{ "%store/vec4a", of_STORE_VEC4A, 3, {OA_ARR_PTR, OA_BIT1, OA_BIT2} },
|
||||
{ "%sub", of_SUB, 0, {OA_NONE, OA_NONE, OA_NONE} },
|
||||
{ "%sub/wr", of_SUB_WR, 0, {OA_NONE, OA_NONE, OA_NONE} },
|
||||
{ "%subi", of_SUBI, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
|
||||
{ "%substr", of_SUBSTR, 2,{OA_BIT1, OA_BIT2, OA_NONE} },
|
||||
{ "%substr/vec4",of_SUBSTR_VEC4,2,{OA_BIT1, OA_BIT2, OA_NONE} },
|
||||
{ "%test_nul", of_TEST_NUL, 1,{OA_FUNC_PTR,OA_NONE, OA_NONE} },
|
||||
|
|
|
|||
|
|
@ -5464,6 +5464,30 @@ bool of_SUB(vthread_t thr, vvp_code_t)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* %subi <vala>, <valb>, <wid>
|
||||
*
|
||||
* Pop1 operand, get the other operand from the arguments, and push
|
||||
* the result.
|
||||
*/
|
||||
bool of_SUBI(vthread_t thr, vvp_code_t cp)
|
||||
{
|
||||
unsigned wid = cp->number;
|
||||
|
||||
vvp_vector4_t&l = thr->peek_vec4();
|
||||
|
||||
// I expect that most of the bits of an immediate value are
|
||||
// going to be zero, so start the result vector with all zero
|
||||
// bits. Then we only need to replace the bits that are different.
|
||||
vvp_vector4_t r (wid, BIT4_0);
|
||||
get_immediate_rval (cp, r);
|
||||
|
||||
l.sub(r);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool of_SUB_WR(vthread_t thr, vvp_code_t)
|
||||
{
|
||||
double r = thr->pop_real();
|
||||
|
|
|
|||
Loading…
Reference in New Issue