output float immediate value with %f instead of %g

Submitted by Guo Yejun on July 23, 2015, 12:48 a.m.


Message ID 1437612501-25709-1-git-send-email-yejun.guo@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Guo Yejun July 23, 2015, 12:48 a.m.
In disassemble, a float immediate value is printf with %g, it
outputs a wrong value with 8 bytes, change it to be %f with the
correct 4 bytes. At some cases, the real data type is not float,
so also print the value in hex format.

Signed-off-by: Guo Yejun <yejun.guo@intel.com>
 backend/src/backend/gen/gen_mesa_disasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/backend/src/backend/gen/gen_mesa_disasm.c b/backend/src/backend/gen/gen_mesa_disasm.c
index df6156c..090143e 100644
--- a/backend/src/backend/gen/gen_mesa_disasm.c
+++ b/backend/src/backend/gen/gen_mesa_disasm.c
@@ -986,7 +986,7 @@  static int imm(FILE *file, uint32_t type, const void* inst)
       format(file, "0x%xV", GEN_BITS_FIELD(inst, bits3.ud));
     case GEN_TYPE_F:
-      format(file, "%-gF", GEN_BITS_FIELD(inst, bits3.f));
+      format(file, "%.*fF (0x%x)", GEN_BITS_FIELD(inst, bits3.f), GEN_BITS_FIELD(inst, bits3.ud));
     case GEN_TYPE_UL:
       assert(!(gen_version < 80));