gallium: remove TGSI_OPCODE_ABS
[mesa.git] / src / gallium / drivers / ilo / shader / toy_tgsi.c
index 9a7140b9a9bb8d99e309c0cf795cf4ed5b9eb211..a88f189ae88d480a7c66c6026829bc6e5a6c6dd3 100644 (file)
@@ -58,7 +58,6 @@ static const struct {
    [TGSI_OPCODE_EX2]          = { TOY_OPCODE_EXP,                 1, 1 },
    [TGSI_OPCODE_LG2]          = { TOY_OPCODE_LOG,                 1, 1 },
    [TGSI_OPCODE_POW]          = { TOY_OPCODE_POW,                 1, 2 },
-   [TGSI_OPCODE_ABS]          = { GEN6_OPCODE_MOV,                 1, 1 },
    [TGSI_OPCODE_DPH]          = { GEN6_OPCODE_DPH,                 1, 2 },
    [TGSI_OPCODE_COS]          = { TOY_OPCODE_COS,                 1, 1 },
    [TGSI_OPCODE_KILL]         = { TOY_OPCODE_KIL,                 0, 0 },
@@ -148,7 +147,6 @@ aos_simple(struct toy_compiler *tc,
    case TGSI_OPCODE_SUB:
       src[1] = tsrc_negate(src[1]);
       break;
-   case TGSI_OPCODE_ABS:
    case TGSI_OPCODE_IABS:
       src[0] = tsrc_absolute(src[0]);
       break;
@@ -190,7 +188,7 @@ aos_simple(struct toy_compiler *tc,
       inst->dst = dst[0];
    }
 
-   assert(num_src <= Elements(inst->src));
+   assert(num_src <= ARRAY_SIZE(inst->src));
    for (i = 0; i < num_src; i++)
       inst->src[i] = src[i];
 }
@@ -380,7 +378,7 @@ aos_tex(struct toy_compiler *tc,
    inst->opcode = opcode;
    inst->tex.target = tgsi_inst->Texture.Texture;
 
-   assert(tgsi_inst->Instruction.NumSrcRegs <= Elements(inst->src));
+   assert(tgsi_inst->Instruction.NumSrcRegs <= ARRAY_SIZE(inst->src));
    assert(tgsi_inst->Instruction.NumDstRegs == 1);
 
    inst->dst = dst[0];
@@ -449,7 +447,7 @@ aos_sample(struct toy_compiler *tc,
    inst = tc_add(tc);
    inst->opcode = opcode;
 
-   assert(tgsi_inst->Instruction.NumSrcRegs <= Elements(inst->src));
+   assert(tgsi_inst->Instruction.NumSrcRegs <= ARRAY_SIZE(inst->src));
    assert(tgsi_inst->Instruction.NumDstRegs == 1);
 
    inst->dst = dst[0];
@@ -790,7 +788,6 @@ static const toy_tgsi_translate aos_translate_table[TGSI_OPCODE_LAST] = {
    [TGSI_OPCODE_LG2]          = aos_simple,
    [TGSI_OPCODE_POW]          = aos_simple,
    [TGSI_OPCODE_XPD]          = aos_XPD,
-   [TGSI_OPCODE_ABS]          = aos_simple,
    [TGSI_OPCODE_DPH]          = aos_simple,
    [TGSI_OPCODE_COS]          = aos_simple,
    [TGSI_OPCODE_DDX]          = aos_unsupported,
@@ -1333,7 +1330,6 @@ static const toy_tgsi_translate soa_translate_table[TGSI_OPCODE_LAST] = {
    [TGSI_OPCODE_LG2]          = soa_scalar_replicate,
    [TGSI_OPCODE_POW]          = soa_scalar_replicate,
    [TGSI_OPCODE_XPD]          = soa_XPD,
-   [TGSI_OPCODE_ABS]          = soa_per_channel,
    [TGSI_OPCODE_DPH]          = soa_dot_product,
    [TGSI_OPCODE_COS]          = soa_scalar_replicate,
    [TGSI_OPCODE_DDX]          = soa_partial_derivative,
@@ -2118,7 +2114,7 @@ decl_add_in(struct toy_tgsi *tgsi, const struct tgsi_full_declaration *decl)
       (decl->Declaration.Interpolate) ? &decl->Interp: &default_interp;
    int index;
 
-   if (decl->Range.Last >= Elements(tgsi->inputs)) {
+   if (decl->Range.Last >= ARRAY_SIZE(tgsi->inputs)) {
       assert(!"invalid IN");
       return;
    }
@@ -2146,7 +2142,7 @@ decl_add_out(struct toy_tgsi *tgsi, const struct tgsi_full_declaration *decl)
 {
    int index;
 
-   if (decl->Range.Last >= Elements(tgsi->outputs)) {
+   if (decl->Range.Last >= ARRAY_SIZE(tgsi->outputs)) {
       assert(!"invalid OUT");
       return;
    }
@@ -2169,7 +2165,7 @@ decl_add_sv(struct toy_tgsi *tgsi, const struct tgsi_full_declaration *decl)
 {
    int index;
 
-   if (decl->Range.Last >= Elements(tgsi->system_values)) {
+   if (decl->Range.Last >= ARRAY_SIZE(tgsi->system_values)) {
       assert(!"invalid SV");
       return;
    }