1/* { dg-do compile { target { ! { ia32 } } } } */ 2/* { dg-options "-O2 -mx32 -maddress-mode=long" } */ 3/* { dg-skip-if "different ABI" { x86_64-*-mingw* } } */ 4 5typedef union tree_node *tree; 6typedef const union tree_node *const_tree; 7typedef struct { 8 unsigned long long low; 9 long long high; 10} double_int; 11struct real_value { 12}; 13struct real_format { 14 int has_signed_zero; 15}; 16extern const struct real_format * real_format_for_mode[]; 17extern int real_isnegzero (const struct real_value *); 18enum tree_code { REAL_CST, SSA_NAME }; 19struct tree_base { 20 enum tree_code code : 16; 21 union { 22 unsigned int version; 23 } 24 u; 25}; 26extern void tree_check_failed (const_tree, const char *, int, const char *, ...) __attribute__ ((__noreturn__)); 27union tree_node { 28 struct tree_base base; 29}; 30inline tree tree_check (tree __t, const char *__f, int __l, const char *__g, enum tree_code __c) { 31 if (((enum tree_code) (__t)->base.code) != __c) 32 tree_check_failed (__t, __f, __l, __g, __c, 0); 33 return __t; 34} 35struct prop_value_d { 36 int lattice_val; 37 tree value; 38 double_int mask; 39}; 40typedef struct prop_value_d prop_value_t; 41static prop_value_t *const_val; 42static void canonicalize_float_value (prop_value_t *); 43typedef void (*ssa_prop_visit_stmt_fn) (prop_value_t); 44typedef void (*ssa_prop_visit_phi_fn) (void); 45typedef void (*ssa_prop_fold_stmt_fn) (void *gsi); 46typedef void (*ssa_prop_get_value_fn) ( prop_value_t *val); 47void ssa_propagate (ssa_prop_visit_stmt_fn, ssa_prop_visit_phi_fn); 48int substitute_and_fold (ssa_prop_get_value_fn, ssa_prop_fold_stmt_fn); 49void ccp_fold_stmt (void *); 50static void get_constant_value (prop_value_t *val) { 51 canonicalize_float_value (val); 52} 53static void canonicalize_float_value (prop_value_t *val) { 54 int mode; 55 struct real_value d; 56 if (val->lattice_val != 1 57 || ((enum tree_code) (val->value)->base.code) != REAL_CST) 58 return; 59 mode = val->lattice_val; 60 if (real_format_for_mode[mode]->has_signed_zero && real_isnegzero (&d)) 61 ccp_fold_stmt (0); 62} 63static void set_lattice_value (tree var, prop_value_t new_val) { 64 prop_value_t *old_val = &const_val[(tree_check ((var), "", 65 0, "", 66 (SSA_NAME)))->base.u.version]; 67 canonicalize_float_value (&new_val); 68 canonicalize_float_value (old_val); 69} 70static void ccp_visit_phi_node (void) { 71 prop_value_t new_val; 72 set_lattice_value (0, new_val); 73} 74static void ccp_visit_stmt (prop_value_t v) { 75 set_lattice_value (0, v); 76} 77unsigned int do_ssa_ccp (void) { 78 ssa_propagate (ccp_visit_stmt, ccp_visit_phi_node); 79 substitute_and_fold (get_constant_value, ccp_fold_stmt); 80 return 0; 81} 82