From 26ebd2f5a89f8f4c5f1a93b23a5cf6df84a30a3a Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 30 Mar 2005 07:58:10 +0000 Subject: [PATCH] mode_overflow_on_unary_Minus() added [r5478] --- ir/ir/irmode.c | 54 ++++++++++++++++++++++++++++++-------------------- ir/ir/irmode.h | 5 +++++ 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/ir/ir/irmode.c b/ir/ir/irmode.c index d49b73f15..8894fda15 100644 --- a/ir/ir/irmode.c +++ b/ir/ir/irmode.c @@ -927,33 +927,45 @@ int mode_honor_signed_zeros(const ir_mode *mode) return 0; } +/* + * Returns non-zero if the given mode might overflow on unary Minus. + * + * This does NOT happen on IEEE 754. + */ +int mode_overflow_on_unary_Minus(const ir_mode *mode) +{ + if (mode->sort == irms_float_number) + return mode->arithmetic == irma_ieee754 ? 0 : 1; + return 1; +} + void finish_mode(void) { obstack_free(&modes, 0); - mode_T = NULL; - mode_X = NULL; - mode_M = NULL; - mode_BB = NULL; + mode_T = NULL; + mode_X = NULL; + mode_M = NULL; + mode_BB = NULL; mode_ANY = NULL; mode_BAD = NULL; - mode_F = NULL; - mode_D = NULL; - mode_E = NULL; - - mode_Bs = NULL; - mode_Bu = NULL; - mode_Hs = NULL; - mode_Hu = NULL; - mode_Is = NULL; - mode_Iu = NULL; - mode_Ls = NULL; - mode_Lu = NULL; - - mode_C = NULL; - mode_U = NULL; - mode_b = NULL; - mode_P = NULL; + mode_F = NULL; + mode_D = NULL; + mode_E = NULL; + + mode_Bs = NULL; + mode_Bu = NULL; + mode_Hs = NULL; + mode_Hu = NULL; + mode_Is = NULL; + mode_Iu = NULL; + mode_Ls = NULL; + mode_Lu = NULL; + + mode_C = NULL; + mode_U = NULL; + mode_b = NULL; + mode_P = NULL; mode_P_mach = NULL; } diff --git a/ir/ir/irmode.h b/ir/ir/irmode.h index 94adf3e07..5f8854077 100644 --- a/ir/ir/irmode.h +++ b/ir/ir/irmode.h @@ -439,4 +439,9 @@ ir_mode *find_double_bits_int_mode(const ir_mode *mode); */ int mode_honor_signed_zeros(const ir_mode *mode); +/** + * Returns non-zero if the given mode might overflow on unary Minus. + */ +int mode_overflow_on_unary_Minus(const ir_mode *mode); + #endif /* _IRMODE_H_ */ -- 2.20.1