mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[gamecode] Add tests for signed comparison ops
Fortunately, they all pass without issues.
This commit is contained in:
parent
0fb6619585
commit
e7d7ec1989
4 changed files with 558 additions and 0 deletions
|
@ -132,6 +132,102 @@ static dstatement_t double_cossin_statements[] = {
|
|||
{ OP(0, 0, 0, OP_IFNZ_A), -7, 0, 46 }, // f0 < fmax
|
||||
};
|
||||
|
||||
static pr_dvec4_t double_cmpop_init[] = {
|
||||
{ 5, -5, 5, -5},
|
||||
{ 5, 5, -5, -5},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
// 5.0 as 64-bit int
|
||||
#define F 0x4014000000000000l
|
||||
#define mF 0xc014000000000000l
|
||||
static pr_lvec4_t double_cmpop_expect[] = {
|
||||
{ F, mF, F, mF},
|
||||
{ F, F, mF, mF},
|
||||
{ -1, 0, 0, -1},
|
||||
{ 0, -1, 0, 0},
|
||||
{ 0, 0, -1, 0},
|
||||
{ 0, -1, -1, 0},
|
||||
{ -1, 0, -1, -1},
|
||||
{ -1, -1, 0, -1},
|
||||
};
|
||||
|
||||
static dstatement_t double_cmpop_1_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -2, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_D_1), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_LT_D_1), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_GT_D_1), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_NE_D_1), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_GE_D_1), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_LE_D_1), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t double_cmpop_2_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -4, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_D_2), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_LT_D_2), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_GT_D_2), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_NE_D_2), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_GE_D_2), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_LE_D_2), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t double_cmpop_3a_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_D_3), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_EQ_D_1), 6, 14, 22 },
|
||||
{ OP(1, 1, 1, OP_LT_D_3), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_LT_D_1), 6, 14, 30 },
|
||||
{ OP(1, 1, 1, OP_GT_D_3), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_GT_D_1), 6, 14, 38 },
|
||||
{ OP(1, 1, 1, OP_NE_D_3), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_NE_D_1), 6, 14, 46 },
|
||||
{ OP(1, 1, 1, OP_GE_D_3), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_GE_D_1), 6, 14, 54 },
|
||||
{ OP(1, 1, 1, OP_LE_D_3), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_LE_D_1), 6, 14, 62 },
|
||||
};
|
||||
|
||||
static dstatement_t double_cmpop_3b_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_D_1), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_EQ_D_3), 2, 10, 18 },
|
||||
{ OP(1, 1, 1, OP_LT_D_1), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_LT_D_3), 2, 10, 26 },
|
||||
{ OP(1, 1, 1, OP_GT_D_1), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_GT_D_3), 2, 10, 34 },
|
||||
{ OP(1, 1, 1, OP_NE_D_1), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_NE_D_3), 2, 10, 42 },
|
||||
{ OP(1, 1, 1, OP_GE_D_1), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_GE_D_3), 2, 10, 50 },
|
||||
{ OP(1, 1, 1, OP_LE_D_1), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_LE_D_3), 2, 10, 58 },
|
||||
};
|
||||
|
||||
static dstatement_t double_cmpop_4_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_D_4), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_LT_D_4), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_GT_D_4), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_NE_D_4), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_GE_D_4), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_LE_D_4), 0, 8, 56 },
|
||||
};
|
||||
|
||||
test_t tests[] = {
|
||||
{
|
||||
.desc = "double binop 1",
|
||||
|
@ -187,6 +283,51 @@ test_t tests[] = {
|
|||
.init_globals = (pr_int_t *) double_cossin_init,
|
||||
.expect_globals = (pr_int_t *) double_cossin_expect,
|
||||
},
|
||||
{
|
||||
.desc = "double cmpop 1",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(double_cmpop_init,double_cmpop_expect),
|
||||
.num_statements = num_statements (double_cmpop_1_statements),
|
||||
.statements = double_cmpop_1_statements,
|
||||
.init_globals = (pr_int_t *) double_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) double_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "double cmpop 2",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(double_cmpop_init,double_cmpop_expect),
|
||||
.num_statements = num_statements (double_cmpop_2_statements),
|
||||
.statements = double_cmpop_2_statements,
|
||||
.init_globals = (pr_int_t *) double_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) double_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "double cmpop 3a",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(double_cmpop_init,double_cmpop_expect),
|
||||
.num_statements = num_statements (double_cmpop_3a_statements),
|
||||
.statements = double_cmpop_3a_statements,
|
||||
.init_globals = (pr_int_t *) double_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) double_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "double cmpop 3b",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(double_cmpop_init,double_cmpop_expect),
|
||||
.num_statements = num_statements (double_cmpop_3b_statements),
|
||||
.statements = double_cmpop_3b_statements,
|
||||
.init_globals = (pr_int_t *) double_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) double_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "double cmpop 4",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(double_cmpop_init,double_cmpop_expect),
|
||||
.num_statements = num_statements (double_cmpop_4_statements),
|
||||
.statements = double_cmpop_4_statements,
|
||||
.init_globals = (pr_int_t *) double_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) double_cmpop_expect,
|
||||
},
|
||||
};
|
||||
|
||||
#include "main.c"
|
||||
|
|
|
@ -132,6 +132,102 @@ static dstatement_t float_cossin_statements[] = {
|
|||
{ OP(0, 0, 0, OP_IFNZ_A), -7, 0, 23 }, // f0 < fmax
|
||||
};
|
||||
|
||||
static pr_vec4_t float_cmpop_init[] = {
|
||||
{ 5, -5, 5, -5},
|
||||
{ 5, 5, -5, -5},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
// 5.0 as 32-bit int
|
||||
#define F 0x40a00000
|
||||
#define mF 0xc0a00000
|
||||
static pr_ivec4_t float_cmpop_expect[] = {
|
||||
{ F, mF, F, mF},
|
||||
{ F, F, mF, mF},
|
||||
{ -1, 0, 0, -1},
|
||||
{ 0, -1, 0, 0},
|
||||
{ 0, 0, -1, 0},
|
||||
{ 0, -1, -1, 0},
|
||||
{ -1, 0, -1, -1},
|
||||
{ -1, -1, 0, -1},
|
||||
};
|
||||
|
||||
static dstatement_t float_cmpop_1_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -1, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_F_1), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_LT_F_1), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_GT_F_1), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_NE_F_1), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_GE_F_1), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_LE_F_1), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t float_cmpop_2_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -2, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_F_2), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_LT_F_2), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_GT_F_2), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_NE_F_2), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_GE_F_2), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_LE_F_2), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t float_cmpop_3a_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_F_3), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_EQ_F_1), 3, 7, 11 },
|
||||
{ OP(1, 1, 1, OP_LT_F_3), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_LT_F_1), 3, 7, 15 },
|
||||
{ OP(1, 1, 1, OP_GT_F_3), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_GT_F_1), 3, 7, 19 },
|
||||
{ OP(1, 1, 1, OP_NE_F_3), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_NE_F_1), 3, 7, 23 },
|
||||
{ OP(1, 1, 1, OP_GE_F_3), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_GE_F_1), 3, 7, 27 },
|
||||
{ OP(1, 1, 1, OP_LE_F_3), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_LE_F_1), 3, 7, 31 },
|
||||
};
|
||||
|
||||
static dstatement_t float_cmpop_3b_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_F_1), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_EQ_F_3), 1, 5, 9 },
|
||||
{ OP(1, 1, 1, OP_LT_F_1), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_LT_F_3), 1, 5, 13 },
|
||||
{ OP(1, 1, 1, OP_GT_F_1), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_GT_F_3), 1, 5, 17 },
|
||||
{ OP(1, 1, 1, OP_NE_F_1), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_NE_F_3), 1, 5, 21 },
|
||||
{ OP(1, 1, 1, OP_GE_F_1), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_GE_F_3), 1, 5, 25 },
|
||||
{ OP(1, 1, 1, OP_LE_F_1), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_LE_F_3), 1, 5, 29 },
|
||||
};
|
||||
|
||||
static dstatement_t float_cmpop_4_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_F_4), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_LT_F_4), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_GT_F_4), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_NE_F_4), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_GE_F_4), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_LE_F_4), 0, 4, 28 },
|
||||
};
|
||||
|
||||
test_t tests[] = {
|
||||
{
|
||||
.desc = "float binop 1",
|
||||
|
@ -187,6 +283,51 @@ test_t tests[] = {
|
|||
.init_globals = (pr_int_t *) float_cossin_init,
|
||||
.expect_globals = (pr_int_t *) float_cossin_expect,
|
||||
},
|
||||
{
|
||||
.desc = "float cmpop 1",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(float_cmpop_init,float_cmpop_expect),
|
||||
.num_statements = num_statements (float_cmpop_1_statements),
|
||||
.statements = float_cmpop_1_statements,
|
||||
.init_globals = (pr_int_t *) float_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) float_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "float cmpop 2",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(float_cmpop_init,float_cmpop_expect),
|
||||
.num_statements = num_statements (float_cmpop_2_statements),
|
||||
.statements = float_cmpop_2_statements,
|
||||
.init_globals = (pr_int_t *) float_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) float_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "float cmpop 3a",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(float_cmpop_init,float_cmpop_expect),
|
||||
.num_statements = num_statements (float_cmpop_3a_statements),
|
||||
.statements = float_cmpop_3a_statements,
|
||||
.init_globals = (pr_int_t *) float_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) float_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "float cmpop 3b",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(float_cmpop_init,float_cmpop_expect),
|
||||
.num_statements = num_statements (float_cmpop_3b_statements),
|
||||
.statements = float_cmpop_3b_statements,
|
||||
.init_globals = (pr_int_t *) float_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) float_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "float cmpop 4",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(float_cmpop_init,float_cmpop_expect),
|
||||
.num_statements = num_statements (float_cmpop_4_statements),
|
||||
.statements = float_cmpop_4_statements,
|
||||
.init_globals = (pr_int_t *) float_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) float_cmpop_expect,
|
||||
},
|
||||
};
|
||||
|
||||
#include "main.c"
|
||||
|
|
|
@ -95,6 +95,99 @@ static dstatement_t int_binop_4_statements[] = {
|
|||
{ OP(1, 1, 1, OP_SUB_I_4), 0, 4, 28 },
|
||||
};
|
||||
|
||||
static pr_ivec4_t int_cmpop_init[] = {
|
||||
{ 5, -5, 5, -5},
|
||||
{ 5, 5, -5, -5},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static pr_ivec4_t int_cmpop_expect[] = {
|
||||
{ 5, -5, 5, -5},
|
||||
{ 5, 5, -5, -5},
|
||||
{ -1, 0, 0, -1},
|
||||
{ 0, -1, 0, 0},
|
||||
{ 0, 0, -1, 0},
|
||||
{ 0, -1, -1, 0},
|
||||
{ -1, 0, -1, -1},
|
||||
{ -1, -1, 0, -1},
|
||||
};
|
||||
|
||||
static dstatement_t int_cmpop_1_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -1, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_I_1), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_LT_I_1), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_GT_I_1), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_NE_I_1), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_GE_I_1), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_LE_I_1), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t int_cmpop_2_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 4, 0, 32 }, // index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 32, -2, 32 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 32 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 32, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_I_2), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_LT_I_2), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_GT_I_2), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_NE_I_2), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_GE_I_2), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_LE_I_2), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t int_cmpop_3a_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_I_3), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_EQ_I_1), 3, 7, 11 },
|
||||
{ OP(1, 1, 1, OP_LT_I_3), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_LT_I_1), 3, 7, 15 },
|
||||
{ OP(1, 1, 1, OP_GT_I_3), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_GT_I_1), 3, 7, 19 },
|
||||
{ OP(1, 1, 1, OP_NE_I_3), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_NE_I_1), 3, 7, 23 },
|
||||
{ OP(1, 1, 1, OP_GE_I_3), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_GE_I_1), 3, 7, 27 },
|
||||
{ OP(1, 1, 1, OP_LE_I_3), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_LE_I_1), 3, 7, 31 },
|
||||
};
|
||||
|
||||
static dstatement_t int_cmpop_3b_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_I_1), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_EQ_I_3), 1, 5, 9 },
|
||||
{ OP(1, 1, 1, OP_LT_I_1), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_LT_I_3), 1, 5, 13 },
|
||||
{ OP(1, 1, 1, OP_GT_I_1), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_GT_I_3), 1, 5, 17 },
|
||||
{ OP(1, 1, 1, OP_NE_I_1), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_NE_I_3), 1, 5, 21 },
|
||||
{ OP(1, 1, 1, OP_GE_I_1), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_GE_I_3), 1, 5, 25 },
|
||||
{ OP(1, 1, 1, OP_LE_I_1), 0, 4, 28 },
|
||||
{ OP(1, 1, 1, OP_LE_I_3), 1, 5, 29 },
|
||||
};
|
||||
|
||||
static dstatement_t int_cmpop_4_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_I_4), 0, 4, 8 },
|
||||
{ OP(1, 1, 1, OP_LT_I_4), 0, 4, 12 },
|
||||
{ OP(1, 1, 1, OP_GT_I_4), 0, 4, 16 },
|
||||
{ OP(1, 1, 1, OP_NE_I_4), 0, 4, 20 },
|
||||
{ OP(1, 1, 1, OP_GE_I_4), 0, 4, 24 },
|
||||
{ OP(1, 1, 1, OP_LE_I_4), 0, 4, 28 },
|
||||
};
|
||||
|
||||
test_t tests[] = {
|
||||
{
|
||||
.desc = "int binop 1",
|
||||
|
@ -141,6 +234,51 @@ test_t tests[] = {
|
|||
.init_globals = (pr_int_t *) int_binop_init,
|
||||
.expect_globals = (pr_int_t *) int_binop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "int cmpop 1",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(int_cmpop_init,int_cmpop_expect),
|
||||
.num_statements = num_statements (int_cmpop_1_statements),
|
||||
.statements = int_cmpop_1_statements,
|
||||
.init_globals = (pr_int_t *) int_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) int_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "int cmpop 2",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(int_cmpop_init,int_cmpop_expect),
|
||||
.num_statements = num_statements (int_cmpop_2_statements),
|
||||
.statements = int_cmpop_2_statements,
|
||||
.init_globals = (pr_int_t *) int_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) int_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "int cmpop 3a",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(int_cmpop_init,int_cmpop_expect),
|
||||
.num_statements = num_statements (int_cmpop_3a_statements),
|
||||
.statements = int_cmpop_3a_statements,
|
||||
.init_globals = (pr_int_t *) int_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) int_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "int cmpop 3b",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(int_cmpop_init,int_cmpop_expect),
|
||||
.num_statements = num_statements (int_cmpop_3b_statements),
|
||||
.statements = int_cmpop_3b_statements,
|
||||
.init_globals = (pr_int_t *) int_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) int_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "int cmpop 4",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(int_cmpop_init,int_cmpop_expect),
|
||||
.num_statements = num_statements (int_cmpop_4_statements),
|
||||
.statements = int_cmpop_4_statements,
|
||||
.init_globals = (pr_int_t *) int_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) int_cmpop_expect,
|
||||
},
|
||||
};
|
||||
|
||||
#include "main.c"
|
||||
|
|
|
@ -97,6 +97,99 @@ static dstatement_t long_binop_4_statements[] = {
|
|||
{ OP(1, 1, 1, OP_SUB_L_4), 0, 8, 56 },
|
||||
};
|
||||
|
||||
static pr_lvec4_t long_cmpop_init[] = {
|
||||
{ 5, -5, 5, -5},
|
||||
{ 5, 5, -5, -5},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static pr_lvec4_t long_cmpop_expect[] = {
|
||||
{ 5, -5, 5, -5},
|
||||
{ 5, 5, -5, -5},
|
||||
{ -1, 0, 0, -1},
|
||||
{ 0, -1, 0, 0},
|
||||
{ 0, 0, -1, 0},
|
||||
{ 0, -1, -1, 0},
|
||||
{ -1, 0, -1, -1},
|
||||
{ -1, -1, 0, -1},
|
||||
};
|
||||
|
||||
static dstatement_t long_cmpop_1_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -2, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_L_1), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_LT_L_1), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_GT_L_1), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_NE_L_1), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_GE_L_1), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_LE_L_1), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t long_cmpop_2_statements[] = {
|
||||
{ OP(0, 0, 0, OP_LEA_A), 8, 0, 64 }, // init index
|
||||
//loop:
|
||||
{ OP(0, 0, 0, OP_LEA_C), 64, -4, 64 }, // dec index
|
||||
{ OP(0, 0, 0, OP_IFAE_A), 2, 0, 64 },
|
||||
{ OP(0, 0, 0, OP_BREAK), 0, 0, 0 },
|
||||
{ OP(0, 0, 0, OP_WITH), 4, 64, 1 },
|
||||
{ OP(1, 1, 1, OP_EQ_L_2), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_LT_L_2), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_GT_L_2), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_NE_L_2), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_GE_L_2), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_LE_L_2), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_JUMP_A), -10, 0, 0 },
|
||||
};
|
||||
|
||||
static dstatement_t long_cmpop_3a_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_L_3), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_EQ_L_1), 6, 14, 22 },
|
||||
{ OP(1, 1, 1, OP_LT_L_3), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_LT_L_1), 6, 14, 30 },
|
||||
{ OP(1, 1, 1, OP_GT_L_3), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_GT_L_1), 6, 14, 38 },
|
||||
{ OP(1, 1, 1, OP_NE_L_3), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_NE_L_1), 6, 14, 46 },
|
||||
{ OP(1, 1, 1, OP_GE_L_3), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_GE_L_1), 6, 14, 54 },
|
||||
{ OP(1, 1, 1, OP_LE_L_3), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_LE_L_1), 6, 14, 62 },
|
||||
};
|
||||
|
||||
static dstatement_t long_cmpop_3b_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_L_1), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_EQ_L_3), 2, 10, 18 },
|
||||
{ OP(1, 1, 1, OP_LT_L_1), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_LT_L_3), 2, 10, 26 },
|
||||
{ OP(1, 1, 1, OP_GT_L_1), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_GT_L_3), 2, 10, 34 },
|
||||
{ OP(1, 1, 1, OP_NE_L_1), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_NE_L_3), 2, 10, 42 },
|
||||
{ OP(1, 1, 1, OP_GE_L_1), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_GE_L_3), 2, 10, 50 },
|
||||
{ OP(1, 1, 1, OP_LE_L_1), 0, 8, 56 },
|
||||
{ OP(1, 1, 1, OP_LE_L_3), 2, 10, 58 },
|
||||
};
|
||||
|
||||
static dstatement_t long_cmpop_4_statements[] = {
|
||||
{ OP(1, 1, 1, OP_EQ_L_4), 0, 8, 16 },
|
||||
{ OP(1, 1, 1, OP_LT_L_4), 0, 8, 24 },
|
||||
{ OP(1, 1, 1, OP_GT_L_4), 0, 8, 32 },
|
||||
{ OP(1, 1, 1, OP_NE_L_4), 0, 8, 40 },
|
||||
{ OP(1, 1, 1, OP_GE_L_4), 0, 8, 48 },
|
||||
{ OP(1, 1, 1, OP_LE_L_4), 0, 8, 56 },
|
||||
};
|
||||
|
||||
test_t tests[] = {
|
||||
{
|
||||
.desc = "long binop 1",
|
||||
|
@ -143,6 +236,51 @@ test_t tests[] = {
|
|||
.init_globals = (pr_int_t *) long_binop_init,
|
||||
.expect_globals = (pr_int_t *) long_binop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "long cmpop 1",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(long_cmpop_init,long_cmpop_expect),
|
||||
.num_statements = num_statements (long_cmpop_1_statements),
|
||||
.statements = long_cmpop_1_statements,
|
||||
.init_globals = (pr_int_t *) long_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) long_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "long cmpop 2",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(long_cmpop_init,long_cmpop_expect),
|
||||
.num_statements = num_statements (long_cmpop_2_statements),
|
||||
.statements = long_cmpop_2_statements,
|
||||
.init_globals = (pr_int_t *) long_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) long_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "long cmpop 3a",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(long_cmpop_init,long_cmpop_expect),
|
||||
.num_statements = num_statements (long_cmpop_3a_statements),
|
||||
.statements = long_cmpop_3a_statements,
|
||||
.init_globals = (pr_int_t *) long_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) long_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "long cmpop 3b",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(long_cmpop_init,long_cmpop_expect),
|
||||
.num_statements = num_statements (long_cmpop_3b_statements),
|
||||
.statements = long_cmpop_3b_statements,
|
||||
.init_globals = (pr_int_t *) long_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) long_cmpop_expect,
|
||||
},
|
||||
{
|
||||
.desc = "long cmpop 4",
|
||||
.extra_globals = 4 * 1,
|
||||
.num_globals = 4*num_globals(long_cmpop_init,long_cmpop_expect),
|
||||
.num_statements = num_statements (long_cmpop_4_statements),
|
||||
.statements = long_cmpop_4_statements,
|
||||
.init_globals = (pr_int_t *) long_cmpop_init,
|
||||
.expect_globals = (pr_int_t *) long_cmpop_expect,
|
||||
},
|
||||
};
|
||||
|
||||
#include "main.c"
|
||||
|
|
Loading…
Reference in a new issue