aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/cgen-dis.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 0dab08e..20e0524 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-22 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * cgen-dis.c (count_decodable_bits): Use __builtin_popcount when
+ available.
+
2021-06-22 Alan Modra <amodra@gmail.com>
* pj-dis.c (print_insn_pj): Don't print trailing tab. Do
diff --git a/opcodes/cgen-dis.c b/opcodes/cgen-dis.c
index 6a93060..1a5d1ae 100644
--- a/opcodes/cgen-dis.c
+++ b/opcodes/cgen-dis.c
@@ -40,6 +40,9 @@ static int
count_decodable_bits (const CGEN_INSN *insn)
{
unsigned mask = CGEN_INSN_BASE_MASK (insn);
+#if GCC_VERSION >= 3004
+ return __builtin_popcount (mask);
+#else
int bits = 0;
unsigned m;
@@ -49,6 +52,7 @@ count_decodable_bits (const CGEN_INSN *insn)
++bits;
}
return bits;
+#endif
}
/* Add an instruction to the hash chain. */