panfrost,asahi: Use util_sign_extend for unpacking

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17214>
This commit is contained in:
Jason Ekstrand 2022-06-23 13:19:12 -05:00 committed by Marge Bot
parent 6787c96039
commit 642283a2c1
2 changed files with 2 additions and 4 deletions

View File

@ -117,8 +117,7 @@ __gen_unpack_sint(const uint8_t *restrict cl, uint32_t start, uint32_t end)
int size = end - start + 1;
int64_t val = __gen_unpack_uint(cl, start, end);
/* Get the sign bit extended. */
return (val << (64 - size)) >> (64 - size);
return util_sign_extend(val, size);
}
#define agx_prepare(dst, T) \\

View File

@ -118,8 +118,7 @@ __gen_unpack_sint(const uint8_t *restrict cl, uint32_t start, uint32_t end)
int size = end - start + 1;
int64_t val = __gen_unpack_uint(cl, start, end);
/* Get the sign bit extended. */
return (val << (64 - size)) >> (64 - size);
return util_sign_extend(val, size);
}
static inline uint64_t