Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
f6daa48c
by Raymond Toy at 2024-03-29T13:17:17+00:00
-
1bc97727
by Raymond Toy at 2024-03-29T13:18:30+00:00
4 changed files:
Changes:
| ... | ... | @@ -41,7 +41,7 @@ else |
| 41 | 41 | fi
|
| 42 | 42 | |
| 43 | 43 | cd ../ansi-test
|
| 44 | -git checkout cmucl-expected-failures
|
|
| 44 | +git checkout issue-288-new-failures
|
|
| 45 | 45 | |
| 46 | 46 | make LISP="$LISP batch -noinit -nositeinit"
|
| 47 | 47 | # There should be no unexpected successes or failures; check these separately
|
| ... | ... | @@ -236,7 +236,7 @@ |
| 236 | 236 | (frob %random-single-float single-float)
|
| 237 | 237 | (frob %random-double-float double-float))
|
| 238 | 238 | |
| 239 | -#-(or new-random random-mt19937 rand-xoroshiro)
|
|
| 239 | +#-(or new-random random-mt19937 random-xoroshiro)
|
|
| 240 | 240 | (deftransform random ((num &optional state)
|
| 241 | 241 | ((integer 1 #.random-fixnum-max) &optional *))
|
| 242 | 242 | _N"use inline fixnum operations"
|
| ... | ... | @@ -259,7 +259,7 @@ |
| 259 | 259 | '(values (truncate (%random-double-float (coerce num 'double-float)
|
| 260 | 260 | (or state *random-state*)))))
|
| 261 | 261 | |
| 262 | -#+(or random-mt19937)
|
|
| 262 | +#+(or random-mt19937 random-xoroshiro)
|
|
| 263 | 263 | (deftransform random ((num &optional state)
|
| 264 | 264 | ((integer 1 #.(expt 2 32)) &optional *))
|
| 265 | 265 | _N"use inline (unsigned-byte 32) operations"
|
| ... | ... | @@ -18997,6 +18997,10 @@ msgstr "" |
| 18997 | 18997 | msgid "use inline (unsigned-byte 32) operations"
|
| 18998 | 18998 | msgstr ""
|
| 18999 | 18999 | |
| 19000 | +#: src/compiler/float-tran.lisp
|
|
| 19001 | +msgid "Shouldn't happen"
|
|
| 19002 | +msgstr ""
|
|
| 19003 | + |
|
| 19000 | 19004 | #: src/compiler/float-tran.lisp
|
| 19001 | 19005 | msgid "Can't open-code float to rational comparison."
|
| 19002 | 19006 | msgstr ""
|
| ... | ... | @@ -82,3 +82,27 @@ |
| 82 | 82 | (assert-equal result (multiple-value-list
|
| 83 | 83 | (64-bit-rng-state *test-state*)))))
|
| 84 | 84 | |
| 85 | +;; Test that the deftransform for random integers is working.
|
|
| 86 | +(defun rng-int-trans (state)
|
|
| 87 | + (declare (type random-state state)
|
|
| 88 | + (optimize (speed 3)))
|
|
| 89 | + (random 100000 state))
|
|
| 90 | + |
|
| 91 | +(defun rng-int (n state)
|
|
| 92 | + (declare (type random-state state))
|
|
| 93 | + (random n state))
|
|
| 94 | + |
|
| 95 | +(define-test deftransform-random-int
|
|
| 96 | + (:tag :issues)
|
|
| 97 | + ;; Using the same state, generate a random integer with RNG-INT.
|
|
| 98 | + ;; This is the expected value. The generate an integer with
|
|
| 99 | + ;; RNG-INT-TRANS. The compiler should have used a deftransform in
|
|
| 100 | + ;; this function. The values returned should be the same.
|
|
| 101 | + (let ((state (kernel::make-random-object :state (kernel::init-random-state 31415926535))))
|
|
| 102 | + (dotimes (k 2)
|
|
| 103 | + (print state)
|
|
| 104 | + (assert-equal (rng-int 100000 (make-random-state state))
|
|
| 105 | + (rng-int-trans (make-random-state state)))
|
|
| 106 | + ;; Generate a random number to change our state.
|
|
| 107 | + (random 100000 state))))
|
|
| 108 | + |