freedreno/cffdump: Fix 64-bit reg decode in script mode.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13733>
This commit is contained in:
Emma Anholt 2021-11-04 16:03:13 -07:00 committed by Marge Bot
parent f63fd3425d
commit 0d7c6eedc7
3 changed files with 10 additions and 8 deletions

View File

@ -201,7 +201,7 @@ rnn_regoff(struct rnn *rnn, uint32_t offset)
}
enum rnnttype
rnn_decodelem(struct rnn *rnn, struct rnntypeinfo *info, uint32_t regval,
rnn_decodelem(struct rnn *rnn, struct rnntypeinfo *info, uint64_t regval,
union rnndecval *val)
{
val->u = regval;

View File

@ -44,9 +44,8 @@ struct rnn {
};
union rnndecval {
uint32_t u;
int32_t i;
float f;
uint64_t u;
int64_t i;
};
void _rnn_init(struct rnn *rnn, int nocolor);
@ -61,6 +60,6 @@ const char *rnn_enumname(struct rnn *rnn, const char *name, uint32_t val);
struct rnndelem *rnn_regelem(struct rnn *rnn, const char *name);
struct rnndelem *rnn_regoff(struct rnn *rnn, uint32_t offset);
enum rnnttype rnn_decodelem(struct rnn *rnn, struct rnntypeinfo *info,
uint32_t regval, union rnndecval *val);
uint64_t regval, union rnndecval *val);
#endif /* RNNUTIL_H_ */

View File

@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util/u_math.h"
#include "cffdec.h"
#include "rnnutil.h"
@ -181,7 +182,7 @@ static int l_rnn_etype_reg(lua_State *L, struct rnn *rnn, struct rnndelem *elem,
uint64_t offset);
static int
pushdecval(struct lua_State *L, struct rnn *rnn, uint32_t regval,
pushdecval(struct lua_State *L, struct rnn *rnn, uint64_t regval,
struct rnntypeinfo *info)
{
union rnndecval val;
@ -198,7 +199,7 @@ pushdecval(struct lua_State *L, struct rnn *rnn, uint32_t regval,
lua_pushunsigned(L, val.u);
return 1;
case RNN_TTYPE_FLOAT:
lua_pushnumber(L, val.f);
lua_pushnumber(L, uif(val.u));
return 1;
case RNN_TTYPE_BOOLEAN:
lua_pushboolean(L, val.u);
@ -214,7 +215,7 @@ l_rnn_etype(lua_State *L, struct rnn *rnn, struct rnndelem *elem,
uint64_t offset)
{
int ret;
uint32_t regval;
uint64_t regval;
DBG("elem=%p (%d), offset=%lu", elem, elem->type, offset);
switch (elem->type) {
case RNN_ETYPE_REG:
@ -222,6 +223,8 @@ l_rnn_etype(lua_State *L, struct rnn *rnn, struct rnndelem *elem,
* the raw value:
*/
regval = rnn_val(rnn, offset);
if (elem->width == 64)
regval |= (uint64_t)rnn_val(rnn, offset + 1) << 32;
regval <<= elem->typeinfo.shr;
ret = pushdecval(L, rnn, regval, &elem->typeinfo);
if (ret)