Raymond Toy pushed to branch issue-276-xoroshiro128starstar at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/compiler/x86/arith.lisp
    ... ... @@ -1678,79 +1678,6 @@
    1678 1678
     
    
    1679 1679
     (in-package "VM")
    
    1680 1680
     
    
    1681
    -#||
    
    1682
    -#+random-xoroshiro
    
    1683
    -(progn
    
    1684
    -(defknown xoroshiro-next ((simple-array double-float (2)))
    
    1685
    -  (values (unsigned-byte 32) (unsigned-byte 32))
    
    1686
    -  (movable))
    
    1687
    -
    
    1688
    -(define-vop (xoroshiro-next)
    
    1689
    -  (:policy :fast-safe)
    
    1690
    -  (:translate xoroshiro-next)
    
    1691
    -  (:args (state :scs (descriptor-reg) :to (:result 3)))
    
    1692
    -  (:arg-types simple-array-double-float)
    
    1693
    -  (:results (r1 :scs (unsigned-reg))
    
    1694
    -	    (r0 :scs (unsigned-reg)))
    
    1695
    -  (:result-types unsigned-num unsigned-num)
    
    1696
    -  (:temporary (:sc double-reg) s0)
    
    1697
    -  (:temporary (:sc double-reg) s1)
    
    1698
    -  (:temporary (:sc double-reg) t0)
    
    1699
    -  (:generator 10
    
    1700
    -    ;; s0 = state[0]
    
    1701
    -    (inst movsd s0 (make-ea :dword :base state
    
    1702
    -			 :disp (- (+ (* vm:vector-data-offset
    
    1703
    -					vm:word-bytes)
    
    1704
    -				     (* 8 0))
    
    1705
    -				  vm:other-pointer-type)))
    
    1706
    -    ;; s1 = state[1]
    
    1707
    -    (inst movsd s1 (make-ea :dword :base state
    
    1708
    -			 :disp (- (+ (* vm:vector-data-offset
    
    1709
    -					vm:word-bytes)
    
    1710
    -				     (* 8 1))
    
    1711
    -				  vm:other-pointer-type)))
    
    1712
    -    ;; Compute result = s0 + s1
    
    1713
    -    (inst movapd t0 s0)
    
    1714
    -    (inst paddq t0 s1)
    
    1715
    -    ;; Save the 64-bit result as two 32-bit results
    
    1716
    -    (inst movd r0 t0)
    
    1717
    -    (inst psrlq t0 32)
    
    1718
    -    (inst movd r1 t0)
    
    1719
    -
    
    1720
    -    ;; s1 = s1 ^ s0
    
    1721
    -    (inst xorpd s1 s0)
    
    1722
    -
    
    1723
    -    ;; s0 = rotl(s0,55) = s0 << 55 | s0 >> 9
    
    1724
    -    (inst movapd t0 s0)
    
    1725
    -    (inst psllq s0 55)			; s0 = s0 << 55
    
    1726
    -    (inst psrlq t0 9)			; t0 = s0 >> 9
    
    1727
    -    (inst orpd s0 t0)			; s0 = rotl(s0, 55)
    
    1728
    -
    
    1729
    -    (inst movapd t0 s1)
    
    1730
    -    (inst xorpd s0 s1)			; s0 = s0 ^ s1
    
    1731
    -    (inst psllq t0 14)			; t0 = s1 << 14
    
    1732
    -    (inst xorpd s0 t0)			; s0 = s0 ^ t0
    
    1733
    -    (inst movsd (make-ea :dword :base state
    
    1734
    -			 :disp (- (+ (* vm:vector-data-offset
    
    1735
    -					vm:word-bytes)
    
    1736
    -				     (* 8 0))
    
    1737
    -				  vm:other-pointer-type))
    
    1738
    -	  s0)
    
    1739
    -
    
    1740
    -    ;; s1 = rotl(s1, 36) = s1 << 36 | s1 >> 28, using t0 as temp
    
    1741
    -    (inst movapd t0 s1)
    
    1742
    -    (inst psllq s1 36)
    
    1743
    -    (inst psrlq t0 28)
    
    1744
    -    (inst orpd s1 t0)
    
    1745
    -
    
    1746
    -    (inst movsd (make-ea :dword :base state
    
    1747
    -			 :disp (- (+ (* vm:vector-data-offset
    
    1748
    -					vm:word-bytes)
    
    1749
    -				     (* 8 1))
    
    1750
    -				  vm:other-pointer-type))
    
    1751
    -	  s1)))
    
    1752
    -)
    
    1753
    -||#
    
    1754 1681
     #+random-xoroshiro
    
    1755 1682
     (progn
    
    1756 1683
     (defknown xoroshiro-next ((simple-array double-float (2)))
    
    ... ... @@ -1790,6 +1717,8 @@
    1790 1717
         ;; 
    
    1791 1718
         ;; 	 return result;
    
    1792 1719
         ;; }
    
    1720
    +
    
    1721
    +    ;; s0 = state[0]
    
    1793 1722
         (inst movsd s0 (make-ea :dword :base state
    
    1794 1723
                                        :disp (- (+ (* vm:vector-data-offset
    
    1795 1724
     					          vm:word-bytes)
    
    ... ... @@ -1819,6 +1748,7 @@
    1819 1748
         (inst psrlq t0 32)
    
    1820 1749
         (inst movd r1 t0)
    
    1821 1750
     
    
    1751
    +    ;; s1 = state[1]
    
    1822 1752
         (inst movsd s1 (make-ea :dword :base state
    
    1823 1753
     			           :disp (- (+ (* vm:vector-data-offset
    
    1824 1754
     					          vm:word-bytes)
    

  • src/general-info/release-21f.md
    ... ... @@ -23,6 +23,9 @@ public domain.
    23 23
         * Add support for Gray streams implementation of file-length via
    
    24 24
           `ext:stream-file-length` generic function.
    
    25 25
       * Changes:
    
    26
    +    * The RNG has changed from an old version of xoroshiro128+ to
    
    27
    +      xoroshiro128**.  This means sequences of random numbers will be
    
    28
    +      different from before.  See ~~#276~~.
    
    26 29
       * ANSI compliance fixes:
    
    27 30
       * Bug fixes:
    
    28 31
       * Gitlab tickets:
    
    ... ... @@ -40,6 +43,7 @@ public domain.
    40 43
         * ~~#258~~ Remove `get-page-size` from linux-os.lisp
    
    41 44
         * ~~#269~~ Add function to get user's home directory
    
    42 45
         * ~~#266~~ Support "~user" in namestrings
    
    46
    +    * ~~#276~~ Implement xoroshiro128** generator for x86
    
    43 47
       * Other changes:
    
    44 48
       * Improvements to the PCL implementation of CLOS:
    
    45 49
       * Changes to building procedure: