All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf/annotate/powerpc: Fix branch instruction with multiple operands
@ 2017-05-25  5:59 Ravi Bangoria
  2017-05-26 23:23 ` [PATCH] perf/annotate: " Kim Phillips
  0 siblings, 1 reply; 9+ messages in thread
From: Ravi Bangoria @ 2017-05-25  5:59 UTC (permalink / raw)
  To: acme
  Cc: anton, peterz, mingo, alexander.shishkin, treeze.taeung,
	borntraeger, linux-kernel, kim.phillips, Ravi Bangoria

Perf annotate is dropping the cr* fields from branch instructions.
Fix it by adding support to display branch instructions having
multiple operands.

Objdump of int_sqrt:

 20.36 | c0000000004d2694:   subf   r10,r10,r3
       | c0000000004d2698: v bgt    cr6,c0000000004d26a0 <int_sqrt+0x40>
  1.82 | c0000000004d269c:   mr     r3,r10
 29.18 | c0000000004d26a0:   mr     r10,r8
       | c0000000004d26a4: v bgt    cr7,c0000000004d26ac <int_sqrt+0x4c>
       | c0000000004d26a8:   mr     r10,r7

Before Patch:

 20.36 |       subf   r10,r10,r3
       |     v bgt    40
  1.82 |       mr     r3,r10
 29.18 | 40:   mr     r10,r8
       |     v bgt    4c
       |       mr     r10,r7

After patch:

 20.36 |       subf   r10,r10,r3
       |     v bgt    cr6,40
  1.82 |       mr     r3,r10
 29.18 | 40:   mr     r10,r8
       |     v bgt    cr7,4c
       |       mr     r10,r7

Reported-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
---
 tools/perf/util/annotate.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 683f834..a031c4d 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -257,10 +257,18 @@ static int jump__parse(struct arch *arch __maybe_unused, struct ins_operands *op
 static int jump__scnprintf(struct ins *ins, char *bf, size_t size,
 			   struct ins_operands *ops)
 {
+	const char *c = strchr(ops->raw, ',');
+
 	if (!ops->target.addr || ops->target.offset < 0)
 		return ins__raw_scnprintf(ins, bf, size, ops);
 
-	return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset);
+	if (c++ != NULL)
+		return scnprintf(bf, size, "%-6.6s %.*s%" PRIx64,
+			ins->name, c - ops->raw, ops->raw,
+			ops->target.offset);
+	else
+		return scnprintf(bf, size, "%-6.6s %" PRIx64,
+			ins->name, ops->target.offset);
 }
 
 static struct ins_ops jump_ops = {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-06-07 16:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25  5:59 [PATCH] perf/annotate/powerpc: Fix branch instruction with multiple operands Ravi Bangoria
2017-05-26 23:23 ` [PATCH] perf/annotate: " Kim Phillips
2017-06-01 13:09   ` Arnaldo Carvalho de Melo
2017-06-01 13:47     ` Ravi Bangoria
2017-06-01 14:29     ` [PATCH v2] " Kim Phillips
2017-06-01 15:03       ` Ravi Bangoria
2017-06-01 16:42         ` Arnaldo Carvalho de Melo
2017-06-01 17:50         ` Arnaldo Carvalho de Melo
2017-06-07 15:57       ` [tip:perf/urgent] perf annotate: " tip-bot for Kim Phillips

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.