• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン377ed92679a2a5f838bc0a095112ea5020720fff (tree)
日時2018-05-18 07:27:15
作者Richard Henderson <richard.henderson@lina...>
コミッターRichard Henderson

ログメッセージ

fpu/softfloat: Define floatN_silence_nan in terms of parts_silence_nan

Isolate the target-specific choice to 3 functions instead of 6.

The code in floatx80_default_nan tried to be over-general. There are
only two targets that support this format: x86 and m68k. Thus there
is no point in inventing a mechanism for snan_bit_is_one.

Move routines that no longer have ifdefs out of softfloat-specialize.h.

Tested-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

変更サマリ

差分

--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -279,24 +279,6 @@ int float16_is_signaling_nan(float16 a_, float_status *status)
279279 }
280280
281281 /*----------------------------------------------------------------------------
282-| Returns a quiet NaN from a signalling NaN for the half-precision
283-| floating point value `a'.
284-*----------------------------------------------------------------------------*/
285-
286-float16 float16_silence_nan(float16 a, float_status *status)
287-{
288-#ifdef NO_SIGNALING_NANS
289- g_assert_not_reached();
290-#else
291- if (snan_bit_is_one(status)) {
292- return float16_default_nan(status);
293- } else {
294- return a | (1 << 9);
295- }
296-#endif
297-}
298-
299-/*----------------------------------------------------------------------------
300282 | Returns 1 if the single-precision floating-point value `a' is a quiet
301283 | NaN; otherwise returns 0.
302284 *----------------------------------------------------------------------------*/
@@ -335,30 +317,6 @@ int float32_is_signaling_nan(float32 a_, float_status *status)
335317 }
336318
337319 /*----------------------------------------------------------------------------
338-| Returns a quiet NaN from a signalling NaN for the single-precision
339-| floating point value `a'.
340-*----------------------------------------------------------------------------*/
341-
342-float32 float32_silence_nan(float32 a, float_status *status)
343-{
344-#ifdef NO_SIGNALING_NANS
345- g_assert_not_reached();
346-#else
347- if (snan_bit_is_one(status)) {
348-# ifdef TARGET_HPPA
349- a &= ~0x00400000;
350- a |= 0x00200000;
351- return a;
352-# else
353- return float32_default_nan(status);
354-# endif
355- } else {
356- return a | (1 << 22);
357- }
358-#endif
359-}
360-
361-/*----------------------------------------------------------------------------
362320 | Returns the result of converting the single-precision floating-point NaN
363321 | `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid
364322 | exception is raised.
@@ -707,31 +665,6 @@ int float64_is_signaling_nan(float64 a_, float_status *status)
707665 }
708666
709667 /*----------------------------------------------------------------------------
710-| Returns a quiet NaN from a signalling NaN for the double-precision
711-| floating point value `a'.
712-*----------------------------------------------------------------------------*/
713-
714-float64 float64_silence_nan(float64 a, float_status *status)
715-{
716-#ifdef NO_SIGNALING_NANS
717- g_assert_not_reached();
718-#else
719- if (snan_bit_is_one(status)) {
720-# ifdef TARGET_HPPA
721- a &= ~0x0008000000000000ULL;
722- a |= 0x0004000000000000ULL;
723- return a;
724-# else
725- return float64_default_nan(status);
726-# endif
727- } else {
728- return a | LIT64(0x0008000000000000);
729- }
730-#endif
731-}
732-
733-
734-/*----------------------------------------------------------------------------
735668 | Returns the result of converting the double-precision floating-point NaN
736669 | `a' to the canonical NaN format. If `a' is a signaling NaN, the invalid
737670 | exception is raised.
@@ -886,16 +819,10 @@ int floatx80_is_signaling_nan(floatx80 a, float_status *status)
886819
887820 floatx80 floatx80_silence_nan(floatx80 a, float_status *status)
888821 {
889-#ifdef NO_SIGNALING_NANS
890- g_assert_not_reached();
891-#else
892- if (snan_bit_is_one(status)) {
893- return floatx80_default_nan(status);
894- } else {
895- a.low |= LIT64(0xC000000000000000);
896- return a;
897- }
898-#endif
822+ /* None of the targets that have snan_bit_is_one use floatx80. */
823+ assert(!snan_bit_is_one(status));
824+ a.low |= LIT64(0xC000000000000000);
825+ return a;
899826 }
900827
901828 /*----------------------------------------------------------------------------
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -2135,6 +2135,37 @@ float128 float128_default_nan(float_status *status)
21352135 }
21362136
21372137 /*----------------------------------------------------------------------------
2138+| Returns a quiet NaN from a signalling NaN for the floating point value `a'.
2139+*----------------------------------------------------------------------------*/
2140+
2141+float16 float16_silence_nan(float16 a, float_status *status)
2142+{
2143+ FloatParts p = float16_unpack_raw(a);
2144+ p.frac <<= float16_params.frac_shift;
2145+ p = parts_silence_nan(p, status);
2146+ p.frac >>= float16_params.frac_shift;
2147+ return float16_pack_raw(p);
2148+}
2149+
2150+float32 float32_silence_nan(float32 a, float_status *status)
2151+{
2152+ FloatParts p = float32_unpack_raw(a);
2153+ p.frac <<= float32_params.frac_shift;
2154+ p = parts_silence_nan(p, status);
2155+ p.frac >>= float32_params.frac_shift;
2156+ return float32_pack_raw(p);
2157+}
2158+
2159+float64 float64_silence_nan(float64 a, float_status *status)
2160+{
2161+ FloatParts p = float64_unpack_raw(a);
2162+ p.frac <<= float64_params.frac_shift;
2163+ p = parts_silence_nan(p, status);
2164+ p.frac >>= float64_params.frac_shift;
2165+ return float64_pack_raw(p);
2166+}
2167+
2168+/*----------------------------------------------------------------------------
21382169 | Takes a 64-bit fixed-point value `absZ' with binary point between bits 6
21392170 | and 7, and returns the properly rounded 32-bit integer corresponding to the
21402171 | input. If `zSign' is 1, the input is negated before being converted to an