[Git][cmucl/cmucl][rtoy-xoro-default] 2 commits: Fix logic mistakes in sparc xoroshiro impl
Raymond Toy
rtoy at common-lisp.net
Thu Dec 28 17:04:29 UTC 2017
Raymond Toy pushed to branch rtoy-xoro-default at cmucl / cmucl
Commits:
6fbd959e by Raymond Toy at 2017-12-28T09:04:13-08:00
Fix logic mistakes in sparc xoroshiro impl
Also compute the array offsets just once so we're consistent between
loading and storing.
- - - - -
11a14537 by Raymond Toy at 2017-12-28T09:04:27-08:00
Export random-state-jump
- - - - -
2 changed files:
- src/code/exports.lisp
- src/compiler/sparc/arith.lisp
Changes:
=====================================
src/code/exports.lisp
=====================================
--- a/src/code/exports.lisp
+++ b/src/code/exports.lisp
@@ -2550,7 +2550,9 @@
"SIMPLE-ARRAY-COMPLEX-DOUBLE-DOUBLE-FLOAT-P"
"OBJECT-NOT-SIMPLE-ARRAY-COMPLEX-DOUBLE-DOUBLE-FLOAT-ERROR"
"DD-PI"
- "INVALID-CASE"))
+ "INVALID-CASE")
+ #+random-xoroshiro
+ (:export "RANDOM-STATE-JUMP"))
(dolist
(name
=====================================
src/compiler/sparc/arith.lisp
=====================================
--- a/src/compiler/sparc/arith.lisp
+++ b/src/compiler/sparc/arith.lisp
@@ -2611,39 +2611,37 @@
(:temporary (:sc unsigned-reg :offset nl4-offset) s1)
(:temporary (:sc unsigned-reg :offset nl3-offset) t0)
(:generator 10
- (inst ldx s0 state (+ (* 0 double-float-bytes)
- (- (* vm:vector-data-offset vm:word-bytes)
- vm:other-pointer-type)))
- (inst ldx s1 state (+ (* 1 double-float-bytes)
- (- (* vm:vector-data-offset vm:word-bytes)
- vm:other-pointer-type)))
- ;; result = s0 + s1, split into low 32-bits in r0 and high 32-bits
- ;; in r1
- (inst add r0 s0 s1)
- (inst srlx r1 r0 32)
-
- ;; s1 = s1 ^ s0
- (inst xor s1 s1 s0)
-
- ;; s0 = rotl(s0,55) = s0 << 55 | s0 >> 9
- (inst sllx s0 s0 55)
- (inst srlx t0 s0 9)
- (inst or s0 t0)
-
- (inst xor s0 s1) ; s0 = s0 ^ s1
- (inst sllx t0 s1 14) ; t0 = s1 << 14
- (inst xor s0 t0) ; s0 = s0 ^ t0
-
- (inst stx s0 state (+ (* 0 double-float-bytes)
- (- (* vm:vector-data-offset vm:word-bytes)
- vm:other-pointer-type)))
-
- ;; s1 = rotl(s1, 36) = s1 << 36 | s1 >> 28, using t0 as temp
- (inst sllx s1 36)
- (inst srlx t0 s1 28)
- (inst or s1 t0)
-
- (inst stx s1 state (+ (* 1 double-float-bytes)
- (- (* vm:vector-data-offset vm:word-bytes)
- vm:other-pointer-type)))))
+ (let ((s0-offset (+ (* 0 double-float-bytes)
+ (- (* vm:vector-data-offset vm:word-bytes)
+ vm:other-pointer-type)))
+ (s1-offset (+ (* 1 double-float-bytes)
+ (- (* vm:vector-data-offset vm:word-bytes)
+ vm:other-pointer-type))))
+ (inst ldx s0 state s0-offset)
+ (inst ldx s1 state s1-offset)
+ ;; result = s0 + s1, split into low 32-bits in r0 and high 32-bits
+ ;; in r1
+ (inst add r0 s0 s1)
+ (inst srlx r1 r0 32)
+
+ ;; s1 = s1 ^ s0
+ (inst xor s1 s0)
+
+ ;; s0 = rotl(s0,55) = s0 << 55 | s0 >> 9
+ (inst sllx t0 s0 55)
+ (inst srlx s0 s0 9)
+ (inst or s0 t0)
+
+ (inst xor s0 s1) ; s0 = s0 ^ s1
+ (inst sllx t0 s1 14) ; t0 = s1 << 14
+ (inst xor s0 t0) ; s0 = s0 ^ t0
+
+ (inst stx s0 state s0-offset)
+
+ ;; s1 = rotl(s1, 36) = s1 << 36 | s1 >> 28, using t0 as temp
+ (inst sllx t0 s1 36)
+ (inst srlx s1 28)
+ (inst or s1 t0)
+
+ (inst stx s1 state s1-offset))))
)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/164cf685e3b50676afd9b7115f60e2e3b1a45c48...11a1453743bb29c813fb308a12fa6b26939fa8ff
---
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/compare/164cf685e3b50676afd9b7115f60e2e3b1a45c48...11a1453743bb29c813fb308a12fa6b26939fa8ff
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20171228/d5959aee/attachment-0001.html>
More information about the cmucl-cvs
mailing list