From dedd9d0500596157cd1db1957e8ed0dd3ba2ac36 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sun, 20 Jun 2010 23:42:10 +0200 Subject: [PATCH] re PR target/44546 (ICE in extract_insn, at recog.c:2103 with -ffast-math -Os (compiling graphviz)) PR target/44546 * config/i386/predicates.md (ix86_swapped_fp_comparsion_operator): New predicate. * config/i386/i386.md (*fp_jcc_8_387): Use ix86_swapped_fp_comparsion_operator instead of ix86_fp_comparison_operator. (*fp_jcc_1_387): Rename from *fp_jcc_3_387. (*fp_jcc_1r_387): Rename from *fp_jcc_4_387. (*fp_jcc_2_387): Rename from *fp_jcc_5_387. (*fp_jcc_2r_387): Rename from *fp_jcc_6_387. (*fp_jcc_3_387): Rename from *fp_jcc_7_387. (*fp_jcc_4__387): Rename from *fp_jcc_8_387. testsuite/ChangeLog: PR target/44546 * gcc.target/i386/pr44546.c: New test. From-SVN: r161055 --- gcc/ChangeLog | 46 +++++++++++--------- gcc/config/i386/i386.md | 75 +++++++++++++++++---------------- gcc/config/i386/predicates.md | 13 ++++++ gcc/testsuite/ChangeLog | 7 ++- gcc/testsuite/gcc.target/i386/pr44546.c | 22 ++++++++++ 5 files changed, 107 insertions(+), 56 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr44546.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a0cbd40..b87c634 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2010-06-20 Uros Bizjak + + PR target/44546 + * config/i386/predicates.md (ix86_swapped_fp_comparsion_operator): + New predicate. + * config/i386/i386.md (*fp_jcc_8_387): Use + ix86_swapped_fp_comparsion_operator instead of + ix86_fp_comparison_operator. + + (*fp_jcc_1_387): Rename from *fp_jcc_3_387. + (*fp_jcc_1r_387): Rename from *fp_jcc_4_387. + (*fp_jcc_2_387): Rename from *fp_jcc_5_387. + (*fp_jcc_2r_387): Rename from *fp_jcc_6_387. + (*fp_jcc_3_387): Rename from *fp_jcc_7_387. + (*fp_jcc_4__387): Rename from *fp_jcc_8_387. + 2010-06-20 Joseph Myers PR other/32998 @@ -15,8 +31,7 @@ decode_cmdline_options_to_array. Use decoded options for -O scan. Use integral_argument for -O parameters. Update call to read_cmdline_options. - (enable_warning_as_error): Update handling of find_opt return - value. + (enable_warning_as_error): Update handling of find_opt return value. * opts.h: Update comment on unknown options. (struct cl_decoded_option): Update comments on opt_index and arg. Add orig_option_with_args_text. @@ -27,11 +42,9 @@ (save_decoded_options, save_decoded_options_count): New. (read_integral_parameter): Remove. (print_switch_values): Use decoded options. - (toplev_main): Don't set save_argv. Update call to - decode_options. + (toplev_main): Don't set save_argv. Update call to decode_options. * toplev.h (read_integral_parameter): Remove. - * varasm.c (elf_record_gcc_switches): Don't handle holding back - names. + * varasm.c (elf_record_gcc_switches): Don't handle holding back names. 2010-06-19 Richard Earnshaw @@ -113,8 +126,8 @@ 2010-06-17 John David Anglin PR target/43740 - config/pa/pa.c (emit_move_sequence): Don't infer REG_POINTER flag for - SET source operand from SET destination operand. + * config/pa/pa.c (emit_move_sequence): Don't infer REG_POINTER flag + for SET source operand from SET destination operand. 2010-06-17 Bernd Schmidt @@ -274,8 +287,7 @@ 2010-06-16 Richard Guenther - * tree-inline.c (remap_gimple_op_r): Recurse using - remap_gimple_op_r. + * tree-inline.c (remap_gimple_op_r): Recurse using remap_gimple_op_r. 2010-06-16 Douglas B Rupp @@ -302,7 +314,7 @@ (AT_vms_delta1, AT_vms_delta2, add_AT_vms_delta): Declare new static functions. (dwarf_attr_name): New cases DW_AT_HP_{prologue,epilogue}. - (AT_vms_delta1, AT_vms_delta2, add_AT_vms_delta): New + (AT_vms_delta1, AT_vms_delta2, add_AT_vms_delta): New static functions. (print_die): New case dw_val_class_vms_delta. (attr_checksum): Likewise. @@ -375,8 +387,7 @@ (bitset): Remove early clobber from destination. (bitset_in_memory): Likewise. (lrintsf2): Clobber the cc0 register. - * config/rx/rx.c (rx_notice_update_cc): - Handle CC_SET_ZSC. + * config/rx/rx.c (rx_notice_update_cc): Handle CC_SET_ZSC. (rx_print_operand): Handle %N. 2010-06-16 Jan Hubicka @@ -3615,8 +3626,7 @@ 2010-05-29 Jan Hubicka * cgraphunit.c (cgraph_materialize_clone): Only remove calles, - refs and body; not the whole node for masters of materialized - clones. + refs and body; not the whole node for masters of materialized clones. 2010-05-29 Mike Stump @@ -3756,8 +3766,7 @@ * gcc.c (inform, warning, inform): New functions. (fatal_ice): Rename to internal_error; change cmsgid parameter to gmsgid. All callers changed. - (notice): Rename to fnotice; add parameter fp. All callers - changed. + (notice): Rename to fnotice; add parameter fp. All callers changed. (fatal_error): Rename to fatal_signal. All users changed. (fatal): Rename to fatal_error; change cmsgid parameter to gmsgid. All callers changed. @@ -3772,8 +3781,7 @@ (warning): Declare. * config/darwin-driver.c (darwin_default_min_version): Use warning instead of fprintf for warnings. - * cppspec.c (lang_specific_driver): Use fatal_error instead of - fatal. + * cppspec.c (lang_specific_driver): Use fatal_error instead of fatal. 2010-05-28 Julian Brown diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index c81b647b..777f8e7 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -11086,7 +11086,7 @@ ;; Define combination compare-and-branch fp compare instructions to help ;; combine. -(define_insn "*fp_jcc_3_387" +(define_insn "*fp_jcc_1_387" [(set (pc) (if_then_else (match_operator 0 "ix86_fp_comparison_operator" [(match_operand 1 "register_operand" "f") @@ -11104,7 +11104,7 @@ && !TARGET_CMOVE" "#") -(define_insn "*fp_jcc_4_387" +(define_insn "*fp_jcc_1r_387" [(set (pc) (if_then_else (match_operator 0 "ix86_fp_comparison_operator" [(match_operand 1 "register_operand" "f") @@ -11122,7 +11122,7 @@ && !TARGET_CMOVE" "#") -(define_insn "*fp_jcc_5_387" +(define_insn "*fp_jcc_2_387" [(set (pc) (if_then_else (match_operator 0 "ix86_fp_comparison_operator" [(match_operand 1 "register_operand" "f") @@ -11137,7 +11137,7 @@ && !TARGET_CMOVE" "#") -(define_insn "*fp_jcc_6_387" +(define_insn "*fp_jcc_2r_387" [(set (pc) (if_then_else (match_operator 0 "ix86_fp_comparison_operator" [(match_operand 1 "register_operand" "f") @@ -11152,7 +11152,7 @@ && !TARGET_CMOVE" "#") -(define_insn "*fp_jcc_7_387" +(define_insn "*fp_jcc_3_387" [(set (pc) (if_then_else (match_operator 0 "ix86_fp_comparison_operator" [(match_operand 1 "register_operand" "f") @@ -11169,29 +11169,6 @@ && !TARGET_CMOVE" "#") -;; The order of operands in *fp_jcc_8_387 is forced by combine in -;; simplify_comparison () function. Float operator is treated as RTX_OBJ -;; with a precedence over other operators and is always put in the first -;; place. Swap condition and operands to match ficom instruction. - -(define_insn "*fp_jcc_8_387" - [(set (pc) - (if_then_else (match_operator 0 "ix86_fp_comparison_operator" - [(match_operator 1 "float_operator" - [(match_operand:X87MODEI12 2 "nonimmediate_operand" "m,?r")]) - (match_operand 3 "register_operand" "f,f")]) - (label_ref (match_operand 4 "" "")) - (pc))) - (clobber (reg:CCFP FPSR_REG)) - (clobber (reg:CCFP FLAGS_REG)) - (clobber (match_scratch:HI 5 "=a,a"))] - "X87_FLOAT_MODE_P (GET_MODE (operands[3])) - && (TARGET_USE_MODE_FIOP || optimize_function_for_size_p (cfun)) - && GET_MODE (operands[1]) == GET_MODE (operands[3]) - && ix86_fp_compare_mode (swap_condition (GET_CODE (operands[0]))) == CCFPmode - && !TARGET_CMOVE" - "#") - (define_split [(set (pc) (if_then_else (match_operator 0 "ix86_fp_comparison_operator" @@ -11227,12 +11204,37 @@ DONE; }) +;; The order of operands in *fp_jcc_4_387 is forced by combine in +;; simplify_comparison () function. Float operator is treated as RTX_OBJ +;; with a precedence over other operators and is always put in the first +;; place. Swap condition and operands to match ficom instruction. + +(define_insn "*fp_jcc_4__387" + [(set (pc) + (if_then_else + (match_operator 0 "ix86_swapped_fp_comparison_operator" + [(match_operator 1 "float_operator" + [(match_operand:X87MODEI12 2 "nonimmediate_operand" "m,?r")]) + (match_operand 3 "register_operand" "f,f")]) + (label_ref (match_operand 4 "" "")) + (pc))) + (clobber (reg:CCFP FPSR_REG)) + (clobber (reg:CCFP FLAGS_REG)) + (clobber (match_scratch:HI 5 "=a,a"))] + "X87_FLOAT_MODE_P (GET_MODE (operands[3])) + && (TARGET_USE_MODE_FIOP || optimize_function_for_size_p (cfun)) + && GET_MODE (operands[1]) == GET_MODE (operands[3]) + && ix86_fp_compare_mode (swap_condition (GET_CODE (operands[0]))) == CCFPmode + && !TARGET_CMOVE" + "#") + (define_split [(set (pc) - (if_then_else (match_operator 0 "ix86_fp_comparison_operator" - [(match_operator 1 "float_operator" - [(match_operand:X87MODEI12 2 "memory_operand" "")]) - (match_operand 3 "register_operand" "")]) + (if_then_else + (match_operator 0 "ix86_swapped_fp_comparison_operator" + [(match_operator 1 "float_operator" + [(match_operand:X87MODEI12 2 "memory_operand" "")]) + (match_operand 3 "register_operand" "")]) (match_operand 4 "" "") (match_operand 5 "" ""))) (clobber (reg:CCFP FPSR_REG)) @@ -11252,10 +11254,11 @@ ;; %%% Kill this when reload knows how to do it. (define_split [(set (pc) - (if_then_else (match_operator 0 "ix86_fp_comparison_operator" - [(match_operator 1 "float_operator" - [(match_operand:X87MODEI12 2 "register_operand" "")]) - (match_operand 3 "register_operand" "")]) + (if_then_else + (match_operator 0 "ix86_swapped_fp_comparison_operator" + [(match_operator 1 "float_operator" + [(match_operand:X87MODEI12 2 "register_operand" "")]) + (match_operand 3 "register_operand" "")]) (match_operand 4 "" "") (match_operand 5 "" ""))) (clobber (reg:CCFP FPSR_REG)) diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index a33d3af..e5fea4a 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -1053,6 +1053,19 @@ (match_operand 0 "comparison_operator") (match_operand 0 "ix86_trivial_fp_comparison_operator"))) +;; Same as above, but for swapped comparison used in fp_jcc_4_387. +(define_predicate "ix86_swapped_fp_comparison_operator" + (match_operand 0 "comparison_operator") +{ + enum rtx_code code = GET_CODE (op); + int ret; + + PUT_CODE (op, swap_condition (code)); + ret = ix86_fp_comparison_operator (op, mode); + PUT_CODE (op, code); + return ret; +}) + ;; Nearly general operand, but accept any const_double, since we wish ;; to be able to drop them into memory rather than have them get pulled ;; into registers. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 922073a..e0c2cda 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-06-20 Uros Bizjak + + PR target/44546 + * gcc.target/i386/pr44546.c: New test. + 2010-06-20 Joseph Myers * gcc.dg/opts-2.c: New test. @@ -181,7 +186,7 @@ 2010-06-12 Daniel Franke - * gfortran.dg/whole_file_20.f03: New. + * gfortran.dg/whole_file_20.f03: New. 2010-06-12 Jan Hubicka diff --git a/gcc/testsuite/gcc.target/i386/pr44546.c b/gcc/testsuite/gcc.target/i386/pr44546.c new file mode 100644 index 0000000..517446f --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr44546.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -ffast-math -mfpmath=387" } */ + +typedef __SIZE_TYPE__ size_t; +typedef struct +{ + float *ewgts; +} vtx_data; + +extern void *zmalloc (size_t); +extern int whatever (vtx_data *); + +float * +compute_apsp_artifical_weights_packed (vtx_data * graph, int n) +{ + float *weights; + + weights = (float *) zmalloc (n * sizeof (float)); + weights[n] = + whatever (graph) > graph[n].ewgts[n] ? + whatever (graph) : graph[n].ewgts[n]; +} -- 2.7.4