tint: Fix x86 build

Fixed: tint:1813
Change-Id: I97b7c0c0a4bfdda2f7e63983caddcfb3a1e19c2f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/117215
Reviewed-by: dan sinclair <dsinclair@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2023-01-24 19:29:54 +00:00 committed by Dawn LUCI CQ
parent 355b70d2be
commit f0d8edecee
3 changed files with 11 additions and 11 deletions

View File

@ -521,15 +521,15 @@ TEST_F(IR_InstructionTest, Binary_Usage) {
EXPECT_EQ(instr->GetKind(), Binary::Kind::kAnd); EXPECT_EQ(instr->GetKind(), Binary::Kind::kAnd);
ASSERT_NE(instr->Result(), nullptr); ASSERT_NE(instr->Result(), nullptr);
ASSERT_EQ(instr->Result()->Usage().Length(), 1); ASSERT_EQ(instr->Result()->Usage().Length(), 1u);
EXPECT_EQ(instr->Result()->Usage()[0], instr); EXPECT_EQ(instr->Result()->Usage()[0], instr);
ASSERT_NE(instr->LHS(), nullptr); ASSERT_NE(instr->LHS(), nullptr);
ASSERT_EQ(instr->LHS()->Usage().Length(), 1); ASSERT_EQ(instr->LHS()->Usage().Length(), 1u);
EXPECT_EQ(instr->LHS()->Usage()[0], instr); EXPECT_EQ(instr->LHS()->Usage()[0], instr);
ASSERT_NE(instr->RHS(), nullptr); ASSERT_NE(instr->RHS(), nullptr);
ASSERT_EQ(instr->RHS()->Usage().Length(), 1); ASSERT_EQ(instr->RHS()->Usage().Length(), 1u);
EXPECT_EQ(instr->RHS()->Usage()[0], instr); EXPECT_EQ(instr->RHS()->Usage()[0], instr);
} }
@ -544,13 +544,13 @@ TEST_F(IR_InstructionTest, Binary_Usage_DuplicateValue) {
EXPECT_EQ(instr->GetKind(), Binary::Kind::kAnd); EXPECT_EQ(instr->GetKind(), Binary::Kind::kAnd);
ASSERT_NE(instr->Result(), nullptr); ASSERT_NE(instr->Result(), nullptr);
ASSERT_EQ(instr->Result()->Usage().Length(), 1); ASSERT_EQ(instr->Result()->Usage().Length(), 1u);
EXPECT_EQ(instr->Result()->Usage()[0], instr); EXPECT_EQ(instr->Result()->Usage()[0], instr);
ASSERT_EQ(instr->LHS(), instr->RHS()); ASSERT_EQ(instr->LHS(), instr->RHS());
ASSERT_NE(instr->LHS(), nullptr); ASSERT_NE(instr->LHS(), nullptr);
ASSERT_EQ(instr->LHS()->Usage().Length(), 1); ASSERT_EQ(instr->LHS()->Usage().Length(), 1u);
EXPECT_EQ(instr->LHS()->Usage()[0], instr); EXPECT_EQ(instr->LHS()->Usage()[0], instr);
} }

View File

@ -53,11 +53,11 @@ TEST_F(IR_InstructionTest, Bitcast_Usage) {
b.builder.Bitcast(b.builder.ir.types.Get<type::I32>(), b.builder.Constant(4_i)); b.builder.Bitcast(b.builder.ir.types.Get<type::I32>(), b.builder.Constant(4_i));
ASSERT_NE(instr->Result(), nullptr); ASSERT_NE(instr->Result(), nullptr);
ASSERT_EQ(instr->Result()->Usage().Length(), 1); ASSERT_EQ(instr->Result()->Usage().Length(), 1u);
EXPECT_EQ(instr->Result()->Usage()[0], instr); EXPECT_EQ(instr->Result()->Usage()[0], instr);
ASSERT_NE(instr->Val(), nullptr); ASSERT_NE(instr->Val(), nullptr);
ASSERT_EQ(instr->Val()->Usage().Length(), 1); ASSERT_EQ(instr->Val()->Usage().Length(), 1u);
EXPECT_EQ(instr->Val()->Usage()[0], instr); EXPECT_EQ(instr->Val()->Usage()[0], instr);
} }

View File

@ -66,10 +66,10 @@ inline constexpr uint32_t Log2(uint64_t value) {
#endif #endif
// Non intrinsic (slow) path. Supports constexpr evaluation. // Non intrinsic (slow) path. Supports constexpr evaluation.
for (size_t clz = 0; clz < 64; clz++) { for (uint64_t clz = 0; clz < 64; clz++) {
size_t bit = 63 - clz; uint64_t bit = 63 - clz;
if (value & (static_cast<size_t>(1u) << bit)) { if (value & (static_cast<uint64_t>(1u) << bit)) {
return bit; return static_cast<uint32_t>(bit);
} }
} }
return 64; return 64;