diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/Vop1FloatUnary.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/Vop1FloatUnary.cpp new file mode 100644 index 000000000..4832b5c96 --- /dev/null +++ b/core/libs/prx/libSceAgcDriver/tests/execution/Vop1FloatUnary.cpp @@ -0,0 +1,220 @@ +#include "prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp" +#include "prx/libSceAgcDriver/Graphics/include/Draw.hpp" +#include "Recompiler.hpp" +#include "VulkanTestDevice.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 = 64; +alignas(256) std::array Input{}; +alignas(256) std::array Output{}; + +alignas(256) constexpr std::array Code{ + 0x34020084, 0x34060088, 0xe0381000, 0x80000401, 0xbf8c3f70, 0x2c100c90, 0x7e144504, 0x7e164505, + 0x7e184904, 0x7e1a4905, 0x7e1c4304, 0x7e1e4305, 0x7e204704, 0x7e224705, 0x7e244104, 0x7e264105, + 0x7e287f04, 0x7e2a7f05, 0x7e2c8104, 0x7e2e8105, 0x7e306704, 0x7e326705, 0x7e345d04, 0x7e365d05, + 0x7e385504, 0x7e3a5505, 0x7e3c5704, 0x7e3e5705, 0x7e404f04, 0x7e424f05, 0x7e444b04, 0x7e464b05, + 0x7e486b04, 0x7e4a6b05, 0x7e4c6d04, 0x7e4e6d05, 0x7e500307, 0x7e50b906, 0x7e520307, 0x7e52b908, + 0x7e540307, 0x7e54b706, 0x7e560307, 0x7e56b708, 0x7e580307, 0x7e58bb06, 0x7e5a0307, 0x7e5abb08, + 0x7e5c0307, 0x7e5cbd06, 0x7e5e0307, 0x7e5ebd08, 0x7e600307, 0x7e60bf06, 0x7e620307, 0x7e62bf08, + 0x7e640307, 0x7e64ab06, 0x7e660307, 0x7e66ab08, 0x7e680307, 0x7e68ad06, 0x7e6a0307, 0x7e6aad08, + 0x7e6c0307, 0x7e6ca906, 0x7e6e0307, 0x7e6ea908, 0x7e700307, 0x7e70af06, 0x7e720307, 0x7e72af08, + 0x7e740307, 0x7e74b106, 0x7e760307, 0x7e76b108, 0x7e780307, 0x7e78c106, 0x7e7a0307, 0x7e7ac108, + 0x7e7c0307, 0x7e7cc306, 0x7e7e0307, 0x7e7ec308, 0xe0781000, 0x80010a03, 0xe0781010, 0x80010e03, + 0xe0781020, 0x80011203, 0xe0781030, 0x80011603, 0xe0781040, 0x80011a03, 0xe0781050, 0x80011e03, + 0xe0781060, 0x80012203, 0xe0781070, 0x80012603, 0xe0781080, 0x80012a03, 0xe0781090, 0x80012e03, + 0xe07810a0, 0x80013203, 0xe07810b0, 0x80013603, 0xe07810c0, 0x80013a03, 0xe07810d0, 0x80013e03, + 0xbf810000, +}; + +constexpr std::uint32_t Rows[32][4] = { + {0x807fffffu, 0x007fffffu, 0x3c003800u, 0x13579bdfu}, + {0x7f800001u, 0xffc00000u, 0x7c01fe00u, 0x12345678u}, + {0xff800000u, 0x80000000u, 0xfc008000u, 0x9abcdef0u}, + {0xb0800000u, 0x3f800000u, 0x84003400u, 0x5555aaaau}, + {0x7f800000u, 0x3e2b6c1au, 0xbe007c00u, 0x2de0a56au}, + {0xbfc00000u, 0x43000000u, 0x00006401u, 0x7274aa88u}, + {0xc2fc0000u, 0x7fc00000u, 0xc0c1fc01u, 0x94d3d2ffu}, + {0x7fa00000u, 0xff800001u, 0xebdb4800u, 0xfb20bf6cu}, + {0xbf800000u, 0x3ab77039u, 0x7e0063ffu, 0xeb609511u}, + {0x00000000u, 0x3f400000u, 0x9ba1236cu, 0x8a4ee80du}, + {0x3dcccccdu, 0x3f400000u, 0x0000ba00u, 0xe8a8529fu}, + {0x7fa00000u, 0x40b5e831u, 0x54ed5567u, 0xe779c470u}, + {0xbfa4797cu, 0x43000000u, 0x3800c85au, 0x691406beu}, + {0x4036ac94u, 0xba85a805u, 0x53869182u, 0xec007b1bu}, + {0xbeffcf24u, 0x00000000u, 0xa7e21400u, 0x686e80a9u}, + {0x7fa00000u, 0x3f800000u, 0xbd813570u, 0x75dd67deu}, + {0xbb27aea0u, 0xbf9e8d90u, 0x1a67bbffu, 0x526c5cc5u}, + {0xbe381e7fu, 0xbc0a3bbfu, 0x2ce6fe00u, 0xc9794969u}, + {0xc2fc0000u, 0x3cee8ea0u, 0x5484b800u, 0x6bd881fdu}, + {0x421c4347u, 0x3dcccccdu, 0xf08320f5u, 0xd2d0d097u}, + {0x40200000u, 0xbf800000u, 0x4e023c00u, 0x7d7015fcu}, + {0x384fbc0eu, 0x42d05018u, 0x3bff8400u, 0x75f99ac4u}, + {0xffc00000u, 0xb966cd34u, 0x8000bbffu, 0xefbd6b85u}, + {0xb3800000u, 0x3abb690bu, 0xf181eaa6u, 0xaae550d5u}, + {0xc2473fefu, 0xbf000000u, 0x6bdefc01u, 0x291e6ca0u}, + {0x3e720beau, 0x3f000000u, 0xac8cacf7u, 0x2feb67afu}, + {0xb8732b55u, 0x38281e0au, 0x185eb800u, 0x43a10696u}, + {0xbb96ece4u, 0xbe800000u, 0x64004248u, 0xa51d4257u}, + {0xbe800000u, 0xc2fc0000u, 0xc4725640u, 0x90e5ac8du}, + {0xc0200000u, 0xbf000000u, 0x95fe0d70u, 0x89f40abfu}, + {0x3df74341u, 0x7fc00000u, 0x3e007c01u, 0xc9717e02u}, + {0x3f000000u, 0xbc321c7bu, 0x26983800u, 0x7d3055d3u} +}; +constexpr std::uint32_t Expected[32][54] = { + {0x80000000u, 0x3f800000u, 0xbf800000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x3f7fffffu, 0x007fffffu, 0xffffff82u, 0xffffff82u, 0xbf7ffffeu, 0x3f7ffffeu, 0x80000000u, 0x00000000u, 0xff800000u, 0x7f800000u, 0xff800000u, 0x7f800000u, 0xff800000u, 0x7f800000u, 0xff800000u, 0xff800000u, 0x3f800000u, 0x3f800000u, 0x81c90fd3u, 0x01c90fd3u, 0x3f800000u, 0x3f800000u, 0x13573c00u, 0x13573c00u, 0x13570000u, 0x13573c00u, 0x13570000u, 0x13573c00u, 0x13570000u, 0x13573c00u, 0x13573800u, 0x13570000u, 0x135739a8u, 0x13573c00u, 0x13573da8u, 0x13573c00u, 0x13574000u, 0x13573c00u, 0x1357bc00u, 0x13570000u, 0x13573da8u, 0x13574000u, 0x13570000u, 0x13570000u, 0x1357bc00u, 0x13573c00u}, + {0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x00000000u, 0x00000000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x7fc00001u, 0xffc00000u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u, 0x1234fe00u, 0x12347e01u}, + {0xff800000u, 0x80000000u, 0xff800000u, 0x80000000u, 0xff800000u, 0x80000000u, 0xff800000u, 0x80000000u, 0xffc00000u, 0x00000000u, 0x00000000u, 0x00000000u, 0xff800000u, 0x80000000u, 0xffc00000u, 0x80000000u, 0xffc00000u, 0xff800000u, 0x80000000u, 0xff800000u, 0x80000000u, 0xff800000u, 0xffc00000u, 0xff800000u, 0x00000000u, 0x3f800000u, 0xffc00000u, 0x80000000u, 0xffc00000u, 0x3f800000u, 0x9abc8000u, 0x9abcfc00u, 0x9abc8000u, 0x9abcfc00u, 0x9abc8000u, 0x9abcfc00u, 0x9abc8000u, 0x9abcfc00u, 0x9abc0000u, 0x9abcfe00u, 0x9abc8000u, 0x9abcfe00u, 0x9abcfc00u, 0x9abcfe00u, 0x9abcfc00u, 0x9abc8000u, 0x9abcfc00u, 0x9abcfe00u, 0x9abc3c00u, 0x9abc0000u, 0x9abc8000u, 0x9abcfe00u, 0x9abc3c00u, 0x9abcfe00u}, + {0x80000000u, 0x3f800000u, 0xbf800000u, 0x3f800000u, 0x80000000u, 0x3f800000u, 0x80000000u, 0x3f800000u, 0x3f7fffffu, 0x00000000u, 0xffffffe3u, 0x00000001u, 0xbf000000u, 0x3f000000u, 0xffc00000u, 0x3f800000u, 0xffc00000u, 0x3f800000u, 0xce800000u, 0x3f800000u, 0xce800000u, 0x3f800000u, 0xffc00000u, 0x00000000u, 0x3f800000u, 0x40000000u, 0xb1c90fd5u, 0x00000000u, 0x3f800000u, 0x3f800000u, 0x55553c00u, 0x55558000u, 0x55550000u, 0x5555bc00u, 0x55550000u, 0x55558000u, 0x55550000u, 0x55558000u, 0x55553400u, 0x55553bffu, 0x55553800u, 0x5555fe00u, 0x55554000u, 0x5555fe00u, 0x55554400u, 0x5555f400u, 0x5555c000u, 0x5555fe00u, 0x55553cc2u, 0x55553c00u, 0x55553c00u, 0x55558e48u, 0x55550000u, 0x55553c00u}, + {0x7f800000u, 0x3f800000u, 0x7f800000u, 0x00000000u, 0x7f800000u, 0x00000000u, 0x7f800000u, 0x00000000u, 0xffc00000u, 0x3e2b6c1au, 0x00000000u, 0xfffffffeu, 0x7f800000u, 0x3f2b6c1au, 0x7f800000u, 0x3ed17c3eu, 0x00000000u, 0x401c6be5u, 0x00000000u, 0x40bf2759u, 0x00000000u, 0x40bf2759u, 0x7f800000u, 0xc025079cu, 0x7f800000u, 0x3f8fbfa7u, 0xffc00000u, 0x3f5e4b27u, 0xffc00000u, 0x3efdf103u, 0x2de07c00u, 0x2de0bc00u, 0x2de07c00u, 0x2de0c000u, 0x2de07c00u, 0x2de0bc00u, 0x2de07c00u, 0x2de0c000u, 0x2de0fe00u, 0x2de03800u, 0x2de07c00u, 0x2de0fe00u, 0x2de00000u, 0x2de0fe00u, 0x2de00000u, 0x2de0b955u, 0x2de07c00u, 0x2de0fe00u, 0x2de07c00u, 0x2de035a8u, 0x2de0fe00u, 0x2de00000u, 0x2de0fe00u, 0x2de0bc00u}, + {0xbf800000u, 0x43000000u, 0xc0000000u, 0x43000000u, 0xbf800000u, 0x43000000u, 0xc0000000u, 0x43000000u, 0x3f000000u, 0x00000000u, 0x00000001u, 0x00000008u, 0xbf400000u, 0x3f000000u, 0xffc00000u, 0x413504f3u, 0xffc00000u, 0x3db504f3u, 0xbf2aaaaau, 0x3c000000u, 0xbf2aaaaau, 0x3c000000u, 0xffc00000u, 0x40e00000u, 0x3eb504f3u, 0x7f800000u, 0x00000000u, 0x00000000u, 0xbf800000u, 0x3f800000u, 0x72746401u, 0x72740000u, 0x72746401u, 0x72740000u, 0x72746401u, 0x72740000u, 0x72746401u, 0x72740000u, 0x72740000u, 0x72740000u, 0x72745000u, 0x72740000u, 0x727427ffu, 0x72747c00u, 0x727413feu, 0x72747c00u, 0x72744900u, 0x7274fc00u, 0x72747c00u, 0x72743c00u, 0x72740000u, 0x72740000u, 0x72743c00u, 0x72743c00u}, + {0xc2fc0000u, 0x7fc00000u, 0xc2fc0000u, 0x7fc00000u, 0xc2fc0000u, 0x7fc00000u, 0xc2fc0000u, 0x7fc00000u, 0x00000000u, 0x7fc00000u, 0x00000007u, 0x00000000u, 0xbf7c0000u, 0x7fc00000u, 0xffc00000u, 0x7fc00000u, 0xffc00000u, 0x7fc00000u, 0xbc020820u, 0x7fc00000u, 0xbc020820u, 0x7fc00000u, 0xffc00000u, 0x7fc00000u, 0x00800000u, 0x7fc00000u, 0x00000000u, 0x7fc00000u, 0x3f800000u, 0x7fc00000u, 0x94d3fe01u, 0x94d3c000u, 0x94d3fe01u, 0x94d3c200u, 0x94d3fe01u, 0x94d3c000u, 0x94d3fe01u, 0x94d3c000u, 0x94d3fe01u, 0x94d338fcu, 0x94d3fe01u, 0x94d3fe00u, 0x94d3fe01u, 0x94d3fe00u, 0x94d3fe01u, 0x94d3b6bbu, 0x94d3fe01u, 0x94d3fe00u, 0x94d3fe01u, 0x94d33229u, 0x94d3fe01u, 0x94d3b996u, 0x94d3fe01u, 0x94d3b9bau}, + {0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x00000000u, 0x00000000u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0x7fe00000u, 0xffc00001u, 0xfb204800u, 0xfb20ebdbu, 0xfb204800u, 0xfb20ebdbu, 0xfb204800u, 0xfb20ebdbu, 0xfb204800u, 0xfb20ebdbu, 0xfb200000u, 0xfb200000u, 0xfb2041a8u, 0xfb20fe00u, 0xfb2035a8u, 0xfb20fe00u, 0xfb203000u, 0xfb208c13u, 0xfb204200u, 0xfb20fe00u, 0xfb205c00u, 0xfb200000u, 0xfb200000u, 0xfb200000u, 0xfb203c00u, 0xfb203c00u}, + {0xbf800000u, 0x3f800000u, 0xbf800000u, 0x00000000u, 0xbf800000u, 0x00000000u, 0xbf800000u, 0x00000000u, 0x00000000u, 0x3ab77039u, 0x00000001u, 0xfffffff7u, 0xbf000000u, 0x3f377039u, 0xffc00000u, 0x3d193b72u, 0xffc00000u, 0x41d5d86bu, 0xbf800000u, 0x4432a1d8u, 0xbf800000u, 0x4432a1d8u, 0xffc00000u, 0xc117b18fu, 0x3f000000u, 0x3f801fceu, 0x00000000u, 0x3c101202u, 0x3f800000u, 0x3f7ffd77u, 0xeb606400u, 0xeb607e00u, 0xeb6063feu, 0xeb607e00u, 0xeb6063feu, 0xeb607e00u, 0xeb606400u, 0xeb607e00u, 0xeb603800u, 0xeb607e00u, 0xeb604fffu, 0xeb607e00u, 0xeb602800u, 0xeb607e00u, 0xeb601401u, 0xeb607e00u, 0xeb604900u, 0xeb607e00u, 0xeb607c00u, 0xeb607e00u, 0xeb600000u, 0xeb607e00u, 0xeb60bc00u, 0xeb607e00u}, + {0x00000000u, 0x3f800000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x3f800000u, 0x00000000u, 0x3f400000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x3f400000u, 0x00000000u, 0x3f5db3d7u, 0x7f800000u, 0x3f93cd3au, 0x7f800000u, 0x3faaaaaau, 0x7f800000u, 0x3faaaaaau, 0xff800000u, 0xbed47fccu, 0x3f800000u, 0x3fd744fdu, 0x00000000u, 0xbf800000u, 0x3f800000u, 0x00000000u, 0x8a4e3c00u, 0x8a4e8000u, 0x8a4e0000u, 0x8a4ebc00u, 0x8a4e0000u, 0x8a4e8000u, 0x8a4e0000u, 0x8a4e8000u, 0x8a4e236cu, 0x8a4e3bf8u, 0x8a4e2fb5u, 0x8a4efe00u, 0x8a4e4827u, 0x8a4efe00u, 0x8a4e5450u, 0x8a4edc32u, 0x8a4ec61cu, 0x8a4efe00u, 0x8a4e3c0au, 0x8a4e3bfbu, 0x8a4e2dd2u, 0x8a4ea5feu, 0x8a4e3bf8u, 0x8a4e3bffu}, + {0x3f800000u, 0x3f800000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x3f800000u, 0x3dcccccdu, 0x3f400000u, 0xfffffffdu, 0x00000000u, 0x3f4ccccdu, 0x3f400000u, 0x3ea1e89bu, 0x3f5db3d7u, 0x404a62c2u, 0x3f93cd3au, 0x41200000u, 0x3faaaaaau, 0x41200000u, 0x3faaaaaau, 0xc0549a79u, 0xbed47fccu, 0x3f892fdfu, 0x3fd744fdu, 0x3f167919u, 0xbf800000u, 0x3f4f1bbdu, 0x00000000u, 0xe8a88000u, 0xe8a80000u, 0xe8a8bc00u, 0xe8a80000u, 0xe8a88000u, 0xe8a80000u, 0xe8a8bc00u, 0xe8a80000u, 0xe8a83400u, 0xe8a80000u, 0xe8a8fe00u, 0xe8a80000u, 0xe8a8fe00u, 0xe8a87c00u, 0xe8a8bd55u, 0xe8a87c00u, 0xe8a8fe00u, 0xe8a8fc00u, 0xe8a838c2u, 0xe8a83c00u, 0xe8a83c00u, 0xe8a80000u, 0xe8a80000u, 0xe8a83c00u}, + {0x7fe00000u, 0x40c00000u, 0x7fe00000u, 0x40a00000u, 0x7fe00000u, 0x40a00000u, 0x7fe00000u, 0x40c00000u, 0x7fe00000u, 0x3f2f4188u, 0x00000000u, 0x00000003u, 0x7fe00000u, 0x3f35e831u, 0x7fe00000u, 0x4018975du, 0x7fe00000u, 0x3ed6be5du, 0x7fe00000u, 0x3e3422d1u, 0x7fe00000u, 0x3e3422d1u, 0x7fe00000u, 0x402073a0u, 0x7fe00000u, 0x424dba58u, 0x7fe00000u, 0xbf6aaf52u, 0x7fe00000u, 0xbecc89e7u, 0xe7795570u, 0xe77954f0u, 0xe7795560u, 0xe77954e0u, 0xe7795560u, 0xe77954e0u, 0xe7795560u, 0xe77954f0u, 0xe7793700u, 0xe7793a80u, 0xe77948a6u, 0xe7794870u, 0xe7792ee2u, 0xe7792f36u, 0xe77921ecu, 0xe779227fu, 0xe779466fu, 0xe779464du, 0xe7797c00u, 0xe7797c00u, 0xe779361fu, 0xe779bb64u, 0xe779bb64u, 0xe779361fu}, + {0xbf800000u, 0x43000000u, 0xc0000000u, 0x43000000u, 0xbf800000u, 0x43000000u, 0xbf800000u, 0x43000000u, 0x3f370d08u, 0x00000000u, 0x00000001u, 0x00000008u, 0xbf24797cu, 0x3f000000u, 0xffc00000u, 0x413504f3u, 0xffc00000u, 0x3db504f3u, 0xbf473a78u, 0x3c000000u, 0xbf473a78u, 0x3c000000u, 0xffc00000u, 0x40e00000u, 0x3ed21db6u, 0x7f800000u, 0xbf79d980u, 0x00000000u, 0xbe5f1c7bu, 0x3f800000u, 0x6914c800u, 0x69143c00u, 0x6914c880u, 0x69140000u, 0x6914c800u, 0x69140000u, 0x6914c880u, 0x69140000u, 0x691434c0u, 0x69143800u, 0x6914fe00u, 0x691439a8u, 0x6914fe00u, 0x69143da8u, 0x6914af5bu, 0x69144000u, 0x6914fe00u, 0x6914bc00u, 0x691418eau, 0x69143da8u, 0x69143ba8u, 0x69140000u, 0x6914b4a5u, 0x6914bc00u}, + {0x40400000u, 0x80000000u, 0x40000000u, 0xbf800000u, 0x40000000u, 0x80000000u, 0x40400000u, 0x80000000u, 0x3f5ab250u, 0x3f7fbd2cu, 0x00000002u, 0xfffffff7u, 0x3f36ac94u, 0xbf05a805u, 0x3fd8404eu, 0xffc00000u, 0x3f17870au, 0xffc00000u, 0x3eb36129u, 0xc4752a85u, 0x3eb36129u, 0xc4752a85u, 0x3fc1ae32u, 0xffc00000u, 0x40e767f9u, 0x3f7fd1b2u, 0xbf4afbf1u, 0xbbd1f20bu, 0x3f1bfde3u, 0x3f7ffea7u, 0xec008000u, 0xec0053a0u, 0xec00bc00u, 0xec005380u, 0xec008000u, 0xec005380u, 0xec008000u, 0xec005380u, 0xec003bffu, 0xec003200u, 0xec00fe00u, 0xec0047c2u, 0xec00fe00u, 0xec003020u, 0xec00e5cfu, 0xec002441u, 0xec00fe00u, 0xec0045e9u, 0xec003bffu, 0xec007c00u, 0xec009c53u, 0xec003b64u, 0xec003c00u, 0xec00361fu}, + {0x80000000u, 0x00000000u, 0xbf800000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x3f00186eu, 0x00000000u, 0xffffffffu, 0x00000000u, 0xbf7fcf24u, 0x00000000u, 0xffc00000u, 0x00000000u, 0xffc00000u, 0x7f800000u, 0xc0001873u, 0x7f800000u, 0xc0001873u, 0x7f800000u, 0xffc00000u, 0xff800000u, 0x3f3510edu, 0x3f800000u, 0xbb197f05u, 0x00000000u, 0xbf7fffd1u, 0x3f800000u, 0x686e3c00u, 0x686e8000u, 0x686e0000u, 0x686ebc00u, 0x686e0000u, 0x686e8000u, 0x686e0000u, 0x686e8000u, 0x686e1400u, 0x686e3bc1u, 0x686e2800u, 0x686efe00u, 0x686e5000u, 0x686efe00u, 0x686e6400u, 0x686ed00fu, 0x686ec900u, 0x686efe00u, 0x686e3c01u, 0x686e3bd5u, 0x686e1e48u, 0x686eb227u, 0x686e3c00u, 0x686e3bdau}, + {0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x7fe00000u, 0x3f000000u, 0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x3f800000u, 0x7fe00000u, 0x00000000u, 0x7fe00000u, 0x40000000u, 0x7fe00000u, 0x00000000u, 0x7fe00000u, 0x3f800000u, 0x75dd3c00u, 0x75ddbc00u, 0x75dd0000u, 0x75ddc000u, 0x75dd0000u, 0x75ddbc00u, 0x75dd0000u, 0x75ddbc00u, 0x75dd3570u, 0x75dd38feu, 0x75dd38aau, 0x75ddfe00u, 0x75dd3eddu, 0x75ddfe00u, 0x75dd41e3u, 0x75ddb9d0u, 0x75ddbe3au, 0x75ddfe00u, 0x75dd3d10u, 0x75dd362au, 0x75dd3ac2u, 0x75ddb99fu, 0x75ddb848u, 0x75ddb9b1u}, + {0x80000000u, 0xbf800000u, 0xbf800000u, 0xc0000000u, 0x80000000u, 0xbf800000u, 0x80000000u, 0xbf800000u, 0x3f7f5851u, 0x3f42e4e0u, 0xfffffff8u, 0x00000001u, 0xbf27aea0u, 0xbf1e8d90u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xc3c36ad8u, 0xbf4eab4au, 0xc3c36ad8u, 0xbf4eab4au, 0xffc00000u, 0xffc00000u, 0x3f7f8be0u, 0x3ed8f684u, 0xbc83b10eu, 0xbf7f5abeu, 0x3f7ff787u, 0x3d91591fu, 0x526c8000u, 0x526c3c00u, 0x526cbc00u, 0x526c0000u, 0x526c8000u, 0x526c0000u, 0x526cbc00u, 0x526c0000u, 0x526c1000u, 0x526c1a67u, 0x526cfe00u, 0x526c2b28u, 0x526cfe00u, 0x526c4c79u, 0x526cbc01u, 0x526c5d00u, 0x526cfe00u, 0x526cc829u, 0x526c3800u, 0x526c3c02u, 0x526c1a48u, 0x526c2507u, 0x526c3c00u, 0x526c3c00u}, + {0x80000000u, 0x80000000u, 0xbf800000u, 0xbf800000u, 0x80000000u, 0x80000000u, 0x80000000u, 0x80000000u, 0x3f51f860u, 0x3f7dd711u, 0xfffffffeu, 0xfffffffau, 0xbf381e7fu, 0xbf0a3bbfu, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xc0b1f8c4u, 0xc2ed0c63u, 0xc0b1f8c4u, 0xc2ed0c63u, 0xffc00000u, 0xffc00000u, 0x3f6200b1u, 0x3f7e81dbu, 0xbf67804fu, 0xbd5908e3u, 0x3eda91e0u, 0x3f7fa3efu, 0xc979fe00u, 0xc9793c00u, 0xc979fe00u, 0xc9790000u, 0xc979fe00u, 0xc9790000u, 0xc979fe00u, 0xc9790000u, 0xc979fe00u, 0xc9792ce6u, 0xc979fe00u, 0xc979346du, 0xc979fe00u, 0xc979433bu, 0xc979fe00u, 0xc9794a88u, 0xc979fe00u, 0xc979c36au, 0xc979fe00u, 0xc9793c38u, 0xc979fe00u, 0xc9793767u, 0xc979fe00u, 0xc9793b18u}, + {0xc2fc0000u, 0x3f800000u, 0xc2fc0000u, 0x00000000u, 0xc2fc0000u, 0x00000000u, 0xc2fc0000u, 0x00000000u, 0x00000000u, 0x3cee8ea0u, 0x00000007u, 0xfffffffbu, 0xbf7c0000u, 0x3f6e8ea0u, 0xffc00000u, 0x3e2ebe5au, 0xffc00000u, 0x40bb853fu, 0xbc020820u, 0x42095bf0u, 0xbc020820u, 0x42095bf0u, 0xffc00000u, 0xc0a34205u, 0x00800000u, 0x3f829c24u, 0x00000000u, 0x3e3a5195u, 0x3f800000u, 0x3f7bba09u, 0x6bd88000u, 0x6bd85490u, 0x6bd8bc00u, 0x6bd85480u, 0x6bd88000u, 0x6bd85480u, 0x6bd88000u, 0x6bd85480u, 0x6bd83800u, 0x6bd83400u, 0x6bd8fe00u, 0x6bd84840u, 0x6bd8fe00u, 0x6bd82f88u, 0x6bd8c000u, 0x6bd82316u, 0x6bd8fe00u, 0x6bd8462du, 0x6bd839a8u, 0x6bd87c00u, 0x6bd80000u, 0x6bd83c00u, 0x6bd8bc00u, 0x6bd80000u}, + {0x42200000u, 0x3f800000u, 0x421c0000u, 0x00000000u, 0x421c0000u, 0x00000000u, 0x421c0000u, 0x00000000u, 0x3d868e00u, 0x3dcccccdu, 0x00000006u, 0xfffffffdu, 0x3f1c4347u, 0x3f4ccccdu, 0x40c80219u, 0x3ea1e89bu, 0x3e23d552u, 0x404a62c2u, 0x3cd1b2b1u, 0x41200000u, 0x3cd1b2b1u, 0x41200000u, 0x40a935e8u, 0xc0549a79u, 0x5305f6c3u, 0x3f892fdfu, 0x3ecd67efu, 0x3f167919u, 0x3f6a7ed2u, 0x3f4f1bbdu, 0xd2d03c00u, 0xd2d0f083u, 0xd2d00000u, 0xd2d0f083u, 0xd2d00000u, 0xd2d0f083u, 0xd2d00000u, 0xd2d0f083u, 0xd2d020f5u, 0xd2d00000u, 0xd2d02e4cu, 0xd2d0fe00u, 0xd2d04915u, 0xd2d0fe00u, 0xd2d05675u, 0xd2d08718u, 0xd2d0c6b1u, 0xd2d0fe00u, 0xd2d03c07u, 0xd2d00000u, 0xd2d02bc8u, 0xd2d00000u, 0xd2d03bfcu, 0xd2d03c00u}, + {0x40400000u, 0xbf800000u, 0x40000000u, 0xbf800000u, 0x40000000u, 0xbf800000u, 0x40000000u, 0xbf800000u, 0x3f000000u, 0x00000000u, 0x00000002u, 0x00000001u, 0x3f200000u, 0xbf000000u, 0x3fca62c2u, 0xffc00000u, 0x3f21e89bu, 0xffc00000u, 0x3ecccccdu, 0xbf800000u, 0x3ecccccdu, 0xbf800000u, 0x3fa934f0u, 0xffc00000u, 0x40b504f3u, 0x3f000000u, 0x00000000u, 0x00000000u, 0xbf800000u, 0x3f800000u, 0x7d703c00u, 0x7d704e40u, 0x7d703c00u, 0x7d704e00u, 0x7d703c00u, 0x7d704e00u, 0x7d703c00u, 0x7d704e00u, 0x7d700000u, 0x7d702800u, 0x7d703c00u, 0x7d7044e7u, 0x7d703c00u, 0x7d703287u, 0x7d703c00u, 0x7d702954u, 0x7d700000u, 0x7d704496u, 0x7d704000u, 0x7d707c00u, 0x7d700000u, 0x7d70323eu, 0x7d703c00u, 0x7d703bd9u}, + {0x3f800000u, 0x42d20000u, 0x00000000u, 0x42d00000u, 0x00000000u, 0x42d00000u, 0x00000000u, 0x42d00000u, 0x384fbc0eu, 0x3e203000u, 0xfffffff2u, 0x00000007u, 0x3f4fbc0eu, 0x3f505018u, 0x3be69ba6u, 0x41234a92u, 0x430e180cu, 0x3dc8ac0cu, 0x469dbd5fu, 0x3c1d4d46u, 0x469dbd5fu, 0x3c1d4d46u, 0xc164d28cu, 0x40d67bc4u, 0x3f800120u, 0x738ea8dcu, 0x39a32780u, 0x3f55050cu, 0x3f7fffffu, 0x3f0dfb22u, 0x75f98000u, 0x75f93c00u, 0x75f9bc00u, 0x75f90000u, 0x75f98000u, 0x75f90000u, 0x75f98000u, 0x75f93c00u, 0x75f93bffu, 0x75f93bffu, 0x75f9fe00u, 0x75f93bffu, 0x75f9fe00u, 0x75f93c00u, 0x75f9f400u, 0x75f93c01u, 0x75f9fe00u, 0x75f991c6u, 0x75f93c00u, 0x75f93fffu, 0x75f98e48u, 0x75f99a48u, 0x75f93c00u, 0x75f93c00u}, + {0xffc00000u, 0x80000000u, 0xffc00000u, 0xbf800000u, 0xffc00000u, 0x80000000u, 0xffc00000u, 0x80000000u, 0xffc00000u, 0x3f7ff193u, 0x00000000u, 0xfffffff4u, 0xffc00000u, 0xbf66cd34u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xc58df98au, 0xffc00000u, 0xc58df98au, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0x3f7ff600u, 0xffc00000u, 0xbab54564u, 0xffc00000u, 0x3f7fffefu, 0xefbd8000u, 0xefbd8000u, 0xefbdbc00u, 0xefbd8000u, 0xefbd8000u, 0xefbd8000u, 0xefbdbc00u, 0xefbd8000u, 0xefbd1000u, 0xefbd0000u, 0xefbdfe00u, 0xefbd8000u, 0xefbdfe00u, 0xefbdfc00u, 0xefbdbc01u, 0xefbdfc00u, 0xefbdfe00u, 0xefbdfc00u, 0xefbd3800u, 0xefbd3c00u, 0xefbd1a48u, 0xefbd8000u, 0xefbd3c00u, 0xefbd3c00u}, + {0x80000000u, 0x3f800000u, 0xbf800000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x3f7fffffu, 0x3abb690bu, 0xffffffe9u, 0xfffffff7u, 0xbf000000u, 0x3f3b690bu, 0xffc00000u, 0x3d1ae1ddu, 0xffc00000u, 0x41d3912fu, 0xcb800000u, 0x442ed8a7u, 0xcb800000u, 0x442ed8a7u, 0xffc00000u, 0xc11732f8u, 0x3f7fffffu, 0x3f80207eu, 0xb4c90fd5u, 0x3c133094u, 0x3f800000u, 0x3f7ffd5au, 0xaae5eaa6u, 0xaae5f181u, 0xaae5eaa6u, 0xaae5f181u, 0xaae5eaa6u, 0xaae5f181u, 0xaae5eaa6u, 0xaae5f181u, 0xaae50000u, 0xaae50000u, 0xaae5fe00u, 0xaae5fe00u, 0xaae5fe00u, 0xaae5fe00u, 0xaae58cd0u, 0xaae585d0u, 0xaae5fe00u, 0xaae5fe00u, 0xaae50000u, 0xaae50000u, 0xaae50000u, 0xaae50000u, 0xaae53c00u, 0xaae53c00u}, + {0xc2440000u, 0x80000000u, 0xc2480000u, 0xbf800000u, 0xc2440000u, 0x80000000u, 0xc2480000u, 0x80000000u, 0x3e401100u, 0x3f000000u, 0x00000006u, 0x00000000u, 0xbf473fefu, 0xbf000000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xbca474f9u, 0xc0000000u, 0xbca474f9u, 0xc0000000u, 0xffc00000u, 0xffc00000u, 0x2691c581u, 0x3f3504f3u, 0x3f6c8d95u, 0x00000000u, 0x3ec3bdbcu, 0xbf800000u, 0x291efe01u, 0x291e6bdeu, 0x291efe01u, 0x291e6bdeu, 0x291efe01u, 0x291e6bdeu, 0x291efe01u, 0x291e6bdeu, 0x291efe01u, 0x291e0000u, 0x291efe01u, 0x291e53efu, 0x291efe01u, 0x291e2409u, 0x291efe01u, 0x291e0c11u, 0x291efe01u, 0x291e49fdu, 0x291efe01u, 0x291e7c00u, 0x291efe01u, 0x291e0000u, 0x291efe01u, 0x291e3c00u}, + {0x3f800000u, 0x3f800000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x3e720beau, 0x3f000000u, 0xfffffffeu, 0x00000000u, 0x3f720beau, 0x3f000000u, 0x3ef8ecefu, 0x3f3504f3u, 0x4003a345u, 0x3fb504f3u, 0x40876101u, 0x40000000u, 0x40876101u, 0x40000000u, 0xc0052ccdu, 0xbf800000u, 0x3f96c99du, 0x3fb504f3u, 0x3f7f0ff2u, 0x00000000u, 0x3daf2153u, 0xbf800000u, 0x2feb8000u, 0x2feb8000u, 0x2febbc00u, 0x2febbc00u, 0x2feb8000u, 0x2feb8000u, 0x2feb8000u, 0x2feb8000u, 0x2feb3b61u, 0x2feb3b6eu, 0x2febfe00u, 0x2febfe00u, 0x2febfe00u, 0x2febfe00u, 0x2febca72u, 0x2febcb0au, 0x2febfe00u, 0x2febfe00u, 0x2feb3b95u, 0x2feb3b9eu, 0x2febb77eu, 0x2febb6e8u, 0x2feb3b11u, 0x2feb3b37u}, + {0x80000000u, 0x3f800000u, 0xbf800000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x3f7ffc33u, 0x38281e0au, 0xfffffff2u, 0xfffffff2u, 0xbf732b55u, 0x3f281e0au, 0xffc00000u, 0x3bcf74c4u, 0xffc00000u, 0x431df394u, 0xc686c0feu, 0x46c2e957u, 0xc686c0feu, 0x46c2e957u, 0xffc00000u, 0xc169b4f2u, 0x3f7ffd5eu, 0x3f8000e9u, 0xb9befc10u, 0x398409fbu, 0x3f7ffffeu, 0x3f7fffffu, 0x43a18000u, 0x43a13c00u, 0x43a1bc00u, 0x43a10000u, 0x43a18000u, 0x43a10000u, 0x43a18000u, 0x43a10000u, 0x43a13800u, 0x43a1185eu, 0x43a1fe00u, 0x43a129e9u, 0x43a1fe00u, 0x43a14d6au, 0x43a1c000u, 0x43a15f54u, 0x43a1fe00u, 0x43a1c870u, 0x43a139a8u, 0x43a13c02u, 0x43a10000u, 0x43a122dcu, 0x43a1bc00u, 0x43a13c00u}, + {0x80000000u, 0x80000000u, 0xbf800000u, 0xbf800000u, 0x80000000u, 0x80000000u, 0x80000000u, 0x80000000u, 0x3f7ed226u, 0x3f400000u, 0xfffffff9u, 0xffffffffu, 0xbf16ece4u, 0xbf000000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xc3591d2cu, 0xc0800000u, 0xc3591d2cu, 0xc0800000u, 0xffc00000u, 0xffc00000u, 0x3f7f2f1bu, 0x3f5744fdu, 0xbced0a3eu, 0xbf800000u, 0x3f7fe48eu, 0x00000000u, 0xa51d4400u, 0xa51d6400u, 0xa51d4200u, 0xa51d6400u, 0xa51d4200u, 0xa51d6400u, 0xa51d4200u, 0xa51d6400u, 0xa51d3080u, 0xa51d0000u, 0xa51d3f17u, 0xa51d5000u, 0xa51d3884u, 0xa51d2800u, 0xa51d3518u, 0xa51d1400u, 0xa51d3e9bu, 0xa51d4900u, 0xa51d4869u, 0xa51d7c00u, 0xa51d3a2fu, 0xa51d0000u, 0xa51d3913u, 0xa51d3c00u}, + {0x80000000u, 0xc2fc0000u, 0xbf800000u, 0xc2fc0000u, 0x80000000u, 0xc2fc0000u, 0x80000000u, 0xc2fc0000u, 0x3f400000u, 0x00000000u, 0xffffffffu, 0x00000007u, 0xbf000000u, 0xbf7c0000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xc0800000u, 0xbc020820u, 0xc0800000u, 0xbc020820u, 0xffc00000u, 0xffc00000u, 0x3f5744fdu, 0x00800000u, 0xbf800000u, 0x00000000u, 0x00000000u, 0x3f800000u, 0x90e55640u, 0x90e5c400u, 0x90e55640u, 0x90e5c500u, 0x90e55640u, 0x90e5c400u, 0x90e55640u, 0x90e5c400u, 0x90e50000u, 0x90e53870u, 0x90e54900u, 0x90e5fe00u, 0x90e52e66u, 0x90e5fe00u, 0x90e5211fu, 0x90e5b333u, 0x90e546a5u, 0x90e5fe00u, 0x90e57c00u, 0x90e529e0u, 0x90e50000u, 0x90e5b564u, 0x90e53c00u, 0x90e5bb88u}, + {0xc0000000u, 0x80000000u, 0xc0400000u, 0xbf800000u, 0xc0000000u, 0x80000000u, 0xc0000000u, 0x80000000u, 0x3f000000u, 0x3f000000u, 0x00000002u, 0x00000000u, 0xbf200000u, 0xbf000000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xbecccccdu, 0xc0000000u, 0xbecccccdu, 0xc0000000u, 0xffc00000u, 0xffc00000u, 0x3e3504f3u, 0x3f3504f3u, 0x00000000u, 0x00000000u, 0xbf800000u, 0xbf800000u, 0x89f43c00u, 0x89f48000u, 0x89f40000u, 0x89f4bc00u, 0x89f40000u, 0x89f48000u, 0x89f40000u, 0x89f48000u, 0x89f40d70u, 0x89f43bfdu, 0x89f424aau, 0x89f4fe00u, 0x89f452ddu, 0x89f4fe00u, 0x89f469e3u, 0x89f4e157u, 0x89f4c9c7u, 0x89f4fe00u, 0x89f43c00u, 0x89f43bfeu, 0x89f41845u, 0x89f4a0b5u, 0x89f43c00u, 0x89f43c00u}, + {0x3f800000u, 0x7fc00000u, 0x00000000u, 0x7fc00000u, 0x00000000u, 0x7fc00000u, 0x00000000u, 0x7fc00000u, 0x3df74341u, 0x7fc00000u, 0xfffffffdu, 0x00000000u, 0x3f774341u, 0x7fc00000u, 0x3eb1e746u, 0x7fc00000u, 0x40383098u, 0x7fc00000u, 0x410485e4u, 0x7fc00000u, 0x410485e4u, 0x7fc00000u, 0xc04334d3u, 0x7fc00000u, 0x3f8b2c3eu, 0x7fc00000u, 0x3f301a40u, 0x7fc00000u, 0x3f39ce5au, 0x7fc00000u, 0xc9717e01u, 0xc9714000u, 0xc9717e01u, 0xc9713c00u, 0xc9717e01u, 0xc9713c00u, 0xc9717e01u, 0xc9714000u, 0xc9717e01u, 0xc9713800u, 0xc9717e01u, 0xc9713ce6u, 0xc9717e01u, 0xc9713a88u, 0xc9717e01u, 0xc9713955u, 0xc9717e01u, 0xc97138aeu, 0xc9717e01u, 0xc97141a8u, 0xc9717e01u, 0xc9710000u, 0xc9717e01u, 0xc971bc00u}, + {0x3f800000u, 0x80000000u, 0x00000000u, 0xbf800000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x80000000u, 0x3f000000u, 0x3f7d378eu, 0x00000000u, 0xfffffffau, 0x3f000000u, 0xbf321c7bu, 0x3f3504f3u, 0xffc00000u, 0x3fb504f3u, 0xffc00000u, 0x40000000u, 0xc2b7f993u, 0x40000000u, 0xc2b7f993u, 0xbf800000u, 0xffc00000u, 0x3fb504f3u, 0x3f7e1407u, 0x00000000u, 0xbd8bc78bu, 0xbf800000u, 0x3f7f672du, 0x7d303c00u, 0x7d303c00u, 0x7d300000u, 0x7d300000u, 0x7d300000u, 0x7d300000u, 0x7d300000u, 0x7d300000u, 0x7d303800u, 0x7d302698u, 0x7d3039a8u, 0x7d303123u, 0x7d303da8u, 0x7d30463bu, 0x7d304000u, 0x7d3050dau, 0x7d30bc00u, 0x7d30c547u, 0x7d303da8u, 0x7d303c12u, 0x7d300000u, 0x7d303128u, 0x7d30bc00u, 0x7d303be5u} +}; +constexpr const char* Names[54] = {"ceil_f32 v4", "ceil_f32 v5", "floor_f32 v4", "floor_f32 v5", "trunc_f32 v4", "trunc_f32 v5", "rndne_f32 v4", "rndne_f32 v5", "fract_f32 v4", "fract_f32 v5", "frexp_exp_i32_f32 v4", "frexp_exp_i32_f32 v5", "frexp_mant_f32 v4", "frexp_mant_f32 v5", "sqrt_f32 v4", "sqrt_f32 v5", "rsq_f32 v4", "rsq_f32 v5", "rcp_f32 v4", "rcp_f32 v5", "rcp_iflag_f32 v4", "rcp_iflag_f32 v5", "log_f32 v4", "log_f32 v5", "exp_f32 v4", "exp_f32 v5", "sin_f32 v4", "sin_f32 v5", "cos_f32 v4", "cos_f32 v5", "ceil_f16 v6", "ceil_f16 v8", "floor_f16 v6", "floor_f16 v8", "trunc_f16 v6", "trunc_f16 v8", "rndne_f16 v6", "rndne_f16 v8", "fract_f16 v6", "fract_f16 v8", "sqrt_f16 v6", "sqrt_f16 v8", "rsq_f16 v6", "rsq_f16 v8", "rcp_f16 v6", "rcp_f16 v8", "log_f16 v6", "log_f16 v8", "exp_f16 v6", "exp_f16 v8", "sin_f16 v6", "sin_f16 v8", "cos_f16 v6", "cos_f16 v8"}; +constexpr std::uint64_t Checked[32] = {0x003fffffc3ffc000ull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull, 0x003fffffffffffffull}; +constexpr std::uint32_t Tolerance[54] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6}; + +void Fill(std::uint32_t tid, std::uint32_t* words) { + std::copy(std::begin(Rows[tid]), std::end(Rows[tid]), words); +} + +std::string Hex(std::uint32_t value); +void Expect(std::uint32_t tid, std::uint32_t actual, std::uint32_t expected, const char* name); + +double Half(std::uint32_t bits) { + const auto exponent = static_cast((bits >> 10u) & 0x1fu); + const double magnitude = exponent == 0x1f ? ((bits & 0x3ffu) ? NAN : INFINITY) : std::ldexp(static_cast((bits & 0x3ffu) | (exponent ? 0x400u : 0u)), (exponent ? exponent : 1) - 25); + return (bits & 0x8000u) ? -magnitude : magnitude; +} + +bool Finite(double value) { + return std::isfinite(value) && value != 0.0; +} + +void ExpectNear(std::uint32_t tid, std::uint32_t index, std::uint32_t actual, std::uint32_t expected) { + const bool half = Tolerance[index] >= 5u; + const double a = half ? Half(actual & 0xffffu) : std::bit_cast(actual); + const double e = half ? Half(expected & 0xffffu) : std::bit_cast(expected); + if (!Finite(e) || (half && (actual >> 16u) != (expected >> 16u))) { + Expect(tid, actual, expected, Names[index]); + return; + } + const double x = half ? Half((Rows[tid][2] >> (index % 2u ? 16u : 0u)) & 0xffffu) : std::bit_cast(Rows[tid][index % 2u]); + const double error = std::abs(a - e); + const double relative = error / std::abs(e); + bool near = false; + switch (Tolerance[index]) { + case 1u: near = relative <= 0x1p-20; break; + case 2u: near = error <= 0x1p-21 || relative <= 0x1p-20; break; + case 3u: near = relative <= (4.0 + 2.0 * std::abs(x)) * 0x1p-23; break; + case 4u: near = error <= 0x1p-11; break; + case 5u: near = relative <= 0x1p-9; break; + default: near = error <= 0x1p-10; break; + } + Require(near, std::string("vop1 float unary: lane ") + std::to_string(tid) + " " + Names[index] + " is " + Hex(actual) + ", expected near " + Hex(expected)); +} + +std::array BufferDescriptor(const void* data, std::uint32_t bytes) { + const auto address = reinterpret_cast(data); + return {static_cast(address), static_cast((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("vop1 float unary: 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 userData(8, 0u); + const auto input = BufferDescriptor(Input.data(), static_cast(Input.size() * 4u)); + const auto output = BufferDescriptor(Output.data(), static_cast(Output.size() * 4u)); + std::copy(input.begin(), input.end(), userData.begin()); + std::copy(output.begin(), output.end(), userData.begin() + 4); + const std::span code(Code); + const std::array memory{{{reinterpret_cast(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(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(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 < 54; ++i) { + if (((Checked[tid] >> i) & 1u) == 0u) continue; + if (Tolerance[i] == 0u) Expect(tid, out[i], Expected[tid][i], Names[i]); + else ExpectNear(tid, i, out[i], Expected[tid][i]); + } + } +} + +} + +int main() { + try { + const auto device = OpenVulkanTestDevice(); + if (!device) return VulkanTestSkipped; + Run(*device); + Check(); + std::puts("vop1 float unary tests passed"); + return 0; + } catch (const std::exception& error) { + std::cerr << error.what() << '\n'; + return 1; + } +} diff --git a/core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp b/core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp index a9fd72b2b..60181644a 100644 --- a/core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp +++ b/core/shader/recompiler/Translation/include/Translation/TranslationContext.hpp @@ -4,6 +4,7 @@ #include "Translation/InstructionTranslator.hpp" #include #include +#include namespace ShaderRecompiler { @@ -150,8 +151,8 @@ private: void vCvtPkU8F32(const RdnaInstruction& inst); void vPackB32F16(const RdnaInstruction& inst); bool packedFloat16(const RdnaInstruction& inst, IrOpcode opcode, bool accumulator, bool quietSnan); - bool float16Unary(const RdnaInstruction& inst, IrOpcode opcode, bool invalidNegative); - bool float16Trig(const RdnaInstruction& inst, IrOpcode opcode); + bool float16Unary(const RdnaInstruction& inst, IrOpcode opcode); + std::pair unaryFloatSpecials(IrOpcode opcode, IrF32 argument, IrF32 result); bool vDivFixupF16(const RdnaInstruction& inst); bool float16Binary(const RdnaInstruction& inst, IrOpcode opcode, bool reverse); bool float16Ternary(const RdnaInstruction& inst, IrOpcode opcode, bool accumulator, bool mix); diff --git a/core/shader/recompiler/Translation/src/FloatInstructions.cpp b/core/shader/recompiler/Translation/src/FloatInstructions.cpp index dd7abb7ee..133638b43 100644 --- a/core/shader/recompiler/Translation/src/FloatInstructions.cpp +++ b/core/shader/recompiler/Translation/src/FloatInstructions.cpp @@ -48,21 +48,92 @@ bool TranslationContext::packedFloat16(const RdnaInstruction& inst, IrOpcode opc return true; } -bool TranslationContext::float16Unary(const RdnaInstruction& inst, IrOpcode opcode, bool invalidNegative) { - const IrF32 argument = readF16AsF32(sourceAt(inst, 0u)); - const IrF32 result(ir.Emit(opcode, IrType::F32, {&argument.Value()})); - if (!invalidNegative) { - writeF16(inst.destination, result); - return true; +bool TranslationContext::float16Unary(const RdnaInstruction& inst, IrOpcode opcode) { + const RdnaOperand& operand = sourceAt(inst, 0u); + const IrF32 argument = readF16AsF32(operand); + const auto [result, invalid] = unaryFloatSpecials(opcode, argument, IrF32(ir.Emit(opcode, IrType::F32, {&argument.Value()}))); + IrU32 bits = packHalf2x16(applyF16ResultModifiers(inst.destination, result), IrF32(ir.ConstantF32(0.0f))); + if (opcode == IrOpcode::FPFract32) { + bits = IrU32(ir.Select(ir.IEqual(bits.Value(), ir.Constant(0x3c00u)), ir.Constant(0x3bffu), bits.Value())); } - const IrU1 negative(ir.Emit(IrOpcode::FPOrdLessThan32, IrType::U1, {&argument.Value(), &ir.ConstantF32(0.0f)})); - const IrF32 modified = applyF16ResultModifiers(inst.destination, result); - const IrU32 bits = packHalf2x16(modified, IrF32(ir.ConstantF32(0.0f))); - const IrU32 invalid(ir.Constant(inst.destination.clamp ? 0u : 0xfe00u)); - write16Bits(inst.destination, IrU32(ir.Select(negative.Value(), invalid.Value(), bits.Value()))); + const IrU32 half = readF16Bits(operand); + const IrU1 nan(ir.UGreaterThan(ir.BitwiseAnd(half.Value(), ir.Constant(0x7fffu)), ir.Constant(0x7c00u))); + const IrU32 special(ir.Select(nan.Value(), ir.BitwiseOr(half.Value(), ir.Constant(0x0200u)), ir.Constant(0xfe00u))); + const IrU32 value(ir.Select(ir.LogicalOr(nan.Value(), invalid.Value()), inst.destination.clamp ? ir.Constant(0u) : special.Value(), bits.Value())); + write16Bits(inst.destination, value); return true; } +std::pair TranslationContext::unaryFloatSpecials(IrOpcode opcode, IrF32 argument, IrF32 result) { + const IrU32 bits(ir.BitCastU32(argument.Value())); + const IrU32 magnitude(ir.BitwiseAnd(bits.Value(), ir.Constant(0x7fffffffu))); + const IrU32 sign(ir.BitwiseAnd(bits.Value(), ir.Constant(0x80000000u))); + const bool flushes = opcode == IrOpcode::FPRecip32 || opcode == IrOpcode::FPRecipIFlag32 || opcode == IrOpcode::FPRecipSqrt32 || opcode == IrOpcode::FPSqrt || opcode == IrOpcode::FPLog2 || opcode == IrOpcode::FPExp2; + const IrU1 zero(flushes ? ir.ULessThan(magnitude.Value(), ir.Constant(0x00800000u)) : ir.IEqual(magnitude.Value(), ir.Constant(0u))); + const IrU1 infinite(ir.IEqual(magnitude.Value(), ir.Constant(0x7f800000u))); + const IrU1 negative(ir.LogicalAnd(ir.INotEqual(sign.Value(), ir.Constant(0u)), ir.LogicalNot(zero.Value()))); + const IrU32 signedInfinity(ir.BitwiseOr(sign.Value(), ir.Constant(0x7f800000u))); + const auto pick = [&](IrU1 condition, IrValue& value, IrU32 current) { return IrU32(ir.Select(condition.Value(), value, current.Value())); }; + IrU32 value(ir.BitCastU32(result.Value())); + IrU1 invalid(ir.ConstantBool(false)); + switch (opcode) { + case IrOpcode::FPRecip32: + case IrOpcode::FPRecipIFlag32: + value = pick(infinite, sign.Value(), value); + value = pick(zero, signedInfinity.Value(), value); + break; + case IrOpcode::FPRecipSqrt32: + value = pick(infinite, ir.Constant(0u), value); + value = pick(zero, signedInfinity.Value(), value); + invalid = negative; + break; + case IrOpcode::FPSqrt: + value = pick(infinite, bits.Value(), value); + value = pick(zero, sign.Value(), value); + invalid = negative; + break; + case IrOpcode::FPLog2: + value = pick(infinite, bits.Value(), value); + value = pick(IrU1(ir.IEqual(bits.Value(), ir.Constant(0x3f800000u))), ir.Constant(0u), value); + value = pick(zero, ir.Constant(0xff800000u), value); + invalid = negative; + break; + case IrOpcode::FPExp2: { + const IrU1 overflow(ir.LogicalAnd(ir.IEqual(sign.Value(), ir.Constant(0u)), ir.UGreaterThan(magnitude.Value(), ir.Constant(0x42ffffffu)))); + const IrU1 underflow(ir.LogicalAnd(negative.Value(), ir.UGreaterThan(magnitude.Value(), ir.Constant(0x42fc0000u)))); + value = pick(overflow, ir.Constant(0x7f800000u), value); + value = pick(underflow, ir.Constant(0u), value); + value = pick(zero, ir.Constant(0x3f800000u), value); + break; + } + case IrOpcode::FPFract32: { + const IrU32 unsignedValue(ir.BitwiseAnd(value.Value(), ir.Constant(0x7fffffffu))); + value = pick(IrU1(ir.UGreaterThan(unsignedValue.Value(), ir.Constant(0x3f7fffffu))), ir.Constant(0x3f7fffffu), unsignedValue); + invalid = infinite; + break; + } + case IrOpcode::FPSin: + case IrOpcode::FPCos: { + const IrF32 whole(ir.Emit(IrOpcode::FPTrunc32, IrType::F32, {&argument.Value()})); + const IrF32 difference(ir.Emit(IrOpcode::FPSub32, IrType::F32, {&argument.Value(), &whole.Value()})); + const IrF32 fraction(ir.Emit(IrOpcode::FPAbs32, IrType::F32, {&difference.Value()})); + const auto fractionIs = [&](float cycle) { return IrU1(ir.Emit(IrOpcode::FPOrdEqual32, IrType::U1, {&fraction.Value(), &ir.ConstantF32(cycle)})); }; + if (opcode == IrOpcode::FPSin) { + const IrU1 cardinal(ir.LogicalOr(fractionIs(0.0f).Value(), fractionIs(0.5f).Value())); + value = pick(cardinal, ir.Constant(0u), value); + value = pick(zero, bits.Value(), value); + } else { + value = pick(IrU1(ir.LogicalOr(fractionIs(0.25f).Value(), fractionIs(0.75f).Value())), ir.Constant(0u), value); + } + invalid = infinite; + break; + } + default: + break; + } + return {IrF32(ir.BitCastF32(value.Value())), invalid}; +} + bool TranslationContext::vDivFixupF16(const RdnaInstruction& inst) { std::array bits{}; std::array magnitude{}; @@ -95,33 +166,6 @@ bool TranslationContext::vDivFixupF16(const RdnaInstruction& inst) { return true; } -bool TranslationContext::float16Trig(const RdnaInstruction& inst, IrOpcode opcode) { - const IrF32 argument = readF16AsF32(sourceAt(inst, 0u)); - const IrU32 magnitude(ir.BitwiseAnd(ir.BitCastU32(argument.Value()), ir.Constant(0x7fffffffu))); - const IrF32 raw(ir.Emit(opcode, IrType::F32, {&argument.Value()})); - const IrF32 fraction(ir.Emit(IrOpcode::FPFract32, IrType::F32, {&argument.Value()})); - const IrF32 zero(ir.ConstantF32(0.0f)); - IrF32 result = raw; - if (opcode == IrOpcode::FPSin) { - const IrU1 whole(ir.Emit(IrOpcode::FPOrdEqual32, IrType::U1, {&fraction.Value(), &zero.Value()})); - const IrU1 half(ir.Emit(IrOpcode::FPOrdEqual32, IrType::U1, {&fraction.Value(), &ir.ConstantF32(0.5f)})); - const IrU1 nonzero(ir.INotEqual(magnitude.Value(), ir.Constant(0u))); - const IrU1 cardinal(ir.LogicalOr(ir.LogicalAnd(whole.Value(), nonzero.Value()), half.Value())); - result = selectF32(cardinal, zero, raw); - } else { - const IrU1 quarter(ir.Emit(IrOpcode::FPOrdEqual32, IrType::U1, {&fraction.Value(), &ir.ConstantF32(0.25f)})); - const IrU1 threeQuarters(ir.Emit(IrOpcode::FPOrdEqual32, IrType::U1, {&fraction.Value(), &ir.ConstantF32(0.75f)})); - const IrU1 quarterCycle(ir.LogicalOr(quarter.Value(), threeQuarters.Value())); - result = selectF32(quarterCycle, zero, raw); - } - const IrU1 infinite(ir.IEqual(magnitude.Value(), ir.Constant(0x7f800000u))); - const IrF32 modified = applyF16ResultModifiers(inst.destination, result); - const IrU32 bits = packHalf2x16(modified, zero); - const IrU32 invalid(ir.Constant(inst.destination.clamp ? 0u : 0xfe00u)); - write16Bits(inst.destination, IrU32(ir.Select(infinite.Value(), invalid.Value(), bits.Value()))); - return true; -} - bool TranslationContext::float16Binary(const RdnaInstruction& inst, IrOpcode opcode, bool reverse) { const IrF32 lhs = readF16AsF32(sourceAt(inst, reverse ? 1u : 0u)); const IrF32 rhs = readF16AsF32(sourceAt(inst, reverse ? 0u : 1u)); @@ -365,9 +409,13 @@ bool TranslationContext::vDivFixupF32(const RdnaInstruction& inst) { } bool TranslationContext::floatUnary(const RdnaInstruction& inst, IrOpcode opcode) { - IrValue* argument = readOperand(sourceAt(inst, 0u), IrOpcodeArgumentType(opcode, 0u)); - IrValue& result = ir.Emit(opcode, IrOpcodeType(opcode), {argument}); - writeOperand(inst.destination, &result); + const IrU32 bits = readU32(sourceAt(inst, 0u)); + const IrF32 argument(ir.BitCastF32(bits.Value())); + const auto [result, invalid] = unaryFloatSpecials(opcode, argument, IrF32(ir.Emit(opcode, IrType::F32, {&argument.Value()}))); + const IrU1 nan(ir.UGreaterThan(ir.BitwiseAnd(bits.Value(), ir.Constant(0x7fffffffu)), ir.Constant(0x7f800000u))); + const IrU32 special(ir.Select(nan.Value(), ir.BitwiseOr(bits.Value(), ir.Constant(0x00400000u)), ir.Constant(0xffc00000u))); + const IrF32 value(ir.Select(ir.LogicalOr(nan.Value(), invalid.Value()), ir.BitCastF32(special.Value()), result.Value())); + writeOperand(inst.destination, &value.Value()); return true; } @@ -421,7 +469,8 @@ bool TranslationContext::vFrexpMantF32(const RdnaInstruction& inst) { const IrU32 zeroOrSubnormal(ir.Select(zero.Value(), bits.Value(), subnormal.Value())); const IrU32 finite(ir.Select(exponentNonZero.Value(), normal.Value(), zeroOrSubnormal.Value())); const IrU1 exponentAllOnes(ir.IEqual(exponent.Value(), ir.Constant(0xffu))); - const IrU32 result(ir.Select(exponentAllOnes.Value(), bits.Value(), finite.Value())); + const IrU32 special(ir.Select(zero.Value(), bits.Value(), ir.BitwiseOr(bits.Value(), ir.Constant(0x00400000u)))); + const IrU32 result(ir.Select(exponentAllOnes.Value(), special.Value(), finite.Value())); writeOperand(inst.destination, &ir.BitCastF32(result.Value())); return true; } diff --git a/core/shader/recompiler/Translation/src/VectorInstructions.cpp b/core/shader/recompiler/Translation/src/VectorInstructions.cpp index de7772fe5..1ff70c7f9 100644 --- a/core/shader/recompiler/Translation/src/VectorInstructions.cpp +++ b/core/shader/recompiler/Translation/src/VectorInstructions.cpp @@ -816,29 +816,29 @@ bool TranslationContext::emitVector(const RdnaInstruction& inst) { case RdnaOpcode::VMadMixhiF16: return float16Ternary(inst, IrOpcode::FPFma32, false, true); case RdnaOpcode::VRcpF16: - return float16Unary(inst, IrOpcode::FPRecip32, false); + return float16Unary(inst, IrOpcode::FPRecip32); case RdnaOpcode::VSqrtF16: - return float16Unary(inst, IrOpcode::FPSqrt, true); + return float16Unary(inst, IrOpcode::FPSqrt); case RdnaOpcode::VRsqF16: - return float16Unary(inst, IrOpcode::FPRecipSqrt32, true); + return float16Unary(inst, IrOpcode::FPRecipSqrt32); case RdnaOpcode::VLogF16: - return float16Unary(inst, IrOpcode::FPLog2, true); + return float16Unary(inst, IrOpcode::FPLog2); case RdnaOpcode::VExpF16: - return float16Unary(inst, IrOpcode::FPExp2, false); + return float16Unary(inst, IrOpcode::FPExp2); case RdnaOpcode::VFloorF16: - return float16Unary(inst, IrOpcode::FPFloor32, false); + return float16Unary(inst, IrOpcode::FPFloor32); case RdnaOpcode::VCeilF16: - return float16Unary(inst, IrOpcode::FPCeil32, false); + return float16Unary(inst, IrOpcode::FPCeil32); case RdnaOpcode::VTruncF16: - return float16Unary(inst, IrOpcode::FPTrunc32, false); + return float16Unary(inst, IrOpcode::FPTrunc32); case RdnaOpcode::VRndneF16: - return float16Unary(inst, IrOpcode::FPRoundEven32, false); + return float16Unary(inst, IrOpcode::FPRoundEven32); case RdnaOpcode::VFractF16: - return float16Unary(inst, IrOpcode::FPFract32, false); + return float16Unary(inst, IrOpcode::FPFract32); case RdnaOpcode::VSinF16: - return float16Trig(inst, IrOpcode::FPSin); + return float16Unary(inst, IrOpcode::FPSin); case RdnaOpcode::VCosF16: - return float16Trig(inst, IrOpcode::FPCos); + return float16Unary(inst, IrOpcode::FPCos); case RdnaOpcode::VMin3F16: return float16Ternary(inst, IrOpcode::FPMinTri32, false, false); case RdnaOpcode::VMax3F16: diff --git a/docs/dev/TechnicalDebt.md b/docs/dev/TechnicalDebt.md index c6f8f8edc..ca7a20f8f 100644 --- a/docs/dev/TechnicalDebt.md +++ b/docs/dev/TechnicalDebt.md @@ -80,6 +80,7 @@ Throughout the project, every function at every stage either **does exactly what - [v_fma_f64](../../core/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterFloat64.cpp) is fused exactly only for normal inputs: with a subnormal input it is a separate multiply and add, which rounds twice. - The executable file that [relinker](../../core/relinker/elfpatcher/src/windows/WindowsPeWriter.cpp) generates opens the console when launched, which is inconvenient for playability. - [libSceJpegEnc](../../core/libs/prx/libSceJpegEnc/Export.cpp) encodes 4:2:2 sampling requests with 4:2:0 chroma subsampling, and grayscale requests as a 3-component JPEG with neutral chroma instead of a single-component one: the [JPEG encoder](../../core/Decoder/Jpeg/src/Jpeg.cpp) (stb) only produces 3-component 4:2:0 and 4:4:4 images. +- [v_rcp, v_rsq, v_sqrt, v_log, v_exp, v_sin and v_cos](../../core/shader/recompiler/Translation/src/FloatInstructions.cpp) (f32 and f16) use the driver's approximation for finite results, not the console's: the low bits can differ. Only NaN, invalid, zero and infinite results and the exact sin/cos zeros are chosen on the bits. v_sin_f32/v_cos_f32 with inputs beyond ±256 cycles were not compared with the console. - `--to-intel` does not lower RDPRU/MCOMMIT; the [matcher](../../core/relinker/codegen/src/x86/Amd64OnlyInstructionMatcher.cpp) fails the relink instead. SHA-1 and SHA-256 instructions with a RIP-relative operand fail the relink. - The length-changing path of the [instruction rewriter](../../core/relinker/codegen/src/x86/X64InstructionRewriter.cpp) is not used by the [converter](../../core/relinker/codegen/src/Amd64OnlyConverter.cpp): it does not adjust VEX/0F38/0F3A RIP-relative operands, data-to-code references (relocations, FDEs, jump tables) or segment sizes, so every substitution keeps the instruction length. - The Linux placement of the `--to-intel` stubs in the [ELF patcher](../../core/relinker/elfpatcher/src/linux/LinuxElfPatcher.cpp) is covered only by a synthetic test.