pan/cs: Fix cs_extract_tuple()

Fix cs_extract_tuple() and implement cs_extract{32,64}() as wrappers
around cs_extract_tuple().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38826>
This commit is contained in:
Boris Brezillon 2025-12-04 20:03:58 +01:00
parent 7b61b2eb61
commit afb66778d1

View file

@ -489,31 +489,26 @@ cs_overflow_length_reg(struct cs_builder *b)
}
static inline struct cs_index
cs_extract32(struct cs_builder *b, struct cs_index idx, unsigned word)
cs_extract_tuple(struct cs_builder *b, struct cs_index idx, unsigned word,
unsigned size)
{
assert(idx.type == CS_INDEX_REGISTER && "unsupported");
assert(word < idx.size && "overrun");
assert(word + size <= idx.size && "overrun");
return cs_reg32(b, idx.reg + word);
return cs_reg_tuple(b, idx.reg + word, size);
}
static inline struct cs_index
cs_extract32(struct cs_builder *b, struct cs_index idx, unsigned word)
{
return cs_extract_tuple(b, idx, word, 1);
}
static inline struct cs_index
cs_extract64(struct cs_builder *b, struct cs_index idx, unsigned word)
{
assert(idx.type == CS_INDEX_REGISTER && "unsupported");
assert(word + 1 < idx.size && "overrun");
return cs_reg64(b, idx.reg + word);
}
static inline struct cs_index
cs_extract_tuple(struct cs_builder *b, struct cs_index idx, unsigned word,
unsigned size)
{
assert(idx.type == CS_INDEX_REGISTER && "unsupported");
assert(word + size < idx.size && "overrun");
return cs_reg_tuple(b, idx.reg + word, size);
assert(!(word & 1) && "not properly aligned");
return cs_extract_tuple(b, idx, word, 2);
}
static inline struct cs_block *