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>
This commit is contained in:
Ben Clayton
2022-12-07 19:25:17 +00:00
committed by Dawn LUCI CQ
parent 507736a43c
commit 6c337aa18e
11 changed files with 34 additions and 30 deletions

View File

@@ -359,7 +359,7 @@ struct BuiltinPolyfill::State {
};
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 @@ struct BuiltinPolyfill::State {
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 @@ struct BuiltinPolyfill::State {
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));

View File

@@ -241,7 +241,7 @@ struct Robustness::State {
// 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));