Commit 67423298 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig

Import midgard integer code

parent 053e8a93
......@@ -85,15 +85,26 @@ static char* alu_opcode_names[256] = {
[midgard_alu_op_fdot3r] = "fdot3r",
[midgard_alu_op_fdot4] = "fdot4",
[midgard_alu_op_freduce] = "freduce",
[midgard_alu_op_imin] = "imin",
[midgard_alu_op_imax] = "imax",
[midgard_alu_op_ishl] = "ishl",
[midgard_alu_op_iasr] = "iasr",
[midgard_alu_op_ilsr] = "ilsr",
[midgard_alu_op_iadd] = "iadd",
[midgard_alu_op_ishladd] = "ishladd",
[midgard_alu_op_isub] = "isub",
[midgard_alu_op_imul] = "imul",
[midgard_alu_op_imov] = "imov",
[midgard_alu_op_iand] = "iand",
[midgard_alu_op_ior] = "ior",
[midgard_alu_op_inot] = "inot",
[midgard_alu_op_ixor] = "ixor",
[midgard_alu_op_feq] = "feq",
[midgard_alu_op_fne] = "fne",
[midgard_alu_op_flt] = "flt",
[midgard_alu_op_fle] = "fle",
[midgard_alu_op_f2i] = "f2i",
[midgard_alu_op_f2u] = "f2u",
[midgard_alu_op_ieq] = "ieq",
[midgard_alu_op_ine] = "ine",
[midgard_alu_op_ilt] = "ilt",
......@@ -101,7 +112,9 @@ static char* alu_opcode_names[256] = {
[midgard_alu_op_ball] = "ball",
[midgard_alu_op_bany] = "bany",
[midgard_alu_op_i2f] = "i2f",
[midgard_alu_op_csel] = "csel",
[midgard_alu_op_u2f] = "u2f",
[midgard_alu_op_icsel] = "icsel",
[midgard_alu_op_fcsel] = "fcsel",
[midgard_alu_op_fatan_pt2] = "fatan_pt2",
[midgard_alu_op_frcp] = "frcp",
[midgard_alu_op_frsqrt] = "frsqrt",
......@@ -273,6 +286,14 @@ static uint16_t decode_vector_imm(unsigned src2_reg, unsigned imm)
return ret;
}
static uint16_t print_immediate(uint16_t imm)
{
if (is_instruction_int)
printf("#%d", imm);
else
printf("#%g", ogt_hfloat_to_float((ogt_hfloat_t)imm));
}
static void print_vector_field(const char *name, uint16_t* words, uint16_t reg_word,
unsigned tabs)
{
......@@ -305,7 +326,10 @@ static void print_vector_field(const char *name, uint16_t* words, uint16_t reg_w
if (alu_field->mask & 0xF)
{
out_high = false;
assert(!(alu_field->mask & 0xF0));
if ((alu_field->mask & 0xF0))
printf("/* %X */ ", alu_field->mask);
mask = alu_field->mask;
}
else
......@@ -326,7 +350,9 @@ static void print_vector_field(const char *name, uint16_t* words, uint16_t reg_w
if (alu_field->dest_override != midgard_dest_override_none)
{
assert(!out_half);
if (out_half)
printf("/* half */ ");
out_half = true;
if (alu_field->dest_override == midgard_dest_override_lower)
out_high = false;
......@@ -365,9 +391,8 @@ static void print_vector_field(const char *name, uint16_t* words, uint16_t reg_w
if (reg_info->src2_imm)
{
uint16_t imm = decode_vector_imm(reg_info->src2_reg,
alu_field->src2 >> 2);
printf("#%g", ogt_hfloat_to_float((ogt_hfloat_t)imm));
uint16_t imm = decode_vector_imm(reg_info->src2_reg, alu_field->src2 >> 2);
print_immediate(imm);
}
else
{
......@@ -448,7 +473,7 @@ static void print_scalar_field(const char *name, uint16_t* words, uint16_t reg_w
{
uint16_t imm = decode_scalar_imm(reg_info->src2_reg,
alu_field->src2);
printf("#%g", ogt_hfloat_to_float((ogt_hfloat_t)imm));
print_immediate(imm);
}
else
print_scalar_src(alu_field->src2, reg_info->src2_reg);
......
......@@ -65,14 +65,25 @@ typedef enum
midgard_alu_op_fdot4 = 0x3E,
midgard_alu_op_freduce = 0x3F,
midgard_alu_op_iadd = 0x40,
midgard_alu_op_ishladd = 0x41,
midgard_alu_op_isub = 0x46,
midgard_alu_op_imul = 0x58,
midgard_alu_op_imin = 0x60,
midgard_alu_op_imax = 0x62,
midgard_alu_op_iasr = 0x68,
midgard_alu_op_ilsr = 0x69,
midgard_alu_op_ishl = 0x6E,
midgard_alu_op_iand = 0x70,
midgard_alu_op_ior = 0x71,
midgard_alu_op_inot = 0x72,
midgard_alu_op_ixor = 0x76,
midgard_alu_op_imov = 0x7B,
midgard_alu_op_feq = 0x80,
midgard_alu_op_fne = 0x81,
midgard_alu_op_flt = 0x82,
midgard_alu_op_fle = 0x83,
midgard_alu_op_f2i = 0x99,
midgard_alu_op_f2u = 0x9D,
midgard_alu_op_ieq = 0xA0,
midgard_alu_op_ine = 0xA1,
midgard_alu_op_ilt = 0xA4,
......@@ -80,7 +91,9 @@ typedef enum
midgard_alu_op_ball = 0xA9,
midgard_alu_op_bany = 0xB1,
midgard_alu_op_i2f = 0xB8,
midgard_alu_op_csel = 0xC5,
midgard_alu_op_u2f = 0xBC,
midgard_alu_op_icsel = 0xC1,
midgard_alu_op_fcsel = 0xC5,
midgard_alu_op_fatan_pt2 = 0xE8,
midgard_alu_op_frcp = 0xF0,
midgard_alu_op_frsqrt = 0xF2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment