pan/bi: Add instruction unit test macro

Checks for instruction equality.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
This commit is contained in:
Alyssa Rosenzweig 2021-07-23 16:33:41 -04:00 committed by Marge Bot
parent 6053741610
commit 07b259defc
1 changed files with 16 additions and 0 deletions

View File

@ -68,4 +68,20 @@ bit_instr_equal(bi_instr *A, bi_instr *B)
sizeof(bi_instr) - sizeof(struct list_head)) == 0;
}
#define INSTRUCTION_CASE(instr, expected, CB) do { \
bi_instr *left = instr; \
bi_instr *right = expected; \
CB(b, left); \
if (bit_instr_equal(left, right)) { \
nr_pass++; \
} else { \
fprintf(stderr, "Incorrect optimization\n"); \
bi_print_instr(instr, stderr); \
bi_print_instr(left, stderr); \
bi_print_instr(right, stderr); \
fprintf(stderr, "\n"); \
nr_fail++; \
} \
} while(0)
#endif