Skip to contentSkip to conversation

parisc: add <asm/hash.h>

PATCH Superseded George Spelvin 1 participant 2 messages May 31, 2016 – Jun 2, 2016 1 message not in the archive PA-RISC architecture

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 parisc: add <asm/hash.h>

PA-RISC is interesting; integer multiplies are implemented in the FPU, so are painful in the kernel. But it tries to be friendly to shift-and-add sequences.

__hash_32 is implemented using the same shift-and-add sequence as Microblaze, just scheduled for the PA7100. (It's 2-way superscalar but in-order, like the Pentium.)

hash_64 was tricky. My tools can't find good shift-and-add sequence for the large multiplier, but the multiplier can be factored and two sequences for smaller multipliers cascaded.

An alternative implementation is included, but not enabled by default:
Thomas Wang's 64-to-32-bit hash. This is more compact than the multiply, but has the same length dependency chain.

---
Definitely an interesting architecture. How did I do? This should pass the self-test in test_hash.ko.

 arch/parisc/Kconfig            |   1 +
 arch/parisc/include/asm/hash.h | 164 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+)
 create mode 100644 arch/parisc/include/asm/hash.h
arch/parisc/Kconfig +1 -0
index 88cfaa8..8ed2a44 100644
@@ -30,6 +30,7 @@ config PARISC
 	select TTY # Needed for pdc_cons.c
 	select HAVE_DEBUG_STACKOVERFLOW
 	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_HASH
 	select HAVE_ARCH_SECCOMP_FILTER
 	select ARCH_NO_COHERENT_DMA_MMAP
 
arch/parisc/include/asm/hash.h new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
2.8.1
#2 lore raw

PATCH v2 1/1 parisc: add <asm/hash.h>

Quoted 1 line

From 76c1fedcb594fc4a75e2d836ab40e9e8ec455755 Mon Sep 17 00:00:00 2001

From: George Spelvin <[email protected]>
Date: Thu, 2 Jun 2016 17:31:42 -0400
Subject: [PATCH] parisc: add <asm/hash.h>

PA-RISC is interesting; integer multiplies are implemented in the FPU, so are painful in the kernel. But it tries to be friendly to shift-and-add sequences.

__hash_32 is implemented using the same shift-and-add sequence as Microblaze, just scheduled for the PA7100. (It's 2-way superscalar but in-order, like the Pentium.)

hash_64 was tricky, but a suggestion from Jason Thong allowed a good solution by breaking up the multiplier. Unfortunately, I scheduled it based on a serious misunderstanding of the PA8000's pipeline. It's 4-way superscalar, but two of those slots are reserved for load/store instructions. Contrary to what I thought while writing the code, it can only issue 2 ALU operations per cycle, so the 20 instructions here take 11 cycles. (The final add can't be paired.)

An alternative implementation is included, but not enabled by default:
Thomas Wang's 64-to-32-bit hash. This is more compact than the multiply, but has a slightly longer dependency chain.

---
I got allexcited when I managed to schedule the multiply in 8 cycles.. then realized I misunderstood the "4-way superscalar" nature of the PA8000. Still, it's better than the previous one, so I'm sending it out for comment anyway.

 arch/parisc/Kconfig            |   1 +
 arch/parisc/include/asm/hash.h | 190 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 191 insertions(+)
 create mode 100644 arch/parisc/include/asm/hash.h
arch/parisc/Kconfig +1 -0
index 88cfaa8..8ed2a44 100644
@@ -30,6 +30,7 @@ config PARISC
 	select TTY # Needed for pdc_cons.c
 	select HAVE_DEBUG_STACKOVERFLOW
 	select HAVE_ARCH_AUDITSYSCALL
+	select HAVE_ARCH_HASH
 	select HAVE_ARCH_SECCOMP_FILTER
 	select ARCH_NO_COHERENT_DMA_MMAP
 
arch/parisc/include/asm/hash.h new file +190 -0

190 lines not on this page · raw message

Signature · 1 line
2.8.1