summaryrefslogtreecommitdiff
path: root/gcc/real.h
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2017-06-08 07:38:42 +0000
committerTamar Christina <tnfchris@gcc.gnu.org>2017-06-08 07:38:42 +0000
commit94fc87ecdf45e2455deb7ee50e13765c98d4e904 (patch)
tree01e590119900d4a8b6df6a832bb5456d8a7fd03c /gcc/real.h
parentfb4bc6ff6c08f4e5524fa5e1881b478b0f689155 (diff)
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.h')
-rw-r--r--gcc/real.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/real.h b/gcc/real.h
index e7248e30fa5..67fa7932e88 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -161,6 +161,19 @@ struct real_format
bool has_signed_zero;
bool qnan_msb_set;
bool canonical_nan_lsbs_set;
+
+ /* This flag indicates whether the format is suitable for the optimized
+ code paths for the __builtin_fpclassify function and friends. For
+ this, the format must be a base 2 representation with the sign bit as
+ the most-significant bit followed by (exp <= 32) exponent bits
+ followed by the mantissa bits. It must be possible to interpret the
+ bits of the floating-point representation as an integer. NaNs and
+ INFs (if available) must be represented by the same schema used by
+ IEEE 754. (NaNs must be represented by an exponent with all bits 1,
+ any mantissa except all bits 0 and any sign bit. +INF and -INF must be
+ represented by an exponent with all bits 1, a mantissa with all bits 0 and
+ a sign bit of 0 and 1 respectively.) */
+ bool is_binary_ieee_compatible;
const char *name;
};
@@ -511,6 +524,11 @@ extern bool real_isinteger (const REAL_VALUE_TYPE *, HOST_WIDE_INT *);
float string. BUF must be large enough to contain the result. */
extern void get_max_float (const struct real_format *, char *, size_t);
+/* Write into BUF the smallest positive normalized number x,
+ such that b**(x-1) is normalized. BUF must be large enough
+ to contain the result. */
+extern void get_min_float (const struct real_format *, char *, size_t);
+
#ifndef GENERATOR_FILE
/* real related routines. */
extern wide_int real_to_integer (const REAL_VALUE_TYPE *, bool *, int);