tint/sem: Rename [un]signed Type helper methods

These only consider integers. Include that fact in their name

Change-Id: I7b54c3fb0a6efd6f8de06fac7734a59eaf7829e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113241
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc
index c8dff2c..16e0ab3 100644
--- a/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc
+++ b/src/tint/fuzzers/tint_ast_fuzzer/mutation_finders/change_unary_operators.cc
@@ -46,7 +46,7 @@
             type->Is<sem::Reference>() ? type->As<sem::Reference>()->StoreType() : type;
 
         // Only signed integer or vector of signed integer can be mutated.
-        if (!basic_type->is_signed_scalar_or_vector()) {
+        if (!basic_type->is_signed_integer_scalar_or_vector()) {
             continue;
         }
 
diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.cc
index d32d569..c9bed06 100644
--- a/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.cc
+++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/change_unary_operator.cc
@@ -52,7 +52,7 @@
 
     // Only signed integer or vector of signed integer has more than 1
     // unary operators to change between.
-    if (!basic_type->is_signed_scalar_or_vector()) {
+    if (!basic_type->is_signed_integer_scalar_or_vector()) {
         return false;
     }
 
diff --git a/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc b/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc
index d6612f5..499a23f 100644
--- a/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc
+++ b/src/tint/fuzzers/tint_ast_fuzzer/mutations/wrap_unary_operator.cc
@@ -100,12 +100,12 @@
         return {ast::UnaryOp::kNot};
     }
 
-    if (expr_type->is_signed_scalar_or_vector() ||
+    if (expr_type->is_signed_integer_scalar_or_vector() ||
         expr_type->is_abstract_integer_scalar_or_vector()) {
         return {ast::UnaryOp::kNegation, ast::UnaryOp::kComplement};
     }
 
-    if (expr_type->is_unsigned_scalar_or_vector()) {
+    if (expr_type->is_unsigned_integer_scalar_or_vector()) {
         return {ast::UnaryOp::kComplement};
     }
 
diff --git a/src/tint/sem/type.cc b/src/tint/sem/type.cc
index 51afc12..1327c03 100644
--- a/src/tint/sem/type.cc
+++ b/src/tint/sem/type.cc
@@ -121,16 +121,16 @@
     return Is([](const Vector* v) { return v->type()->Is<U32>(); });
 }
 
-bool Type::is_unsigned_scalar_or_vector() const {
+bool Type::is_unsigned_integer_scalar_or_vector() const {
     return Is<U32>() || is_unsigned_integer_vector();
 }
 
-bool Type::is_signed_scalar_or_vector() const {
+bool Type::is_signed_integer_scalar_or_vector() const {
     return IsAnyOf<I32, AbstractInt>() || is_signed_integer_vector();
 }
 
 bool Type::is_integer_scalar_or_vector() const {
-    return is_unsigned_scalar_or_vector() || is_signed_scalar_or_vector();
+    return is_unsigned_integer_scalar_or_vector() || is_signed_integer_scalar_or_vector();
 }
 
 bool Type::is_abstract_integer_vector() const {
diff --git a/src/tint/sem/type.h b/src/tint/sem/type.h
index 38f5ba8..5b6772b 100644
--- a/src/tint/sem/type.h
+++ b/src/tint/sem/type.h
@@ -126,9 +126,9 @@
     /// @returns true if this type is an unsigned vector
     bool is_unsigned_integer_vector() const;
     /// @returns true if this type is an unsigned scalar or vector
-    bool is_unsigned_scalar_or_vector() const;
+    bool is_unsigned_integer_scalar_or_vector() const;
     /// @returns true if this type is a signed scalar or vector
-    bool is_signed_scalar_or_vector() const;
+    bool is_signed_integer_scalar_or_vector() const;
     /// @returns true if this type is an integer scalar or vector
     bool is_integer_scalar_or_vector() const;
     /// @returns true if this type is an abstract integer vector
diff --git a/src/tint/transform/builtin_polyfill.cc b/src/tint/transform/builtin_polyfill.cc
index 62f8f4c..310cb81 100644
--- a/src/tint/transform/builtin_polyfill.cc
+++ b/src/tint/transform/builtin_polyfill.cc
@@ -359,7 +359,7 @@
         };
 
         const ast::Expression* x = nullptr;
-        if (ty->is_unsigned_scalar_or_vector()) {
+        if (ty->is_unsigned_integer_scalar_or_vector()) {
             x = b.Expr("v");
         } else {
             // If ty is signed, then the value is inverted if the sign is negative
@@ -484,7 +484,7 @@
 
         auto V = [&](auto value) -> const ast::Expression* {
             const ast::Expression* expr = b.Expr(value);
-            if (!ty->is_unsigned_scalar_or_vector()) {
+            if (!ty->is_unsigned_integer_scalar_or_vector()) {
                 expr = b.Construct<i32>(expr);
             }
             if (ty->Is<sem::Vector>()) {
@@ -691,7 +691,7 @@
 
             auto name = b.Symbols().New(is_div ? "tint_div" : "tint_mod");
             auto* use_one = b.Equal(rhs, ScalarOrVector(width, 0_a));
-            if (lhs_ty->is_signed_scalar_or_vector()) {
+            if (lhs_ty->is_signed_integer_scalar_or_vector()) {
                 const auto bits = lhs_el_ty->Size() * 8;
                 auto min_int = AInt(AInt::kLowestValue >> (AInt::kNumBits - bits));
                 const ast::Expression* lhs_is_min = b.Equal(lhs, ScalarOrVector(width, min_int));
diff --git a/src/tint/transform/robustness.cc b/src/tint/transform/robustness.cc
index c9f6292..6c94e90 100644
--- a/src/tint/transform/robustness.cc
+++ b/src/tint/transform/robustness.cc
@@ -241,7 +241,7 @@
 
             // texture_dims is u32 or vecN<u32>
             const auto* unsigned_max = b.Sub(texture_dims, scalar_or_vec(b.Expr(1_a), width));
-            if (target_ty->is_signed_scalar_or_vector()) {
+            if (target_ty->is_signed_integer_scalar_or_vector()) {
                 const auto* zero = scalar_or_vec(b.Expr(0_a), width);
                 const auto* signed_max = cast_to_signed(unsigned_max, width);
                 ctx.Replace(coords_arg, b.Call("clamp", ctx.Clone(coords_arg), zero, signed_max));
diff --git a/src/tint/writer/glsl/generator_impl.cc b/src/tint/writer/glsl/generator_impl.cc
index 4f86d35..f72fe29 100644
--- a/src/tint/writer/glsl/generator_impl.cc
+++ b/src/tint/writer/glsl/generator_impl.cc
@@ -396,13 +396,16 @@
         return EmitExpression(out, expr->expr);
     }
 
-    if (src_type->is_float_scalar_or_vector() && dst_type->is_signed_scalar_or_vector()) {
+    if (src_type->is_float_scalar_or_vector() && dst_type->is_signed_integer_scalar_or_vector()) {
         out << "floatBitsToInt";
-    } else if (src_type->is_float_scalar_or_vector() && dst_type->is_unsigned_scalar_or_vector()) {
+    } else if (src_type->is_float_scalar_or_vector() &&
+               dst_type->is_unsigned_integer_scalar_or_vector()) {
         out << "floatBitsToUint";
-    } else if (src_type->is_signed_scalar_or_vector() && dst_type->is_float_scalar_or_vector()) {
+    } else if (src_type->is_signed_integer_scalar_or_vector() &&
+               dst_type->is_float_scalar_or_vector()) {
         out << "intBitsToFloat";
-    } else if (src_type->is_unsigned_scalar_or_vector() && dst_type->is_float_scalar_or_vector()) {
+    } else if (src_type->is_unsigned_integer_scalar_or_vector() &&
+               dst_type->is_float_scalar_or_vector()) {
         out << "uintBitsToFloat";
     } else {
         if (!EmitType(out, dst_type, ast::AddressSpace::kNone, ast::Access::kReadWrite, "")) {
@@ -823,7 +826,7 @@
         return EmitEmulatedFMA(out, expr);
     }
     if (builtin->Type() == sem::BuiltinType::kAbs &&
-        TypeOf(expr->args[0])->UnwrapRef()->is_unsigned_scalar_or_vector()) {
+        TypeOf(expr->args[0])->UnwrapRef()->is_unsigned_integer_scalar_or_vector()) {
         // GLSL does not support abs() on unsigned arguments. However, it's a no-op.
         return EmitExpression(out, expr->args[0]);
     }
@@ -1401,7 +1404,7 @@
 
     auto emit_expr_as_signed = [&](const ast::Expression* e) {
         auto* ty = TypeOf(e)->UnwrapRef();
-        if (!ty->is_unsigned_scalar_or_vector()) {
+        if (!ty->is_unsigned_integer_scalar_or_vector()) {
             return EmitExpression(out, e);
         }
         emit_signed_int_type(ty);
diff --git a/src/tint/writer/hlsl/generator_impl.cc b/src/tint/writer/hlsl/generator_impl.cc
index 944481c..25ac606 100644
--- a/src/tint/writer/hlsl/generator_impl.cc
+++ b/src/tint/writer/hlsl/generator_impl.cc
@@ -987,7 +987,7 @@
     // crbug.com/tint/1550
     if (type == sem::BuiltinType::kCountOneBits || type == sem::BuiltinType::kReverseBits) {
         auto* arg = call->Arguments()[0];
-        if (arg->Type()->UnwrapRef()->is_signed_scalar_or_vector()) {
+        if (arg->Type()->UnwrapRef()->is_signed_integer_scalar_or_vector()) {
             out << "asint(" << name << "(asuint(";
             if (!EmitExpression(out, arg->Declaration())) {
                 return false;
diff --git a/src/tint/writer/msl/generator_impl.cc b/src/tint/writer/msl/generator_impl.cc
index 1056026..a38e267 100644
--- a/src/tint/writer/msl/generator_impl.cc
+++ b/src/tint/writer/msl/generator_impl.cc
@@ -528,7 +528,8 @@
 
     // Handle +/-/* of signed values
     if ((expr->IsAdd() || expr->IsSubtract() || expr->IsMultiply()) &&
-        lhs_type->is_signed_scalar_or_vector() && rhs_type->is_signed_scalar_or_vector()) {
+        lhs_type->is_signed_integer_scalar_or_vector() &&
+        rhs_type->is_signed_integer_scalar_or_vector()) {
         // If lhs or rhs is a vector, use that type (support implicit scalar to
         // vector promotion)
         auto* target_type = lhs_type->Is<sem::Vector>()
@@ -561,7 +562,7 @@
     // TODO(crbug.com/tint/1077): This may not be necessary. The MSL spec
     // seems to imply that left shifting a signed value is treated the same as
     // left shifting an unsigned value, but we need to make sure.
-    if (expr->IsShiftLeft() && lhs_type->is_signed_scalar_or_vector()) {
+    if (expr->IsShiftLeft() && lhs_type->is_signed_integer_scalar_or_vector()) {
         // Shift left: discards top bits, so convert first operand to unsigned
         // first, then convert result back to signed
         ScopedBitCast outer_int_cast(this, out, lhs_type, signed_type_of(lhs_type));
@@ -2918,7 +2919,7 @@
     // Handle `-e` when `e` is signed, so that we ensure that if `e` is the
     // largest negative value, it returns `e`.
     auto* expr_type = TypeOf(expr->expr)->UnwrapRef();
-    if (expr->op == ast::UnaryOp::kNegation && expr_type->is_signed_scalar_or_vector()) {
+    if (expr->op == ast::UnaryOp::kNegation && expr_type->is_signed_integer_scalar_or_vector()) {
         auto fn = utils::GetOrCreate(unary_minus_funcs_, expr_type, [&]() -> std::string {
             // e.g.:
             // int tint_unary_minus(const int v) {
diff --git a/src/tint/writer/spirv/builder.cc b/src/tint/writer/spirv/builder.cc
index b5910ff..670da7e 100644
--- a/src/tint/writer/spirv/builder.cc
+++ b/src/tint/writer/spirv/builder.cc
@@ -117,7 +117,7 @@
         case BuiltinType::kClamp:
             if (builtin->ReturnType()->is_float_scalar_or_vector()) {
                 return GLSLstd450NClamp;
-            } else if (builtin->ReturnType()->is_unsigned_scalar_or_vector()) {
+            } else if (builtin->ReturnType()->is_unsigned_integer_scalar_or_vector()) {
                 return GLSLstd450UClamp;
             } else {
                 return GLSLstd450SClamp;
@@ -161,7 +161,7 @@
         case BuiltinType::kMax:
             if (builtin->ReturnType()->is_float_scalar_or_vector()) {
                 return GLSLstd450NMax;
-            } else if (builtin->ReturnType()->is_unsigned_scalar_or_vector()) {
+            } else if (builtin->ReturnType()->is_unsigned_integer_scalar_or_vector()) {
                 return GLSLstd450UMax;
             } else {
                 return GLSLstd450SMax;
@@ -169,7 +169,7 @@
         case BuiltinType::kMin:
             if (builtin->ReturnType()->is_float_scalar_or_vector()) {
                 return GLSLstd450NMin;
-            } else if (builtin->ReturnType()->is_unsigned_scalar_or_vector()) {
+            } else if (builtin->ReturnType()->is_unsigned_integer_scalar_or_vector()) {
                 return GLSLstd450UMin;
             } else {
                 return GLSLstd450SMin;
@@ -2052,7 +2052,7 @@
     bool lhs_is_float_or_vec = lhs_type->is_float_scalar_or_vector();
     bool lhs_is_bool_or_vec = lhs_type->is_bool_scalar_or_vector();
     bool lhs_is_integer_or_vec = lhs_type->is_integer_scalar_or_vector();
-    bool lhs_is_unsigned = lhs_type->is_unsigned_scalar_or_vector();
+    bool lhs_is_unsigned = lhs_type->is_unsigned_integer_scalar_or_vector();
 
     spv::Op op = spv::Op::OpNop;
     if (expr->IsAnd()) {
@@ -2187,7 +2187,7 @@
         }
     } else if (expr->IsShiftLeft()) {
         op = spv::Op::OpShiftLeftLogical;
-    } else if (expr->IsShiftRight() && lhs_type->is_signed_scalar_or_vector()) {
+    } else if (expr->IsShiftRight() && lhs_type->is_signed_integer_scalar_or_vector()) {
         // A shift right with a signed LHS is an arithmetic shift.
         op = spv::Op::OpShiftRightArithmetic;
     } else if (expr->IsShiftRight()) {
@@ -2458,7 +2458,7 @@
             op = spv::Op::OpDPdyFine;
             break;
         case BuiltinType::kExtractBits:
-            op = builtin->Parameters()[0]->Type()->is_unsigned_scalar_or_vector()
+            op = builtin->Parameters()[0]->Type()->is_unsigned_integer_scalar_or_vector()
                      ? spv::Op::OpBitFieldUExtract
                      : spv::Op::OpBitFieldSExtract;
             break;
@@ -2543,7 +2543,7 @@
             op = spv::Op::OpTranspose;
             break;
         case BuiltinType::kAbs:
-            if (builtin->ReturnType()->is_unsigned_scalar_or_vector()) {
+            if (builtin->ReturnType()->is_unsigned_integer_scalar_or_vector()) {
                 // abs() only operates on *signed* integers.
                 // This is a no-op for unsigned integers.
                 return get_arg_as_value_id(0);