i965/cfg: Add a foreach_inst_in_block_reverse_safe macro.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_fs_channel_expressions.cpp
index 4afae245d0be302b96c7fbbbf76f4b643e527b8f..cb0a07948c0209a5556912853c8ac72844a83674 100644 (file)
@@ -75,6 +75,18 @@ channel_expressions_predicate(ir_instruction *ir)
    if (!expr)
       return false;
 
+   switch (expr->operation) {
+      /* these opcodes need to act on the whole vector,
+       * just like texturing.
+       */
+      case ir_unop_interpolate_at_centroid:
+      case ir_binop_interpolate_at_offset:
+      case ir_binop_interpolate_at_sample:
+         return false;
+      default:
+         break;
+   }
+
    for (i = 0; i < expr->get_num_operands(); i++) {
       if (expr->operands[i]->type->is_vector())
         return true;
@@ -153,6 +165,16 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    if (!found_vector)
       return visit_continue;
 
+   switch (expr->operation) {
+      case ir_unop_interpolate_at_centroid:
+      case ir_binop_interpolate_at_offset:
+      case ir_binop_interpolate_at_sample:
+         return visit_continue;
+
+      default:
+         break;
+   }
+
    /* Store the expression operands in temps so we can use them
     * multiple times.
     */
@@ -215,11 +237,16 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_unop_sin_reduced:
    case ir_unop_cos_reduced:
    case ir_unop_dFdx:
+   case ir_unop_dFdx_coarse:
+   case ir_unop_dFdx_fine:
    case ir_unop_dFdy:
+   case ir_unop_dFdy_coarse:
+   case ir_unop_dFdy_fine:
    case ir_unop_bitfield_reverse:
    case ir_unop_bit_count:
    case ir_unop_find_msb:
    case ir_unop_find_lsb:
+   case ir_unop_saturate:
       for (i = 0; i < vector_elements; i++) {
         ir_rvalue *op0 = get_element(op_var[0], i);
 
@@ -233,7 +260,10 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_binop_add:
    case ir_binop_sub:
    case ir_binop_mul:
+   case ir_binop_imul_high:
    case ir_binop_div:
+   case ir_binop_carry:
+   case ir_binop_borrow:
    case ir_binop_mod:
    case ir_binop_min:
    case ir_binop_max:
@@ -304,10 +334,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_binop_logic_and:
    case ir_binop_logic_xor:
    case ir_binop_logic_or:
-      ir->print();
-      printf("\n");
-      assert(!"not reached: expression operates on scalars only");
-      break;
+      ir->fprint(stderr);
+      fprintf(stderr, "\n");
+      unreachable("not reached: expression operates on scalars only");
    case ir_binop_all_equal:
    case ir_binop_any_nequal: {
       ir_expression *last = NULL;
@@ -339,8 +368,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
       break;
    }
    case ir_unop_noise:
-      assert(!"noise should have been broken down to function call");
-      break;
+      unreachable("noise should have been broken down to function call");
 
    case ir_binop_bfm: {
       /* Does not need to be scalarized, since its result will be identical
@@ -357,10 +385,11 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    }
 
    case ir_binop_ubo_load:
-      assert(!"not yet supported");
-      break;
+      unreachable("not yet supported");
 
+   case ir_triop_fma:
    case ir_triop_lrp:
+   case ir_triop_csel:
    case ir_triop_bitfield_extract:
       for (i = 0; i < vector_elements; i++) {
         ir_rvalue *op0 = get_element(op_var[0], i);
@@ -402,18 +431,20 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_unop_unpack_unorm_2x16:
    case ir_unop_unpack_unorm_4x8:
    case ir_unop_unpack_half_2x16:
+   case ir_binop_ldexp:
    case ir_binop_vector_extract:
    case ir_triop_vector_insert:
    case ir_quadop_bitfield_insert:
    case ir_quadop_vector:
-      assert(!"should have been lowered");
-      break;
+      unreachable("should have been lowered");
 
    case ir_unop_unpack_half_2x16_split_x:
    case ir_unop_unpack_half_2x16_split_y:
    case ir_binop_pack_half_2x16_split:
-      assert("!not reached: expression operates on scalars only");
-      break;
+   case ir_unop_interpolate_at_centroid:
+   case ir_binop_interpolate_at_offset:
+   case ir_binop_interpolate_at_sample:
+      unreachable("not reached: expression operates on scalars only");
    }
 
    ir->remove();