2 * Copyright (c) 2010 by Peter Jeremy <peterjeremy@acm.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
23 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 ===============================================================================
29 This GNU assembler source file is part of TestFloat, Release 2a, a package
30 of programs for testing the correctness of floating-point arithmetic
31 complying to the IEC/IEEE Standard for Floating-Point.
33 Written by John R. Hauser. More information is available through the Web
34 page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
36 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
37 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
38 TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
39 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
40 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
42 Derivative works are acceptable, even for commercial purposes, so long as
43 (1) they include prominent notice that the work is derivative, and (2) they
44 include prominent notice akin to these four paragraphs for those parts of
45 this code that are retained.
47 ===============================================================================
50 #include <machine/asm.h>
51 __FBSDID("$FreeBSD$");
56 .macro i2f32 src=%i0,dst=%f0
61 .macro i2f64 src=%i0,dst=%f0
66 .macro f2i32 src=%f0,dst=%i0
71 .macro f2i64 src=%f0,dst=%i0
77 -------------------------------------------------------------------------------
78 -------------------------------------------------------------------------------
81 .global syst_int32_to_float32
82 syst_int32_to_float32:
95 -------------------------------------------------------------------------------
96 -------------------------------------------------------------------------------
99 .global syst_int32_to_float64
100 syst_int32_to_float64:
113 -------------------------------------------------------------------------------
114 -------------------------------------------------------------------------------
117 .global syst_int32_to_float128
118 syst_int32_to_float128:
133 -------------------------------------------------------------------------------
134 -------------------------------------------------------------------------------
137 .global syst_int64_to_float32
138 syst_int64_to_float32:
151 -------------------------------------------------------------------------------
152 -------------------------------------------------------------------------------
155 .global syst_int64_to_float64
156 syst_int64_to_float64:
169 -------------------------------------------------------------------------------
170 -------------------------------------------------------------------------------
173 .global syst_int64_to_float128
174 syst_int64_to_float128:
189 -------------------------------------------------------------------------------
190 -------------------------------------------------------------------------------
193 .global syst_float32_to_int32_round_to_zero
194 syst_float32_to_int32_round_to_zero:
207 -------------------------------------------------------------------------------
208 -------------------------------------------------------------------------------
211 .global syst_float32_to_int64_round_to_zero
212 syst_float32_to_int64_round_to_zero:
225 -------------------------------------------------------------------------------
226 -------------------------------------------------------------------------------
229 .global syst_float32_to_float64
230 syst_float32_to_float64:
243 -------------------------------------------------------------------------------
244 -------------------------------------------------------------------------------
247 .global syst_float32_to_float128
248 syst_float32_to_float128:
263 -------------------------------------------------------------------------------
264 -------------------------------------------------------------------------------
267 .global syst_float32_add
283 -------------------------------------------------------------------------------
284 -------------------------------------------------------------------------------
287 .global syst_float32_sub
303 -------------------------------------------------------------------------------
304 -------------------------------------------------------------------------------
307 .global syst_float32_mul
323 -------------------------------------------------------------------------------
324 -------------------------------------------------------------------------------
327 .global syst_float32_div
343 -------------------------------------------------------------------------------
344 -------------------------------------------------------------------------------
347 .global syst_float32_sqrt
361 -------------------------------------------------------------------------------
362 -------------------------------------------------------------------------------
365 .global syst_float32_eq
381 -------------------------------------------------------------------------------
382 -------------------------------------------------------------------------------
385 .global syst_float32_le
401 -------------------------------------------------------------------------------
402 -------------------------------------------------------------------------------
405 .global syst_float32_lt
421 -------------------------------------------------------------------------------
422 -------------------------------------------------------------------------------
425 .global syst_float32_eq_signaling
426 syst_float32_eq_signaling:
441 -------------------------------------------------------------------------------
442 -------------------------------------------------------------------------------
445 .global syst_float32_le_quiet
446 syst_float32_le_quiet:
461 -------------------------------------------------------------------------------
462 -------------------------------------------------------------------------------
465 .global syst_float32_lt_quiet
466 syst_float32_lt_quiet:
481 -------------------------------------------------------------------------------
482 -------------------------------------------------------------------------------
485 .global syst_float64_to_int32_round_to_zero
486 syst_float64_to_int32_round_to_zero:
499 -------------------------------------------------------------------------------
500 -------------------------------------------------------------------------------
503 .global syst_float64_to_int64_round_to_zero
504 syst_float64_to_int64_round_to_zero:
517 -------------------------------------------------------------------------------
518 -------------------------------------------------------------------------------
521 .global syst_float64_to_float32
522 syst_float64_to_float32:
535 -------------------------------------------------------------------------------
536 -------------------------------------------------------------------------------
539 .global syst_float64_to_float128
540 syst_float64_to_float128:
555 -------------------------------------------------------------------------------
556 -------------------------------------------------------------------------------
559 .global syst_float64_add
575 -------------------------------------------------------------------------------
576 -------------------------------------------------------------------------------
579 .global syst_float64_sub
595 -------------------------------------------------------------------------------
596 -------------------------------------------------------------------------------
599 .global syst_float64_mul
615 -------------------------------------------------------------------------------
616 -------------------------------------------------------------------------------
619 .global syst_float64_div
635 -------------------------------------------------------------------------------
636 -------------------------------------------------------------------------------
639 .global syst_float64_sqrt
653 -------------------------------------------------------------------------------
654 -------------------------------------------------------------------------------
657 .global syst_float64_eq
673 -------------------------------------------------------------------------------
674 -------------------------------------------------------------------------------
677 .global syst_float64_le
693 -------------------------------------------------------------------------------
694 -------------------------------------------------------------------------------
697 .global syst_float64_lt
713 -------------------------------------------------------------------------------
714 -------------------------------------------------------------------------------
717 .global syst_float64_eq_signaling
718 syst_float64_eq_signaling:
733 -------------------------------------------------------------------------------
734 -------------------------------------------------------------------------------
737 .global syst_float64_le_quiet
738 syst_float64_le_quiet:
753 -------------------------------------------------------------------------------
754 -------------------------------------------------------------------------------
757 .global syst_float64_lt_quiet
758 syst_float64_lt_quiet:
773 -------------------------------------------------------------------------------
774 -------------------------------------------------------------------------------
777 .global syst_float128_to_int32_round_to_zero
778 syst_float128_to_int32_round_to_zero:
793 -------------------------------------------------------------------------------
794 -------------------------------------------------------------------------------
797 .global syst_float128_to_int64_round_to_zero
798 syst_float128_to_int64_round_to_zero:
813 -------------------------------------------------------------------------------
814 -------------------------------------------------------------------------------
817 .global syst_float128_to_float32
818 syst_float128_to_float32:
833 -------------------------------------------------------------------------------
834 -------------------------------------------------------------------------------
837 .global syst_float128_to_float64
838 syst_float128_to_float64:
853 -------------------------------------------------------------------------------
854 -------------------------------------------------------------------------------
857 .global syst_float128_add
879 -------------------------------------------------------------------------------
880 -------------------------------------------------------------------------------
883 .global syst_float128_sub
905 -------------------------------------------------------------------------------
906 -------------------------------------------------------------------------------
909 .global syst_float128_mul
931 -------------------------------------------------------------------------------
932 -------------------------------------------------------------------------------
935 .global syst_float128_div
957 -------------------------------------------------------------------------------
958 -------------------------------------------------------------------------------
961 .global syst_float128_sqrt
979 -------------------------------------------------------------------------------
980 -------------------------------------------------------------------------------
983 .global syst_float128_eq
1003 -------------------------------------------------------------------------------
1004 -------------------------------------------------------------------------------
1007 .global syst_float128_le
1019 fcmpeq %fcc0,%f0,%f4
1027 -------------------------------------------------------------------------------
1028 -------------------------------------------------------------------------------
1031 .global syst_float128_lt
1043 fcmpeq %fcc0,%f0,%f4
1051 -------------------------------------------------------------------------------
1052 -------------------------------------------------------------------------------
1055 .global syst_float128_eq_signaling
1056 syst_float128_eq_signaling:
1067 fcmpeq %fcc0,%f0,%f4
1075 -------------------------------------------------------------------------------
1076 -------------------------------------------------------------------------------
1079 .global syst_float128_le_quiet
1080 syst_float128_le_quiet:
1099 -------------------------------------------------------------------------------
1100 -------------------------------------------------------------------------------
1103 .global syst_float128_lt_quiet
1104 syst_float128_lt_quiet: