1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
|
; X86ISA Library
; Note: The license below is based on the template at:
; http://opensource.org/licenses/BSD-3-Clause
; Copyright (C) 2015, Regents of the University of Texas
; All rights reserved.
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are
; met:
; o Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; o Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; o Neither the name of the copyright holders nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
; Original Author(s):
; Cuong Chau <ckcuong@cs.utexas.edu>
;; Specifications of FP Converts
(in-package "X86ISA")
(include-book "base")
(local (include-book "centaur/bitops/ihs-extensions" :dir :system))
(local (include-book "arithmetic/top-with-meta" :dir :system))
(local (in-theory (e/d (bitops::ash-1-removal) ())))
;; ======================================================================
(defsection floating-point-converts
:parents (floating-point-specifications)
:short "Specification of floating-point conversion operations" )
(local (xdoc::set-default-parents floating-point-converts))
;; ======================================================================
;; FP to Integer:
(define rat-round-to-int-rn ((rat rationalp))
:returns (r integerp :rule-classes :type-prescription)
(round rat 1))
(define rat-round-to-int-rd ((rat rationalp))
:returns (r integerp :rule-classes :type-prescription)
(let ((rn (round rat 1)))
(if (> rn rat) (1- rn) rn)))
(define rat-round-to-int-ru ((rat rationalp))
:returns (r integerp :rule-classes :type-prescription)
(let ((rn (round rat 1)))
(if (< rn rat) (1+ rn) rn)))
(define rat-round-to-int-rz ((rat rationalp))
:returns (r integerp :rule-classes :type-prescription)
(truncate rat 1))
(define rat-round-to-int ((rat rationalp)
(rc natp))
:inline t
:no-function t
:returns (r integerp :rule-classes :type-prescription)
(rc-cases
:rn (rat-round-to-int-rn rat)
:rd (rat-round-to-int-rd rat)
:ru (rat-round-to-int-ru rat)
:rz (rat-round-to-int-rz rat)
;; Should never get here.
:other 0))
(define sse-cvt-fp-to-int-special (kind (nbytes natp))
:short "Check whether the operand is NaN or infinity. If so, return
the integer indefinite."
;; Return (mv flag integer-result invalid).
:returns (mv flg
(r integerp :hyp :guard :rule-classes :type-prescription)
invalid)
(let ((invalid (or (eq kind 'snan) (eq kind 'qnan)
(eq kind 'indef) (eq kind 'inf))))
(if invalid
(mv t (ash 1 (1- (ash nbytes 3))) invalid)
(mv nil 0 invalid))))
(define sse-cvt-fp-to-int ((nbytes natp)
(op natp)
(mxcsr :type (unsigned-byte 32))
(trunc booleanp)
(exp-width posp)
(frac-width posp))
:prepwork ((local (in-theory (e/d* () (bitops::logand-with-negated-bitmask)))))
(b* ((mxcsr (mbe :logic (loghead 32 mxcsr)
:exec mxcsr))
((mv kind sign exp ?implicit frac)
(fp-decode op exp-width frac-width))
(daz (logbitp #.*mxcsr-daz* mxcsr))
((mv kind exp frac)
(sse-daz kind exp frac daz))
((mv special-ok result invalid)
(sse-cvt-fp-to-int-special kind nbytes))
;; Check invalid operation
(mxcsr (if invalid (!mxcsrBits->ie 1 mxcsr) mxcsr))
(im (equal (mxcsrBits->im mxcsr) 1))
((when (and invalid (not im)))
(mv 'invalid-operand-exception-is-not-masked 0 mxcsr)))
(if special-ok
(mv nil result mxcsr)
(b* ((bias (nfix (ec-call (RTL::bias (list nil (1+ frac-width) exp-width)))))
(rat (fp-to-rat sign exp frac bias exp-width frac-width))
(rc (mbe :logic
(part-select mxcsr :low #.*mxcsr-rc* :high (1+ #.*mxcsr-rc*))
;; (get-bits #.*mxcsr-rc* (1+ #.*mxcsr-rc*) mxcsr)
:exec (logand #b11 (ash mxcsr (- #.*mxcsr-rc*)))))
(rc (if trunc #b11 rc))
(rat-to-int (rat-round-to-int rat rc))
(nbits (ash nbytes 3))
(min-signed-int (- (expt 2 (1- nbits))))
(max-signed-int (1- (expt 2 (1- nbits))))
(out-of-range (or (< rat-to-int min-signed-int)
(> rat-to-int max-signed-int)))
;; If the converted integer is out-of-range, set IE flag.
(mxcsr (if out-of-range (!mxcsrBits->ie 1 mxcsr) mxcsr))
((when (and out-of-range (not im)))
(mv 'invalid-operand-exception-is-not-masked 0 mxcsr))
;; If out-of-range and IM is masked, return integer indefinite.
((when out-of-range)
(mv nil (ash 1 (1- nbits)) mxcsr))
;; Check precision
(pe (not (= rat-to-int rat)))
(mxcsr (if pe (!mxcsrBits->pe 1 mxcsr) mxcsr))
(pm (equal (mxcsrBits->pm mxcsr) 1))
((when (and pe (not pm)))
(mv 'precision-exception-is-not-masked 0 mxcsr)))
(mv nil rat-to-int mxcsr))))
///
(defthm integerp-result-sse-cvt-fp-to-int
(implies (natp nbytes)
(integerp (mv-nth 1 (sse-cvt-fp-to-int
nbytes op mxcsr trunc exp-width frac-width))))
:rule-classes :type-prescription)
(defthm-unsigned-byte-p n32p-mxcsr-sse-cvt-fp-to-int
:bound 32
:concl (mv-nth 2 (sse-cvt-fp-to-int
nbytes op mxcsr trunc exp-width frac-width))
:hints (("Goal" :in-theory (e/d* (unsigned-byte-p-when-mxcsrbits-p) (unsigned-byte-p))))
:gen-type t
:gen-linear t))
;; ======================================================================
;; Integerp to FP:
(define sse-cvt-int-to-fp ((op integerp)
(mxcsr :type (unsigned-byte 32))
(exp-width posp)
(frac-width posp))
:prepwork
((local (in-theory (e/d* () (unsigned-byte-p)))))
(b* ((mxcsr (mbe :logic (loghead 32 mxcsr)
:exec mxcsr))
(rc (mbe :logic
(part-select mxcsr :low #.*mxcsr-rc* :high (1+ #.*mxcsr-rc*))
:exec (logand #b11 (ash mxcsr (- #.*mxcsr-rc*)))))
(bias (nfix (ec-call (RTL::bias (list nil (1+ frac-width) exp-width)))))
(int-to-rat (rat-round op rc bias exp-width frac-width))
(sign (cond ((> int-to-rat 0) 0)
((< int-to-rat 0) 1)
(t (if (int= rc #.*rc-rd*) 1 0))))
;; Check precision
(pe (not (= op int-to-rat)))
(mxcsr (if pe (!mxcsrBits->pe 1 mxcsr) mxcsr))
(pm (equal (mxcsrBits->pm mxcsr) 1))
((when (and pe (not pm)))
(mv 'precision-exception-is-not-masked 0 mxcsr))
(fp-result
(rat-to-fp int-to-rat sign
nil nil nil rc
exp-width frac-width)))
(mv nil fp-result mxcsr))
///
(defthm integerp-result-sse-cvt-int-to-fp
(integerp (mv-nth 1 (sse-cvt-int-to-fp op mxcsr exp-width frac-width)))
:rule-classes :type-prescription)
(defthm-unsigned-byte-p n32p-mxcsr-sse-cvt-int-to-fp
:bound 32
:concl (mv-nth 2 (sse-cvt-int-to-fp op mxcsr exp-width frac-width))
:hints (("Goal" :in-theory (e/d* (unsigned-byte-p-when-mxcsrbits-p) (unsigned-byte-p))))
:gen-type t
:gen-linear t))
;; ======================================================================
;; Convert FP1 to FP2:
(define denormalp ((rat rationalp)
(rounded-expo integerp)
(bias natp))
(let ((expo (RTL::expo rat))
(minus-bias (- bias)))
(or (<= rounded-expo minus-bias)
(and (= rounded-expo 0)
(<= expo minus-bias))))
///
(defthm booleanp-denormalp
(booleanp (denormalp rat rounded-expo bias))))
(define sse-cvt-fp1-to-fp2-special (kind
(sign :type (unsigned-byte 1))
(implicit :type (unsigned-byte 1))
(frac natp)
(frac-width1 posp)
(exp-width2 posp)
(frac-width2 posp))
:short "Check whether the operand is SNaN or QNaN and then return
corresponding result. Also handle the infinities."
;; Return (mv flag sign exp implicit frac invalid).
(let ((invalid (eq kind 'snan)))
(cond
((eq kind 'snan)
(let ((exp-width exp-width2)
(frac-width frac-width2)
(nan-frac-bits (ash
(part-select frac :low 0 :high (nfix (- frac-width1 2)))
(- frac-width2 frac-width1))))
(flag-make-special-bp 'qnan nan-frac-bits
sign invalid)))
((or (eq kind 'qnan) (eq kind 'indef))
(let ((exp-width exp-width2)
(frac (ash frac (- frac-width2 frac-width1))))
(mv t sign (fp-max-exp exp-width) implicit frac invalid)))
((eq kind 'inf)
(let ((exp-width exp-width2)
(frac-width frac-width2))
(flag-make-special-bp 'inf 0 sign invalid)))
(t (mv nil 0 0 0 0 invalid))))
///
(defthm integerp-sse-cvt-fp1-to-fp2-special-1
(implies (integerp sign)
(integerp
(mv-nth
1
(sse-cvt-fp1-to-fp2-special
kind sign implicit frac frac-width1 exp-width2 frac-width2))))
:rule-classes :type-prescription)
(defthm integerp-sse-cvt-fp1-to-fp2-special-2
(integerp (mv-nth
2
(sse-cvt-fp1-to-fp2-special
kind sign implicit frac frac-width1 exp-width2 frac-width2)))
:rule-classes :type-prescription)
(defthm integerp-sse-cvt-fp1-to-fp2-special-3
(implies (integerp implicit)
(integerp (mv-nth
3 (sse-cvt-fp1-to-fp2-special
kind sign implicit frac frac-width1 exp-width2 frac-width2))))
:rule-classes :type-prescription)
(defthm integerp-sse-cvt-fp1-to-fp2-special-4
(integerp (mv-nth
4
(sse-cvt-fp1-to-fp2-special
kind sign implicit frac frac-width1 exp-width2 frac-width2)))
:rule-classes :type-prescription))
(ACL2::with-supporters
(local (include-book "rtl/rel11/lib/excps" :dir :system))
(defun sse-cvt-fp1-to-fp2 (op mxcsr
exp-width1 frac-width1
exp-width2 frac-width2)
(declare (xargs :guard (and (natp op) (n32p mxcsr)
(posp exp-width1) (posp frac-width1)
(posp exp-width2) (posp frac-width2))
:guard-hints (("Goal" :in-theory (e/d* ()
(rtl::sse-post-comp
bitops::logand-with-negated-bitmask
bitops::loghead-of-loghead-1
unsigned-byte-p
bitops::logtail-of-loghead
bitops::logbitp-of-loghead-in-bounds
bitops::loghead-of-logior))))))
(b* ((mxcsr (mbe :logic (loghead 32 mxcsr)
:exec mxcsr))
((mv kind sign exp ?implicit frac)
(fp-decode op exp-width1 frac-width1))
(daz (logbitp #.*mxcsr-daz* mxcsr))
((mv kind ?exp frac)
(sse-daz kind exp frac daz))
((mv special-ok sign-special exp-special & frac-special invalid)
(sse-cvt-fp1-to-fp2-special kind sign implicit frac frac-width1
exp-width2 frac-width2))
;; Check invalid operation
(mxcsr (if invalid (!mxcsrBits->ie 1 mxcsr) mxcsr))
(im (equal (mxcsrBits->im mxcsr) 1))
((when (and invalid (not im)))
(mv 'invalid-operand-exception-is-not-masked 0 mxcsr))
;; Check denormal operand
(de (eq kind 'denormal))
(mxcsr (if de (!mxcsrBits->de 1 mxcsr) mxcsr))
(dm (equal (mxcsrBits->dm mxcsr) 1))
((when (and de (not dm)))
(mv 'denormal-operand-exception-is-not-masked 0 mxcsr)))
(if special-ok
(mv nil
(fp-encode-integer sign-special exp-special frac-special
exp-width2 frac-width2)
mxcsr)
(b* ((bias1 (nfix (ec-call (RTL::bias (list nil (1+ frac-width1) exp-width1)))))
(bias2 (nfix (ec-call (RTL::bias (list nil (1+ frac-width2) exp-width2)))))
(rat (fp-to-rat sign exp frac bias1 exp-width1 frac-width1))
((mv result flags)
(ec-call (rtl::sse-post-comp rat mxcsr (list nil (1+ frac-width2) exp-width2))))
(result (loghead (+ 1 frac-width2 exp-width2) (ifix result)))
(mxcsr (loghead 32 (logior (ifix flags) mxcsr)))
;; Post-computation Exceptions
;; Check overflow
(overflowp (equal (mxcsrBits->oe mxcsr) 1))
((when (and overflowp
(equal (mxcsrBits->om mxcsr) 0)))
(mv 'overflow-exception-is-not-masked result mxcsr))
;; Check underflow
((when (and (equal (mxcsrBits->ue mxcsr) 1)
(equal (mxcsrBits->um mxcsr) 0)))
(mv 'underflow-exception-is-not-masked result mxcsr))
;; Check precision
((when (and (equal (mxcsrBits->pe mxcsr) 1)
(equal (mxcsrBits->pm mxcsr) 0)))
(mv 'precision-exception-is-not-masked result mxcsr))
(rc
(mbe :logic (part-select mxcsr :low #.*mxcsr-rc* :high (1+ #.*mxcsr-rc*))
:exec (logand #b11 (ash mxcsr (- #.*mxcsr-rc*)))))
(rounded-rat (rat-round rat rc bias2 exp-width2 frac-width2))
(rounded-expo (RTL::expo rounded-rat))
(denormalp (denormalp rat rounded-expo bias2))
(flush (and denormalp
(equal (mxcsrBits->um mxcsr) 1)
(equal (mxcsrBits->ftz mxcsr) 1)))
(fp-result
(rat-to-fp rounded-rat sign overflowp
denormalp flush rc exp-width2 frac-width2)))
(mv nil fp-result mxcsr))))))
(defthm integerp-result-sse-cvt-fp1-to-fp2
(integerp (mv-nth
1
(sse-cvt-fp1-to-fp2 op mxcsr exp-width1 frac-width1 exp-width2 frac-width2)))
:hints (("Goal" :in-theory (e/d* ()
(rtl::sse-post-comp
bitops::loghead-of-loghead-1
unsigned-byte-p
bitops::logtail-of-loghead
bitops::logbitp-of-loghead-in-bounds
bitops::loghead-of-logior))))
:rule-classes :type-prescription)
(defthm-unsigned-byte-p n32p-mxcsr-sse-cvt-fp1-to-fp2
:bound 32
:concl (mv-nth
2
(sse-cvt-fp1-to-fp2 op mxcsr exp-width1 frac-width1 exp-width2 frac-width2))
:hints (("Goal" :in-theory (e/d* (unsigned-byte-p-when-mxcsrbits-p)
(rtl::sse-post-comp
bitops::loghead-of-loghead-1
unsigned-byte-p
bitops::logtail-of-loghead
bitops::logbitp-of-loghead-in-bounds
bitops::loghead-of-logior))))
:gen-type t
:gen-linear t)
(in-theory (e/d () (sse-cvt-fp1-to-fp2)))
;; ======================================================================
;; Single-Precision Operations:
(define sp-sse-cvt-fp-to-int ((nbytes :type (integer 0 *))
(op :type (unsigned-byte 32))
(mxcsr :type (unsigned-byte 32))
(trunc booleanp))
(b* (((mv flg result mxcsr)
(sse-cvt-fp-to-int nbytes op mxcsr trunc
#.*IEEE-SP-EXP-WIDTH* #.*IEEE-SP-FRAC-WIDTH*))
(result (trunc nbytes result)))
(mv flg result mxcsr))
///
(defthm bytesp-sp-sse-cvt-fp-to-int-1
(implies (and (natp nbytes)
(member nbytes '(1 2 4 8 16)))
(unsigned-byte-p
(ash nbytes 3)
(mv-nth 1 (sp-sse-cvt-fp-to-int nbytes op mxcsr trunc)))))
(defthm-unsigned-byte-p n32p-mxcsr-sp-sse-cvt-fp-to-int
:bound 32
:concl (mv-nth 2 (sp-sse-cvt-fp-to-int nbytes op mxcsr trunc))
:hints (("Goal" :in-theory (e/d () (unsigned-byte-p))))
:gen-type t
:gen-linear t))
(define sp-sse-cvt-int-to-fp ((op integerp)
(mxcsr :type (unsigned-byte 32)))
(b* (((mv flg result mxcsr)
(sse-cvt-int-to-fp op mxcsr
#.*IEEE-SP-EXP-WIDTH* #.*IEEE-SP-FRAC-WIDTH*))
(result (n32 result)))
(mv flg result mxcsr))
///
(defthm-unsigned-byte-p n32p-result-sp-sse-cvt-int-to-fp
:bound 32
:concl (mv-nth 1 (sp-sse-cvt-int-to-fp op mxcsr))
:gen-type t
:gen-linear t)
(defthm-unsigned-byte-p n32p-mxcsr-sp-sse-cvt-int-to-fp
:bound 32
:concl (mv-nth 2 (sp-sse-cvt-int-to-fp op mxcsr))
:hints (("Goal" :in-theory (e/d () (unsigned-byte-p))))
:gen-type t
:gen-linear t))
(define sse-cvt-sp-to-dp ((op :type (unsigned-byte 32))
(mxcsr :type (unsigned-byte 32)))
(b* (((mv flg result mxcsr)
(sse-cvt-fp1-to-fp2 op mxcsr
#.*IEEE-SP-EXP-WIDTH* #.*IEEE-SP-FRAC-WIDTH*
#.*IEEE-DP-EXP-WIDTH* #.*IEEE-DP-FRAC-WIDTH*))
(result (n64 result)))
(mv flg result mxcsr))
///
(defthm-unsigned-byte-p n64p-result-sse-cvt-sp-to-dp
:bound 64
:concl (mv-nth 1 (sse-cvt-sp-to-dp op mxcsr))
:gen-type t
:gen-linear t)
(defthm-unsigned-byte-p n32p-mxcsr-sse-cvt-sp-to-dp
:bound 32
:concl (mv-nth 2 (sse-cvt-sp-to-dp op mxcsr))
:hints (("Goal" :in-theory (e/d () (unsigned-byte-p))))
:gen-type t
:gen-linear t))
;; Double-Precision Operations:
(define dp-sse-cvt-fp-to-int ((nbytes :type (integer 0 *))
(op :type (unsigned-byte 64))
(mxcsr :type (unsigned-byte 32))
(trunc booleanp))
(b* (((mv flg result mxcsr)
(sse-cvt-fp-to-int nbytes op mxcsr trunc
#.*IEEE-DP-EXP-WIDTH* #.*IEEE-DP-FRAC-WIDTH*))
(result (trunc nbytes result)))
(mv flg result mxcsr))
///
(defthm bytesp-dp-sse-cvt-fp-to-int-1
(implies (and (natp nbytes)
(member nbytes '(1 2 4 8 16)))
(unsigned-byte-p
(ash nbytes 3)
(mv-nth 1 (dp-sse-cvt-fp-to-int nbytes op mxcsr trunc)))))
(defthm-unsigned-byte-p n32p-mxcsr-dp-sse-cvt-fp-to-int
:bound 32
:concl (mv-nth 2 (dp-sse-cvt-fp-to-int nbytes op mxcsr trunc))
:hints (("Goal" :in-theory (e/d () (unsigned-byte-p))))
:gen-type t
:gen-linear t))
(define dp-sse-cvt-int-to-fp ((op integerp)
(mxcsr :type (unsigned-byte 32)))
(b* (((mv flg result mxcsr)
(sse-cvt-int-to-fp op mxcsr
#.*IEEE-DP-EXP-WIDTH* #.*IEEE-DP-FRAC-WIDTH*))
(result (n64 result)))
(mv flg result mxcsr))
///
(defthm-unsigned-byte-p n64p-result-dp-sse-cvt-int-to-fp
:bound 64
:concl (mv-nth 1 (dp-sse-cvt-int-to-fp op mxcsr))
:gen-type t
:gen-linear t)
(defthm-unsigned-byte-p n32p-mxcsr-dp-sse-cvt-int-to-fp
:bound 32
:concl (mv-nth 2 (dp-sse-cvt-int-to-fp op mxcsr))
:hints (("Goal" :in-theory (e/d () (unsigned-byte-p))))
:gen-type t
:gen-linear t))
(define sse-cvt-dp-to-sp ((op :type (unsigned-byte 64))
(mxcsr :type (unsigned-byte 32)))
(b* (((mv flg result mxcsr)
(sse-cvt-fp1-to-fp2 op mxcsr
#.*IEEE-DP-EXP-WIDTH* #.*IEEE-DP-FRAC-WIDTH*
#.*IEEE-SP-EXP-WIDTH* #.*IEEE-SP-FRAC-WIDTH*))
(result (n32 result)))
(mv flg result mxcsr))
///
(defthm-unsigned-byte-p n32p-result-sse-cvt-dp-to-sp
:bound 32
:concl (mv-nth 1 (sse-cvt-dp-to-sp op mxcsr))
:gen-type t
:gen-linear t)
(defthm-unsigned-byte-p n32p-mxcsr-sse-cvt-dp-to-sp
:bound 32
:concl (mv-nth 2 (sse-cvt-dp-to-sp op mxcsr))
:hints (("Goal" :in-theory (e/d () (unsigned-byte-p))))
:gen-type t
:gen-linear t))
;; ======================================================================
|