lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ppc: Add optimization to generate endian-swapping load opcod


From: Paul Cercueil
Subject: Re: [PATCH] ppc: Add optimization to generate endian-swapping load opcodes
Date: Fri, 12 Aug 2022 14:19:56 +0200


[...]

One last question is, will it work as expected in big endian and little
endian? Also, will it work in 32 and 64 bit? Before doing a release I
would check in actual hardware or virtual machines all backends and
validate it, but better to not let things like this to be verified very later.

Tested on PowerPC 64-bit big-endian and it works perfectly fine.

Using the following code:

#include <lightning.h>
#include <stdio.h>

static unsigned int value = 0xdeadbabe;

int main(int argc, char **argv)
{
        unsigned int (*get_value)(void);
        jit_state_t *_jit;

        init_jit(argv[0]);

        _jit = jit_new_state();
        jit_prolog();

#if 0
        jit_movi(JIT_R0, (long) &value);
        jit_ldr_ui(JIT_R0, JIT_R0);
#else
        jit_ldi_ui(JIT_R0, &value);
#endif
        jit_bswapr_ui(JIT_R0, JIT_R0);

        jit_retr(JIT_R0);
        jit_epilog();

        get_value = jit_emit();
        jit_disassemble();

        printf("Value: 0x%x\n", get_value());

        jit_clear_state();
        jit_destroy_state();
        finish_jit();

        return 0;
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]