summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-01-07 11:52:05 -0800
committerMatt Turner <[email protected]>2015-02-04 12:14:34 -0800
commit6b3a301f611c9aabc090522951eda589e8302562 (patch)
treeb3107db39a2d494165401cf64a07f31830423dff
parent7e6079439246e6a18d7f9d34b6c29a662dc619c7 (diff)
i965: Set CMP's destination type to src0's type.
Allows CMP instructions with float sources to be compacted and coissued. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp16
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp20
2 files changed, 18 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0ada5837cfd..2046eba354a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -339,17 +339,13 @@ fs_visitor::CMP(fs_reg dst, fs_reg src0, fs_reg src1,
*
* Original gen4 does type conversion to the destination type before
* comparison, producing garbage results for floating point comparisons.
- * gen5 does the comparison on the execution type (resolved source types),
- * so dst type doesn't matter. gen6 does comparison and then uses the
- * result as if it was the dst type with no conversion, which happens to
- * mostly work out for float-interpreted-as-int since our comparisons are
- * for >0, =0, <0.
+ *
+ * The destination type doesn't matter on newer generations, so we set the
+ * type to match src0 so we can compact the instruction.
*/
- if (brw->gen == 4) {
- dst.type = src0.type;
- if (dst.file == HW_REG)
- dst.fixed_hw_reg.type = dst.type;
- }
+ dst.type = src0.type;
+ if (dst.file == HW_REG)
+ dst.fixed_hw_reg.type = dst.type;
resolve_ud_negate(&src0);
resolve_ud_negate(&src1);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 8129118e28d..e6a7ed06020 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -222,15 +222,19 @@ vec4_visitor::CMP(dst_reg dst, src_reg src0, src_reg src1,
{
vec4_instruction *inst;
- /* original gen4 does type conversion to the destination type
- * before before comparison, producing garbage results for floating
- * point comparisons.
+ /* Take the instruction:
+ *
+ * CMP null<d> src0<f> src1<f>
+ *
+ * Original gen4 does type conversion to the destination type before
+ * comparison, producing garbage results for floating point comparisons.
+ *
+ * The destination type doesn't matter on newer generations, so we set the
+ * type to match src0 so we can compact the instruction.
*/
- if (brw->gen == 4) {
- dst.type = src0.type;
- if (dst.file == HW_REG)
- dst.fixed_hw_reg.type = dst.type;
- }
+ dst.type = src0.type;
+ if (dst.file == HW_REG)
+ dst.fixed_hw_reg.type = dst.type;
resolve_ud_negate(&src0);
resolve_ud_negate(&src1);