[glsl] Convert `select` to `mix` instead of ternary.

The current GLSL IR and AST backends translate the `select` builtin to a
ternary condition. This isn't correct as in WGSL both branches need to
be evaluated all of the time while in GLSL only the selected branch of
a ternary is evaluated.

This Cl converts the `select` calls to a `mix` call. In the case of a
WGSL select with vector values and a scalar boolean condition the scalar
boolean is splatted into a vector of correct size.

Bug: 367066331
Change-Id: Ibe2bd5a3aabd29a108831e3ed4469eb40c490278
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/208194
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl
index da96e9a..8dec860 100644
--- a/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl
+++ b/test/tint/statements/compound_assign/divide_by_zero.wgsl.expected.ir.glsl
@@ -6,14 +6,14 @@
   uint v = uint((lhs == (-2147483647 - 1)));
   bool v_1 = bool((v & uint((rhs == -1))));
   uint v_2 = uint((rhs == 0));
-  int v_3 = ((bool((v_2 | uint(v_1)))) ? (1) : (rhs));
+  int v_3 = mix(rhs, 1, bool((v_2 | uint(v_1))));
   return (lhs - ((lhs / v_3) * v_3));
 }
 int tint_div_i32(int lhs, int rhs) {
   uint v_4 = uint((lhs == (-2147483647 - 1)));
   bool v_5 = bool((v_4 & uint((rhs == -1))));
   uint v_6 = uint((rhs == 0));
-  return (lhs / ((bool((v_6 | uint(v_5)))) ? (1) : (rhs)));
+  return (lhs / mix(rhs, 1, bool((v_6 | uint(v_5)))));
 }
 void foo(int maybe_zero) {
   a = tint_div_i32(a, maybe_zero);