Fixed issues with specialization for x86, with and without SSE.
This commit is contained in:
parent
d8dae19289
commit
437d9b9fb2
|
@ -0,0 +1,271 @@
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# This Makefile is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
# Package, Release 3, by John R. Hauser.
|
||||||
|
#
|
||||||
|
# Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
# (Regents). All Rights Reserved. Redistribution and use in source and
|
||||||
|
# binary forms, with or without modification, are permitted provided that the
|
||||||
|
# following conditions are met:
|
||||||
|
#
|
||||||
|
# Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
# Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions, and the following two paragraphs of disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the distribution.
|
||||||
|
# Neither the name of the Regents nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software without
|
||||||
|
# specific prior written permission.
|
||||||
|
#
|
||||||
|
# IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
|
||||||
|
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
|
||||||
|
# REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
# HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
# MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
SOURCE_DIR = ../../source
|
||||||
|
SPECIALIZE_TYPE = 8086-SSE
|
||||||
|
|
||||||
|
SOFTFLOAT_OPTS = -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV64TO32
|
||||||
|
|
||||||
|
DELETE = rm -f
|
||||||
|
C_INCLUDES = -I. -I$(SOURCE_DIR)/$(SPECIALIZE_TYPE) -I$(SOURCE_DIR)/include
|
||||||
|
COMPILE_C = \
|
||||||
|
gcc -c -Werror-implicit-function-declaration $(SOFTFLOAT_OPTS) \
|
||||||
|
$(C_INCLUDES) -O2 -o $@
|
||||||
|
MAKELIB = ar crs $@
|
||||||
|
|
||||||
|
OBJ = .o
|
||||||
|
LIB = .a
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: softfloat$(LIB)
|
||||||
|
|
||||||
|
OBJS_PRIMITIVES = \
|
||||||
|
s_compare96M$(OBJ) \
|
||||||
|
s_compare128M$(OBJ) \
|
||||||
|
s_shortShiftLeft64To96M$(OBJ) \
|
||||||
|
s_shortShiftLeftM$(OBJ) \
|
||||||
|
s_shiftLeftM$(OBJ) \
|
||||||
|
s_shortShiftRightM$(OBJ) \
|
||||||
|
s_shortShiftRightJam64$(OBJ) \
|
||||||
|
s_shortShiftRightJamM$(OBJ) \
|
||||||
|
s_shiftRightJam32$(OBJ) \
|
||||||
|
s_shiftRightJam64$(OBJ) \
|
||||||
|
s_shiftRightJamM$(OBJ) \
|
||||||
|
s_shiftRightM$(OBJ) \
|
||||||
|
s_countLeadingZeros8$(OBJ) \
|
||||||
|
s_countLeadingZeros32$(OBJ) \
|
||||||
|
s_countLeadingZeros64$(OBJ) \
|
||||||
|
s_addM$(OBJ) \
|
||||||
|
s_addCarryM$(OBJ) \
|
||||||
|
s_addComplCarryM$(OBJ) \
|
||||||
|
s_negXM$(OBJ) \
|
||||||
|
s_sub1XM$(OBJ) \
|
||||||
|
s_subM$(OBJ) \
|
||||||
|
s_mul64To128M$(OBJ) \
|
||||||
|
s_mul128MTo256M$(OBJ) \
|
||||||
|
s_approxRecip32_1$(OBJ) \
|
||||||
|
s_approxRecipSqrt32_1$(OBJ) \
|
||||||
|
s_remStepMBy32$(OBJ) \
|
||||||
|
|
||||||
|
OBJS_SPECIALIZE = \
|
||||||
|
softfloat_raiseFlags$(OBJ) \
|
||||||
|
s_f32UIToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToF32UI$(OBJ) \
|
||||||
|
s_propagateNaNF32UI$(OBJ) \
|
||||||
|
s_f64UIToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToF64UI$(OBJ) \
|
||||||
|
s_propagateNaNF64UI$(OBJ) \
|
||||||
|
extF80M_isSignalingNaN$(OBJ) \
|
||||||
|
s_extF80MToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToExtF80M$(OBJ) \
|
||||||
|
s_propagateNaNExtF80M$(OBJ) \
|
||||||
|
f128M_isSignalingNaN$(OBJ) \
|
||||||
|
s_f128MToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToF128M$(OBJ) \
|
||||||
|
s_propagateNaNF128M$(OBJ) \
|
||||||
|
|
||||||
|
OBJS_OTHERS = \
|
||||||
|
s_roundPackToUI32$(OBJ) \
|
||||||
|
s_roundPackMToUI64$(OBJ) \
|
||||||
|
s_roundPackToI32$(OBJ) \
|
||||||
|
s_roundPackMToI64$(OBJ) \
|
||||||
|
s_normSubnormalF32Sig$(OBJ) \
|
||||||
|
s_roundPackToF32$(OBJ) \
|
||||||
|
s_normRoundPackToF32$(OBJ) \
|
||||||
|
s_addMagsF32$(OBJ) \
|
||||||
|
s_subMagsF32$(OBJ) \
|
||||||
|
s_mulAddF32$(OBJ) \
|
||||||
|
s_normSubnormalF64Sig$(OBJ) \
|
||||||
|
s_roundPackToF64$(OBJ) \
|
||||||
|
s_normRoundPackToF64$(OBJ) \
|
||||||
|
s_addMagsF64$(OBJ) \
|
||||||
|
s_subMagsF64$(OBJ) \
|
||||||
|
s_mulAddF64$(OBJ) \
|
||||||
|
s_tryPropagateNaNExtF80M$(OBJ) \
|
||||||
|
s_invalidExtF80M$(OBJ) \
|
||||||
|
s_normExtF80SigM$(OBJ) \
|
||||||
|
s_roundPackMToExtF80M$(OBJ) \
|
||||||
|
s_normRoundPackMToExtF80M$(OBJ) \
|
||||||
|
s_addExtF80M$(OBJ) \
|
||||||
|
s_compareNonnormExtF80M$(OBJ) \
|
||||||
|
s_isNaNF128M$(OBJ) \
|
||||||
|
s_tryPropagateNaNF128M$(OBJ) \
|
||||||
|
s_invalidF128M$(OBJ) \
|
||||||
|
s_shiftNormSigF128M$(OBJ) \
|
||||||
|
s_roundPackMToF128M$(OBJ) \
|
||||||
|
s_normRoundPackMToF128M$(OBJ) \
|
||||||
|
s_addF128M$(OBJ) \
|
||||||
|
s_mulAddF128M$(OBJ) \
|
||||||
|
softfloat_state$(OBJ) \
|
||||||
|
ui32_to_f32$(OBJ) \
|
||||||
|
ui32_to_f64$(OBJ) \
|
||||||
|
ui32_to_extF80M$(OBJ) \
|
||||||
|
ui32_to_f128M$(OBJ) \
|
||||||
|
ui64_to_f32$(OBJ) \
|
||||||
|
ui64_to_f64$(OBJ) \
|
||||||
|
ui64_to_extF80M$(OBJ) \
|
||||||
|
ui64_to_f128M$(OBJ) \
|
||||||
|
i32_to_f32$(OBJ) \
|
||||||
|
i32_to_f64$(OBJ) \
|
||||||
|
i32_to_extF80M$(OBJ) \
|
||||||
|
i32_to_f128M$(OBJ) \
|
||||||
|
i64_to_f32$(OBJ) \
|
||||||
|
i64_to_f64$(OBJ) \
|
||||||
|
i64_to_extF80M$(OBJ) \
|
||||||
|
i64_to_f128M$(OBJ) \
|
||||||
|
f32_to_ui32$(OBJ) \
|
||||||
|
f32_to_ui64$(OBJ) \
|
||||||
|
f32_to_i32$(OBJ) \
|
||||||
|
f32_to_i64$(OBJ) \
|
||||||
|
f32_to_ui32_r_minMag$(OBJ) \
|
||||||
|
f32_to_ui64_r_minMag$(OBJ) \
|
||||||
|
f32_to_i32_r_minMag$(OBJ) \
|
||||||
|
f32_to_i64_r_minMag$(OBJ) \
|
||||||
|
f32_to_f64$(OBJ) \
|
||||||
|
f32_to_extF80M$(OBJ) \
|
||||||
|
f32_to_f128M$(OBJ) \
|
||||||
|
f32_roundToInt$(OBJ) \
|
||||||
|
f32_add$(OBJ) \
|
||||||
|
f32_sub$(OBJ) \
|
||||||
|
f32_mul$(OBJ) \
|
||||||
|
f32_mulAdd$(OBJ) \
|
||||||
|
f32_div$(OBJ) \
|
||||||
|
f32_rem$(OBJ) \
|
||||||
|
f32_sqrt$(OBJ) \
|
||||||
|
f32_eq$(OBJ) \
|
||||||
|
f32_le$(OBJ) \
|
||||||
|
f32_lt$(OBJ) \
|
||||||
|
f32_eq_signaling$(OBJ) \
|
||||||
|
f32_le_quiet$(OBJ) \
|
||||||
|
f32_lt_quiet$(OBJ) \
|
||||||
|
f32_isSignalingNaN$(OBJ) \
|
||||||
|
f64_to_ui32$(OBJ) \
|
||||||
|
f64_to_ui64$(OBJ) \
|
||||||
|
f64_to_i32$(OBJ) \
|
||||||
|
f64_to_i64$(OBJ) \
|
||||||
|
f64_to_ui32_r_minMag$(OBJ) \
|
||||||
|
f64_to_ui64_r_minMag$(OBJ) \
|
||||||
|
f64_to_i32_r_minMag$(OBJ) \
|
||||||
|
f64_to_i64_r_minMag$(OBJ) \
|
||||||
|
f64_to_f32$(OBJ) \
|
||||||
|
f64_to_extF80M$(OBJ) \
|
||||||
|
f64_to_f128M$(OBJ) \
|
||||||
|
f64_roundToInt$(OBJ) \
|
||||||
|
f64_add$(OBJ) \
|
||||||
|
f64_sub$(OBJ) \
|
||||||
|
f64_mul$(OBJ) \
|
||||||
|
f64_mulAdd$(OBJ) \
|
||||||
|
f64_div$(OBJ) \
|
||||||
|
f64_rem$(OBJ) \
|
||||||
|
f64_sqrt$(OBJ) \
|
||||||
|
f64_eq$(OBJ) \
|
||||||
|
f64_le$(OBJ) \
|
||||||
|
f64_lt$(OBJ) \
|
||||||
|
f64_eq_signaling$(OBJ) \
|
||||||
|
f64_le_quiet$(OBJ) \
|
||||||
|
f64_lt_quiet$(OBJ) \
|
||||||
|
f64_isSignalingNaN$(OBJ) \
|
||||||
|
extF80M_to_ui32$(OBJ) \
|
||||||
|
extF80M_to_ui64$(OBJ) \
|
||||||
|
extF80M_to_i32$(OBJ) \
|
||||||
|
extF80M_to_i64$(OBJ) \
|
||||||
|
extF80M_to_ui32_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_ui64_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_i32_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_i64_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_f32$(OBJ) \
|
||||||
|
extF80M_to_f64$(OBJ) \
|
||||||
|
extF80M_to_f128M$(OBJ) \
|
||||||
|
extF80M_roundToInt$(OBJ) \
|
||||||
|
extF80M_add$(OBJ) \
|
||||||
|
extF80M_sub$(OBJ) \
|
||||||
|
extF80M_mul$(OBJ) \
|
||||||
|
extF80M_div$(OBJ) \
|
||||||
|
extF80M_rem$(OBJ) \
|
||||||
|
extF80M_sqrt$(OBJ) \
|
||||||
|
extF80M_eq$(OBJ) \
|
||||||
|
extF80M_le$(OBJ) \
|
||||||
|
extF80M_lt$(OBJ) \
|
||||||
|
extF80M_eq_signaling$(OBJ) \
|
||||||
|
extF80M_le_quiet$(OBJ) \
|
||||||
|
extF80M_lt_quiet$(OBJ) \
|
||||||
|
f128M_to_ui32$(OBJ) \
|
||||||
|
f128M_to_ui64$(OBJ) \
|
||||||
|
f128M_to_i32$(OBJ) \
|
||||||
|
f128M_to_i64$(OBJ) \
|
||||||
|
f128M_to_ui32_r_minMag$(OBJ) \
|
||||||
|
f128M_to_ui64_r_minMag$(OBJ) \
|
||||||
|
f128M_to_i32_r_minMag$(OBJ) \
|
||||||
|
f128M_to_i64_r_minMag$(OBJ) \
|
||||||
|
f128M_to_f32$(OBJ) \
|
||||||
|
f128M_to_f64$(OBJ) \
|
||||||
|
f128M_to_extF80M$(OBJ) \
|
||||||
|
f128M_roundToInt$(OBJ) \
|
||||||
|
f128M_add$(OBJ) \
|
||||||
|
f128M_sub$(OBJ) \
|
||||||
|
f128M_mul$(OBJ) \
|
||||||
|
f128M_mulAdd$(OBJ) \
|
||||||
|
f128M_div$(OBJ) \
|
||||||
|
f128M_rem$(OBJ) \
|
||||||
|
f128M_sqrt$(OBJ) \
|
||||||
|
f128M_eq$(OBJ) \
|
||||||
|
f128M_le$(OBJ) \
|
||||||
|
f128M_lt$(OBJ) \
|
||||||
|
f128M_eq_signaling$(OBJ) \
|
||||||
|
f128M_le_quiet$(OBJ) \
|
||||||
|
f128M_lt_quiet$(OBJ) \
|
||||||
|
|
||||||
|
OBJS_ALL = $(OBJS_PRIMITIVES) $(OBJS_SPECIALIZE) $(OBJS_OTHERS)
|
||||||
|
|
||||||
|
$(OBJS_ALL): \
|
||||||
|
platform.h $(SOURCE_DIR)/include/primitiveTypes.h \
|
||||||
|
$(SOURCE_DIR)/include/primitives.h
|
||||||
|
$(OBJS_SPECIALIZE) $(OBJS_OTHERS): \
|
||||||
|
$(SOURCE_DIR)/include/softfloat_types.h $(SOURCE_DIR)/include/internals.h \
|
||||||
|
$(SOURCE_DIR)/$(SPECIALIZE_TYPE)/specialize.h \
|
||||||
|
$(SOURCE_DIR)/include/softfloat.h
|
||||||
|
|
||||||
|
$(OBJS_PRIMITIVES) $(OBJS_OTHERS): %$(OBJ): $(SOURCE_DIR)/%.c
|
||||||
|
$(COMPILE_C) $(SOURCE_DIR)/$*.c
|
||||||
|
|
||||||
|
$(OBJS_SPECIALIZE): %$(OBJ): $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/%.c
|
||||||
|
$(COMPILE_C) $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/$*.c
|
||||||
|
|
||||||
|
softfloat$(LIB): $(OBJS_ALL)
|
||||||
|
$(DELETE) $@
|
||||||
|
$(MAKELIB) $^
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
$(DELETE) $(OBJS_ALL) softfloat$(LIB)
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define LITTLEENDIAN 1
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define INLINE extern inline
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
SOURCE_DIR = ../../source
|
SOURCE_DIR = ../../source
|
||||||
SPECIALIZE_TYPE = 8086
|
SPECIALIZE_TYPE = 8086-SSE
|
||||||
|
|
||||||
SOFTFLOAT_OPTS = -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV64TO32
|
SOFTFLOAT_OPTS = -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV64TO32
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,271 @@
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# This Makefile is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
# Package, Release 3, by John R. Hauser.
|
||||||
|
#
|
||||||
|
# Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
# (Regents). All Rights Reserved. Redistribution and use in source and
|
||||||
|
# binary forms, with or without modification, are permitted provided that the
|
||||||
|
# following conditions are met:
|
||||||
|
#
|
||||||
|
# Redistributions of source code must retain the above copyright notice,
|
||||||
|
# this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
# Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions, and the following two paragraphs of disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the distribution.
|
||||||
|
# Neither the name of the Regents nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software without
|
||||||
|
# specific prior written permission.
|
||||||
|
#
|
||||||
|
# IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
# SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
|
||||||
|
# ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
|
||||||
|
# REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
# REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
# HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
# MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
SOURCE_DIR = ../../source
|
||||||
|
SPECIALIZE_TYPE = 8086-SSE
|
||||||
|
|
||||||
|
SOFTFLOAT_OPTS = -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV64TO32
|
||||||
|
|
||||||
|
DELETE = rm -f
|
||||||
|
C_INCLUDES = -I. -I$(SOURCE_DIR)/$(SPECIALIZE_TYPE) -I$(SOURCE_DIR)/include
|
||||||
|
COMPILE_C = \
|
||||||
|
gcc -c -Werror-implicit-function-declaration $(SOFTFLOAT_OPTS) \
|
||||||
|
$(C_INCLUDES) -O2 -o $@
|
||||||
|
MAKELIB = ar crs $@
|
||||||
|
|
||||||
|
OBJ = .o
|
||||||
|
LIB = .a
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: softfloat$(LIB)
|
||||||
|
|
||||||
|
OBJS_PRIMITIVES = \
|
||||||
|
s_compare96M$(OBJ) \
|
||||||
|
s_compare128M$(OBJ) \
|
||||||
|
s_shortShiftLeft64To96M$(OBJ) \
|
||||||
|
s_shortShiftLeftM$(OBJ) \
|
||||||
|
s_shiftLeftM$(OBJ) \
|
||||||
|
s_shortShiftRightM$(OBJ) \
|
||||||
|
s_shortShiftRightJam64$(OBJ) \
|
||||||
|
s_shortShiftRightJamM$(OBJ) \
|
||||||
|
s_shiftRightJam32$(OBJ) \
|
||||||
|
s_shiftRightJam64$(OBJ) \
|
||||||
|
s_shiftRightJamM$(OBJ) \
|
||||||
|
s_shiftRightM$(OBJ) \
|
||||||
|
s_countLeadingZeros8$(OBJ) \
|
||||||
|
s_countLeadingZeros32$(OBJ) \
|
||||||
|
s_countLeadingZeros64$(OBJ) \
|
||||||
|
s_addM$(OBJ) \
|
||||||
|
s_addCarryM$(OBJ) \
|
||||||
|
s_addComplCarryM$(OBJ) \
|
||||||
|
s_negXM$(OBJ) \
|
||||||
|
s_sub1XM$(OBJ) \
|
||||||
|
s_subM$(OBJ) \
|
||||||
|
s_mul64To128M$(OBJ) \
|
||||||
|
s_mul128MTo256M$(OBJ) \
|
||||||
|
s_approxRecip32_1$(OBJ) \
|
||||||
|
s_approxRecipSqrt32_1$(OBJ) \
|
||||||
|
s_remStepMBy32$(OBJ) \
|
||||||
|
|
||||||
|
OBJS_SPECIALIZE = \
|
||||||
|
softfloat_raiseFlags$(OBJ) \
|
||||||
|
s_f32UIToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToF32UI$(OBJ) \
|
||||||
|
s_propagateNaNF32UI$(OBJ) \
|
||||||
|
s_f64UIToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToF64UI$(OBJ) \
|
||||||
|
s_propagateNaNF64UI$(OBJ) \
|
||||||
|
extF80M_isSignalingNaN$(OBJ) \
|
||||||
|
s_extF80MToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToExtF80M$(OBJ) \
|
||||||
|
s_propagateNaNExtF80M$(OBJ) \
|
||||||
|
f128M_isSignalingNaN$(OBJ) \
|
||||||
|
s_f128MToCommonNaN$(OBJ) \
|
||||||
|
s_commonNaNToF128M$(OBJ) \
|
||||||
|
s_propagateNaNF128M$(OBJ) \
|
||||||
|
|
||||||
|
OBJS_OTHERS = \
|
||||||
|
s_roundPackToUI32$(OBJ) \
|
||||||
|
s_roundPackMToUI64$(OBJ) \
|
||||||
|
s_roundPackToI32$(OBJ) \
|
||||||
|
s_roundPackMToI64$(OBJ) \
|
||||||
|
s_normSubnormalF32Sig$(OBJ) \
|
||||||
|
s_roundPackToF32$(OBJ) \
|
||||||
|
s_normRoundPackToF32$(OBJ) \
|
||||||
|
s_addMagsF32$(OBJ) \
|
||||||
|
s_subMagsF32$(OBJ) \
|
||||||
|
s_mulAddF32$(OBJ) \
|
||||||
|
s_normSubnormalF64Sig$(OBJ) \
|
||||||
|
s_roundPackToF64$(OBJ) \
|
||||||
|
s_normRoundPackToF64$(OBJ) \
|
||||||
|
s_addMagsF64$(OBJ) \
|
||||||
|
s_subMagsF64$(OBJ) \
|
||||||
|
s_mulAddF64$(OBJ) \
|
||||||
|
s_tryPropagateNaNExtF80M$(OBJ) \
|
||||||
|
s_invalidExtF80M$(OBJ) \
|
||||||
|
s_normExtF80SigM$(OBJ) \
|
||||||
|
s_roundPackMToExtF80M$(OBJ) \
|
||||||
|
s_normRoundPackMToExtF80M$(OBJ) \
|
||||||
|
s_addExtF80M$(OBJ) \
|
||||||
|
s_compareNonnormExtF80M$(OBJ) \
|
||||||
|
s_isNaNF128M$(OBJ) \
|
||||||
|
s_tryPropagateNaNF128M$(OBJ) \
|
||||||
|
s_invalidF128M$(OBJ) \
|
||||||
|
s_shiftNormSigF128M$(OBJ) \
|
||||||
|
s_roundPackMToF128M$(OBJ) \
|
||||||
|
s_normRoundPackMToF128M$(OBJ) \
|
||||||
|
s_addF128M$(OBJ) \
|
||||||
|
s_mulAddF128M$(OBJ) \
|
||||||
|
softfloat_state$(OBJ) \
|
||||||
|
ui32_to_f32$(OBJ) \
|
||||||
|
ui32_to_f64$(OBJ) \
|
||||||
|
ui32_to_extF80M$(OBJ) \
|
||||||
|
ui32_to_f128M$(OBJ) \
|
||||||
|
ui64_to_f32$(OBJ) \
|
||||||
|
ui64_to_f64$(OBJ) \
|
||||||
|
ui64_to_extF80M$(OBJ) \
|
||||||
|
ui64_to_f128M$(OBJ) \
|
||||||
|
i32_to_f32$(OBJ) \
|
||||||
|
i32_to_f64$(OBJ) \
|
||||||
|
i32_to_extF80M$(OBJ) \
|
||||||
|
i32_to_f128M$(OBJ) \
|
||||||
|
i64_to_f32$(OBJ) \
|
||||||
|
i64_to_f64$(OBJ) \
|
||||||
|
i64_to_extF80M$(OBJ) \
|
||||||
|
i64_to_f128M$(OBJ) \
|
||||||
|
f32_to_ui32$(OBJ) \
|
||||||
|
f32_to_ui64$(OBJ) \
|
||||||
|
f32_to_i32$(OBJ) \
|
||||||
|
f32_to_i64$(OBJ) \
|
||||||
|
f32_to_ui32_r_minMag$(OBJ) \
|
||||||
|
f32_to_ui64_r_minMag$(OBJ) \
|
||||||
|
f32_to_i32_r_minMag$(OBJ) \
|
||||||
|
f32_to_i64_r_minMag$(OBJ) \
|
||||||
|
f32_to_f64$(OBJ) \
|
||||||
|
f32_to_extF80M$(OBJ) \
|
||||||
|
f32_to_f128M$(OBJ) \
|
||||||
|
f32_roundToInt$(OBJ) \
|
||||||
|
f32_add$(OBJ) \
|
||||||
|
f32_sub$(OBJ) \
|
||||||
|
f32_mul$(OBJ) \
|
||||||
|
f32_mulAdd$(OBJ) \
|
||||||
|
f32_div$(OBJ) \
|
||||||
|
f32_rem$(OBJ) \
|
||||||
|
f32_sqrt$(OBJ) \
|
||||||
|
f32_eq$(OBJ) \
|
||||||
|
f32_le$(OBJ) \
|
||||||
|
f32_lt$(OBJ) \
|
||||||
|
f32_eq_signaling$(OBJ) \
|
||||||
|
f32_le_quiet$(OBJ) \
|
||||||
|
f32_lt_quiet$(OBJ) \
|
||||||
|
f32_isSignalingNaN$(OBJ) \
|
||||||
|
f64_to_ui32$(OBJ) \
|
||||||
|
f64_to_ui64$(OBJ) \
|
||||||
|
f64_to_i32$(OBJ) \
|
||||||
|
f64_to_i64$(OBJ) \
|
||||||
|
f64_to_ui32_r_minMag$(OBJ) \
|
||||||
|
f64_to_ui64_r_minMag$(OBJ) \
|
||||||
|
f64_to_i32_r_minMag$(OBJ) \
|
||||||
|
f64_to_i64_r_minMag$(OBJ) \
|
||||||
|
f64_to_f32$(OBJ) \
|
||||||
|
f64_to_extF80M$(OBJ) \
|
||||||
|
f64_to_f128M$(OBJ) \
|
||||||
|
f64_roundToInt$(OBJ) \
|
||||||
|
f64_add$(OBJ) \
|
||||||
|
f64_sub$(OBJ) \
|
||||||
|
f64_mul$(OBJ) \
|
||||||
|
f64_mulAdd$(OBJ) \
|
||||||
|
f64_div$(OBJ) \
|
||||||
|
f64_rem$(OBJ) \
|
||||||
|
f64_sqrt$(OBJ) \
|
||||||
|
f64_eq$(OBJ) \
|
||||||
|
f64_le$(OBJ) \
|
||||||
|
f64_lt$(OBJ) \
|
||||||
|
f64_eq_signaling$(OBJ) \
|
||||||
|
f64_le_quiet$(OBJ) \
|
||||||
|
f64_lt_quiet$(OBJ) \
|
||||||
|
f64_isSignalingNaN$(OBJ) \
|
||||||
|
extF80M_to_ui32$(OBJ) \
|
||||||
|
extF80M_to_ui64$(OBJ) \
|
||||||
|
extF80M_to_i32$(OBJ) \
|
||||||
|
extF80M_to_i64$(OBJ) \
|
||||||
|
extF80M_to_ui32_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_ui64_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_i32_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_i64_r_minMag$(OBJ) \
|
||||||
|
extF80M_to_f32$(OBJ) \
|
||||||
|
extF80M_to_f64$(OBJ) \
|
||||||
|
extF80M_to_f128M$(OBJ) \
|
||||||
|
extF80M_roundToInt$(OBJ) \
|
||||||
|
extF80M_add$(OBJ) \
|
||||||
|
extF80M_sub$(OBJ) \
|
||||||
|
extF80M_mul$(OBJ) \
|
||||||
|
extF80M_div$(OBJ) \
|
||||||
|
extF80M_rem$(OBJ) \
|
||||||
|
extF80M_sqrt$(OBJ) \
|
||||||
|
extF80M_eq$(OBJ) \
|
||||||
|
extF80M_le$(OBJ) \
|
||||||
|
extF80M_lt$(OBJ) \
|
||||||
|
extF80M_eq_signaling$(OBJ) \
|
||||||
|
extF80M_le_quiet$(OBJ) \
|
||||||
|
extF80M_lt_quiet$(OBJ) \
|
||||||
|
f128M_to_ui32$(OBJ) \
|
||||||
|
f128M_to_ui64$(OBJ) \
|
||||||
|
f128M_to_i32$(OBJ) \
|
||||||
|
f128M_to_i64$(OBJ) \
|
||||||
|
f128M_to_ui32_r_minMag$(OBJ) \
|
||||||
|
f128M_to_ui64_r_minMag$(OBJ) \
|
||||||
|
f128M_to_i32_r_minMag$(OBJ) \
|
||||||
|
f128M_to_i64_r_minMag$(OBJ) \
|
||||||
|
f128M_to_f32$(OBJ) \
|
||||||
|
f128M_to_f64$(OBJ) \
|
||||||
|
f128M_to_extF80M$(OBJ) \
|
||||||
|
f128M_roundToInt$(OBJ) \
|
||||||
|
f128M_add$(OBJ) \
|
||||||
|
f128M_sub$(OBJ) \
|
||||||
|
f128M_mul$(OBJ) \
|
||||||
|
f128M_mulAdd$(OBJ) \
|
||||||
|
f128M_div$(OBJ) \
|
||||||
|
f128M_rem$(OBJ) \
|
||||||
|
f128M_sqrt$(OBJ) \
|
||||||
|
f128M_eq$(OBJ) \
|
||||||
|
f128M_le$(OBJ) \
|
||||||
|
f128M_lt$(OBJ) \
|
||||||
|
f128M_eq_signaling$(OBJ) \
|
||||||
|
f128M_le_quiet$(OBJ) \
|
||||||
|
f128M_lt_quiet$(OBJ) \
|
||||||
|
|
||||||
|
OBJS_ALL = $(OBJS_PRIMITIVES) $(OBJS_SPECIALIZE) $(OBJS_OTHERS)
|
||||||
|
|
||||||
|
$(OBJS_ALL): \
|
||||||
|
platform.h $(SOURCE_DIR)/include/primitiveTypes.h \
|
||||||
|
$(SOURCE_DIR)/include/primitives.h
|
||||||
|
$(OBJS_SPECIALIZE) $(OBJS_OTHERS): \
|
||||||
|
$(SOURCE_DIR)/include/softfloat_types.h $(SOURCE_DIR)/include/internals.h \
|
||||||
|
$(SOURCE_DIR)/$(SPECIALIZE_TYPE)/specialize.h \
|
||||||
|
$(SOURCE_DIR)/include/softfloat.h
|
||||||
|
|
||||||
|
$(OBJS_PRIMITIVES) $(OBJS_OTHERS): %$(OBJ): $(SOURCE_DIR)/%.c
|
||||||
|
$(COMPILE_C) $(SOURCE_DIR)/$*.c
|
||||||
|
|
||||||
|
$(OBJS_SPECIALIZE): %$(OBJ): $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/%.c
|
||||||
|
$(COMPILE_C) $(SOURCE_DIR)/$(SPECIALIZE_TYPE)/$*.c
|
||||||
|
|
||||||
|
softfloat$(LIB): $(OBJS_ALL)
|
||||||
|
$(DELETE) $@
|
||||||
|
$(MAKELIB) $^
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
$(DELETE) $(OBJS_ALL) softfloat$(LIB)
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define LITTLEENDIAN 1
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define INLINE extern inline
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
SOURCE_DIR = ../../source
|
SOURCE_DIR = ../../source
|
||||||
SPECIALIZE_TYPE = 8086
|
SPECIALIZE_TYPE = 8086-SSE
|
||||||
|
|
||||||
SOFTFLOAT_OPTS = -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV64TO32
|
SOFTFLOAT_OPTS = -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV64TO32
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
bool extF80M_isSignalingNaN( const extFloat80_t *aPtr )
|
||||||
|
{
|
||||||
|
const struct extFloat80M *aSPtr;
|
||||||
|
uint64_t uiA0;
|
||||||
|
|
||||||
|
aSPtr = (const struct extFloat80M *) aPtr;
|
||||||
|
if ( (aSPtr->signExp & 0x7FFF) != 0x7FFF ) return false;
|
||||||
|
uiA0 = aSPtr->signif;
|
||||||
|
return
|
||||||
|
! (uiA0 & UINT64_C( 0x4000000000000000 ))
|
||||||
|
&& (uiA0 & UINT64_C( 0x3FFFFFFFFFFFFFFF));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "primitives.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
bool f128M_isSignalingNaN( const float128_t *aPtr )
|
||||||
|
{
|
||||||
|
const uint32_t *aWPtr;
|
||||||
|
uint32_t uiA96;
|
||||||
|
|
||||||
|
aWPtr = (const uint32_t *) aPtr;
|
||||||
|
uiA96 = aWPtr[indexWordHi( 4 )];
|
||||||
|
if ( (uiA96 & 0x7FFF8000) != 0x7FFF0000 ) return false;
|
||||||
|
return
|
||||||
|
((uiA96 & 0x00007FFF) != 0)
|
||||||
|
|| ((aWPtr[indexWord( 4, 2 )] | aWPtr[indexWord( 4, 1 )]
|
||||||
|
| aWPtr[indexWord( 4, 0 )])
|
||||||
|
!= 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into an 80-bit extended
|
||||||
|
| floating-point NaN, and stores this NaN at the location pointed to by
|
||||||
|
| `zSPtr'.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_commonNaNToExtF80M(
|
||||||
|
const struct commonNaN *aPtr, struct extFloat80M *zSPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
zSPtr->signExp = packToExtF80UI64( aPtr->sign, 0x7FFF );
|
||||||
|
zSPtr->signif = UINT64_C( 0xC000000000000000 ) | aPtr->v64>>1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "primitives.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into an 80-bit extended
|
||||||
|
| floating-point NaN, and returns the bit pattern of this value as an unsigned
|
||||||
|
| integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128 softfloat_commonNaNToExtF80UI( const struct commonNaN *aPtr )
|
||||||
|
{
|
||||||
|
struct uint128 uiZ;
|
||||||
|
|
||||||
|
uiZ.v64 = (uint_fast16_t) aPtr->sign<<15 | 0x7FFF;
|
||||||
|
uiZ.v0 = UINT64_C( 0xC000000000000000 ) | aPtr->v64>>1;
|
||||||
|
return uiZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "primitives.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 128-bit floating-point
|
||||||
|
| NaN, and stores this NaN at the location pointed to by `zWPtr'. Argument
|
||||||
|
| `zWPtr' points to an array of four 32-bit elements that concatenate in the
|
||||||
|
| platform's normal endian order to form a 128-bit floating-point value.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_commonNaNToF128M( const struct commonNaN *aPtr, uint32_t *zWPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
softfloat_shortShiftRight128M( (const uint32_t *) &aPtr->v0, 16, zWPtr );
|
||||||
|
zWPtr[indexWordHi( 4 )] |= (uint32_t) aPtr->sign<<31 | 0x7FFF8000;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "primitives.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 128-bit floating-point
|
||||||
|
| NaN, and returns the bit pattern of this value as an unsigned integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128 softfloat_commonNaNToF128UI( const struct commonNaN *aPtr )
|
||||||
|
{
|
||||||
|
struct uint128 uiZ;
|
||||||
|
|
||||||
|
uiZ = softfloat_shortShiftRight128( aPtr->v64, aPtr->v0, 16 );
|
||||||
|
uiZ.v64 |= (uint_fast64_t) aPtr->sign<<63 | UINT64_C( 0x7FFF800000000000 );
|
||||||
|
return uiZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 32-bit floating-point
|
||||||
|
| NaN, and returns the bit pattern of this value as an unsigned integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast32_t softfloat_commonNaNToF32UI( const struct commonNaN *aPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
return (uint_fast32_t) aPtr->sign<<31 | 0x7FC00000 | aPtr->v64>>41;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 64-bit floating-point
|
||||||
|
| NaN, and returns the bit pattern of this value as an unsigned integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast64_t softfloat_commonNaNToF64UI( const struct commonNaN *aPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
return
|
||||||
|
(uint_fast64_t) aPtr->sign<<63 | UINT64_C( 0x7FF8000000000000 )
|
||||||
|
| aPtr->v64>>12;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the 80-bit extended floating-point value pointed to by `aSPtr' is
|
||||||
|
| a NaN, converts this NaN to the common NaN form, and stores the resulting
|
||||||
|
| common NaN at the location pointed to by `zPtr'. If the NaN is a signaling
|
||||||
|
| NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_extF80MToCommonNaN(
|
||||||
|
const struct extFloat80M *aSPtr, struct commonNaN *zPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( extF80M_isSignalingNaN( (const extFloat80_t *) aSPtr ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
}
|
||||||
|
zPtr->sign = signExtF80UI64( aSPtr->signExp );
|
||||||
|
zPtr->v64 = aSPtr->signif<<1;
|
||||||
|
zPtr->v0 = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the unsigned integer formed from concatenating `uiA64' and `uiA0'
|
||||||
|
| has the bit pattern of an 80-bit extended floating-point NaN, converts
|
||||||
|
| this NaN to the common NaN form, and stores the resulting common NaN at the
|
||||||
|
| location pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_extF80UIToCommonNaN(
|
||||||
|
uint_fast16_t uiA64, uint_fast64_t uiA0, struct commonNaN *zPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( softfloat_isSigNaNExtF80UI( uiA64, uiA0 ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
}
|
||||||
|
zPtr->sign = uiA64>>15;
|
||||||
|
zPtr->v64 = uiA0<<1;
|
||||||
|
zPtr->v0 = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "primitives.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the 128-bit floating-point value pointed to by `aWPtr' is a NaN,
|
||||||
|
| converts this NaN to the common NaN form, and stores the resulting common
|
||||||
|
| NaN at the location pointed to by `zPtr'. If the NaN is a signaling NaN,
|
||||||
|
| the invalid exception is raised. Argument `aWPtr' points to an array of
|
||||||
|
| four 32-bit elements that concatenate in the platform's normal endian order
|
||||||
|
| to form a 128-bit floating-point value.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_f128MToCommonNaN( const uint32_t *aWPtr, struct commonNaN *zPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( f128M_isSignalingNaN( (const float128_t *) aWPtr ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
}
|
||||||
|
zPtr->sign = aWPtr[indexWordHi( 4 )]>>31;
|
||||||
|
softfloat_shortShiftLeft128M( aWPtr, 16, (uint32_t *) &zPtr->v0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "primitives.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the unsigned integer formed from concatenating `uiA64' and `uiA0'
|
||||||
|
| has the bit pattern of a 128-bit floating-point NaN, converts this NaN to
|
||||||
|
| the common NaN form, and stores the resulting common NaN at the location
|
||||||
|
| pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid exception
|
||||||
|
| is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_f128UIToCommonNaN(
|
||||||
|
uint_fast64_t uiA64, uint_fast64_t uiA0, struct commonNaN *zPtr )
|
||||||
|
{
|
||||||
|
struct uint128 NaNSig;
|
||||||
|
|
||||||
|
if ( softfloat_isSigNaNF128UI( uiA64, uiA0 ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
}
|
||||||
|
NaNSig = softfloat_shortShiftLeft128( uiA64, uiA0, 16 );
|
||||||
|
zPtr->sign = uiA64>>63;
|
||||||
|
zPtr->v64 = NaNSig.v64;
|
||||||
|
zPtr->v0 = NaNSig.v0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming `uiA' has the bit pattern of a 32-bit floating-point NaN, converts
|
||||||
|
| this NaN to the common NaN form, and stores the resulting common NaN at the
|
||||||
|
| location pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void softfloat_f32UIToCommonNaN( uint_fast32_t uiA, struct commonNaN *zPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( softfloat_isSigNaNF32UI( uiA ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
}
|
||||||
|
zPtr->sign = uiA>>31;
|
||||||
|
zPtr->v64 = (uint_fast64_t) uiA<<41;
|
||||||
|
zPtr->v0 = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming `uiA' has the bit pattern of a 64-bit floating-point NaN, converts
|
||||||
|
| this NaN to the common NaN form, and stores the resulting common NaN at the
|
||||||
|
| location pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void softfloat_f64UIToCommonNaN( uint_fast64_t uiA, struct commonNaN *zPtr )
|
||||||
|
{
|
||||||
|
|
||||||
|
if ( softfloat_isSigNaNF64UI( uiA ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
}
|
||||||
|
zPtr->sign = uiA>>63;
|
||||||
|
zPtr->v64 = uiA<<12;
|
||||||
|
zPtr->v0 = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming at least one of the two 80-bit extended floating-point values
|
||||||
|
| pointed to by `aSPtr' and `bSPtr' is a NaN, stores the combined NaN result
|
||||||
|
| at the location pointed to by `zSPtr'. If either original floating-point
|
||||||
|
| value is a signaling NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_propagateNaNExtF80M(
|
||||||
|
const struct extFloat80M *aSPtr,
|
||||||
|
const struct extFloat80M *bSPtr,
|
||||||
|
struct extFloat80M *zSPtr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bool isSigNaNA;
|
||||||
|
const struct extFloat80M *sPtr;
|
||||||
|
bool isSigNaNB;
|
||||||
|
uint_fast16_t uiB64;
|
||||||
|
uint64_t uiB0;
|
||||||
|
uint_fast16_t uiA64;
|
||||||
|
uint64_t uiA0;
|
||||||
|
uint_fast16_t uiMagA64, uiMagB64;
|
||||||
|
|
||||||
|
isSigNaNA = extF80M_isSignalingNaN( (const extFloat80_t *) aSPtr );
|
||||||
|
sPtr = aSPtr;
|
||||||
|
if ( ! bSPtr ) {
|
||||||
|
if ( isSigNaNA ) softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
goto copy;
|
||||||
|
}
|
||||||
|
isSigNaNB = extF80M_isSignalingNaN( (const extFloat80_t *) bSPtr );
|
||||||
|
if ( isSigNaNA | isSigNaNB ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
if ( isSigNaNA ) {
|
||||||
|
uiB64 = bSPtr->signExp;
|
||||||
|
if ( isSigNaNB ) goto returnLargerUIMag;
|
||||||
|
uiB0 = bSPtr->signif;
|
||||||
|
if ( isNaNExtF80UI( uiB64, uiB0 ) ) goto copyB;
|
||||||
|
goto copy;
|
||||||
|
} else {
|
||||||
|
uiA64 = aSPtr->signExp;
|
||||||
|
uiA0 = aSPtr->signif;
|
||||||
|
if ( isNaNExtF80UI( uiA64, uiA0 ) ) goto copy;
|
||||||
|
goto copyB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uiB64 = bSPtr->signExp;
|
||||||
|
returnLargerUIMag:
|
||||||
|
uiA64 = aSPtr->signExp;
|
||||||
|
uiMagA64 = uiA64 & 0x7FFF;
|
||||||
|
uiMagB64 = uiB64 & 0x7FFF;
|
||||||
|
if ( uiMagA64 < uiMagB64 ) goto copyB;
|
||||||
|
if ( uiMagB64 < uiMagA64 ) goto copy;
|
||||||
|
uiA0 = aSPtr->signif;
|
||||||
|
uiB0 = bSPtr->signif;
|
||||||
|
if ( uiA0 < uiB0 ) goto copyB;
|
||||||
|
if ( uiB0 < uiA0 ) goto copy;
|
||||||
|
if ( uiA64 < uiB64 ) goto copy;
|
||||||
|
copyB:
|
||||||
|
sPtr = bSPtr;
|
||||||
|
copy:
|
||||||
|
zSPtr->signExp = sPtr->signExp;
|
||||||
|
zSPtr->signif = sPtr->signif | UINT64_C( 0xC000000000000000 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting the unsigned integer formed from concatenating `uiA64' and
|
||||||
|
| `uiA0' as an 80-bit extended floating-point value, and likewise interpreting
|
||||||
|
| the unsigned integer formed from concatenating `uiB64' and `uiB0' as another
|
||||||
|
| 80-bit extended floating-point value, and assuming at least on of these
|
||||||
|
| floating-point values is a NaN, returns the bit pattern of the combined NaN
|
||||||
|
| result. If either original floating-point value is a signaling NaN, the
|
||||||
|
| invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128
|
||||||
|
softfloat_propagateNaNExtF80UI(
|
||||||
|
uint_fast16_t uiA64,
|
||||||
|
uint_fast64_t uiA0,
|
||||||
|
uint_fast16_t uiB64,
|
||||||
|
uint_fast64_t uiB0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bool isSigNaNA, isSigNaNB;
|
||||||
|
uint_fast64_t uiNonsigA0, uiNonsigB0;
|
||||||
|
uint_fast16_t uiMagA64, uiMagB64;
|
||||||
|
struct uint128 uiZ;
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
*------------------------------------------------------------------------*/
|
||||||
|
isSigNaNA = softfloat_isSigNaNExtF80UI( uiA64, uiA0 );
|
||||||
|
isSigNaNB = softfloat_isSigNaNExtF80UI( uiB64, uiB0 );
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
| Make NaNs non-signaling.
|
||||||
|
*------------------------------------------------------------------------*/
|
||||||
|
uiNonsigA0 = uiA0 | UINT64_C( 0xC000000000000000 );
|
||||||
|
uiNonsigB0 = uiB0 | UINT64_C( 0xC000000000000000 );
|
||||||
|
/*------------------------------------------------------------------------
|
||||||
|
*------------------------------------------------------------------------*/
|
||||||
|
if ( isSigNaNA | isSigNaNB ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
if ( isSigNaNA ) {
|
||||||
|
if ( isSigNaNB ) goto returnLargerMag;
|
||||||
|
if ( isNaNExtF80UI( uiB64, uiB0 ) ) goto returnB;
|
||||||
|
goto returnA;
|
||||||
|
} else {
|
||||||
|
if ( isNaNExtF80UI( uiA64, uiA0 ) ) goto returnA;
|
||||||
|
goto returnB;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
returnLargerMag:
|
||||||
|
uiMagA64 = uiA64 & 0x7FFF;
|
||||||
|
uiMagB64 = uiB64 & 0x7FFF;
|
||||||
|
if ( uiMagA64 < uiMagB64 ) goto returnB;
|
||||||
|
if ( uiMagB64 < uiMagA64 ) goto returnA;
|
||||||
|
if ( uiNonsigA0 < uiNonsigB0 ) goto returnB;
|
||||||
|
if ( uiNonsigB0 < uiNonsigA0 ) goto returnA;
|
||||||
|
if ( uiA64 < uiB64 ) goto returnA;
|
||||||
|
returnB:
|
||||||
|
uiZ.v64 = uiB64;
|
||||||
|
uiZ.v0 = uiNonsigB0;
|
||||||
|
return uiZ;
|
||||||
|
returnA:
|
||||||
|
uiZ.v64 = uiA64;
|
||||||
|
uiZ.v0 = uiNonsigA0;
|
||||||
|
return uiZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming at least one of the two 128-bit floating-point values pointed to by
|
||||||
|
| `aWPtr' and `bWPtr' is a NaN, stores the combined NaN result at the location
|
||||||
|
| pointed to by `zWPtr'. If either original floating-point value is a
|
||||||
|
| signaling NaN, the invalid exception is raised. Each of `aWPtr', `bWPtr',
|
||||||
|
| and `zWPtr' points to an array of four 32-bit elements that concatenate in
|
||||||
|
| the platform's normal endian order to form a 128-bit floating-point value.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_propagateNaNF128M(
|
||||||
|
const uint32_t *aWPtr, const uint32_t *bWPtr, uint32_t *zWPtr )
|
||||||
|
{
|
||||||
|
bool isSigNaNA;
|
||||||
|
const uint32_t *ptr;
|
||||||
|
|
||||||
|
ptr = aWPtr;
|
||||||
|
isSigNaNA = f128M_isSignalingNaN( (const float128_t *) aWPtr );
|
||||||
|
if (
|
||||||
|
isSigNaNA
|
||||||
|
|| (bWPtr && f128M_isSignalingNaN( (const float128_t *) bWPtr ))
|
||||||
|
) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
if ( isSigNaNA ) goto copy;
|
||||||
|
}
|
||||||
|
if ( ! softfloat_isNaNF128M( aWPtr ) ) ptr = bWPtr;
|
||||||
|
copy:
|
||||||
|
zWPtr[indexWordHi( 4 )] = ptr[indexWordHi( 4 )] | 0x00008000;
|
||||||
|
zWPtr[indexWord( 4, 2 )] = ptr[indexWord( 4, 2 )];
|
||||||
|
zWPtr[indexWord( 4, 1 )] = ptr[indexWord( 4, 1 )];
|
||||||
|
zWPtr[indexWord( 4, 0 )] = ptr[indexWord( 4, 0 )];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting the unsigned integer formed from concatenating `uiA64' and
|
||||||
|
| `uiA0' as a 128-bit floating-point value, and likewise interpreting the
|
||||||
|
| unsigned integer formed from concatenating `uiB64' and `uiB0' as another
|
||||||
|
| 128-bit floating-point value, and assuming at least on of these floating-
|
||||||
|
| point values is a NaN, returns the bit pattern of the combined NaN result.
|
||||||
|
| If either original floating-point value is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128
|
||||||
|
softfloat_propagateNaNF128UI(
|
||||||
|
uint_fast64_t uiA64,
|
||||||
|
uint_fast64_t uiA0,
|
||||||
|
uint_fast64_t uiB64,
|
||||||
|
uint_fast64_t uiB0
|
||||||
|
)
|
||||||
|
{
|
||||||
|
bool isSigNaNA;
|
||||||
|
struct uint128 uiZ;
|
||||||
|
|
||||||
|
isSigNaNA = softfloat_isSigNaNF128UI( uiA64, uiA0 );
|
||||||
|
if ( isSigNaNA || softfloat_isSigNaNF128UI( uiB64, uiB0 ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
if ( isSigNaNA ) goto returnNonsigA;
|
||||||
|
}
|
||||||
|
if ( isNaNF128UI( uiA64, uiA0 ) ) {
|
||||||
|
returnNonsigA:
|
||||||
|
uiZ.v64 = uiA64;
|
||||||
|
uiZ.v0 = uiA0;
|
||||||
|
} else {
|
||||||
|
uiZ.v64 = uiB64;
|
||||||
|
uiZ.v0 = uiB0;
|
||||||
|
}
|
||||||
|
uiZ.v64 |= UINT64_C( 0x0000800000000000 );
|
||||||
|
return uiZ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting `uiA' and `uiB' as the bit patterns of two 32-bit floating-
|
||||||
|
| point values, at least one of which is a NaN, returns the bit pattern of
|
||||||
|
| the combined NaN result. If either `uiA' or `uiB' has the pattern of a
|
||||||
|
| signaling NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast32_t
|
||||||
|
softfloat_propagateNaNF32UI( uint_fast32_t uiA, uint_fast32_t uiB )
|
||||||
|
{
|
||||||
|
bool isSigNaNA;
|
||||||
|
|
||||||
|
isSigNaNA = softfloat_isSigNaNF32UI( uiA );
|
||||||
|
if ( isSigNaNA || softfloat_isSigNaNF32UI( uiB ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
if ( isSigNaNA ) return uiA | 0x00400000;
|
||||||
|
}
|
||||||
|
return (isNaNF32UI( uiA ) ? uiA : uiB) | 0x00400000;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "platform.h"
|
||||||
|
#include "internals.h"
|
||||||
|
#include "specialize.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting `uiA' and `uiB' as the bit patterns of two 64-bit floating-
|
||||||
|
| point values, at least one of which is a NaN, returns the bit pattern of
|
||||||
|
| the combined NaN result. If either `uiA' or `uiB' has the pattern of a
|
||||||
|
| signaling NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast64_t
|
||||||
|
softfloat_propagateNaNF64UI( uint_fast64_t uiA, uint_fast64_t uiB )
|
||||||
|
{
|
||||||
|
bool isSigNaNA;
|
||||||
|
|
||||||
|
isSigNaNA = softfloat_isSigNaNF64UI( uiA );
|
||||||
|
if ( isSigNaNA || softfloat_isSigNaNF64UI( uiB ) ) {
|
||||||
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
|
if ( isSigNaNA ) return uiA | UINT64_C( 0x0008000000000000 );
|
||||||
|
}
|
||||||
|
return (isNaNF64UI( uiA ) ? uiA : uiB) | UINT64_C( 0x0008000000000000 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
#include "softfloat.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Raises the exceptions specified by `flags'. Floating-point traps can be
|
||||||
|
| defined here if desired. It is currently not possible for such a trap
|
||||||
|
| to substitute a result value. If traps are not implemented, this routine
|
||||||
|
| should be simply `softfloat_exceptionFlags |= flags;'.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void softfloat_raiseFlags( uint_fast8_t flags )
|
||||||
|
{
|
||||||
|
|
||||||
|
softfloat_exceptionFlags |= flags;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,315 @@
|
||||||
|
|
||||||
|
/*============================================================================
|
||||||
|
|
||||||
|
This C header file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||||
|
Package, Release 3, by John R. Hauser.
|
||||||
|
|
||||||
|
Copyright 2011, 2012, 2013, 2014 The Regents of the University of California
|
||||||
|
(Regents). All Rights Reserved. Redistribution and use in source and binary
|
||||||
|
forms, with or without modification, are permitted provided that the following
|
||||||
|
conditions are met:
|
||||||
|
|
||||||
|
Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer.
|
||||||
|
Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions, and the following two paragraphs of disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution. Neither
|
||||||
|
the name of the Regents nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
|
IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||||
|
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
|
||||||
|
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
|
||||||
|
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
|
||||||
|
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
|
||||||
|
=============================================================================*/
|
||||||
|
|
||||||
|
#ifndef specialize_h
|
||||||
|
#define specialize_h 1
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "softfloat_types.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Default value for `softfloat_detectTininess'.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define init_detectTininess softfloat_tininess_afterRounding;
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| "Common NaN" structure, used to transfer NaN representations from one format
|
||||||
|
| to another.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct commonNaN {
|
||||||
|
bool sign;
|
||||||
|
#ifdef LITTLEENDIAN
|
||||||
|
uint64_t v0, v64;
|
||||||
|
#else
|
||||||
|
uint64_t v64, v0;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| The bit pattern for a default generated 32-bit floating-point NaN.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define defaultNaNF32UI 0xFFC00000
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Returns true when 32-bit unsigned integer `uiA' has the bit pattern of a
|
||||||
|
| 32-bit floating-point signaling NaN.
|
||||||
|
| Note: This macro evaluates its argument more than once.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define softfloat_isSigNaNF32UI( uiA ) ((((uiA) & 0x7FC00000) == 0x7F800000) && ((uiA) & 0x003FFFFF))
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming `uiA' has the bit pattern of a 32-bit floating-point NaN, converts
|
||||||
|
| this NaN to the common NaN form, and stores the resulting common NaN at the
|
||||||
|
| location pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void softfloat_f32UIToCommonNaN( uint_fast32_t uiA, struct commonNaN *zPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 32-bit floating-point
|
||||||
|
| NaN, and returns the bit pattern of this value as an unsigned integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast32_t softfloat_commonNaNToF32UI( const struct commonNaN *aPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting `uiA' and `uiB' as the bit patterns of two 32-bit floating-
|
||||||
|
| point values, at least one of which is a NaN, returns the bit pattern of
|
||||||
|
| the combined NaN result. If either `uiA' or `uiB' has the pattern of a
|
||||||
|
| signaling NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast32_t
|
||||||
|
softfloat_propagateNaNF32UI( uint_fast32_t uiA, uint_fast32_t uiB );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| The bit pattern for a default generated 64-bit floating-point NaN.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define defaultNaNF64UI UINT64_C( 0xFFF8000000000000 )
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Returns true when 64-bit unsigned integer `uiA' has the bit pattern of a
|
||||||
|
| 64-bit floating-point signaling NaN.
|
||||||
|
| Note: This macro evaluates its argument more than once.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define softfloat_isSigNaNF64UI( uiA ) ((((uiA) & UINT64_C( 0x7FF8000000000000 )) == UINT64_C( 0x7FF0000000000000 )) && ((uiA) & UINT64_C( 0x0007FFFFFFFFFFFF )))
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming `uiA' has the bit pattern of a 64-bit floating-point NaN, converts
|
||||||
|
| this NaN to the common NaN form, and stores the resulting common NaN at the
|
||||||
|
| location pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void softfloat_f64UIToCommonNaN( uint_fast64_t uiA, struct commonNaN *zPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 64-bit floating-point
|
||||||
|
| NaN, and returns the bit pattern of this value as an unsigned integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast64_t softfloat_commonNaNToF64UI( const struct commonNaN *aPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting `uiA' and `uiB' as the bit patterns of two 64-bit floating-
|
||||||
|
| point values, at least one of which is a NaN, returns the bit pattern of
|
||||||
|
| the combined NaN result. If either `uiA' or `uiB' has the pattern of a
|
||||||
|
| signaling NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
uint_fast64_t
|
||||||
|
softfloat_propagateNaNF64UI( uint_fast64_t uiA, uint_fast64_t uiB );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| The bit pattern for a default generated 80-bit extended floating-point NaN.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define defaultNaNExtF80UI64 0xFFFF
|
||||||
|
#define defaultNaNExtF80UI0 UINT64_C( 0xC000000000000000 )
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Returns true when the 80-bit unsigned integer formed from concatenating
|
||||||
|
| 16-bit `uiA64' and 64-bit `uiA0' has the bit pattern of an 80-bit extended
|
||||||
|
| floating-point signaling NaN.
|
||||||
|
| Note: This macro evaluates its arguments more than once.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define softfloat_isSigNaNExtF80UI( uiA64, uiA0 ) ((((uiA64) & 0x7FFF) == 0x7FFF) && ! ((uiA0) & UINT64_C( 0x4000000000000000 )) && ((uiA0) & UINT64_C( 0x3FFFFFFFFFFFFFFF )))
|
||||||
|
|
||||||
|
#ifdef SOFTFLOAT_FAST_INT64
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| The following functions are needed only when `SOFTFLOAT_FAST_INT64' is
|
||||||
|
| defined.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the unsigned integer formed from concatenating `uiA64' and `uiA0'
|
||||||
|
| has the bit pattern of an 80-bit extended floating-point NaN, converts
|
||||||
|
| this NaN to the common NaN form, and stores the resulting common NaN at the
|
||||||
|
| location pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_extF80UIToCommonNaN(
|
||||||
|
uint_fast16_t uiA64, uint_fast64_t uiA0, struct commonNaN *zPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into an 80-bit extended
|
||||||
|
| floating-point NaN, and returns the bit pattern of this value as an unsigned
|
||||||
|
| integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128 softfloat_commonNaNToExtF80UI( const struct commonNaN *aPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting the unsigned integer formed from concatenating `uiA64' and
|
||||||
|
| `uiA0' as an 80-bit extended floating-point value, and likewise interpreting
|
||||||
|
| the unsigned integer formed from concatenating `uiB64' and `uiB0' as another
|
||||||
|
| 80-bit extended floating-point value, and assuming at least on of these
|
||||||
|
| floating-point values is a NaN, returns the bit pattern of the combined NaN
|
||||||
|
| result. If either original floating-point value is a signaling NaN, the
|
||||||
|
| invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128
|
||||||
|
softfloat_propagateNaNExtF80UI(
|
||||||
|
uint_fast16_t uiA64,
|
||||||
|
uint_fast64_t uiA0,
|
||||||
|
uint_fast16_t uiB64,
|
||||||
|
uint_fast64_t uiB0
|
||||||
|
);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| The bit pattern for a default generated 128-bit floating-point NaN.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define defaultNaNF128UI64 UINT64_C( 0xFFFF800000000000 )
|
||||||
|
#define defaultNaNF128UI0 UINT64_C( 0 )
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Returns true when the 128-bit unsigned integer formed from concatenating
|
||||||
|
| 64-bit `uiA64' and 64-bit `uiA0' has the bit pattern of a 128-bit floating-
|
||||||
|
| point signaling NaN.
|
||||||
|
| Note: This macro evaluates its arguments more than once.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define softfloat_isSigNaNF128UI( uiA64, uiA0 ) ((((uiA64) & UINT64_C( 0x7FFF800000000000 )) == UINT64_C( 0x7FFF000000000000 )) && ((uiA0) || ((uiA64) & UINT64_C( 0x00007FFFFFFFFFFF ))))
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the unsigned integer formed from concatenating `uiA64' and `uiA0'
|
||||||
|
| has the bit pattern of a 128-bit floating-point NaN, converts this NaN to
|
||||||
|
| the common NaN form, and stores the resulting common NaN at the location
|
||||||
|
| pointed to by `zPtr'. If the NaN is a signaling NaN, the invalid exception
|
||||||
|
| is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_f128UIToCommonNaN(
|
||||||
|
uint_fast64_t uiA64, uint_fast64_t uiA0, struct commonNaN *zPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 128-bit floating-point
|
||||||
|
| NaN, and returns the bit pattern of this value as an unsigned integer.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128 softfloat_commonNaNToF128UI( const struct commonNaN * );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Interpreting the unsigned integer formed from concatenating `uiA64' and
|
||||||
|
| `uiA0' as a 128-bit floating-point value, and likewise interpreting the
|
||||||
|
| unsigned integer formed from concatenating `uiB64' and `uiB0' as another
|
||||||
|
| 128-bit floating-point value, and assuming at least on of these floating-
|
||||||
|
| point values is a NaN, returns the bit pattern of the combined NaN result.
|
||||||
|
| If either original floating-point value is a signaling NaN, the invalid
|
||||||
|
| exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
struct uint128
|
||||||
|
softfloat_propagateNaNF128UI(
|
||||||
|
uint_fast64_t uiA64,
|
||||||
|
uint_fast64_t uiA0,
|
||||||
|
uint_fast64_t uiB64,
|
||||||
|
uint_fast64_t uiB0
|
||||||
|
);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| The following functions are needed only when `SOFTFLOAT_FAST_INT64' is not
|
||||||
|
| defined.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the 80-bit extended floating-point value pointed to by `aSPtr' is
|
||||||
|
| a NaN, converts this NaN to the common NaN form, and stores the resulting
|
||||||
|
| common NaN at the location pointed to by `zPtr'. If the NaN is a signaling
|
||||||
|
| NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_extF80MToCommonNaN(
|
||||||
|
const struct extFloat80M *aSPtr, struct commonNaN *zPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into an 80-bit extended
|
||||||
|
| floating-point NaN, and stores this NaN at the location pointed to by
|
||||||
|
| `zSPtr'.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_commonNaNToExtF80M(
|
||||||
|
const struct commonNaN *aPtr, struct extFloat80M *zSPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming at least one of the two 80-bit extended floating-point values
|
||||||
|
| pointed to by `aSPtr' and `bSPtr' is a NaN, stores the combined NaN result
|
||||||
|
| at the location pointed to by `zSPtr'. If either original floating-point
|
||||||
|
| value is a signaling NaN, the invalid exception is raised.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_propagateNaNExtF80M(
|
||||||
|
const struct extFloat80M *aSPtr,
|
||||||
|
const struct extFloat80M *bSPtr,
|
||||||
|
struct extFloat80M *zSPtr
|
||||||
|
);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| The bit pattern for a default generated 128-bit floating-point NaN.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
#define defaultNaNF128UI96 0xFFFF8000
|
||||||
|
#define defaultNaNF128UI64 0
|
||||||
|
#define defaultNaNF128UI32 0
|
||||||
|
#define defaultNaNF128UI0 0
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming the 128-bit floating-point value pointed to by `aWPtr' is a NaN,
|
||||||
|
| converts this NaN to the common NaN form, and stores the resulting common
|
||||||
|
| NaN at the location pointed to by `zPtr'. If the NaN is a signaling NaN,
|
||||||
|
| the invalid exception is raised. Argument `aWPtr' points to an array of
|
||||||
|
| four 32-bit elements that concatenate in the platform's normal endian order
|
||||||
|
| to form a 128-bit floating-point value.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_f128MToCommonNaN( const uint32_t *aWPtr, struct commonNaN *zPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Converts the common NaN pointed to by `aPtr' into a 128-bit floating-point
|
||||||
|
| NaN, and stores this NaN at the location pointed to by `zWPtr'. Argument
|
||||||
|
| `zWPtr' points to an array of four 32-bit elements that concatenate in the
|
||||||
|
| platform's normal endian order to form a 128-bit floating-point value.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_commonNaNToF128M( const struct commonNaN *aPtr, uint32_t *zWPtr );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
| Assuming at least one of the two 128-bit floating-point values pointed to by
|
||||||
|
| `aWPtr' and `bWPtr' is a NaN, stores the combined NaN result at the location
|
||||||
|
| pointed to by `zWPtr'. If either original floating-point value is a
|
||||||
|
| signaling NaN, the invalid exception is raised. Each of `aWPtr', `bWPtr',
|
||||||
|
| and `zWPtr' points to an array of four 32-bit elements that concatenate in
|
||||||
|
| the platform's normal endian order to form a 128-bit floating-point value.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
softfloat_propagateNaNF128M(
|
||||||
|
const uint32_t *aWPtr, const uint32_t *bWPtr, uint32_t *zWPtr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct uint128
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
bool isSigNaNA, isSigNaNB;
|
bool isSigNaNA, isSigNaNB;
|
||||||
|
uint_fast64_t uiNonsigA0, uiNonsigB0;
|
||||||
uint_fast16_t uiMagA64, uiMagB64;
|
uint_fast16_t uiMagA64, uiMagB64;
|
||||||
struct uint128 uiZ;
|
struct uint128 uiZ;
|
||||||
|
|
||||||
|
@ -66,8 +67,8 @@ struct uint128
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
| Make NaNs non-signaling.
|
| Make NaNs non-signaling.
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
uiA0 |= UINT64_C( 0xC000000000000000 );
|
uiNonsigA0 = uiA0 | UINT64_C( 0xC000000000000000 );
|
||||||
uiB0 |= UINT64_C( 0xC000000000000000 );
|
uiNonsigB0 = uiB0 | UINT64_C( 0xC000000000000000 );
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
if ( isSigNaNA | isSigNaNB ) {
|
if ( isSigNaNA | isSigNaNB ) {
|
||||||
|
@ -86,16 +87,16 @@ struct uint128
|
||||||
uiMagB64 = uiB64 & 0x7FFF;
|
uiMagB64 = uiB64 & 0x7FFF;
|
||||||
if ( uiMagA64 < uiMagB64 ) goto returnB;
|
if ( uiMagA64 < uiMagB64 ) goto returnB;
|
||||||
if ( uiMagB64 < uiMagA64 ) goto returnA;
|
if ( uiMagB64 < uiMagA64 ) goto returnA;
|
||||||
if ( uiA0 < uiB0 ) goto returnB;
|
if ( uiNonsigA0 < uiNonsigB0 ) goto returnB;
|
||||||
if ( uiB0 < uiA0 ) goto returnA;
|
if ( uiNonsigB0 < uiNonsigA0 ) goto returnA;
|
||||||
if ( uiA64 < uiB64 ) goto returnA;
|
if ( uiA64 < uiB64 ) goto returnA;
|
||||||
returnB:
|
returnB:
|
||||||
uiZ.v64 = uiB64;
|
uiZ.v64 = uiB64;
|
||||||
uiZ.v0 = uiB0;
|
uiZ.v0 = uiNonsigB0;
|
||||||
return uiZ;
|
return uiZ;
|
||||||
returnA:
|
returnA:
|
||||||
uiZ.v64 = uiA64;
|
uiZ.v64 = uiA64;
|
||||||
uiZ.v0 = uiA0;
|
uiZ.v0 = uiNonsigA0;
|
||||||
return uiZ;
|
return uiZ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct uint128
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
bool isSigNaNA, isSigNaNB;
|
bool isSigNaNA, isSigNaNB;
|
||||||
uint_fast64_t uiMagA64, uiMagB64;
|
uint_fast64_t uiNonsigA64, uiNonsigB64, uiMagA64, uiMagB64;
|
||||||
struct uint128 uiZ;
|
struct uint128 uiZ;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
|
@ -66,8 +66,8 @@ struct uint128
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
| Make NaNs non-signaling.
|
| Make NaNs non-signaling.
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
uiA64 |= UINT64_C( 0x0000800000000000 );
|
uiNonsigA64 = uiA64 | UINT64_C( 0x0000800000000000 );
|
||||||
uiB64 |= UINT64_C( 0x0000800000000000 );
|
uiNonsigB64 = uiB64 | UINT64_C( 0x0000800000000000 );
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
if ( isSigNaNA | isSigNaNB ) {
|
if ( isSigNaNA | isSigNaNB ) {
|
||||||
|
@ -82,19 +82,19 @@ struct uint128
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returnLargerMag:
|
returnLargerMag:
|
||||||
uiMagA64 = uiA64 & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
uiMagA64 = uiNonsigA64 & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
||||||
uiMagB64 = uiB64 & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
uiMagB64 = uiNonsigB64 & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
||||||
if ( uiMagA64 < uiMagB64 ) goto returnB;
|
if ( uiMagA64 < uiMagB64 ) goto returnB;
|
||||||
if ( uiMagB64 < uiMagA64 ) goto returnA;
|
if ( uiMagB64 < uiMagA64 ) goto returnA;
|
||||||
if ( uiA0 < uiB0 ) goto returnB;
|
if ( uiA0 < uiB0 ) goto returnB;
|
||||||
if ( uiB0 < uiA0 ) goto returnA;
|
if ( uiB0 < uiA0 ) goto returnA;
|
||||||
if ( uiA64 < uiB64 ) goto returnA;
|
if ( uiNonsigA64 < uiNonsigB64 ) goto returnA;
|
||||||
returnB:
|
returnB:
|
||||||
uiZ.v64 = uiB64;
|
uiZ.v64 = uiNonsigB64;
|
||||||
uiZ.v0 = uiB0;
|
uiZ.v0 = uiB0;
|
||||||
return uiZ;
|
return uiZ;
|
||||||
returnA:
|
returnA:
|
||||||
uiZ.v64 = uiA64;
|
uiZ.v64 = uiNonsigA64;
|
||||||
uiZ.v0 = uiA0;
|
uiZ.v0 = uiA0;
|
||||||
return uiZ;
|
return uiZ;
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ uint_fast32_t
|
||||||
softfloat_propagateNaNF32UI( uint_fast32_t uiA, uint_fast32_t uiB )
|
softfloat_propagateNaNF32UI( uint_fast32_t uiA, uint_fast32_t uiB )
|
||||||
{
|
{
|
||||||
bool isSigNaNA, isSigNaNB;
|
bool isSigNaNA, isSigNaNB;
|
||||||
uint_fast32_t uiMagA, uiMagB;
|
uint_fast32_t uiNonsigA, uiNonsigB, uiMagA, uiMagB;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
|
@ -57,25 +57,25 @@ uint_fast32_t
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
| Make NaNs non-signaling.
|
| Make NaNs non-signaling.
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
uiA |= 0x00400000;
|
uiNonsigA = uiA | 0x00400000;
|
||||||
uiB |= 0x00400000;
|
uiNonsigB = uiB | 0x00400000;
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
if ( isSigNaNA | isSigNaNB ) {
|
if ( isSigNaNA | isSigNaNB ) {
|
||||||
softfloat_raiseFlags( softfloat_flag_invalid );
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
if ( isSigNaNA ) {
|
if ( isSigNaNA ) {
|
||||||
if ( isSigNaNB ) goto returnLargerMag;
|
if ( isSigNaNB ) goto returnLargerMag;
|
||||||
return isNaNF32UI( uiB ) ? uiB : uiA;
|
return isNaNF32UI( uiB ) ? uiNonsigB : uiNonsigA;
|
||||||
} else {
|
} else {
|
||||||
return isNaNF32UI( uiA ) ? uiA : uiB;
|
return isNaNF32UI( uiA ) ? uiNonsigA : uiNonsigB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returnLargerMag:
|
returnLargerMag:
|
||||||
uiMagA = uiA & 0x7FFFFFFF;
|
uiMagA = uiNonsigA & 0x7FFFFFFF;
|
||||||
uiMagB = uiB & 0x7FFFFFFF;
|
uiMagB = uiNonsigB & 0x7FFFFFFF;
|
||||||
if ( uiMagA < uiMagB ) return uiB;
|
if ( uiMagA < uiMagB ) return uiNonsigB;
|
||||||
if ( uiMagB < uiMagA ) return uiA;
|
if ( uiMagB < uiMagA ) return uiNonsigA;
|
||||||
return (uiA < uiB) ? uiA : uiB;
|
return (uiNonsigA < uiNonsigB) ? uiNonsigA : uiNonsigB;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ uint_fast64_t
|
||||||
softfloat_propagateNaNF64UI( uint_fast64_t uiA, uint_fast64_t uiB )
|
softfloat_propagateNaNF64UI( uint_fast64_t uiA, uint_fast64_t uiB )
|
||||||
{
|
{
|
||||||
bool isSigNaNA, isSigNaNB;
|
bool isSigNaNA, isSigNaNB;
|
||||||
uint_fast64_t uiMagA, uiMagB;
|
uint_fast64_t uiNonsigA, uiNonsigB, uiMagA, uiMagB;
|
||||||
|
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
|
@ -57,25 +57,25 @@ uint_fast64_t
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
| Make NaNs non-signaling.
|
| Make NaNs non-signaling.
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
uiA |= UINT64_C( 0x0008000000000000 );
|
uiNonsigA = uiA | UINT64_C( 0x0008000000000000 );
|
||||||
uiB |= UINT64_C( 0x0008000000000000 );
|
uiNonsigB = uiB | UINT64_C( 0x0008000000000000 );
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
*------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------*/
|
||||||
if ( isSigNaNA | isSigNaNB ) {
|
if ( isSigNaNA | isSigNaNB ) {
|
||||||
softfloat_raiseFlags( softfloat_flag_invalid );
|
softfloat_raiseFlags( softfloat_flag_invalid );
|
||||||
if ( isSigNaNA ) {
|
if ( isSigNaNA ) {
|
||||||
if ( isSigNaNB ) goto returnLargerMag;
|
if ( isSigNaNB ) goto returnLargerMag;
|
||||||
return isNaNF64UI( uiB ) ? uiB : uiA;
|
return isNaNF64UI( uiB ) ? uiNonsigB : uiNonsigA;
|
||||||
} else {
|
} else {
|
||||||
return isNaNF64UI( uiA ) ? uiA : uiB;
|
return isNaNF64UI( uiA ) ? uiNonsigA : uiNonsigB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
returnLargerMag:
|
returnLargerMag:
|
||||||
uiMagA = uiA & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
uiMagA = uiNonsigA & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
||||||
uiMagB = uiB & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
uiMagB = uiNonsigB & UINT64_C( 0x7FFFFFFFFFFFFFFF );
|
||||||
if ( uiMagA < uiMagB ) return uiB;
|
if ( uiMagA < uiMagB ) return uiNonsigB;
|
||||||
if ( uiMagB < uiMagA ) return uiA;
|
if ( uiMagB < uiMagA ) return uiNonsigA;
|
||||||
return (uiA < uiB) ? uiA : uiB;
|
return (uiNonsigA < uiNonsigB) ? uiNonsigA : uiNonsigB;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue