diff mbox series

[4/8,RS6000] rs6000_rtx_costs tidy break/return

Message ID 20201007225800.9536-5-amodra@gmail.com
State New
Headers show
Series rs6000_rtx_costs V2 | expand

Commit Message

Alan Modra Oct. 7, 2020, 10:57 p.m. UTC
Most cases use "return false" rather than breaking out of the switch.
Do so in all cases.

	* config/rs6000/rs6000.c (rs6000_rtx_costs): Tidy break/return.

Comments

Alan Modra Jan. 21, 2021, 11:09 p.m. UTC | #1
Ping.

On Tue, Jan 12, 2021 at 02:02:09PM +1030, Alan Modra wrote:
> Ping
> https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555755.html
> 
> On Thu, Oct 08, 2020 at 09:27:56AM +1030, Alan Modra wrote:
> > Most cases use "return false" rather than breaking out of the switch.
> > Do so in all cases.
> > 
> > 	* config/rs6000/rs6000.c (rs6000_rtx_costs): Tidy break/return.
> > 
> > diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> > index bc5e51aa5ce..383d2901c9f 100644
> > --- a/gcc/config/rs6000/rs6000.c
> > +++ b/gcc/config/rs6000/rs6000.c
> > @@ -21371,7 +21371,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
> >  	*total = rs6000_cost->fp;
> >        else
> >  	*total = rs6000_cost->dmul;
> > -      break;
> > +      return false;
> >  
> >      case DIV:
> >      case MOD:
> > @@ -21539,7 +21539,7 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
> >  	  *total = rs6000_cost->fp;
> >  	  return false;
> >  	}
> > -      break;
> > +      return false;
> >  
> >      case NE:
> >      case EQ:
> > @@ -21577,13 +21577,11 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
> >  	  *total = 0;
> >  	  return true;
> >  	}
> > -      break;
> > +      return false;
> >  
> >      default:
> > -      break;
> > +      return false;
> >      }
> > -
> > -  return false;
> >  }
> >  
> >  /* Debug form of r6000_rtx_costs that is selected if -mdebug=cost.  */
Segher Boessenkool Jan. 25, 2021, 10:40 p.m. UTC | #2
On Thu, Oct 08, 2020 at 09:27:56AM +1030, Alan Modra wrote:
> Most cases use "return false" rather than breaking out of the switch.
> Do so in all cases.

>      default:
> -      break;
> +      return false;
>      }
> -
> -  return false;
>  }

Please don't do this part.  The rest is okay.  Thanks!


Segher
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index bc5e51aa5ce..383d2901c9f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -21371,7 +21371,7 @@  rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	*total = rs6000_cost->fp;
       else
 	*total = rs6000_cost->dmul;
-      break;
+      return false;
 
     case DIV:
     case MOD:
@@ -21539,7 +21539,7 @@  rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	  *total = rs6000_cost->fp;
 	  return false;
 	}
-      break;
+      return false;
 
     case NE:
     case EQ:
@@ -21577,13 +21577,11 @@  rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code,
 	  *total = 0;
 	  return true;
 	}
-      break;
+      return false;
 
     default:
-      break;
+      return false;
     }
-
-  return false;
 }
 
 /* Debug form of r6000_rtx_costs that is selected if -mdebug=cost.  */