Rework and add new rules for simplifying ramp/x and ramp%x

Fixes issue #458 

I'd appreciate another set of eyes, because these rules are pretty nuts. They should be tested by the test cases at the bottom, and also by the simplify fuzz-tester.
The cases that went away are constant ramps (possibly involving casts),
broadcasts of casts, and stringimms.

In that particular place (926) there's no change, because that only
triggers if the type was Int(32), so the constant ramp case going away is
irrelevant.

I think this is true throughout. Whenever I wrote is_simple_const
previously, I was thinking of IntImm, FloatImm, and Broadcast of the same.
This is why no tests broke. The cases we care about for simplification have
explicit tests at the bottom.

On Tue, Oct 7, 2014 at 10:28 PM, Dillon Sharlet <notifications@github.com>
wrote:

> In src/Simplify.cpp:
>
> > @@ -28,9 +28,15 @@ using std::pair;
> >  using std::make_pair;
> >  using std::ostringstream;
> >
> > -// Immediates and broadcasts of immediates
> > +// Things that we can constant fold: Immediates and broadcasts of
> > +// immediates.
> >  bool is_simple_const(Expr e) {
>
> Looking through the uses of is_simple_const in this file, I think we lost
> quite a few rules with this change. For example, the bounds inference based
> rule for Min (line 926). I think the specialize branched loops work
> specifically needed this rule. I think this change is correct, but I also
> think we may need to be more precise with our usage of is_simple_const
> elsewhere in the file.
>
> I think we should consider renaming is_simple_const to
> "is_foldable_const", and then try to be more precise about the const-ness
> tests used in the simplifier.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/halide/Halide/pull/496/files#r18564788>.
>