diff options
author | Tamar Christina <tamar.christina@arm.com> | 2017-06-08 07:38:42 +0000 |
---|---|---|
committer | Tamar Christina <tnfchris@gcc.gnu.org> | 2017-06-08 07:38:42 +0000 |
commit | 94fc87ecdf45e2455deb7ee50e13765c98d4e904 (patch) | |
tree | 01e590119900d4a8b6df6a832bb5456d8a7fd03c /gcc/real.c | |
parent | fb4bc6ff6c08f4e5524fa5e1881b478b0f689155 (diff) | |
download | gcc-94fc87ecdf45e2455deb7ee50e13765c98d4e904.zip gcc-94fc87ecdf45e2455deb7ee50e13765c98d4e904.tar.gz gcc-94fc87ecdf45e2455deb7ee50e13765c98d4e904.tar.bz2 |
re PR middle-end/77925 (Add __builtin_issubnormal)
2017-06-08 Tamar Christina <tamar.christina@arm.com>
PR middle-end/77925
PR middle-end/77926
PR middle-end/66462
* gcc/builtins.c (fold_builtin_fpclassify): Remove.
(fold_builtin_interclass_mathfn): Remove.
(expand_builtin): Add builtins to lowering list.
(fold_builtin_n): Remove fold_builtin_varargs.
(fold_builtin_varargs): Remove.
* gcc/builtins.def (BUILT_IN_ISZERO, BUILT_IN_ISSUBNORMAL): New.
* gcc/real.h (get_min_float): New.
(real_format): Add is_ieee_compatible field.
* gcc/real.c (get_min_float): New.
(ieee_single_format): Set is_ieee_compatible flag.
* gcc/gimple-low.c (lower_stm): Define BUILT_IN_FPCLASSIFY,
CASE_FLT_FN (BUILT_IN_ISINF), BUILT_IN_ISINFD32, BUILT_IN_ISINFD64,
BUILT_IN_ISINFD128, BUILT_IN_ISNAND32, BUILT_IN_ISNAND64,
BUILT_IN_ISNAND128, BUILT_IN_ISNAN, BUILT_IN_ISNORMAL, BUILT_IN_ISZERO,
BUILT_IN_ISSUBNORMAL, CASE_FLT_FN (BUILT_IN_FINITE), BUILT_IN_FINITED32
BUILT_IN_FINITED64, BUILT_IN_FINITED128, BUILT_IN_ISFINITE.
(lower_builtin_fpclassify, is_nan, is_normal, is_infinity): New.
(is_zero, is_subnormal, is_finite, use_ieee_int_mode): Likewise.
(lower_builtin_isnan, lower_builtin_isinfinite): Likewise.
(lower_builtin_isnormal, lower_builtin_iszero): Likewise.
(lower_builtin_issubnormal, lower_builtin_isfinite): Likewise.
(emit_tree_cond, get_num_as_int, emit_tree_and_return_var): New.
(mips_single_format): Likewise.
(motorola_single_format): Likewise.
(spu_single_format): Likewise.
(ieee_double_format): Likewise.
(mips_double_format): Likewise.
(motorola_double_format): Likewise.
(ieee_extended_motorola_format): Likewise.
(ieee_extended_intel_128_format): Likewise.
(ieee_extended_intel_96_round_53_format): Likewise.
(ibm_extended_format): Likewise.
(mips_extended_format): Likewise.
(ieee_quad_format): Likewise.
(mips_quad_format): Likewise.
(vax_f_format): Likewise.
(vax_d_format): Likewise.
(vax_g_format): Likewise.
(decimal_single_format): Likewise.
(decimal_quad_format): Likewise.
(iee_half_format): Likewise.
(mips_single_format): Likewise.
(arm_half_format): Likewise.
(real_internal_format): Likewise.
* gcc/doc/extend.texi: Add documentation for built-ins.
* gcc/c/c-typeck.c (convert_arguments): Add BUILT_IN_ISZERO
and BUILT_IN_ISSUBNORMAL.
gcc/testsuite/
2017-06-08 Tamar Christina <tamar.christina@arm.com>
* gcc.target/aarch64/builtin-fpclassify.c: New codegen test.
* gcc.dg/fold-notunord.c: Removed.
* gcc.dg/torture/floatn-tg-4.h: Add tests for iszero and issubnormal.
* gcc.dg/torture/float128-tg-4.c: Likewise.
* gcc.dg/torture/float128x-tg-4: Likewise.
* gcc.dg/torture/float16-tg-4.c: Likewise.
* gcc.dg/torture/float32-tg-4.c: Likewise.
* gcc.dg/torture/float32x-tg-4.c: Likewise.
* gcc.dg/torture/float64-tg-4.c: Likewise.
* gcc.dg/torture/float64x-tg-4.c: Likewise.
* gcc.dg/pr28796-1.c: Add -O2.
* gcc.dg/builtins-43.c: Check lower instead of gimple.
* gcc.dg/tg-tests.h: Add iszero and issubnormal.
* gcc.dg/pr77925.c: Add to test safe cases.
From-SVN: r249005
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -3052,6 +3052,7 @@ const struct real_format ieee_single_format = true, true, false, + true, "ieee_single" }; @@ -3075,6 +3076,7 @@ const struct real_format mips_single_format = true, false, true, + true, "mips_single" }; @@ -3098,6 +3100,7 @@ const struct real_format motorola_single_format = true, true, true, + true, "motorola_single" }; @@ -3132,6 +3135,7 @@ const struct real_format spu_single_format = true, false, false, + false, "spu_single" }; @@ -3343,6 +3347,7 @@ const struct real_format ieee_double_format = true, true, false, + true, "ieee_double" }; @@ -3366,6 +3371,7 @@ const struct real_format mips_double_format = true, false, true, + true, "mips_double" }; @@ -3389,6 +3395,7 @@ const struct real_format motorola_double_format = true, true, true, + true, "motorola_double" }; @@ -3735,6 +3742,7 @@ const struct real_format ieee_extended_motorola_format = true, true, true, + false, "ieee_extended_motorola" }; @@ -3758,6 +3766,7 @@ const struct real_format ieee_extended_intel_96_format = true, true, false, + false, "ieee_extended_intel_96" }; @@ -3781,6 +3790,7 @@ const struct real_format ieee_extended_intel_128_format = true, true, false, + false, "ieee_extended_intel_128" }; @@ -3806,6 +3816,7 @@ const struct real_format ieee_extended_intel_96_round_53_format = true, true, false, + false, "ieee_extended_intel_96_round_53" }; @@ -3896,6 +3907,7 @@ const struct real_format ibm_extended_format = true, true, false, + false, "ibm_extended" }; @@ -3919,6 +3931,7 @@ const struct real_format mips_extended_format = true, false, true, + false, "mips_extended" }; @@ -4184,6 +4197,7 @@ const struct real_format ieee_quad_format = true, true, false, + true, "ieee_quad" }; @@ -4207,6 +4221,7 @@ const struct real_format mips_quad_format = true, false, true, + true, "mips_quad" }; @@ -4509,6 +4524,7 @@ const struct real_format vax_f_format = false, false, false, + false, "vax_f" }; @@ -4532,6 +4548,7 @@ const struct real_format vax_d_format = false, false, false, + false, "vax_d" }; @@ -4555,6 +4572,7 @@ const struct real_format vax_g_format = false, false, false, + false, "vax_g" }; @@ -4633,6 +4651,7 @@ const struct real_format decimal_single_format = true, true, false, + false, "decimal_single" }; @@ -4657,6 +4676,7 @@ const struct real_format decimal_double_format = true, true, false, + false, "decimal_double" }; @@ -4681,6 +4701,7 @@ const struct real_format decimal_quad_format = true, true, false, + false, "decimal_quad" }; @@ -4820,6 +4841,7 @@ const struct real_format ieee_half_format = true, true, false, + true, "ieee_half" }; @@ -4846,6 +4868,7 @@ const struct real_format arm_half_format = true, false, false, + false, "arm_half" }; @@ -4893,6 +4916,7 @@ const struct real_format real_internal_format = true, true, false, + false, "real_internal" }; @@ -5080,6 +5104,16 @@ get_max_float (const struct real_format *fmt, char *buf, size_t len) gcc_assert (strlen (buf) < len); } +/* Write into BUF the minimum negative representable finite floating-point + number, x, such that b**(x-1) is normalized. + BUF must be large enough to contain the result. */ +void +get_min_float (const struct real_format *fmt, char *buf, size_t len) +{ + sprintf (buf, "0x1p%d", fmt->emin - 1); + gcc_assert (strlen (buf) < len); +} + /* True if mode M has a NaN representation and the treatment of NaN operands is important. */ |