Fix some warnings

This commit is contained in:
Megamouse 2025-03-03 08:15:57 +01:00 committed by Malcolm Jestadt
commit b316d737d0

View file

@ -76,13 +76,13 @@ AVX512_ICL_FUNC usz get_vertex_program_ucode_hash_512(const RSXVertexProgram &pr
__m512i rotMask0 = _mm512_set_epi64(7, 6, 5, 4, 3, 2, 1, 0); __m512i rotMask0 = _mm512_set_epi64(7, 6, 5, 4, 3, 2, 1, 0);
__m512i rotMask1 = _mm512_set_epi64(15, 14, 13, 12, 11, 10, 9, 8); __m512i rotMask1 = _mm512_set_epi64(15, 14, 13, 12, 11, 10, 9, 8);
__m512i rotMaskAdd = _mm512_set_epi64(16, 16, 16, 16, 16, 16, 16, 16); const __m512i rotMaskAdd = _mm512_set_epi64(16, 16, 16, 16, 16, 16, 16, 16);
u32 instIndex = 0; u32 instIndex = 0;
// If there is remainder, add an extra (masked) iteration // If there is remainder, add an extra (masked) iteration
u32 extraIteration = (program.data.size() % 32 != 0) ? 1 : 0; const u32 extraIteration = (program.data.size() % 32 != 0) ? 1 : 0;
u32 length = (program.data.size() / 32) + extraIteration; const u32 length = static_cast<u32>(program.data.size() / 32) + extraIteration;
// The instruction mask will prevent us from reading out of bounds, we do not need a seperate masked loop // The instruction mask will prevent us from reading out of bounds, we do not need a seperate masked loop
// for the remainder, or a scalar loop. // for the remainder, or a scalar loop.
@ -109,6 +109,7 @@ AVX512_ICL_FUNC usz get_vertex_program_ucode_hash_512(const RSXVertexProgram &pr
const __m512i result = _mm512_add_epi64(acc0, acc1); const __m512i result = _mm512_add_epi64(acc0, acc1);
return _mm512_reduce_add_epi64(result); return _mm512_reduce_add_epi64(result);
} }
#endif #endif
@ -125,9 +126,9 @@ usz vertex_program_utils::get_vertex_program_ucode_hash(const RSXVertexProgram &
if (program.instruction_mask[instIndex]) if (program.instruction_mask[instIndex])
{ {
const auto inst = v128::loadu(instbuffer, instIndex); const auto inst = v128::loadu(instbuffer, instIndex);
usz tmp0 = std::rotr(inst._u64[0], instIndex * 2); const usz tmp0 = std::rotr(inst._u64[0], instIndex * 2);
acc0 += tmp0; acc0 += tmp0;
usz tmp1 = std::rotr(inst._u64[1], (instIndex * 2) + 1); const usz tmp1 = std::rotr(inst._u64[1], (instIndex * 2) + 1);
acc1 += tmp1; acc1 += tmp1;
} }
@ -147,10 +148,10 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert
bool has_branch_instruction = false; bool has_branch_instruction = false;
std::stack<u32> call_stack; std::stack<u32> call_stack;
D3 d3; D3 d3{};
D2 d2; D2 d2{};
D1 d1; D1 d1{};
D0 d0; D0 d0{};
std::function<void(u32, bool)> walk_function = [&](u32 start, bool fast_exit) std::function<void(u32, bool)> walk_function = [&](u32 start, bool fast_exit)
{ {
@ -491,8 +492,8 @@ AVX512_ICL_FUNC bool vertex_program_compare_512(const RSXVertexProgram &binary1,
const __m512i* instBuffer2 = reinterpret_cast<const __m512i*>(binary2.data.data()); const __m512i* instBuffer2 = reinterpret_cast<const __m512i*>(binary2.data.data());
// If there is remainder, add an extra (masked) iteration // If there is remainder, add an extra (masked) iteration
u32 extraIteration = (binary1.data.size() % 32 != 0) ? 1 : 0; const u32 extraIteration = (binary1.data.size() % 32 != 0) ? 1 : 0;
u32 length = (binary1.data.size() / 32) + extraIteration; const u32 length = static_cast<u32>(binary1.data.size() / 32) + extraIteration;
u32 instIndex = 0; u32 instIndex = 0;
@ -584,7 +585,7 @@ usz fragment_program_utils::get_fragment_program_ucode_size(const void* ptr)
while (true) while (true)
{ {
const v128 inst = v128::loadu(instBuffer, instIndex); const v128 inst = v128::loadu(instBuffer, instIndex);
bool end = (inst._u32[0] >> 8) & 0x1; const bool end = (inst._u32[0] >> 8) & 0x1;
if (is_any_src_constant(inst)) if (is_any_src_constant(inst))
{ {
@ -702,16 +703,16 @@ usz fragment_program_utils::get_fragment_program_ucode_hash(const RSXFragmentPro
while (true) while (true)
{ {
const auto inst = v128::loadu(instbuffer, instIndex); const auto inst = v128::loadu(instbuffer, instIndex);
usz tmp0 = std::rotr(inst._u64[0], instIndex * 2); const usz tmp0 = std::rotr(inst._u64[0], instIndex * 2);
acc0 += tmp0; acc0 += tmp0;
usz tmp1 = std::rotr(inst._u64[1], (instIndex * 2) + 1); const usz tmp1 = std::rotr(inst._u64[1], (instIndex * 2) + 1);
acc1 += tmp1; acc1 += tmp1;
instIndex++; instIndex++;
// Skip constants // Skip constants
if (fragment_program_utils::is_any_src_constant(inst)) if (fragment_program_utils::is_any_src_constant(inst))
instIndex++; instIndex++;
bool end = (inst._u32[0] >> 8) & 0x1; const bool end = (inst._u32[0] >> 8) & 0x1;
if (end) if (end)
return acc0 + acc1; return acc0 + acc1;
} }
@ -778,9 +779,9 @@ namespace rsx
f32* dst = buffer.data(); f32* dst = buffer.data();
for (usz offset_in_fragment_program : offsets_cache) for (usz offset_in_fragment_program : offsets_cache)
{ {
char* data = static_cast<char*>(rsx_prog.get_data()) + offset_in_fragment_program; const char* data = static_cast<const char*>(rsx_prog.get_data()) + offset_in_fragment_program;
const __m128i vector = _mm_loadu_si128(reinterpret_cast<__m128i*>(data)); const __m128i vector = _mm_loadu_si128(reinterpret_cast<const __m128i*>(data));
const __m128i shuffled_vector = _mm_or_si128(_mm_slli_epi16(vector, 8), _mm_srli_epi16(vector, 8)); const __m128i shuffled_vector = _mm_or_si128(_mm_slli_epi16(vector, 8), _mm_srli_epi16(vector, 8));
if (sanitize) if (sanitize)
@ -806,11 +807,11 @@ namespace rsx
for (usz offset_in_fragment_program : offsets_cache) for (usz offset_in_fragment_program : offsets_cache)
{ {
char* data = static_cast<char*>(rsx_prog.get_data()) + offset_in_fragment_program; const char* data = static_cast<const char*>(rsx_prog.get_data()) + offset_in_fragment_program;
for (u32 i = 0; i < 4; i++) for (u32 i = 0; i < 4; i++)
{ {
const u32 value = reinterpret_cast<u32*>(data)[i]; const u32 value = reinterpret_cast<const u32*>(data)[i];
const u32 shuffled = ((value >> 8) & 0xff00ff) | ((value << 8) & 0xff00ff00); const u32 shuffled = ((value >> 8) & 0xff00ff) | ((value << 8) & 0xff00ff00);
if (sanitize && (shuffled & 0x7fffffff) >= 0x7f800000) if (sanitize && (shuffled & 0x7fffffff) >= 0x7f800000)