Added a rule to replace bitshifts by a constant value to a divide by the corresponding power of two.
GLSL: Handle more math functions correctly

Map intrinsics to correct GLSL functions:
- trigonometric functions (sin, cos, tan, asin, acos, atan, atan2)
- exponential functions (pow, exp, log)
- general functions (floor, ceil, lerp)

Since GLSL doesn't support bit arithmetic, don't use C backend to generate
code for "Mod" and "Div".
Correct implementation of sdiv by casting to float and back to int
Added a check to the simplification to ensure the bitshift is valid.
Simplified the integer overflow checks in the simplification.
Simplify common type casts in GLSL

Since small integer types are represented as floats, a lot of redundant type
casts were generated (e.g., float(uint8(expr)) -> float(float(expr))).

In some cases, this almost halves the number of temporary variables generated.
Correctly map lerp() to mix intrinsic
Fix indentation
Handle wider range of types when mapping filter Params to uniforms.

For example, uint8_t parameters are stored as float uniforms. This patch
fixed the parameter declaration in the special comment preceding
the shader as well as correctly setting the uniforms at runtime.
GLSL: Improve copy_to_dev and copy_to_host

- don't use GL_UNPACK_ROW_LENGTH, which is unavailable in OpenGL ES
- only transfer directly to/from host buffer if memory is contiguous
- honor min[] values of associated buffer
Merge branch 'master' into glsl_codegen
Fixed bitshift simplify to handle negative shifts and avoid 32 bit overflow.
Pass string by const ref instead of by value
GLSL: fix codegen for mod function, add small test for special functions
Merge branch 'master' into glsl_codegen
Fixed if statement in bitshift simplification. Added tests to check correctness of bitshift simplifies.
Redirect open, write, close on windows ...

to use _open, _write, _close
Use simplify() instead of home-grown simplification

Also add an internal test for CodeGen_GLSL.
GLSL supports integer division, no need to use sdiv()
Directly map Halide intrinsics to corresponding GLSL builtins

There is actually no need to use #defines for this purpose. This also allows
us to emit better error messages when unsupported intrinsics (such as
reinterpret or bit operations) are used in a filter.