fix(shader): DPP16 operands of v_pk_fmac_f16 and the relative moves

v_pk_fmac_f16 read its accumulator through the permuted destination and
wrote without the DPP write mask. v_movrels/movrelsd/movrelsd_2 dropped
the source permute, and the relative writes dropped the DPP write mask.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Adrià Franch
2026-10-04 16:24:32 +02:00
parent d7f0c49fdc
commit cebc1e8289
3 changed files with 186 additions and 5 deletions
@@ -0,0 +1,182 @@
#include "prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp"
#include "prx/libSceAgcDriver/Graphics/include/Draw.hpp"
#include "Recompiler.hpp"
#include "VulkanTestDevice.hpp"
#include <algorithm>
#include <array>
#include <bit>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
namespace {
using AgcDriver::Graphics::Require;
using ShaderRecompiler::ShaderStage;
constexpr std::uint32_t Threads = 32;
constexpr std::uint32_t Inputs = 4;
constexpr std::uint32_t Results = 16;
alignas(256) std::array<std::uint32_t, Threads * Inputs> Input{};
alignas(256) std::array<std::uint32_t, Threads * Results> Output{};
alignas(256) constexpr std::array<std::uint32_t, 122> Code{
0x34020084, 0x34060086, 0xe0381000, 0x80000401, 0xbf8c3f70, 0x7e500304, 0x7e520305, 0x7e140306,
0x7e1602ff, 0xdeaddead, 0x7e5802ff, 0xdeaddead, 0x7e5a02ff, 0xdeaddead, 0x7e5c02ff, 0xdeaddead,
0x7e5e02ff, 0xdeaddead, 0x7e6002ff, 0xdeaddead, 0x7e6202ff, 0xdeaddead, 0xbefe03c1, 0xbefc0381,
0x78140afa, 0xff004b04, 0x7e1686fa, 0xff004b28, 0x7e5888fa, 0xff004b28, 0x7e5c84fa, 0xff004b28,
0xbefc03ff, 0x00010001, 0x7e6090fa, 0xff004b28, 0xbefe03c1, 0x7e18032d, 0x7e1a032f, 0x7e1c0331,
0x7e500304, 0x7e520305, 0x7e1e0306, 0x7e2002ff, 0xdeaddead, 0x7e5802ff, 0xdeaddead, 0x7e5a02ff,
0xdeaddead, 0x7e5c02ff, 0xdeaddead, 0x7e5e02ff, 0xdeaddead, 0x7e6002ff, 0xdeaddead, 0x7e6202ff,
0xdeaddead, 0xbefe03c1, 0xbefc0381, 0x781e0afa, 0xff011104, 0x7e2086fa, 0xff011128, 0x7e5888fa,
0xff011128, 0x7e5c84fa, 0xff011128, 0xbefc03ff, 0x00010001, 0x7e6090fa, 0xff011128, 0xbefe03c1,
0x7e22032d, 0x7e24032f, 0x7e260331, 0x7e500304, 0x7e520305, 0x7e280306, 0x7e2a02ff, 0xdeaddead,
0x7e5802ff, 0xdeaddead, 0x7e5a02ff, 0xdeaddead, 0x7e5c02ff, 0xdeaddead, 0x7e5e02ff, 0xdeaddead,
0x7e6002ff, 0xdeaddead, 0x7e6202ff, 0xdeaddead, 0xbefe03ff, 0x33cc0ff3, 0xbefc0381, 0x78280afa,
0x5a00b104, 0x7e2a86fa, 0x5a00b128, 0x7e5888fa, 0x5a00b128, 0x7e5c84fa, 0x5a00b128, 0xbefc03ff,
0x00010001, 0x7e6090fa, 0x5a00b128, 0xbefe03c1, 0x7e2c032d, 0x7e2e032f, 0x7e300331, 0xd5780019,
0x04c25d2c, 0xe0781000, 0x80010a03, 0xe0781010, 0x80010e03, 0xe0781020, 0x80011203, 0xe0781030,
0x80011603, 0xbf810000,
};
constexpr const char* Names[] = {"quad_perm_pk_fmac_f16", "quad_perm_movrels", "quad_perm_movrelsd", "quad_perm_movreld", "quad_perm_movrelsd_2", "row_shr_pk_fmac_f16", "row_shr_movrels", "row_shr_movrelsd", "row_shr_movreld", "row_shr_movrelsd_2", "masks_exec_pk_fmac_f16", "masks_exec_movrels", "masks_exec_movrelsd", "masks_exec_movreld", "masks_exec_movrelsd_2", "relative_bases"};
constexpr std::uint32_t Rows[32][4] = {
{0x4000c4abu, 0x00000000u, 0x4a3d4000u, 0xe255accbu},
{0x35558000u, 0x80000000u, 0x2e668000u, 0x8c3d5f16u},
{0xb1c73f01u, 0x80003f01u, 0x35553c00u, 0x9d3c7decu},
{0x40004000u, 0x42484000u, 0x3f013c00u, 0xd0944996u},
{0x4a3d3f01u, 0x4a3dc4abu, 0x35552e66u, 0x406329bcu},
{0xc4abc4abu, 0x2e66b1c7u, 0x00004a3du, 0x1389b372u},
{0xb1c7c4abu, 0x40000000u, 0x00004248u, 0x49a047dcu},
{0x3f01b800u, 0x4a3db1c7u, 0xb1c78000u, 0x4f1a8a1du},
{0x3c00b1c7u, 0xc4abc4abu, 0x3f012e66u, 0x17371472u},
{0x2e668000u, 0x00003f01u, 0x40002e66u, 0x81a0ba05u},
{0x80003f01u, 0x2e660000u, 0x42482e66u, 0x90624fe3u},
{0x3f010000u, 0x00003c00u, 0x80003555u, 0xc40d31b5u},
{0xb8003c00u, 0xb1c70000u, 0x4a3d4000u, 0xb7a1774fu},
{0x80002e66u, 0x3f01b800u, 0x3f013555u, 0xd9814559u},
{0x40004a3du, 0xb1c73f01u, 0x4a3d3f01u, 0xb6eafff5u},
{0x00004248u, 0x00002e66u, 0x4a3d4248u, 0x8c53765fu},
{0x4a3d0000u, 0xb1c73f01u, 0x2e662e66u, 0x33d91808u},
{0x42484248u, 0x3c003c00u, 0xb8004a3du, 0xe1cd7be8u},
{0x80003f01u, 0x00003f01u, 0xc4ab3555u, 0x42969a50u},
{0xb1c73f01u, 0x3f010000u, 0x3f012e66u, 0x8ece78b0u},
{0x4a3d3c00u, 0x4248c4abu, 0x3f014000u, 0x703e53cfu},
{0xb1c7b1c7u, 0x00004248u, 0x3f01b800u, 0xf79edc82u},
{0x2e66b1c7u, 0x3f014000u, 0x4a3d4248u, 0xe73c49eau},
{0x3f01c4abu, 0x40003555u, 0xb1c72e66u, 0x2577c324u},
{0x3f013c00u, 0x40003c00u, 0x3f018000u, 0x8bed5b65u},
{0x40008000u, 0x35553555u, 0x40008000u, 0x0b6ec6f3u},
{0x00004248u, 0x4a3d4a3du, 0xc4abb800u, 0x01504585u},
{0xc4ab4a3du, 0x80008000u, 0x3f01b1c7u, 0xb870e4e1u},
{0xb8000000u, 0x35553f01u, 0x8000b800u, 0xf551abfdu},
{0x8000b1c7u, 0x00004248u, 0x40002e66u, 0xab266981u},
{0xb800b800u, 0x80004248u, 0x00002e66u, 0x63f1bbbcu},
{0xb8000000u, 0x35552e66u, 0x3c004000u, 0x63ac4f14u}
};
constexpr std::uint32_t Expected[32][16] = {
{0x4a3d4000u, 0x42484000u, 0x42484000u, 0x40004000u, 0x42484000u, 0x4a3d4000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0x4a3d4000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x2e660000u, 0x80003f01u, 0x80003f01u, 0xb1c73f01u, 0x80003f01u, 0x2e668000u, 0x00000000u, 0x00000000u, 0x4000c4abu, 0x00000000u, 0x2e668000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x3555c72cu, 0x00000000u, 0x00000000u, 0x4000c4abu, 0x00000000u, 0x35553c00u, 0x80000000u, 0x80000000u, 0x35558000u, 0x80000000u, 0x35553c00u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x41983c00u, 0x80000000u, 0x80000000u, 0x35558000u, 0x80000000u, 0x3cbc4480u, 0x80003f01u, 0x80003f01u, 0xb1c73f01u, 0x80003f01u, 0x3f013c00u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x4d8b40deu, 0x4a3db1c7u, 0x4a3db1c7u, 0x3f01b800u, 0x4a3db1c7u, 0x4e52c89eu, 0x42484000u, 0x42484000u, 0x40004000u, 0x42484000u, 0xd33d4d79u, 0x2e66b1c7u, 0x2e66b1c7u, 0xc4abc4abu, 0x2e66b1c7u, 0xdeaddeadu},
{0xa49f4aa9u, 0x40000000u, 0x40000000u, 0xb1c7c4abu, 0x40000000u, 0x3cfd4a15u, 0x4a3dc4abu, 0x4a3dc4abu, 0x4a3d3f01u, 0x4a3dc4abu, 0x3cfd4a15u, 0x4a3dc4abu, 0x4a3dc4abu, 0x4a3d3f01u, 0x4a3dc4abu, 0xdeaddeadu},
{0x4e3d4248u, 0x4a3dc4abu, 0x4a3dc4abu, 0x4a3d3f01u, 0x4a3dc4abu, 0xc8ab4248u, 0x2e66b1c7u, 0x2e66b1c7u, 0xc4abc4abu, 0x2e66b1c7u, 0x43014248u, 0x4a3db1c7u, 0x4a3db1c7u, 0x3f01b800u, 0x4a3db1c7u, 0xdeaddeadu},
{0xd34d3abeu, 0x2e66b1c7u, 0x2e66b1c7u, 0xc4abc4abu, 0x2e66b1c7u, 0xc0de3abeu, 0x40000000u, 0x40000000u, 0xb1c7c4abu, 0x40000000u, 0xc0de3abeu, 0x40000000u, 0x40000000u, 0xb1c7c4abu, 0x40000000u, 0xdeaddeadu},
{0xc66c2e66u, 0x00003c00u, 0x00003c00u, 0x3f010000u, 0x00003c00u, 0xc66c40deu, 0x4a3db1c7u, 0x4a3db1c7u, 0x3f01b800u, 0x4a3db1c7u, 0x3f012e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x40004255u, 0x2e660000u, 0x2e660000u, 0x80003f01u, 0x2e660000u, 0x4000b2ebu, 0xc4abc4abu, 0xc4abc4abu, 0x3c00b1c7u, 0xc4abc4abu, 0x40002e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x427b2e66u, 0xc4abc4abu, 0xc4abc4abu, 0x3c00b1c7u, 0xc4abc4abu, 0x424d2e66u, 0x00003f01u, 0x00003f01u, 0x2e668000u, 0x00003f01u, 0x42482e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x00003555u, 0x00003f01u, 0x00003f01u, 0x2e668000u, 0x00003f01u, 0x8000402bu, 0x2e660000u, 0x2e660000u, 0x80003f01u, 0x2e660000u, 0x80003555u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x4a3d4000u, 0x00002e66u, 0x00002e66u, 0x00004248u, 0x00002e66u, 0x4a154000u, 0x00003c00u, 0x00003c00u, 0x3f010000u, 0x00003c00u, 0x4a3d4000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x4541c5e8u, 0xb1c73f01u, 0xb1c73f01u, 0x40004a3du, 0xb1c73f01u, 0x3b01b156u, 0xb1c70000u, 0xb1c70000u, 0xb8003c00u, 0xb1c70000u, 0x3f013555u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x4a494301u, 0xb1c70000u, 0xb1c70000u, 0xb8003c00u, 0xb1c70000u, 0x4a3d3fb4u, 0x3f01b800u, 0x3f01b800u, 0x80002e66u, 0x3f01b800u, 0x4a3d3f01u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x4a3d424du, 0x3f01b800u, 0x3f01b800u, 0x80002e66u, 0x3f01b800u, 0x4a3d4463u, 0xb1c73f01u, 0xb1c73f01u, 0x40004a3du, 0xb1c73f01u, 0x4a3d4248u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x303e4255u, 0x3f010000u, 0x3f010000u, 0xb1c73f01u, 0x3f010000u, 0x2e662e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0x2e662e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0xb8004b1du, 0x00003f01u, 0x00003f01u, 0x80003f01u, 0x00003f01u, 0x49fd4a3du, 0xb1c73f01u, 0xb1c73f01u, 0x4a3d0000u, 0xb1c73f01u, 0xb8004a3du, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0xc4ab3555u, 0xb1c73f01u, 0xb1c73f01u, 0x4a3d0000u, 0xb1c73f01u, 0xc4ab45d5u, 0x3c003c00u, 0x3c003c00u, 0x42484248u, 0x3c003c00u, 0xc4ab3555u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x47402e66u, 0x3c003c00u, 0x3c003c00u, 0x42484248u, 0x3c003c00u, 0x3f012e66u, 0x00003f01u, 0x00003f01u, 0x80003f01u, 0x00003f01u, 0x3f012e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x47404df3u, 0x40003555u, 0x40003555u, 0x3f01c4abu, 0x40003555u, 0x3cbcc62cu, 0x3f010000u, 0x3f010000u, 0xb1c73f01u, 0x3f010000u, 0x3f014000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x3f01bc45u, 0x3f014000u, 0x3f014000u, 0x2e66b1c7u, 0x3f014000u, 0x3f014148u, 0x4248c4abu, 0x4248c4abu, 0x4a3d3c00u, 0x4248c4abu, 0x3f01b800u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x504a4524u, 0x4248c4abu, 0x4248c4abu, 0x4a3d3c00u, 0x4248c4abu, 0x4a15418fu, 0x00004248u, 0x00004248u, 0xb1c7b1c7u, 0x00004248u, 0x4a3d4248u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0xb8552918u, 0x00004248u, 0x00004248u, 0xb1c7b1c7u, 0x00004248u, 0x24f82918u, 0x3f014000u, 0x3f014000u, 0x2e66b1c7u, 0x3f014000u, 0xb1c72e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0xc7964a3du, 0x80008000u, 0x80008000u, 0xc4ab4a3du, 0x80008000u, 0x4541c4abu, 0x40003555u, 0x40003555u, 0x3f01c4abu, 0x40003555u, 0x3f018000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x40003c30u, 0x4a3d4a3du, 0x4a3d4a3du, 0x00004248u, 0x4a3d4a3du, 0x412b3555u, 0x40003c00u, 0x40003c00u, 0x3f013c00u, 0x40003c00u, 0x40008000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x4c4b49fdu, 0x40003c00u, 0x40003c00u, 0x3f013c00u, 0x40003c00u, 0x4d12b800u, 0x35553555u, 0x35553555u, 0x40008000u, 0x35553555u, 0xc4abb800u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x3f01b1c7u, 0x35553555u, 0x35553555u, 0x40008000u, 0x35553555u, 0x3f01b1c7u, 0x4a3d4a3du, 0x4a3d4a3du, 0x00004248u, 0x4a3d4a3du, 0x3f01b1c7u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0xb155b800u, 0x35552e66u, 0x35552e66u, 0xb8000000u, 0x35552e66u, 0xbe394d56u, 0x80008000u, 0x80008000u, 0xc4ab4a3du, 0x80008000u, 0x8000b800u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x4000bde2u, 0x80004248u, 0x80004248u, 0xb800b800u, 0x80004248u, 0x40002e66u, 0x35553f01u, 0x35553f01u, 0xb8000000u, 0x35553f01u, 0x40002e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x00002e66u, 0x35553f01u, 0x35553f01u, 0xb8000000u, 0x35553f01u, 0x0000b779u, 0x00004248u, 0x00004248u, 0x8000b1c7u, 0x00004248u, 0x00002e66u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu},
{0x3c003feeu, 0x00004248u, 0x00004248u, 0x8000b1c7u, 0x00004248u, 0x3aab3fcdu, 0x80004248u, 0x80004248u, 0xb800b800u, 0x80004248u, 0x3c004000u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}
};
void Fill(std::uint32_t tid, std::uint32_t* words) {
for (std::uint32_t i = 0; i < 4; ++i) words[i] = Rows[tid][i];
}
std::array<std::uint32_t, 4> BufferDescriptor(const void* data, std::uint32_t bytes) {
const auto address = reinterpret_cast<std::uintptr_t>(data);
return {static_cast<std::uint32_t>(address), static_cast<std::uint32_t>((address >> 32u) & 0xffffu), bytes, 0x01016facu};
}
std::string Hex(std::uint32_t value) {
char text[16];
std::snprintf(text, sizeof(text), "0x%08x", value);
return text;
}
void Expect(std::uint32_t tid, std::uint32_t actual, std::uint32_t expected, const char* name) {
Require(actual == expected, std::string("dpp16 operands: lane ") + std::to_string(tid) + " " + name + " is " + Hex(actual) + ", expected " + Hex(expected));
}
void Run(AgcDriver::VulkanDevice& device) {
for (std::uint32_t tid = 0; tid < Threads; ++tid) Fill(tid, &Input[tid * Inputs]);
Output.fill(0xdeadbeefu);
std::vector<std::uint32_t> userData(8, 0u);
const auto input = BufferDescriptor(Input.data(), static_cast<std::uint32_t>(Input.size() * 4u));
const auto output = BufferDescriptor(Output.data(), static_cast<std::uint32_t>(Output.size() * 4u));
std::copy(input.begin(), input.end(), userData.begin());
std::copy(output.begin(), output.end(), userData.begin() + 4);
const std::span<const std::uint32_t> code(Code);
const std::array<ShaderRecompiler::MemoryRegion, 1> memory{{{reinterpret_cast<std::uintptr_t>(code.data()), std::as_bytes(code)}}};
const ShaderRecompiler::ShaderComputeStageInfo compute{{Threads, 1, 1}, 0u, {false, false, false}, false, 1};
ShaderRecompiler::RecompileRequest request{
{ShaderStage::Compute, reinterpret_cast<std::uintptr_t>(code.data()), code, 0, {}},
{32, 0, userData, compute, std::nullopt, std::nullopt, memory},
device.Target(),
{0, 0, 0, 128}
};
request.useCache = false;
const auto result = ShaderRecompiler::Recompile(request);
device.Dispatch(result, 1, 1, 1, {}, reinterpret_cast<std::uintptr_t>(code.data()));
device.WaitIdle();
}
void Check() {
for (std::uint32_t tid = 0; tid < Threads; ++tid) {
const std::uint32_t* in = &Input[tid * Inputs];
const std::uint32_t* out = &Output[tid * Results];
for (std::uint32_t i = 0; i < 16; ++i) Expect(tid, out[i], Expected[tid][i], Names[i]);
}
}
}
int main() {
try {
const auto device = OpenVulkanTestDevice();
if (!device) return VulkanTestSkipped;
if (device->Target().subgroupSize < Threads) {
std::printf("skipped, the device's subgroups are narrower than a wave (%u lanes)\n", device->Target().subgroupSize);
return VulkanTestSkipped;
}
Run(*device);
Check();
std::puts("dpp16 operands tests passed");
return 0;
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}
@@ -258,11 +258,11 @@ IrU32 TranslationContext::readRelativeVector(const RdnaOperand& base, IrValue& o
IrValue& hit = ir.IEqual(offset, ir.Constant(reg - base.reg));
result = IrU32(ir.Select(hit, ir.GetVectorReg(static_cast<VectorReg>(reg)), result.Value()));
}
return result;
return applyBitSourceModifiers(base, result);
}
void TranslationContext::writeRelativeVector(const RdnaOperand& base, IrValue& offset, IrU32 value, const char* name) {
const RdnaOperand destination = plainOperand(base);
const RdnaOperand& destination = base;
if (destination.kind != RdnaOperandKind::VectorRegister) {
throw std::runtime_error(std::string(name) + " destination is not a vector register");
}
@@ -16,7 +16,7 @@ bool TranslationContext::packedFloat16(const RdnaInstruction& inst, IrOpcode opc
const IrF32 lhs = readF16LaneAsF32(sourceAt(inst, 0u), high, true);
const IrF32 rhs = readF16LaneAsF32(sourceAt(inst, 1u), high, true);
if (accumulator) {
const IrF32 acc = readF16LaneAsF32(inst.destination, high, true);
const IrF32 acc = readF16LaneAsF32(accumulatorOperand(inst), high, true);
return applyF32ResultModifiers(inst.destination, IrF32(ir.Emit(opcode, IrType::F32, {&lhs.Value(), &rhs.Value(), &acc.Value()})));
}
if (inst.sourceCount == 3u) {
@@ -25,7 +25,6 @@ bool TranslationContext::packedFloat16(const RdnaInstruction& inst, IrOpcode opc
}
return applyF32ResultModifiers(inst.destination, IrF32(ir.Emit(opcode, IrType::F32, {&lhs.Value(), &rhs.Value()})));
};
const RdnaOperand raw = plainOperand(inst.destination);
IrU32 result = packHalf2x16(translateLane(false), translateLane(true));
if (quietSnan) {
const auto quietSnanLane = [&](const RdnaOperand& operand, bool high) {
@@ -44,7 +43,7 @@ bool TranslationContext::packedFloat16(const RdnaInstruction& inst, IrOpcode opc
};
result = packU16Lanes(overrideLane(false), overrideLane(true));
}
writeOperand(raw, &result.Value());
writeRawU32(inst.destination, result);
return true;
}