From 448e99705bdfbc1a9e77756e3bb5123c95575dc1 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Thu, 28 Dec 2017 09:53:39 -0800
Subject: [PATCH] Use the xoroshiro vop on sparc

The vop greatly speeds up the generator on sparc.  The time to
generate 10,000,000 single-floats (on a 1 GHz Ultrasparc 3i) is:

mt19937:   1.32 sec
xoroshiro: 1.03 sec

So xoroshiro is 22% faster than mt19937.
---
 src/code/rand-xoroshiro.lisp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/code/rand-xoroshiro.lisp b/src/code/rand-xoroshiro.lisp
index 68b567d94..be9f0cb5a 100644
--- a/src/code/rand-xoroshiro.lisp
+++ b/src/code/rand-xoroshiro.lisp
@@ -206,15 +206,17 @@
 
 ;;;; Random entries:
 
-#+x86
+;; Sparc and x86 have vops to implement xoroshiro-gen that are much
+;; faster than the portable lisp version.  Use them.
+#+(or x86 sparc)
 (declaim (inline xoroshiro-gen))
-#+x86
+#+(or x86 sparc)
 (defun xoroshiro-gen (state)
   (declare (type (simple-array double-float (2)) state)
 	   (optimize (speed 3) (safety 0)))
   (vm::xoroshiro-next state))
 
-#-x86
+#+(or x86 sparc)
 (defun xoroshiro-gen (state)
   (declare (type (simple-array double-float (2)) state)
 	   (optimize (speed 3) (safety 0)))
-- 
GitLab