misc-cmucl-type-prop.lsp 11.9 KB
Newer Older
1 2 3 4 5 6 7 8 9
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Fri Mar  4 06:21:51 2005
;;;; Contains: CMUCL type prop failures (moved from misc.lsp)

(in-package :cl-test)

;;; All these are 'strange template failures'
;;; The comment before each is the NAME of the template in the backtrace
10
;;; These tests seem to all have (space 2) (speed 3)
11 12

; X86::FAST-LOGAND-C/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
13
(deftest cmucl-type-prop.1
14 15 16 17 18
  (funcall
   (compile
    nil
    '(lambda (p1)
       (declare (optimize (speed 2) (safety 2) (debug 2) (space 3))
sds's avatar
sds committed
19
                (type (member 2 -4 -211907662 -27215198) p1))
20 21 22 23 24
       (logand (the (integer * 161212781) p1) 10600829)))
   -27215198)
  2129952)

; X86::FAST-LOGAND/SIGNED-UNSIGNED=>UNSIGNED
pfdietz's avatar
pfdietz committed
25
(deftest cmucl-type-prop.2
26 27 28 29 30
  (funcall
   (compile
    nil
    '(lambda (p1 p2)
       (declare (optimize (speed 2) (safety 1) (debug 3) (space 3))
sds's avatar
sds committed
31
                (type (integer 1619851121 1619868587) p1) (type (integer * 303689) p2))
32 33 34 35 36
       (logandc2 (the (integer -5359291650 1619851136) p1) (the unsigned-byte p2))))
   1619851124 300065)
  1619551060)

; X86::FAST-LOGIOR-C/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
37
(deftest cmucl-type-prop.3
38 39 40 41 42
  (funcall
   (compile
    nil
    '(lambda (p1)
       (declare (optimize (speed 2) (safety 3) (debug 0) (space 3))
sds's avatar
sds committed
43
                (type (integer 59087 63964) p1))
44 45 46 47 48
       (logior p1 -65887623)))
   59967)
  -65869185)

; X86::FAST-LOGIOR/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
49
(deftest cmucl-type-prop.4
50 51 52 53 54
  (funcall
   (compile
    nil
    '(lambda (p1 p2)
       (declare (optimize (speed 2) (safety 2) (debug 0) (space 3))
sds's avatar
sds committed
55
                (type (integer 3585942 72924743) p1) (type (integer -70689 *) p2))
56 57 58 59 60
       (logorc2 (the (integer * 8514860) p1) (the (integer 1 411) p2))))
   3586455 4)
  -1)

; X86::FAST-LOGAND-C/SIGNED=>SIGNED
pfdietz's avatar
pfdietz committed
61
(deftest cmucl-type-prop.5
62 63 64 65 66
  (funcall
   (compile
    nil
    '(lambda (p2)
       (declare (optimize (speed 2) (safety 1) (debug 2) (space 3))
sds's avatar
sds committed
67
                (type (integer -257 *) p2))
68 69 70 71 72
       (lognand 1020158769 (the (integer -5275217 2381998) p2))))
   2)
  -1)

; X86::FAST-LOGAND-C/SIGNED-UNSIGNED=>UNSIGNED
pfdietz's avatar
pfdietz committed
73
(deftest cmucl-type-prop.6
74 75 76 77 78
  (funcall
   (compile
    nil
    '(lambda (p1)
       (declare (optimize (speed 2) (safety 1) (debug 0) (space 3))
sds's avatar
sds committed
79
                (type (integer -96413017 -96297711) p1))
80 81 82 83 84
       (lognand p1 3472289945)))
   -96413016)
  -3393245321)

; X86::FAST-LOGAND/UNSIGNED-SIGNED=>UNSIGNED
pfdietz's avatar
pfdietz committed
85
(deftest cmucl-type-prop.7
86 87 88 89 90
  (funcall
   (compile
    nil
    '(lambda (p1 p2)
       (declare (optimize (speed 2) (safety 3) (debug 2) (space 3))
sds's avatar
sds committed
91 92
                (type (integer 438294 891242) p1)
                (type (member 16317 -15 -541332155 33554427) p2))
93 94 95 96 97
       (logand (the (integer -33116139 1759877902) p1) p2)))
   438295 16317)
  12309)

; X86::FAST-LOGIOR-C/SIGNED=>SIGNED
pfdietz's avatar
pfdietz committed
98
(deftest cmucl-type-prop.8
99 100 101 102 103
  (funcall
   (compile
    nil
    '(lambda (p1)
       (declare (optimize (speed 2) (safety 1) (debug 1) (space 3))
sds's avatar
sds committed
104
                (type (integer -728025757 -727856169) p1))
105 106 107 108 109
       (logorc1 (the (integer -734005577 -727855553) p1) -3311)))
   -727856176)
  -2241)

; X86::FAST-LOGXOR/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
110
(deftest cmucl-type-prop.9
111 112 113 114 115
  (funcall
   (compile
    nil
    '(lambda (p1 p2)
       (declare (optimize (speed 2) (safety 3) (debug 3) (space 3))
sds's avatar
sds committed
116
                (type (integer * 1489068) p1) (type (integer -7455 *) p2))
117
       (logeqv (the (member 9543 -15 32766 -264472) p1)
sds's avatar
sds committed
118
               (the (integer -524303 11182721) p2))))
119 120 121 122
   9543 -8)
  9536)

; X86::FAST-LOGXOR/SIGNED=>SIGNED
pfdietz's avatar
pfdietz committed
123
(deftest cmucl-type-prop.10
124 125 126 127 128
  (funcall
   (compile
    nil
    '(lambda (p1 p2)
       (declare (optimize (speed 2) (safety 1) (debug 3) (space 3))
sds's avatar
sds committed
129
                (type (integer -616605365 -616598658) p1) (type (eql 499113) p2))
130 131 132 133 134
       (logeqv (the real p1) p2)))
   -616604953 499113)
  617035953)

; X86::FAST-LOGXOR-C/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
135
(deftest cmucl-type-prop.11
136 137 138 139 140
  (funcall
   (compile
    nil
    '(lambda (p1)
       (declare (optimize (speed 2) (safety 1) (debug 0) (space 3))
sds's avatar
sds committed
141
                (type (integer -112225610 *) p1))
142 143 144 145 146
       (logeqv (the (integer -2822315666 3) p1) 1679389)))
   1)
  -1679389)

; X86::FAST-LOGXOR-C/SIGNED=>SIGNED
pfdietz's avatar
pfdietz committed
147
(deftest cmucl-type-prop.12
148 149 150 151 152
  (funcall
   (compile
    nil
    '(lambda (p2)
       (declare (optimize (speed 2) (safety 3) (debug 0) (space 3))
sds's avatar
sds committed
153
                (type (integer -67 268435455) p2))
154 155 156 157 158
       (logeqv 1038360149 (the (integer -3605943309) p2))))
   -1)
  1038360149)

; X86::-/SINGLE-FLOAT
pfdietz's avatar
pfdietz committed
159
(deftest cmucl-type-prop.13
160 161 162 163 164 165
  (notnot
   (typep
    (funcall
     (compile
      nil
      '(lambda (p1)
sds's avatar
sds committed
166 167 168
         (declare (optimize (speed 2) (safety 2) (debug 1) (space 3))
                  (type (eql 64848.973) p1))
         (- (the (eql 64848.973f0) p1) -2808/1031)))
169 170 171 172 173
     64848.973f0)
    'single-float))
  t)

; X86::-/DOUBLE-FLOAT
pfdietz's avatar
pfdietz committed
174
(deftest cmucl-type-prop.14
175 176 177 178 179 180
  (notnot
   (typep
    (funcall
     (compile
      nil
      '(lambda (p2)
sds's avatar
sds committed
181 182 183
         (declare (optimize (speed 2) (safety 1) (debug 1) (space 3))
                  (type (integer 9297 *) p2))
         (- 54090.82691488265d0 (the (integer * 1263530808) p2))))
184 185 186 187
     9590)
    'double-float))
  t)

188
; X86::-/SINGLE-FLOAT
pfdietz's avatar
pfdietz committed
189
(deftest cmucl-type-prop.15
190 191 192 193 194 195
  (notnot
   (typep
    (funcall
     (compile
      nil
      '(lambda (p1)
sds's avatar
sds committed
196 197 198
         (declare (optimize (speed 2) (safety 3) (debug 3) (space 3))
                  (type (eql 328536/53893) p1))
         (- p1 59218.633f0)))
199 200 201 202
     328536/53893)
    'single-float))
  t)

sds's avatar
sds committed
203
; X86::FAST--/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
204
(deftest cmucl-type-prop.16
205 206
  (funcall
   (compile nil '(lambda (p2)
sds's avatar
sds committed
207 208 209
                   (declare (optimize (speed 2) (safety 2) (debug 3) (space 3))
                            (type (integer -605782 -28141) p2))
                   (- -61118 p2)))
210 211 212 213
   -28225)
  -32893)

; X86::FAST---C/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
214
(deftest cmucl-type-prop.17
215 216
  (funcall
   (compile nil '(lambda (p1)
sds's avatar
sds committed
217 218 219
                   (declare (optimize (speed 2) (safety 1) (debug 1) (space 3))
                            (type (integer 5535202) p1))
                   (- (the (integer * 27858177) p1) 405)))
220 221 222 223
   5535436)
  5535031)

; X86::FAST--/SIGNED=>SIGNED
pfdietz's avatar
pfdietz committed
224
(deftest cmucl-type-prop.18
225 226
  (funcall
   (compile nil '(lambda (p2)
sds's avatar
sds committed
227 228 229
                   (declare (optimize (speed 2) (safety 2) (debug 2) (space 3))
                            (type (integer -1175231414 -3471291) p2))
                   (- -440 p2)))
230 231 232 233
   -3536832)
  3536392)

; X86::FAST-+-C/FIXNUM=>FIXNUM
pfdietz's avatar
pfdietz committed
234
(deftest cmucl-type-prop.19
235 236
  (funcall
   (compile nil '(lambda (p2)
sds's avatar
sds committed
237 238 239
                   (declare (optimize (speed 2) (safety 3) (debug 2) (space 3))
                            (type (integer -1015240116 5) p2))
                   (+ 491841 (the unsigned-byte p2))))
240 241 242 243
   0)
  491841)

; X86::+/DOUBLE-FLOAT
pfdietz's avatar
pfdietz committed
244
(deftest cmucl-type-prop.20
245
  (notnot (typep (funcall (compile nil '(lambda (p1)
sds's avatar
sds committed
246 247 248 249 250
                                          (declare (optimize (speed 2) (safety 3) (debug 3) (space 3))
                                                   (type (rational -1255531/68466 4) p1))
                                          (+ p1 41888.98682005542d0)))
                          -1255531/68466)
                 'double-float))
251 252 253
  t)

;  X86::+/SINGLE-FLOAT
pfdietz's avatar
pfdietz committed
254
(deftest cmucl-type-prop.21
255
  (notnot (typep (funcall (compile nil '(lambda (p1)
sds's avatar
sds committed
256 257 258 259 260
                                          (declare (optimize (speed 2) (safety 2) (debug 1) (space 3))
                                                   (type (integer -284887911 *) p1))
                                          (+ (the (integer -50006902 19512639861) p1) 68648.28f0)))
                          -16452463)
                 'single-float))
261 262 263
  t)

; X86::=0/DOUBLE-FLOAT
pfdietz's avatar
pfdietz committed
264
(deftest cmucl-type-prop.22
265
  (funcall (compile nil '(lambda (p1)
sds's avatar
sds committed
266 267 268 269
                           (declare (optimize (speed 2) (safety 3) (debug 1) (space 3))
                                    (type (complex double-float) p1))
                           (= p1 -1590311/896933)))
           #c(1.0d0 1.0d0))
270 271 272
  nil)

; X86::=/SINGLE-FLOAT
pfdietz's avatar
pfdietz committed
273
(deftest cmucl-type-prop.23
274
  (funcall (compile nil '(lambda (p2)
sds's avatar
sds committed
275 276 277 278
                           (declare (optimize (speed 2) (safety 2) (debug 1) (space 3))
                                    (type (complex single-float) p2))
                           (= -976855 (the (eql #c(-57420.04 806984.0)) p2))))
           #c(-57420.04f0 806984.0f0))
279 280 281
  nil)

; X86::FAST-EQL/FIXNUM
pfdietz's avatar
pfdietz committed
282
(deftest cmucl-type-prop.24
283 284
  (notnot
   (funcall (compile nil '(lambda (p1 p2)
sds's avatar
sds committed
285 286 287 288
                            (declare (optimize (speed 2) (safety 1) (debug 3) (space 3))
                                     (type (integer -3705845 488458) p1) (type (integer * 869076010) p2))
                            (/= p1 (the (integer -69832764 470) p2))))
            488456 465))
289 290 291
  t)

; X86::FAST-EQL-C/FIXNUM
pfdietz's avatar
pfdietz committed
292
(deftest cmucl-type-prop.25
293 294
  (notnot
   (funcall (compile nil '(lambda (p1)
sds's avatar
sds committed
295 296 297 298
                            (declare (optimize (speed 2) (safety 3) (debug 2) (space 3))
                                     (type (integer -69741922) p1))
                            (/= (the (integer * 216) p1) 182)))
            103))
299 300 301
  t)

; X86::FAST-IF->-C/FIXNUM
pfdietz's avatar
pfdietz committed
302
(deftest cmucl-type-prop.26
303
  (funcall (compile nil '(lambda (p2)
sds's avatar
sds committed
304 305 306 307
                           (declare (optimize (speed 2) (safety 2) (debug 3) (space 3))
                                    (type (integer -451 204073899) p2))
                           (< 134799 (the (integer -56 8589934581) p2))))
           -2)
308 309 310
  nil)

; X86::FAST-IF-<-C/FIXNUM
pfdietz's avatar
pfdietz committed
311
(deftest cmucl-type-prop.27
312
  (funcall (compile nil '(lambda (p2)
sds's avatar
sds committed
313 314 315 316
                           (declare (optimize (speed 2) (safety 2) (debug 2) (space 3))
                                    (type (integer -93662 *) p2))
                           (<= -1 (the (integer -2975848 16770677) p2))))
            -6548)
317
  nil)
318 319 320 321 322

; X86::FAST-+-C/FIXNUM=>FIXNUM
; (simple example)
(deftest cmucl-type-prop.28
  (funcall (compile nil '(lambda (p1)
sds's avatar
sds committed
323 324 325 326
                           (declare (optimize (speed 2) (safety 1) (debug 0) (space 3))
                                    (type (integer -65545 80818) p1))
                           (1+ p1)))
           -1)
327 328 329 330 331
  0)

; X86::FAST-NEGATE/FIXNUM
(deftest cmucl-type-prop.29
  (funcall (compile nil '(lambda (p1)
sds's avatar
sds committed
332 333 334 335
                           (declare (optimize (speed 2) (safety 1) (debug 0) (space 3))
                                    (type (integer -4194320 11531) p1))
                           (- (the (integer -6253866924 34530147) p1))))
           -20)
336 337 338 339 340 341
  20)

;;; Bug in COPY-SEQ

(deftest cmucl-type-prop.30
  (let ((a (funcall
sds's avatar
sds committed
342 343 344 345
            (compile nil `(lambda ()
                            (declare (optimize (speed 2) (safety 2) (debug 0) (space 2)))
                            (copy-seq
                             ,(make-array '(0) :adjustable t)))))))
pfdietz's avatar
pfdietz committed
346
    (and (not (adjustable-array-p a))
sds's avatar
sds committed
347 348
         (= (length a) 0)
         t))
349 350 351 352
  t)

; Bug for PACKAGEP

pfdietz's avatar
pfdietz committed
353
(deftest cmucl-type-prop.31
354
  (funcall (compile nil '(lambda (x)
sds's avatar
sds committed
355 356 357
                           (declare (optimize (speed 2) (space 3)))
                           (packagep x)))
           t)
358
  nil)
359 360 361 362 363 364 365 366 367 368 369 370 371 372

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; There were many failures in string comparison functions
;;; Some are that C::WIN strange template problem, but others
;;; are not.

;;;  0 is not of type (INTEGER 0 (0))
(deftest cmucl-type-prop.32
  (funcall
   (compile
    nil
    '(lambda (p4)
       (declare (optimize (speed 1) (safety 1) (debug 1) (space 0))
sds's avatar
sds committed
373
                (type (integer -2040 9) p4))
374 375 376 377 378 379 380 381 382 383 384
       (string< "bbaa" "" :start1 p4)))
   2)
  nil)

;;;  2 is not of type (INTEGER 0 (2))
(deftest cmucl-type-prop.33
  (funcall
   (compile
    nil
    '(lambda (p4)
       (declare (optimize (speed 0) (safety 0) (debug 2) (space 0))
sds's avatar
sds committed
385
                (type (integer -52340 *) p4))
386 387 388 389 390 391 392 393 394 395 396
       (string< "baabbb" "bb" :start2 p4)))
   1)
  nil)

;;; Incorrect return value
(deftest cmucl-type-prop.34
  (funcall
   (compile
    nil
    '(lambda (p1 p4)
       (declare (optimize (speed 2) (safety 0) (debug 3) (space 0))
sds's avatar
sds committed
397
                (type (simple-string) p1) (type real p4))
398
       (string< (the array p1)
sds's avatar
sds committed
399 400 401
                "bbbba"
                :start1 (the (integer -16382 *) p4)
                :end1 7)))
402 403
   "J4sPI71C3Xn" 5)
  5)