From 60537416100356b4daaa10053293a5b93e0e5eaf Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 22 Jul 2021 11:58:32 -0400 Subject: [PATCH] pan/bi: Add instruction equality helper Useful for unit testing. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_test.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/panfrost/bifrost/bi_test.h b/src/panfrost/bifrost/bi_test.h index 1f67eb46537..81038d46b1e 100644 --- a/src/panfrost/bifrost/bi_test.h +++ b/src/panfrost/bifrost/bi_test.h @@ -58,4 +58,14 @@ bit_builder(void *memctx) return b; } +/* Helper to compare for logical equality of instructions. Need to skip over + * the link, guaranteed to be first. After that we can compare raw data. */ +static inline bool +bit_instr_equal(bi_instr *A, bi_instr *B) +{ + return memcmp((uint8_t *) A + sizeof(struct list_head), + (uint8_t *) B + sizeof(struct list_head), + sizeof(bi_instr) - sizeof(struct list_head)) == 0; +} + #endif