android_system_core/libpixelflinger/tests/codegen/codegen.cpp
Ashok Bhat 658f89dc5c Pixelflinger: Add AArch64 support to pixelflinger JIT.
See the comment-block at the top of Aarch64Assembler.cpp
for overview on how AArch64 support has been implemented

In addition, this commit contains
[x] AArch64 inline asm versions of gglmul series of
    functions and a new unit test bench to test the
    functions

[x] Assembly implementations of scanline_col32cb16blend
    and scanline_t32cb16blend for AArch64, with unit
    test bench

Change-Id: I915cded9e1d39d9a2a70bf8a0394b8a0064d1eb4
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2013-12-12 17:30:13 +00:00

86 lines
2 KiB
C++

#include <stdio.h>
#include <stdint.h>
#include "private/pixelflinger/ggl_context.h"
#include "buffer.h"
#include "scanline.h"
#include "codeflinger/CodeCache.h"
#include "codeflinger/GGLAssembler.h"
#include "codeflinger/ARMAssembler.h"
#include "codeflinger/MIPSAssembler.h"
#include "codeflinger/Aarch64Assembler.h"
#if defined(__arm__) || defined(__mips__) || defined(__aarch64__)
# define ANDROID_ARM_CODEGEN 1
#else
# define ANDROID_ARM_CODEGEN 0
#endif
#if defined (__mips__)
#define ASSEMBLY_SCRATCH_SIZE 4096
#elif defined(__aarch64__)
#define ASSEMBLY_SCRATCH_SIZE 8192
#else
#define ASSEMBLY_SCRATCH_SIZE 2048
#endif
using namespace android;
class ScanlineAssembly : public Assembly {
AssemblyKey<needs_t> mKey;
public:
ScanlineAssembly(needs_t needs, size_t size)
: Assembly(size), mKey(needs) { }
const AssemblyKey<needs_t>& key() const { return mKey; }
};
static void ggl_test_codegen(uint32_t n, uint32_t p, uint32_t t0, uint32_t t1)
{
#if ANDROID_ARM_CODEGEN
GGLContext* c;
gglInit(&c);
needs_t needs;
needs.n = n;
needs.p = p;
needs.t[0] = t0;
needs.t[1] = t1;
sp<ScanlineAssembly> a(new ScanlineAssembly(needs, ASSEMBLY_SCRATCH_SIZE));
#if defined(__arm__)
GGLAssembler assembler( new ARMAssembler(a) );
#endif
#if defined(__mips__)
GGLAssembler assembler( new ArmToMipsAssembler(a) );
#endif
#if defined(__aarch64__)
GGLAssembler assembler( new ArmToAarch64Assembler(a) );
#endif
int err = assembler.scanline(needs, (context_t*)c);
if (err != 0) {
printf("error %08x (%s)\n", err, strerror(-err));
}
gglUninit(c);
#else
printf("This test runs only on ARM, Aarch64 or MIPS\n");
#endif
}
int main(int argc, char** argv)
{
if (argc != 2) {
printf("usage: %s 00000117:03454504_00001501_00000000\n", argv[0]);
return 0;
}
uint32_t n;
uint32_t p;
uint32_t t0;
uint32_t t1;
sscanf(argv[1], "%08x:%08x_%08x_%08x", &p, &n, &t0, &t1);
ggl_test_codegen(n, p, t0, t1);
return 0;
}