Implement -Wswitch-fallthrough: rs6000

Marek Polacek polacek@redhat.com
Mon Jul 11 19:59:00 GMT 2016


2016-07-11  Marek Polacek  <polacek@redhat.com>

	PR c/7652
	* config/rs6000/rs6000.c (rs6000_builtin_vectorized_libmass): Likewise.
	(rs6000_legitimate_offset_address_p): Likewise.
	(rs6000_emit_move): Likewise.
	(altivec_expand_ld_builtin): Likewise.
	(altivec_expand_st_builtin): Likewise.
	(rs6000_emit_vector_compare_inner): Likewise.
	(rs6000_adjust_cost): Likewise.
	(insn_must_be_first_in_group): Likewise.
	(rs6000_handle_altivec_attribute): Likewise.
	(rs6000_rtx_costs): Likewise.
	(altivec_expand_vec_perm_const): Likewise.
	(rtx_is_swappable_p): Likewise.
	* config/rs6000/rs6000.md: Likewise.

diff --git gcc/gcc/config/rs6000/rs6000.c gcc/gcc/config/rs6000/rs6000.c
index dd77e1b..a41d6be 100644
--- gcc/gcc/config/rs6000/rs6000.c
+++ gcc/gcc/config/rs6000/rs6000.c
@@ -5459,6 +5459,7 @@ rs6000_builtin_vectorized_libmass (combined_fn fn, tree type_out,
     CASE_CFN_POW:
       n_args = 2;
       /* fall through */
+      gcc_fallthrough ();
 
     CASE_CFN_ACOS:
     CASE_CFN_ACOSH:
@@ -7675,6 +7676,7 @@ rs6000_legitimate_offset_address_p (machine_mode mode, rtx x,
 	return (SPE_CONST_OFFSET_OK (offset)
 		&& SPE_CONST_OFFSET_OK (offset + 8));
       /* fall through */
+      gcc_fallthrough ();
 
     case TDmode:
     case TImode:
@@ -9778,6 +9780,7 @@ rs6000_emit_move (rtx dest, rtx source, machine_mode mode)
       if (FLOAT128_2REG_P (mode))
 	rs6000_eliminate_indexed_memrefs (operands);
       /* fall through */
+      gcc_fallthrough ();
 
     case DFmode:
     case DDmode:
@@ -14398,6 +14401,8 @@ altivec_expand_ld_builtin (tree exp, rtx target, bool *expandedp)
       break;
     case ALTIVEC_BUILTIN_LD_INTERNAL_2di:
       icode = CODE_FOR_vector_altivec_load_v2di;
+      /* XXX Really?  */
+      gcc_fallthrough ();
     case ALTIVEC_BUILTIN_LD_INTERNAL_1ti:
       icode = CODE_FOR_vector_altivec_load_v1ti;
       break;
@@ -14459,6 +14464,8 @@ altivec_expand_st_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
       break;
     case ALTIVEC_BUILTIN_ST_INTERNAL_2di:
       icode = CODE_FOR_vector_altivec_store_v2di;
+      /* XXX Really?  */
+      gcc_fallthrough ();
     case ALTIVEC_BUILTIN_ST_INTERNAL_1ti:
       icode = CODE_FOR_vector_altivec_store_v1ti;
       break;
@@ -20961,6 +20968,7 @@ print_operand (FILE *file, rtx x, int code)
 	return;
       fputc (',', file);
       /* FALLTHRU */
+      gcc_fallthrough ();
 
     case 'R':
       /* X is a CR register.  Print the mask for `mtcrf'.  */
@@ -22532,6 +22540,7 @@ rs6000_emit_vector_compare_inner (enum rtx_code code, rtx op0, rtx op1)
     case GE:
       if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
 	return NULL_RTX;
+      gcc_fallthrough ();
 
     case EQ:
     case GT:
@@ -30191,6 +30200,7 @@ rs6000_adjust_cost (rtx_insn *insn, rtx link, rtx_insn *dep_insn, int cost)
                 && (INSN_CODE (dep_insn) >= 0)
                 && (get_attr_type (dep_insn) == TYPE_MFFGPR))
               return 2;
+	    gcc_fallthrough ();
 
           default:
             break;
@@ -30227,6 +30237,7 @@ rs6000_adjust_cost (rtx_insn *insn, rtx link, rtx_insn *dep_insn, int cost)
             }
         }
       /* Fall through, no cost for output dependency.  */
+      gcc_fallthrough ();
 
     case REG_DEP_ANTI:
       /* Anti dependency; DEP_INSN reads a register that INSN writes some
@@ -31373,6 +31384,7 @@ insn_must_be_first_in_group (rtx_insn *insn)
     case PROCESSOR_POWER5:
       if (is_cracked_insn (insn))
         return true;
+      gcc_fallthrough ();
     case PROCESSOR_POWER4:
       if (is_microcoded_insn (insn))
         return true;
@@ -32290,6 +32302,7 @@ rs6000_handle_altivec_attribute (tree *node,
 	case V4SImode: case V8HImode: case V16QImode: case V4SFmode:
 	case V2DImode: case V2DFmode:
 	  result = type;
+	  gcc_fallthrough ();
 	default: break;
 	}
       break;
@@ -32300,6 +32313,7 @@ rs6000_handle_altivec_attribute (tree *node,
 	case SImode: case V4SImode: result = bool_V4SI_type_node; break;
 	case HImode: case V8HImode: result = bool_V8HI_type_node; break;
 	case QImode: case V16QImode: result = bool_V16QI_type_node;
+	gcc_fallthrough ();
 	default: break;
 	}
       break;
@@ -32307,6 +32321,7 @@ rs6000_handle_altivec_attribute (tree *node,
       switch (mode)
 	{
 	case V8HImode: result = pixel_V8HI_type_node;
+	gcc_fallthrough ();
 	default: break;
 	}
     default: break;
@@ -33912,6 +33927,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	  return true;
 	}
       /* FALLTHRU */
+      gcc_fallthrough ();
 
     case CONST_DOUBLE:
     case CONST_WIDE_INT:
@@ -33973,6 +33989,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	  return false;
 	}
       /* FALLTHRU */
+      gcc_fallthrough ();
 
     case UDIV:
     case UMOD:
@@ -34086,6 +34103,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	  return false;
 	}
       /* fall through */
+      gcc_fallthrough ();
 	  
     case ASHIFTRT:
     case LSHIFTRT:
@@ -34124,6 +34142,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	  return false;
 	}
       /* FALLTHRU */
+      gcc_fallthrough ();
 
     case FLOAT:
     case UNSIGNED_FLOAT:
@@ -34196,6 +34215,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	    }
 	}
       /* FALLTHRU */
+      gcc_fallthrough ();
 
     case GT:
     case LT:
@@ -34970,6 +34990,7 @@ altivec_expand_vec_perm_const (rtx operands[4])
       if (!rtx_equal_p (op0, op1))
 	break;
       /* FALLTHRU */
+      gcc_fallthrough ();
 
     case 2:
       for (i = 0; i < 16; ++i)
@@ -38540,6 +38561,7 @@ rtx_is_swappable_p (rtx op, unsigned int *special)
 	    return 1;
 	  }
       }
+      gcc_fallthrough ();
 
     default:
       break;
diff --git gcc/gcc/config/rs6000/rs6000.md gcc/gcc/config/rs6000/rs6000.md
index a7615b1..3d3cfaa 100644
--- gcc/gcc/config/rs6000/rs6000.md
+++ gcc/gcc/config/rs6000/rs6000.md
@@ -8094,6 +8094,8 @@
     case 0:
       if (TARGET_STRING)
         return \"stswi %1,%P0,16\";
+      /* XXX Really fallthru?  */
+      gcc_fallthrough ();
     case 1:
       return \"#\";
     case 2:
@@ -8103,6 +8105,7 @@
           && ! reg_overlap_mentioned_p (operands[0], operands[1]))
 	return \"lswi %0,%P1,16\";
       /* ... fall through ...  */
+      gcc_fallthrough ();
     case 3:
     case 4:
     case 5:



More information about the Gcc-patches mailing list