diff options
author | Matt Turner <[email protected]> | 2015-02-09 22:54:51 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2015-02-19 21:16:43 -0800 |
commit | dada30462b8469509ef16fbc351764d42320b236 (patch) | |
tree | e3c81103ac144da19024f3b083c1ca646fb0d923 | |
parent | 30ec53f30ee5813db30777b45dbe456a02c8382e (diff) |
i965/blorp: Emit MADs.
Low hanging fruit: cuts a couple of instructions.
Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index fc111aef3b1..5c936cf8180 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -1255,10 +1255,8 @@ brw_blorp_blit_program::translate_dst_to_src() emit_mov(Xp_f, X); emit_mov(Yp_f, Y); /* Scale and offset */ - emit_mul(X_f, Xp_f, x_transform.multiplier); - emit_mul(Y_f, Yp_f, y_transform.multiplier); - emit_add(X_f, X_f, x_transform.offset); - emit_add(Y_f, Y_f, y_transform.offset); + emit_mad(X_f, x_transform.offset, Xp_f, x_transform.multiplier); + emit_mad(Y_f, y_transform.offset, Yp_f, y_transform.multiplier); if (key->blit_scaled && key->blend) { /* Translate coordinates to lay out the samples in a rectangular grid * roughly corresponding to sample locations. diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h index bfad4224a2c..8e44eb482c4 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h @@ -85,6 +85,15 @@ protected: new (mem_ctx) fs_inst(BRW_OPCODE_LRP, 16, dst, src1, src2, src3)); } + inline void emit_mad(const struct brw_reg &dst, + const struct brw_reg &src1, + const struct brw_reg &src2, + const struct brw_reg &src3) + { + insts.push_tail( + new (mem_ctx) fs_inst(BRW_OPCODE_MAD, 16, dst, src1, src2, src3)); + } + inline void emit_min(const struct brw_reg& dst, const struct brw_reg& src1, const struct brw_reg& src2) |