dynarmic/externals/xbyak/test/noexception.cpp

112 lines
1.7 KiB
C++
Raw Normal View History

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
#define XBYAK_NO_EXCEPTION
#include <xbyak/xbyak.h>
using namespace Xbyak;
int g_err = 0;
int g_test = 0;
void assertEq(int x, int y)
{
if (x != y) {
printf("ERR x=%d y=%d\n", x, y);
g_err++;
}
g_test++;
}
void assertBool(bool b)
{
if (!b) {
printf("ERR assertBool\n");
g_err++;
}
g_test++;
}
void test1()
{
const int v = 123;
struct Code : CodeGenerator {
Code()
{
mov(eax, v);
ret();
}
} c;
int (*f)() = c.getCode<int (*)()>();
assertEq(f(), v);
assertEq(Xbyak::GetError(), ERR_NONE);
}
void test2()
{
struct Code : CodeGenerator {
Code()
{
Label lp;
L(lp);
L(lp);
}
} c;
assertEq(Xbyak::GetError(), ERR_LABEL_IS_REDEFINED);
Xbyak::ClearError();
}
void test3()
{
static struct EmptyAllocator : Xbyak::Allocator {
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
uint8_t *alloc(size_t) { return 0; }
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
} emptyAllocator;
struct Code : CodeGenerator {
Code() : CodeGenerator(8, 0, &emptyAllocator)
{
mov(eax, 3);
assertBool(Xbyak::GetError() == 0);
mov(eax, 3);
mov(eax, 3);
assertBool(Xbyak::GetError() != 0);
Xbyak::ClearError();
assertBool(Xbyak::GetError() == 0);
}
} c;
}
void test4()
{
struct Code : CodeGenerator {
Code()
{
mov(ptr[eax], 1);
assertBool(Xbyak::GetError() != 0);
Xbyak::ClearError();
test(ptr[eax], 1);
assertBool(Xbyak::GetError() != 0);
Xbyak::ClearError();
adc(ptr[eax], 1);
assertBool(Xbyak::GetError() != 0);
Xbyak::ClearError();
setz(eax);
assertBool(Xbyak::GetError() != 0);
Xbyak::ClearError();
}
};
}
int main()
{
test1();
test2();
test3();
test4();
if (g_err) {
printf("err %d/%d\n", g_err, g_test);
} else {
printf("all ok %d\n", g_test);
}
return g_err != 0;
}