summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asmjit/test/asmjit_test_compiler_a64.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asmjit/test/asmjit_test_compiler_a64.cpp')
-rw-r--r--3rdparty/asmjit/test/asmjit_test_compiler_a64.cpp111
1 files changed, 54 insertions, 57 deletions
diff --git a/3rdparty/asmjit/test/asmjit_test_compiler_a64.cpp b/3rdparty/asmjit/test/asmjit_test_compiler_a64.cpp
index 4fc362e7230..4d8cd5e8b2d 100644
--- a/3rdparty/asmjit/test/asmjit_test_compiler_a64.cpp
+++ b/3rdparty/asmjit/test/asmjit_test_compiler_a64.cpp
@@ -4,7 +4,7 @@
// SPDX-License-Identifier: Zlib
#include <asmjit/core.h>
-#if !defined(ASMJIT_NO_AARCH64) && ASMJIT_ARCH_ARM == 64
+#if !defined(ASMJIT_NO_COMPILER) && !defined(ASMJIT_NO_AARCH64)
#include <asmjit/a64.h>
#include <stdio.h>
@@ -21,7 +21,7 @@ using namespace asmjit;
class A64TestCase : public TestCase {
public:
A64TestCase(const char* name = nullptr)
- : TestCase(name) {}
+ : TestCase(name, Arch::kAArch64) {}
virtual void compile(BaseCompiler& cc) override {
compile(static_cast<a64::Compiler&>(cc));
@@ -55,7 +55,7 @@ public:
uint32_t i;
uint32_t argCount = _argCount;
- FuncSignatureBuilder signature;
+ FuncSignature signature;
signature.setRetT<int>();
for (i = 0; i < argCount; i++)
signature.addArgT<int>();
@@ -64,11 +64,11 @@ public:
if (_preserveFP)
funcNode->frame().setPreservedFP();
- arm::Gp sum;
+ a64::Gp sum;
if (argCount) {
for (i = 0; i < argCount; i++) {
- arm::Gp iReg = cc.newInt32("i%u", i);
+ a64::Gp iReg = cc.newInt32("i%u", i);
funcNode->setArg(i, iReg);
if (i == 0)
@@ -184,7 +184,7 @@ public:
result.assignFormat("ret={%u, %u}", resultRet >> 28, resultRet & 0x0FFFFFFFu);
expect.assignFormat("ret={%u, %u}", expectRet >> 28, expectRet & 0x0FFFFFFFu);
- return resultRet == expectRet;
+ return result == expect;
}
};
@@ -201,24 +201,24 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, const void*, const void*>());
+ FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, const void*, const void*>());
- arm::Gp dst = cc.newUIntPtr("dst");
- arm::Gp src1 = cc.newUIntPtr("src1");
- arm::Gp src2 = cc.newUIntPtr("src2");
+ a64::Gp dst = cc.newUIntPtr("dst");
+ a64::Gp src1 = cc.newUIntPtr("src1");
+ a64::Gp src2 = cc.newUIntPtr("src2");
funcNode->setArg(0, dst);
funcNode->setArg(1, src1);
funcNode->setArg(2, src2);
- arm::Vec v1 = cc.newVecQ("vec1");
- arm::Vec v2 = cc.newVecQ("vec2");
- arm::Vec v3 = cc.newVecQ("vec3");
+ a64::Vec v1 = cc.newVecQ("vec1");
+ a64::Vec v2 = cc.newVecQ("vec2");
+ a64::Vec v3 = cc.newVecQ("vec3");
- cc.ldr(v2, arm::ptr(src1));
- cc.ldr(v3, arm::ptr(src2));
+ cc.ldr(v2, a64::ptr(src1));
+ cc.ldr(v3, a64::ptr(src2));
cc.add(v1.b16(), v2.b16(), v3.b16());
- cc.str(v1, arm::ptr(dst));
+ cc.str(v1, a64::ptr(dst));
cc.endFunc();
}
@@ -235,13 +235,10 @@ public:
ptr_as_func<Func>(_func)(dst, aSrc, bSrc);
- unsigned int resultRet = 0;
- unsigned int expectRet = 0;
-
result.assignFormat("ret={%u, %u, %u, %u}", dst[0], dst[1], dst[2], dst[3]);
expect.assignFormat("ret={%u, %u, %u, %u}", ref[0], ref[1], ref[2], ref[3]);
- return resultRet == expectRet;
+ return result == expect;
}
};
@@ -264,16 +261,16 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- cc.addFunc(FuncSignatureT<int>());
+ cc.addFunc(FuncSignature::build<int>());
- arm::Gp* regs = static_cast<arm::Gp*>(malloc(_regCount * sizeof(arm::Gp)));
+ a64::Gp* regs = static_cast<a64::Gp*>(malloc(_regCount * sizeof(a64::Gp)));
for (uint32_t i = 0; i < _regCount; i++) {
regs[i] = cc.newUInt32("reg%u", i);
cc.mov(regs[i], i + 1);
}
- arm::Gp sum = cc.newUInt32("sum");
+ a64::Gp sum = cc.newUInt32("sum");
cc.mov(sum, 0);
for (uint32_t i = 0; i < _regCount; i++) {
@@ -314,15 +311,15 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- cc.addFunc(FuncSignatureT<int>());
+ cc.addFunc(FuncSignature::build<int>());
- arm::Gp addr = cc.newIntPtr("addr");
- arm::Gp val = cc.newIntPtr("val");
+ a64::Gp addr = cc.newIntPtr("addr");
+ a64::Gp val = cc.newIntPtr("val");
Label L_Table = cc.newLabel();
cc.adr(addr, L_Table);
- cc.ldrsw(val, arm::ptr(addr, 8));
+ cc.ldrsw(val, a64::ptr(addr, 8));
cc.ret(val);
cc.endFunc();
@@ -358,11 +355,11 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- FuncNode* funcNode = cc.addFunc(FuncSignatureT<void, void*, size_t>());
+ FuncNode* funcNode = cc.addFunc(FuncSignature::build<void, void*, size_t>());
- arm::Gp p = cc.newIntPtr("p");
- arm::Gp count = cc.newIntPtr("count");
- arm::Gp i = cc.newIntPtr("i");
+ a64::Gp p = cc.newIntPtr("p");
+ a64::Gp count = cc.newIntPtr("count");
+ a64::Gp i = cc.newIntPtr("i");
Label L = cc.newLabel();
funcNode->setArg(0, p);
@@ -413,12 +410,12 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- FuncNode* funcNode = cc.addFunc(FuncSignatureT<uint32_t, uint32_t, uint32_t>());
+ FuncNode* funcNode = cc.addFunc(FuncSignature::build<uint32_t, uint32_t, uint32_t>());
- arm::Gp x = cc.newUInt32("x");
- arm::Gp y = cc.newUInt32("y");
- arm::Gp r = cc.newUInt32("r");
- arm::Gp fn = cc.newUIntPtr("fn");
+ a64::Gp x = cc.newUInt32("x");
+ a64::Gp y = cc.newUInt32("y");
+ a64::Gp r = cc.newUInt32("r");
+ a64::Gp fn = cc.newUIntPtr("fn");
funcNode->setArg(0, x);
funcNode->setArg(1, y);
@@ -426,7 +423,7 @@ public:
cc.mov(fn, (uint64_t)calledFunc);
InvokeNode* invokeNode;
- cc.invoke(&invokeNode, fn, FuncSignatureT<uint32_t, uint32_t, uint32_t>(CallConvId::kHost));
+ cc.invoke(&invokeNode, fn, FuncSignature::build<uint32_t, uint32_t, uint32_t>());
invokeNode->setArg(0, x);
invokeNode->setArg(1, y);
invokeNode->setRet(0, r);
@@ -466,19 +463,19 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double, double>());
+ FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double, double>());
- arm::Vec x = cc.newVecD("x");
- arm::Vec y = cc.newVecD("y");
- arm::Vec r = cc.newVecD("r");
- arm::Gp fn = cc.newUIntPtr("fn");
+ a64::Vec x = cc.newVecD("x");
+ a64::Vec y = cc.newVecD("y");
+ a64::Vec r = cc.newVecD("r");
+ a64::Gp fn = cc.newUIntPtr("fn");
funcNode->setArg(0, x);
funcNode->setArg(1, y);
cc.mov(fn, (uint64_t)calledFunc);
InvokeNode* invokeNode;
- cc.invoke(&invokeNode, fn, FuncSignatureT<double, double, double>(CallConvId::kHost));
+ cc.invoke(&invokeNode, fn, FuncSignature::build<double, double, double>());
invokeNode->setArg(0, x);
invokeNode->setArg(1, y);
invokeNode->setRet(0, r);
@@ -518,19 +515,19 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- FuncNode* funcNode = cc.addFunc(FuncSignatureT<double, double, double>());
+ FuncNode* funcNode = cc.addFunc(FuncSignature::build<double, double, double>());
- arm::Vec x = cc.newVecD("x");
- arm::Vec y = cc.newVecD("y");
- arm::Vec r = cc.newVecD("r");
- arm::Gp fn = cc.newUIntPtr("fn");
+ a64::Vec x = cc.newVecD("x");
+ a64::Vec y = cc.newVecD("y");
+ a64::Vec r = cc.newVecD("r");
+ a64::Gp fn = cc.newUIntPtr("fn");
funcNode->setArg(0, x);
funcNode->setArg(1, y);
cc.mov(fn, (uint64_t)calledFunc);
InvokeNode* invokeNode;
- cc.invoke(&invokeNode, fn, FuncSignatureT<double, double, double>(CallConvId::kHost));
+ cc.invoke(&invokeNode, fn, FuncSignature::build<double, double, double>());
invokeNode->setArg(0, y);
invokeNode->setArg(1, x);
invokeNode->setRet(0, r);
@@ -583,14 +580,14 @@ public:
}
virtual void compile(a64::Compiler& cc) {
- FuncNode* funcNode = cc.addFunc(FuncSignatureT<float, float, float, uint32_t>());
+ FuncNode* funcNode = cc.addFunc(FuncSignature::build<float, float, float, uint32_t>());
- arm::Vec a = cc.newVecS("a");
- arm::Vec b = cc.newVecS("b");
- arm::Gp op = cc.newUInt32("op");
+ a64::Vec a = cc.newVecS("a");
+ a64::Vec b = cc.newVecS("b");
+ a64::Gp op = cc.newUInt32("op");
- arm::Gp target = cc.newIntPtr("target");
- arm::Gp offset = cc.newIntPtr("offset");
+ a64::Gp target = cc.newIntPtr("target");
+ a64::Gp offset = cc.newIntPtr("offset");
Label L_End = cc.newLabel();
@@ -605,7 +602,7 @@ public:
funcNode->setArg(2, op);
cc.adr(target, L_Table);
- cc.ldrsw(offset, arm::ptr(target, op, arm::sxtw(2)));
+ cc.ldrsw(offset, a64::ptr(target, op, a64::sxtw(2)));
cc.add(target, target, offset);
// JumpAnnotation allows to annotate all possible jump targets of
@@ -687,4 +684,4 @@ void compiler_add_a64_tests(TestApp& app) {
app.addT<A64Test_JumpTable>();
}
-#endif // !ASMJIT_NO_AARCH64 && ASMJIT_ARCH_ARM == 64
+#endif // !ASMJIT_NO_COMPILER && !ASMJIT_NO_AARCH64