[Beignet] [PATCH] Re-format the asm print for long imm

Zhigang Gong zhigang.gong at linux.intel.com
Thu Jan 29 19:49:16 PST 2015


On Thu, Jan 29, 2015 at 07:24:54PM +0800, junyan.he at inbox.com wrote:
> From: Junyan He <junyan.he at linux.intel.com>
> 
> Use decimal to print signed long and use hex to print
> unsigned long, which make the format more clear.
> 
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
>  backend/src/backend/gen/gen_mesa_disasm.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/backend/src/backend/gen/gen_mesa_disasm.c b/backend/src/backend/gen/gen_mesa_disasm.c
> index 640c0fe..e6a2c6b 100644
> --- a/backend/src/backend/gen/gen_mesa_disasm.c
> +++ b/backend/src/backend/gen/gen_mesa_disasm.c
> @@ -989,17 +989,17 @@ static int imm(FILE *file, uint32_t type, const void* inst)
>      case GEN_TYPE_F:
>        format(file, "%-gF", GEN_BITS_FIELD(inst, bits3.f));
>        break;
> -    case GEN_TYPE_L:
> +    case GEN_TYPE_UL:
>        assert(!(gen_version < 80));
> -      format(file, "0x%.8x %.8xQ", (((const union Gen8NativeInstruction *)inst)->bits3).ud,
> +      format(file, "0x%.8x %.8xUQ", (((const union Gen8NativeInstruction *)inst)->bits3).ud,
>                                  (((const union Gen8NativeInstruction *)inst)->bits2).ud);
>        break;
> -    case GEN_TYPE_UL:
> +    case GEN_TYPE_L:
>      {
>        assert(!(gen_version < 80));
>        uint64_t val = (((const union Gen8NativeInstruction *)inst)->bits3).ud;
>        val = (val << 32) + ((((const union Gen8NativeInstruction *)inst)->bits2).ud);
> -      format(file, "0x%luUQ", val);
> +      format(file, "0x%ldQ", val);
Should use %lld here, otherwise on i386 linux, it will only print 32 bit value.

>      }
>    }
>    return 0;
> -- 
> 1.9.1
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list