dynarmic/externals/xbyak/sample/quantize.cpp

227 lines
4.7 KiB
C++
Raw Normal View History

/*
@author herumi
JPEG quantize sample
This program generates a quantization routine by using fast division algorithm in run-time.
time(sec)
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
quality 1(high) 10 50 100(low)
VC2005 8.0 8.0 8.0 8.0
Xbyak 1.6 0.8 0.5 0.5
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
; generated code at q = 1
push esi
push edi
mov edi,dword ptr [esp+0Ch]
mov esi,dword ptr [esp+10h]
mov eax,dword ptr [esi]
shr eax,4
mov dword ptr [edi],eax
mov eax,dword ptr [esi+4]
mov edx,0BA2E8BA3h
mul eax,edx
shr edx,3
...
; generated code at q = 100
push esi
push edi
mov edi,dword ptr [esp+0Ch]
mov esi,dword ptr [esp+10h]
mov eax,dword ptr [esi]
mov dword ptr [edi],eax
mov eax,dword ptr [esi+4]
mov dword ptr [edi+4],eax
mov eax,dword ptr [esi+8]
mov dword ptr [edi+8],eax
mov eax,dword ptr [esi+0Ch]
...
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define XBYAK_NO_OP_NAMES
#include "xbyak/xbyak.h"
#ifdef _MSC_VER
#pragma warning(disable : 4996) // scanf
#endif
const int N = 64;
class Quantize : public Xbyak::CodeGenerator {
static int ilog2(int x)
{
int shift = 0;
while ((1 << shift) <= x) shift++;
return shift - 1;
}
public:
/*
input : esi
output : eax = [esi+offset] / dividend
destroy : edx
*/
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
void udiv(uint32_t dividend, int offset)
{
mov(eax, ptr[esi + offset]);
/* dividend = odd x 2^exponent */
int exponent = 0, odd = dividend;
while ((odd & 1) == 0) {
odd >>= 1; exponent++;
}
if (odd == 1) { // trivial case
if (exponent) {
shr(eax, exponent);
}
return;
}
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
uint64_t mLow, mHigh;
int len = ilog2(odd) + 1;
{
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
uint64_t roundUp = uint64_t(1) << (32 + len);
uint64_t k = roundUp / (0xFFFFFFFFL - (0xFFFFFFFFL % odd));
mLow = roundUp / odd;
mHigh = (roundUp + k) / odd;
}
while (((mLow >> 1) < (mHigh >> 1)) && (len > 0)) {
mLow >>= 1; mHigh >>= 1; len--;
}
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
uint64_t m; int a;
if ((mHigh >> 32) == 0) {
m = mHigh; a = 0;
} else {
len = ilog2(odd);
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
uint64_t roundDown = uint64_t(1) << (32 + len);
mLow = roundDown / odd;
int r = (int)(roundDown % odd);
m = (r <= (odd >> 1)) ? mLow : mLow + 1;
a = 1;
}
while ((m & 1) == 0) {
m >>= 1; len--;
}
len += exponent;
mov(edx, int(m));
mul(edx);
if (a) {
add(eax, int(m));
adc(edx, 0);
}
if (len) {
shr(edx, len);
}
mov(eax, edx);
}
/*
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
quantize(uint32_t dest[64], const uint32_t src[64]);
*/
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
Quantize(const uint32_t qTbl[64])
{
push(esi);
push(edi);
const int P_ = 4 * 2;
mov(edi, ptr [esp+P_+4]); // dest
mov(esi, ptr [esp+P_+8]); // src
for (int i = 0; i < N; i++) {
udiv(qTbl[i], i * 4);
mov(ptr[edi+i*4], eax);
}
pop(edi);
pop(esi);
ret();
}
};
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
void quantize(uint32_t dest[64], const uint32_t src[64], const uint32_t qTbl[64])
{
for (int i = 0; i < N; i++) {
dest[i] = src[i] / qTbl[i];
}
}
#ifdef XBYAK64
int main()
{
puts("not implemented for 64bit");
return 1;
}
#else
int main(int argc, char *argv[])
{
int q;
if (argc > 1) {
q = atoi(argv[1]);
} else {
printf("input quantize=");
if (scanf("%d", &q) != 1) {
fprintf(stderr, "bad number\n");
return 1;
}
}
printf("q=%d\n", q);
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
uint32_t qTbl[] = {
16, 11, 10, 16, 24, 40, 51, 61,
12, 12, 14, 19, 26, 58, 60, 55,
14, 13, 16, 24, 40, 57, 69, 56,
14, 17, 22, 29, 51, 87, 80, 62,
18, 22, 37, 56, 68, 109, 103, 77,
24, 35, 55, 64, 81, 104, 113, 92,
49, 64, 78, 87, 103, 121, 120, 101,
72, 92, 95, 98, 112, 100, 103, 99
};
for (int i = 0; i < N; i++) {
qTbl[i] /= q;
if (qTbl[i] == 0) qTbl[i] = 1;
}
try {
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
uint32_t src[N];
uint32_t dest[N];
uint32_t dest2[N];
for (int i = 0; i < N; i++) {
src[i] = rand() % 2048;
}
Quantize jit(qTbl);
//printf("jit size=%d, ptr=%p\n", jit.getSize(), jit.getCode());
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff 0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
2020-09-19 17:27:42 +02:00
void (*quantize2)(uint32_t*, const uint32_t*, const uint32_t *) = jit.getCode<void (*)(uint32_t*, const uint32_t*, const uint32_t *)>();
quantize(dest, src, qTbl);
quantize2(dest2, src, qTbl);
for (int i = 0; i < N; i++) {
if (dest[i] != dest2[i]) {
Squashed 'externals/xbyak/' changes from 88f2f771f..a1ac3750f a1ac3750f Merge branch 'dev' 5f4ba971f v6.68 cac2c175f update doc 1b08a8248 add test of prefetchiti bef70d9b1 add prefetchit{0,1} f66785876 add detection of prefetchiti 124617ac9 Merge branch 'dev' 1bce8be17 Merge commit 'fbb18f6' into dev bebfe64a3 [test] X32 is optional and remove CFLAGS d8c332cef Merge branch 'Tachi107-small-changes' into dev fbb18f69d ci: use containers 8a974696c test: simplify makefile 1efe9fe7c Merge branch 'dev' bb70083e6 v6.67 436e452d7 update doc 47ff6ef42 I get an error after all on GitHub action 445c0dcec add test of CMPccXADD c9347907d add CMPccXADD dc792cc56 add detection of cmpccxadd 62be84cc8 fix detection of boost b5ac7b0f0 Merge branch 'dev' 05dd400e0 recover a removed line 94eff6246 v6.66 ec3fadeba update doc 00bfaaa7f add test of rao-int 0f2f1aaa6 support rio-int 6c047f480 detect rao-int f07c5c255 fix args of EmptyAllocator::alloc in test 04d3eb5f5 stop if a test script causes an error 1c1d2366f disable boost sample cfb1127c3 tweak 5fcbeb7c4 [sample] change the way of detection of boost bafc1ee60 CXX uses g++ as default value d8cabc6cb remove warning of blace bc73a0816 remove -fno-operator-names option 6989aea94 use CXX instead of g++ a7c5a1bd7 use English 1bfbd8c4d Fix incorrect format strings 0ecef5c28 Merge branch 'dev' 7556c20ba update doc a15709271 v6.65 3b83aab3e add detect_x32 to TARGET 8c64bbbc3 use gcc instead of dpkg for portability 5e9a9b96f test_avx512.sh runs on x32 8ae01b0c2 disable some tests on x32 83b3da217 x32 does not check large disp 693ab8c9d sizeof(void*) = 4 on x32, so disable the test 348e3e548 Merge branch 'dev' 11b9c4dc0 v6.64 459636196 add T_M_K flag to vpmov* 1d3722928 add include path 5e27eddae move CrearError from LabelManager::reset() to CodeGenerator::reset() f8ea5c28d Merge branch 'dev' 20b2b1eae v6.63 3706869f8 desc. of setDefaultEncoding d6f2d7577 add test of setDefaultEncoding 3b0a19c41 vpmadd52{h,l}uq for avx-ifma 95752ebd7 add tAVX_IFMA cd36e31ea [sample] show AMX_FP16/AVX_VNNI_INT8/AVX_NE_CONVERT e5858af27 add setDefaultEncoding 2f7fb0220 modify gen.cpp for AVX-NE-CONVERT/AVX-VNNI-INT8/AMX-FP16 1c5cb7efa add AVX-NE-CONVERT instructions 564fe9acd add AVX-VNNI-INT8 instructions cd14d07b1 add AMX-FP16 instruction 7811f593c Merge pull request #161 from scribam/patch-1 2218f6c08 Update changelog.md 7bccdbbb4 Merge pull request #160 from herumi/dev 5fcf87596 compile nasm-2.15 instead of apt install e31961ea8 v6.62 ff4f9e65c update doc 9c8fb81db disable wrong detection of gcc -Warray-bounds 6b7519659 add serialize e16582696 Merge branch 'JonLiu1993-vcpkg-installition' into dev edbb410fb Add vcpkg installation instructions 055d31242 Merge branch 'dev' 21ab98441 Merge branch 'akodanka-enable_CIV' into dev ed4d598e3 Changes to compile xbyak project for openvino b652430c4 mingw uses __cpuidex 48457bfa0 Merge branch 'dev' 29cb524d1 v6.61.2 1a9a0b0e1 avoid including algorithm header in xbyak_util.h 6fadefd04 Merge branch 'dev' fc1c18a9d update doc f7cae7f11 v6.61.1 6f5ec5cf3 Merge branch 'doyaGu-master' into dev 4554d6bb9 Fix error related to XBYAK_NOEXCEPT git-subtree-dir: externals/xbyak git-subtree-split: a1ac3750f9a639b5a6c6d6c7da4259b8d6790989
2022-12-31 00:05:02 +01:00
printf("err[%d] %u %u\n", i, dest[i], dest2[i]);
}
}
const int count = 10000000;
int begin;
begin = clock();
for (int i = 0; i < count; i++) {
quantize(dest, src, qTbl);
}
printf("time=%.1fsec\n", (clock() - begin) / double(CLOCKS_PER_SEC));
begin = clock();
for (int i = 0; i < count; i++) {
quantize2(dest, src, qTbl);
}
printf("time=%.1fsec\n", (clock() - begin) / double(CLOCKS_PER_SEC));
} catch (std::exception& e) {
printf("ERR:%s\n", e.what());
} catch (...) {
printf("unknown error\n");
}
}
#endif