From 3761c0108cbfc6f88c4bf43fc13a38a2f7db0d6f Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 24 Nov 2008 18:40:49 +0000 Subject: Branch optimisation in both C (giving hints to gcc - verified using -fprofile-arcs and gcov) and asm files. Biggest effect on coldfire (-c1000: +8%, -c2000: +5%), but ARM also profits a bit (less than 1% on ARM7TDMI, around 1% on ARM1136). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19199 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/demac/libdemac/demac_config.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'apps/codecs/demac/libdemac/demac_config.h') diff --git a/apps/codecs/demac/libdemac/demac_config.h b/apps/codecs/demac/libdemac/demac_config.h index dd3aaa3f9c..986e5376c4 100644 --- a/apps/codecs/demac/libdemac/demac_config.h +++ b/apps/codecs/demac/libdemac/demac_config.h @@ -70,6 +70,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA #define ICODE_ATTR #define ICODE_ATTR_DEMAC +/* Use to give gcc hints on which branch is most likely taken */ +#if defined(__GNUC__) && __GNUC__ >= 3 +#define LIKELY(x) __builtin_expect(!!(x), 1) +#define UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define LIKELY(x) (x) +#define UNLIKELY(x) (x) +#endif + #endif /* !ROCKBOX */ /* Defaults */ -- cgit v1.2.3