From b81285ed3ce8b261837dcdc0ca0220afa03754d9 Mon Sep 17 00:00:00 2001 From: Justin Seyster Date: Thu, 28 Oct 2010 16:32:21 -0400 Subject: [PATCH] Replaced float96 and float128 with just long_double. These two types are not really distinct types: they are both just 80-bit floating point numbers padded to fit in machine registers. --- src/aop-type.c | 38 ++++++++++++++++++-------------------- src/aop.h | 3 +-- test/plugin-float-types.c | 7 +------ 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/aop-type.c b/src/aop-type.c index f1e233d..435fdc1 100644 --- a/src/aop-type.c +++ b/src/aop-type.c @@ -368,8 +368,8 @@ aop_t_all_unsigned () * * Standard floating point sizes are single-precision (float) and * double-precision (double). This type will not match - * quadruple-precision floating point types (you must use - * aop_t_float128() to match quadruple-precision). + * higher-precision floating point types (you must use + * aop_t_long_double() to match GCC's long double). * * \return A type that will match any standard-sized floating point * type. @@ -525,27 +525,25 @@ aop_t_float64 () } /** - * Return a type that will match 96-bit floating point types (long double - * in C on a 32-bit system). - * \return A type that will match quadruple-precision floating point - * types. + * Return a type that will match long double. Where + * supported, the long double type is actually 80-bits, + * though it is padded to 96 or 128 bits on different systems. + * \return A type that will match GCC's long double + * floating point type. */ const struct aop_type * -aop_t_float96 () +aop_t_long_double () { - return &_aop_t_float96; -} - -/** - * Return a type that will match quadruple-precision floating point - * types (long double in C on a 64-bit system). - * \return A type that will match quadruple-precision floating point - * types. - */ -const struct aop_type * -aop_t_float128 () -{ - return &_aop_t_float128; + switch (int_size_in_bytes (long_double_type_node)) + { + case 12: + return &_aop_t_float96; + case 16: + return &_aop_t_float128; + default: + fatal_error ("(InterAspect) This compiler does not supply a standard long" + " double type."); + } } /** diff --git a/src/aop.h b/src/aop.h index 819db7f..efc68fd 100644 --- a/src/aop.h +++ b/src/aop.h @@ -199,8 +199,7 @@ extern const struct aop_type *aop_t_unsigned64 (); extern const struct aop_type *aop_t_unsigned128 (); extern const struct aop_type *aop_t_float32 (); extern const struct aop_type *aop_t_float64 (); -extern const struct aop_type *aop_t_float96 (); -extern const struct aop_type *aop_t_float128 (); +extern const struct aop_type *aop_t_long_double (); extern const struct aop_type *aop_t_cstring (); extern const struct aop_type *aop_t_struct (const char *tag); extern const struct aop_type *aop_t_struct_ptr (const char *tag); diff --git a/test/plugin-float-types.c b/test/plugin-float-types.c index 49877b2..c5746c9 100644 --- a/test/plugin-float-types.c +++ b/test/plugin-float-types.c @@ -31,13 +31,8 @@ static unsigned int plugin_float() aop_filter_call_pc_by_param(pc, 0, aop_t_float64()); aop_join_on(pc, plugin_join_on_call, "_advice_64"); - /* (long double) is 96 bits on 32-bit machines but 128 bits on - 64-bit machines. */ pc = aop_match_function_call(); - if (sizeof(long double) == 12) - aop_filter_call_pc_by_param(pc, 0, aop_t_float96()); - else - aop_filter_call_pc_by_param(pc, 0, aop_t_float128()); + aop_filter_call_pc_by_param(pc, 0, aop_t_long_double()); aop_join_on(pc, plugin_join_on_call, "_advice_128"); return 0; -- 2.34.1