Commit ca693d1c authored by Aleksandar Markovic's avatar Aleksandar Markovic
Browse files

tests/tcg: target/mips: Add utility function reset_msa_registers()



Add function reset_msa_registers() and utilize it in each MSA test.
This is needed to ensure independency of test results on the state of
MSA registers before test execution. This also allows for correction
of tests for VSHF* instructions, that are now independent on the
previous state of MSA registers.

Signed-off-by: default avatarAleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: default avatarAleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1559838440-9866-9-git-send-email-aleksandar.markovic@rt-rk.com>
parent b7c67982
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -23,6 +23,54 @@
#define WRAPPERS_MSA_H


#define RESET_MSA_REGISTER(wi)                                         \
   __asm__ volatile (                                                  \
      "xor.v $" #wi ", $" #wi ", $" #wi "\n\t"                         \
      :                                                                \
      :                                                                \
      :                                                                \
   )


static inline void reset_msa_registers()
{

   RESET_MSA_REGISTER(w0);
   RESET_MSA_REGISTER(w1);
   RESET_MSA_REGISTER(w2);
   RESET_MSA_REGISTER(w3);
   RESET_MSA_REGISTER(w4);
   RESET_MSA_REGISTER(w5);
   RESET_MSA_REGISTER(w6);
   RESET_MSA_REGISTER(w7);
   RESET_MSA_REGISTER(w8);
   RESET_MSA_REGISTER(w9);
   RESET_MSA_REGISTER(w10);
   RESET_MSA_REGISTER(w11);
   RESET_MSA_REGISTER(w12);
   RESET_MSA_REGISTER(w13);
   RESET_MSA_REGISTER(w14);
   RESET_MSA_REGISTER(w15);
   RESET_MSA_REGISTER(w16);
   RESET_MSA_REGISTER(w17);
   RESET_MSA_REGISTER(w18);
   RESET_MSA_REGISTER(w19);
   RESET_MSA_REGISTER(w20);
   RESET_MSA_REGISTER(w21);
   RESET_MSA_REGISTER(w22);
   RESET_MSA_REGISTER(w23);
   RESET_MSA_REGISTER(w24);
   RESET_MSA_REGISTER(w25);
   RESET_MSA_REGISTER(w26);
   RESET_MSA_REGISTER(w27);
   RESET_MSA_REGISTER(w28);
   RESET_MSA_REGISTER(w29);
   RESET_MSA_REGISTER(w30);
   RESET_MSA_REGISTER(w31);

}


#define DO_MSA__WD__WS(suffix, mnemonic)                               \
static inline void do_msa_##suffix(const void *input,                  \
                                   const void *output)                 \
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ int32_t main(void)
        { 0x0100010104000201ULL, 0x0200020200000003ULL, },
    };

    reset_msa_registers();

    gettimeofday(&start, NULL);

    for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ int32_t main(void)
        { 0x0000000000000001ULL, 0x0000000000000002ULL, },
    };

    reset_msa_registers();

    gettimeofday(&start, NULL);

    for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ int32_t main(void)
        { 0x0001000100040002ULL, 0x0002000200000000ULL, },
    };

    reset_msa_registers();

    gettimeofday(&start, NULL);

    for (i = 0; i < TEST_COUNT_TOTAL; i++) {
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ int32_t main(void)
        { 0x0000000100000004ULL, 0x0000000200000000ULL, },
    };

    reset_msa_registers();

    gettimeofday(&start, NULL);

    for (i = 0; i < TEST_COUNT_TOTAL; i++) {
Loading