Add workaround for MSVC141 bug evoking C2440 compilation error (#18122)

MSVC141 fails to handle reinterpret cast of a template function
pointer due to a bug in the compiler:
https://developercommunity.visualstudio.com/t/bug-reinterpret-cast-address-of-templated-static-f/396044
This commit is contained in:
Georgiy Manuilov
2023-06-17 15:49:41 +02:00
committed by GitHub
parent 358893c758
commit 26c4ed7ba8

View File

@@ -154,11 +154,14 @@ void RegPrinter::print_vmm(jit_generator &h, REG_T vmm, const char *name) {
h.mov(abi_param2, reinterpret_cast<size_t>(vmm.toString()));
h.mov(abi_param1, reinterpret_cast<size_t>(name));
if (vmm.isZMM()) {
h.mov(h.rax, reinterpret_cast<size_t>(&print_vmm_prc<PRC_T, 64>));
auto p = &print_vmm_prc<PRC_T, 64>;
h.mov(h.rax, reinterpret_cast<size_t>(p));
} else if (vmm.isYMM()) {
h.mov(h.rax, reinterpret_cast<size_t>(&print_vmm_prc<PRC_T, 32>));
auto p = &print_vmm_prc<PRC_T, 32>;
h.mov(h.rax, reinterpret_cast<size_t>(p));
} else {
h.mov(h.rax, reinterpret_cast<size_t>(&print_vmm_prc<PRC_T, 16>));
auto p = &print_vmm_prc<PRC_T, 16>;
h.mov(h.rax, reinterpret_cast<size_t>(p));
}
align_rsp(h);
h.call(h.rax);
@@ -191,7 +194,8 @@ void RegPrinter::print_reg(jit_generator &h, REG_T reg, const char *name) {
h.mov(abi_param3, h.rsp);
h.mov(abi_param2, reinterpret_cast<size_t>(reg.toString()));
h.mov(abi_param1, reinterpret_cast<size_t>(name));
h.mov(h.rax, reinterpret_cast<size_t>(&print_reg_prc<PRC_T>));
auto p = &print_reg_prc<PRC_T>;
h.mov(h.rax, reinterpret_cast<size_t>(p));
align_rsp(h);
h.call(h.rax);
restore_rsp(h);