lkml.org 
[lkml]   [2009]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 06/12] Immediate Values - Powerpc Optimization
PowerPC optimization of the immediate values which uses a li instruction,
patched with an immediate value.

Changelog:
- Put imv_set and _imv_set in the architecture independent header.
- Pack the __imv section. Use smallest types required for size (char).
- Remove architecture specific update code : now handled by architecture
agnostic code.
- Use imv_* instead of immediate_*.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Rusty Russell <rusty@rustcorp.com.au>
CC: Christoph Hellwig <hch@infradead.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Adrian Bunk <bunk@stusta.de>
CC: Andi Kleen <andi@firstfloor.org>
CC: mingo@elte.hu
CC: akpm@osdl.org
---
arch/powerpc/Kconfig | 1
arch/powerpc/include/asm/immediate.h | 56 +++++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+)
Index: linux.trees.git/arch/powerpc/include/asm/immediate.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux.trees.git/arch/powerpc/include/asm/immediate.h 2009-09-24 09:00:33.000000000 -0400
@@ -0,0 +1,56 @@
+#ifndef _ASM_POWERPC_IMMEDIATE_H
+#define _ASM_POWERPC_IMMEDIATE_H
+
+/*
+ * Immediate values. PowerPC architecture optimizations.
+ *
+ * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * This file is released under the GPLv2.
+ * See the file COPYING for more details.
+ */
+
+#include <asm/asm-compat.h>
+
+/**
+ * imv_read - read immediate variable
+ * @name: immediate value name
+ *
+ * Reads the value of @name.
+ * Optimized version of the immediate.
+ * Do not use in __init and __exit functions. Use _imv_read() instead.
+ */
+#define imv_read(name) \
+ ({ \
+ __typeof__(name##__imv) value; \
+ BUILD_BUG_ON(sizeof(value) > 8); \
+ switch (sizeof(value)) { \
+ case 1: \
+ asm(".section __imv,\"a\",@progbits\n\t" \
+ PPC_LONG "%c1, ((1f)-1)\n\t" \
+ ".byte 1\n\t" \
+ ".previous\n\t" \
+ "li %0,0\n\t" \
+ "1:\n\t" \
+ : "=r" (value) \
+ : "i" (&name##__imv)); \
+ break; \
+ case 2: \
+ asm(".section __imv,\"a\",@progbits\n\t" \
+ PPC_LONG "%c1, ((1f)-2)\n\t" \
+ ".byte 2\n\t" \
+ ".previous\n\t" \
+ "li %0,0\n\t" \
+ "1:\n\t" \
+ : "=r" (value) \
+ : "i" (&name##__imv)); \
+ break; \
+ case 4: \
+ case 8: \
+ value = name##__imv; \
+ break; \
+ }; \
+ value; \
+ })
+
+#endif /* _ASM_POWERPC_IMMEDIATE_H */
Index: linux.trees.git/arch/powerpc/Kconfig
===================================================================
--- linux.trees.git.orig/arch/powerpc/Kconfig 2009-09-24 08:52:40.000000000 -0400
+++ linux.trees.git/arch/powerpc/Kconfig 2009-09-24 09:00:51.000000000 -0400
@@ -130,6 +130,7 @@ config PPC
select HAVE_SYSCALL_WRAPPERS if PPC64
select GENERIC_ATOMIC64 if PPC32
select HAVE_PERF_EVENTS
+ select HAVE_IMMEDIATE

config EARLY_PRINTK
bool
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68


\
 
 \ /
  Last update: 2009-09-24 17:15    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site