diff options
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r600/r600_isa.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_bc.h | 34 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_expr.cpp | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_if_conversion.cpp | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_ir.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_peephole.cpp | 4 |
6 files changed, 45 insertions, 10 deletions
diff --git a/src/gallium/drivers/r600/r600_isa.h b/src/gallium/drivers/r600/r600_isa.h index fcaf1f766b3..73694f7b434 100644 --- a/src/gallium/drivers/r600/r600_isa.h +++ b/src/gallium/drivers/r600/r600_isa.h @@ -36,6 +36,7 @@ extern "C" { /* ALU flags */ enum alu_op_flags { + AF_NONE = 0, AF_V = (1<<0), /* allowed in vector slots */ /* allowed in scalar(trans) slot (slots xyz on cayman, may be replicated diff --git a/src/gallium/drivers/r600/sb/sb_bc.h b/src/gallium/drivers/r600/sb/sb_bc.h index e7231702d80..942e228d95c 100644 --- a/src/gallium/drivers/r600/sb/sb_bc.h +++ b/src/gallium/drivers/r600/sb/sb_bc.h @@ -495,6 +495,15 @@ struct bc_alu_src { unsigned abs:1; unsigned rel:1; literal value; + + void clear() { + sel = 0; + chan = 0; + neg = 0; + abs = 0; + rel = 0; + value = 0; + } }; struct bc_alu { @@ -529,6 +538,31 @@ struct bc_alu { this->op = op; op_ptr = r600_isa_alu(op); } + void clear() { + op_ptr = nullptr; + op = 0; + for (int i = 0; i < 3; ++i) + src[i].clear(); + dst_gpr = 0; + dst_chan = 0; + dst_rel = 0; + clamp = 0; + omod = 0; + bank_swizzle = 0; + index_mode = 0; + last = 0; + pred_sel = 0; + fog_merge = 0; + write_mask = 0; + update_exec_mask = 0; + update_pred = 0; + slot = 0; + lds_idx_offset = 0; + slot_flags = AF_NONE; + } + bc_alu() { + clear(); + } }; struct bc_fetch { diff --git a/src/gallium/drivers/r600/sb/sb_expr.cpp b/src/gallium/drivers/r600/sb/sb_expr.cpp index 73287f126b0..36361a25116 100644 --- a/src/gallium/drivers/r600/sb/sb_expr.cpp +++ b/src/gallium/drivers/r600/sb/sb_expr.cpp @@ -719,7 +719,7 @@ bool expr_handler::fold_assoc(alu_node *n) { n->src[0] = n->src[2]; n->bc.src[0] = n->bc.src[2]; n->src[1] = sh.get_const_value(cr); - memset(&n->bc.src[1], 0, sizeof(bc_alu_src)); + n->bc.src[1].clear(); n->src.resize(2); n->bc.set_op(ALU_OP2_ADD); @@ -729,7 +729,7 @@ bool expr_handler::fold_assoc(alu_node *n) { n->bc.src[0] = a->bc.src[last_arg]; n->bc.src[0].neg ^= cur_neg; n->src[1] = sh.get_const_value(cr); - memset(&n->bc.src[1], 0, sizeof(bc_alu_src)); + n->bc.src[1].clear(); } return false; @@ -770,7 +770,7 @@ bool expr_handler::fold_alu_op2(alu_node& n) { case ALU_OP2_ADD: // (ADD x, x) => (MUL x, 2) if (!sh.safe_math) { n.src[1] = sh.get_const_value(2.0f); - memset(&n.bc.src[1], 0, sizeof(bc_alu_src)); + n.bc.src[1].clear(); n.bc.set_op(ALU_OP2_MUL); return fold_alu_op2(n); } @@ -1070,7 +1070,7 @@ bool expr_handler::fold_alu_op3(alu_node& n) { } n.src[1] = t; - memset(&n.bc.src[1], 0, sizeof(bc_alu_src)); + n.bc.src[1].clear(); n.src.resize(2); @@ -1101,7 +1101,7 @@ bool expr_handler::fold_alu_op3(alu_node& n) { dv = cv0.f * cv1.f; n.bc.set_op(ALU_OP2_ADD); n.src[0] = sh.get_const_value(dv); - memset(&n.bc.src[0], 0, sizeof(bc_alu_src)); + n.bc.src[0].clear(); n.src[1] = n.src[2]; n.bc.src[1] = n.bc.src[2]; n.src.resize(2); diff --git a/src/gallium/drivers/r600/sb/sb_if_conversion.cpp b/src/gallium/drivers/r600/sb/sb_if_conversion.cpp index 017153434fc..48355e8d6e2 100644 --- a/src/gallium/drivers/r600/sb/sb_if_conversion.cpp +++ b/src/gallium/drivers/r600/sb/sb_if_conversion.cpp @@ -99,8 +99,8 @@ void if_conversion::convert_kill_instructions(region_node *r, a->src[0] = cnd; a->src[1] = sh.get_const_value(0); // clear modifiers - memset(&a->bc.src[0], 0, sizeof(bc_alu_src)); - memset(&a->bc.src[1], 0, sizeof(bc_alu_src)); + a->bc.src[0].clear(); + a->bc.src[1].clear(); } else { // kill with constant 'false' condition, this shouldn't happen // but remove it anyway diff --git a/src/gallium/drivers/r600/sb/sb_ir.h b/src/gallium/drivers/r600/sb/sb_ir.h index ef0fbd4e68f..2d629443641 100644 --- a/src/gallium/drivers/r600/sb/sb_ir.h +++ b/src/gallium/drivers/r600/sb/sb_ir.h @@ -1012,7 +1012,7 @@ public: class alu_node : public node { protected: - alu_node() : node(NT_OP, NST_ALU_INST) { memset(&bc, 0, sizeof(bc_alu)); } + alu_node() : node(NT_OP, NST_ALU_INST) { } public: bc_alu bc; diff --git a/src/gallium/drivers/r600/sb/sb_peephole.cpp b/src/gallium/drivers/r600/sb/sb_peephole.cpp index 4390a8f525c..979f4bc130b 100644 --- a/src/gallium/drivers/r600/sb/sb_peephole.cpp +++ b/src/gallium/drivers/r600/sb/sb_peephole.cpp @@ -131,8 +131,8 @@ void peephole::optimize_cc_op2(alu_node* a) { std::swap(a->src[0],a->src[1]); swapped = true; // clear modifiers - memset(&a->bc.src[0], 0, sizeof(bc_alu_src)); - memset(&a->bc.src[1], 0, sizeof(bc_alu_src)); + a->bc.src[0].clear(); + a->bc.src[1].clear(); } if (swapped || (a->src[1]->is_const() && |