diff options
Diffstat (limited to 'gcc')
374 files changed, 10148 insertions, 3131 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d239c35..33d10ef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,418 @@ +2025-05-10 H.J. Lu <hjl.tools@gmail.com> + + PR target/92080 + PR target/117839 + * config/i386/i386-features.cc (replace_vector_const): Change + dest to src. + +2025-05-10 Jan Hubicka <hubicka@ucw.cz> + + * config/i386/i386-features.cc + (general_scalar_chain::vector_const_cost): Add BB parameter; handle + size costs; use COSTS_N_INSNS to compute move costs. + (general_scalar_chain::compute_convert_gain): Use optimize_bb_for_size + instead of optimize_insn_for size; use COSTS_N_INSNS to compute move costs; + update calls of general_scalar_chain::vector_const_cost; use + ix86_cost->integer_to_sse. + (timode_immed_const_gain): Add bb parameter; use + optimize_bb_for_size_p. + (timode_scalar_chain::compute_convert_gain): Use optimize_bb_for_size_p. + * config/i386/i386-features.h (class general_scalar_chain): Update + prototype of vector_const_cost. + * config/i386/i386.h (struct processor_costs): Add integer_to_sse. + * config/i386/x86-tune-costs.h (struct processor_costs): Copy + sse_to_integer to integer_to_sse everywhere. + +2025-05-10 Filip Kastl <fkastl@suse.cz> + + PR tree-optimization/120080 + * tree-switch-conversion.cc (bit_test_cluster::find_bit_tests): + Replace assert with return. + +2025-05-10 Shreya Munnangi <smunnangi1@ventanamicro.com> + + * config/riscv/iterators.md (OPTAB): New iterator. + * config/riscv/predicates.md (arith_or_zbs_operand): Remove. + (reg_or_const_int_operand): New predicate. + * config/riscv/riscv-protos.h (synthesize_ior_xor): Prototype. + * config/riscv/riscv.cc (synthesize_ior_xor): New function. + * config/riscv/riscv.md (ior/xor expander): Use synthesize_ior_xor. + +2025-05-10 LIU Hao <lh_mouse@126.com> + + PR target/111107 + * config/i386/cygming.h (PREFERRED_STACK_BOUNDARY_DEFAULT): Override + definition from i386.h. + (STACK_REALIGN_DEFAULT): Undefine, as it no longer has an effect. + * config/i386/i386.cc (ix86_update_stack_boundary): Force minimum + 128-bit alignment if `force_align_arg_pointer`. + +2025-05-10 Anton Blanchard <antonb@tenstorrent.com> + + * config/riscv/bitmanip.md (crc_rev<ANYI1:mode><ANYI:mode>4): Check + TARGET_ZVBC. + * config/riscv/riscv.cc (expand_crc_using_clmul): Emit code using + vclmul if TARGET_ZVBC. + +2025-05-09 Eric Botcazou <ebotcazou@adacore.com> + + * vr-values.cc (simplify_using_ranges::simplify) <BIT_AND_EXPR>: + Do not call simplify_bit_ops_using_ranges for boolean types whose + precision is not 1. + +2025-05-09 Richard Biener <rguenther@suse.de> + + PR tree-optimization/114166 + * tree-vect-stmts.cc (vectorizable_operation): Lower also + bitwise operations on word-mode vectors. + +2025-05-09 Richard Biener <rguenther@suse.de> + + * tree-vect-stmts.cc (vectorizable_operation): Remve non-SLP + path. + +2025-05-09 Andrew Pinski <quic_apinski@quicinc.com> + + * gimple.h (gimple_cond_true_canonical_p): New function. + (gimple_cond_false_canonical_p): New function. + * gimple-fold.cc (replace_stmt_with_simplification): Return + false if replacing the operands of GIMPLE_COND with an INTEGER_CST + and already in canonical form. + +2025-05-09 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/120182 + * dse.cc (canon_address): Constant addresses have no + separate store group. + +2025-05-09 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119960 + * tree-vect-slp.cc (vect_slp_can_convert_to_external): + Handle cases where defs from multiple BBs are ordered + by their dominance relation. + +2025-05-09 Jørgen Kvalsvik <j@lambda.is> + + PR gcov-profile/120086 + * gcov.cc (print_prime_path_lines): Use unsigned, format with + %u. + (print_prime_path_source): Likewise. + (output_path_coverage): Format with HOST_SIZE_T_PRINT_UNSIGNED, + use unsigned for pathno. + +2025-05-09 Jennifer Schmitz <jschmitz@nvidia.com> + + * config/aarch64/aarch64-sve.md (*aarch64_sve_ptrue<mode>_ldr_str): + Add define_insn_and_split to fold predicated SVE loads/stores with + ptrue predicates to unpredicated instructions. + +2025-05-09 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * Makefile.in (OBJS-libcommon): Add diagnostic-format-html.o. + * diagnostic-format-html.cc: Move here from + testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc. + Simplify includes. Rename "xhtml" to "html" throughout. + (write_escaped_text): Drop. + (class xhtml_stream_output_format): Drop. + (class html_file_output_format): Reimplement using + diagnostic_output_file. + (diagnostic_output_format_init_xhtml): Drop. + (diagnostic_output_format_init_xhtml_stderr): Drop. + (diagnostic_output_format_init_xhtml_file): Drop. + (diagnostic_output_format_open_html_file): New. + (make_html_sink): New. + (xhtml_format_selftests): Convert to... + (diagnostic_format_html_cc_tests): ...this. + (plugin_is_GPL_compatible): Drop. + (plugin_init): Drop. + * diagnostic-format-html.h: New file. + * doc/invoke.texi (-fdiagnostics-add-output=): Add + "experimental-html" scheme. + * opts-diagnostic.cc: Include "diagnostic-format-html.h". + (class html_scheme_handler): New. + (output_factory::output_factory): Add html_scheme_handler. + (html_scheme_handler::make_sink): New. + * selftest-run-tests.cc (selftest::run_tests): Call the new + selftests. + * selftest.h (selftest::diagnostic_format_html_cc_tests): New + decl. + +2025-05-08 Andrew Pinski <quic_apinski@quicinc.com> + + * gimple-fold.cc (replace_stmt_with_simplification): Return false + if replacing `bool_var != 0` with `bool_var` in GIMPLE_COND. + +2025-05-08 Andre Vieira <andre.simoesdiasvieira@arm.com> + + * tree-vect-loop.cc (get_initial_def_for_reduction): Remove. + (vect-create_epilog_for_reduction): Remove non-SLP path. + (vectorize_fold_left_reduction): Likewise. + (vectorizable_lane_reducing): Likewise. + (vectorizable_reduction): Likewise. + (vect_transform_reduction): Likewise. + (vect_transform_cycle_phi): Likewise. + (vectorizable_lc_phi): Remove non-SLP PATH and split into... + (vect_transform_lc_phi): ... this. + (update_epilogue_loop_vinfo): Update comment. + * tree-vect-stmts.cc (vect_analyze_stmt): Update call to + vectorizable_lc_phi. + (vect_transform_stmt): Update calls to vect_transform_reduction and + vect_transform_cycle_phi. Rename call from vectorizable_lc_phi to + vect_transform_lc_phi. + * tree-vectorizer.h (vect_transform_reduction): Update declaration. + (vect_transform_cycle_phi): Likewise. + (vectorizable_lc_phi): Likewise. + (vect_transform_lc_phi): New. + +2025-05-08 Richard Earnshaw <rearnsha@arm.com> + + * gensupport.cc (conlist::conlist): Pass a location to the constructor. + Only allow skipping of non-alpha-numeric characters when parsing a + number and only allow '=', '+' or '%'. Add some error checking when + parsing an operand number. + (parse_section_layout): Pass the location to the conlist constructor. + (parse_section): Allow an optional list of forbidden characters. + If specified, reject strings containing them. + (convert_syntax): Reject '=', '+' or '%' in an alternative. + +2025-05-08 Richard Earnshaw <rearnsha@arm.com> + + * config/aarch64/aarch64-sve.md (@aarch64_pred_<optab><mode>): Move + commutative marker to the cons specification. + (add<mode>3): Likewise. + (@aarch64_pred_<su>abd<mode>): Likewise. + (@aarch64_pred_<optab><mode>): Likewise. + (*cond_<optab><mode>_z): Likewise. + (<optab><mode>3): Likewise. + (@aarch64_pred_<optab><mode>): Likewise. + (*aarch64_pred_abd<mode>_relaxed): Likewise. + (*aarch64_pred_abd<mode>_strict): Likewise. + (@aarch64_pred_<optab><mode>): Likewise. + (@aarch64_pred_<optab><mode>): Likewise. + (@aarch64_pred_fma<mode>): Likewise. + (@aarch64_pred_fnma<mode>): Likewise. + (@aarch64_pred_<optab><mode>): Likewise. + * config/aarch64/aarch64-sve2.md (@aarch64_sve_<su>clamp<mode>): Move + commutative marker to the cons specification. + (*aarch64_sve_<su>clamp<mode>_x): Likewise. + (@aarch64_sve_fclamp<mode>): Likewise. + (*aarch64_sve_fclamp<mode>_x): Likewise. + (*aarch64_sve2_nor<mode>): Likewise. + (*aarch64_sve2_nand<mode>): Likewise. + (*aarch64_pred_faminmax_fused): Likewise. + * config/aarch64/aarch64.md (*loadwb_pre_pair_<ldst_sz>): Move the + early-clobber marker to the relevant alternative. + (*storewb_pre_pair_<ldst_sz>): Likewise. + (*add<mode>3_aarch64): Move commutative marker to the cons + specification. + (*addsi3_aarch64_uxtw): Likewise. + (*add<mode>3_poly_1): Likewise. + (add<mode>3_compare0): Likewise. + (*addsi3_compare0_uxtw): Likewise. + (*add<mode>3nr_compare0): Likewise. + (<optab><mode>3): Likewise. + (*<optab>si3_uxtw): Likewise. + (*and<mode>3_compare0): Likewise. + (*andsi3_compare0_uxtw): Likewise. + (@aarch64_and<mode>3nr_compare0): Likewise. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/116352 + * tree-vect-slp.cc (vect_build_slp_tree_2): When compressing + operands from a two-operator node make sure the resulting + operation does not mix defs from different basic-blocks. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120043 + * tree-ssa-phiopt.cc (cond_store_replacement): Check + whether the store is to readonly memory. + +2025-05-08 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/116938 + * tree-ssa-phiopt.cc (move_stmt): Use rewrite_to_defined_overflow + isntead of manually doing the rewrite of the VCE. + +2025-05-08 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/120122 + PR tree-optimization/116939 + * gimple-fold.h (gimple_with_undefined_signed_overflow): Rename to .. + (rewrite_to_defined_overflow): This. + (gimple_needing_rewrite_undefined): Rename to ... + (rewrite_to_defined_unconditional): this. + * gimple-fold.cc (gimple_with_undefined_signed_overflow): Rename to ... + (gimple_needing_rewrite_undefined): This. Return true for VCE with integral + types of smaller precision. + (rewrite_to_defined_overflow): Rename to ... + (rewrite_to_defined_unconditional): This. Handle VCE rewriting to a cast. + * tree-if-conv.cc: s/gimple_with_undefined_signed_overflow/gimple_needing_rewrite_undefined/ + s/rewrite_to_defined_overflow/rewrite_to_defined_unconditional. + * tree-scalar-evolution.cc: Likewise + * tree-ssa-ifcombine.cc: Likewise. + * tree-ssa-loop-im.cc: Likewise. + * tree-ssa-loop-split.cc: Likewise. + * tree-ssa-reassoc.cc: Likewise. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR ipa/120146 + * tree-ssa-structalias.cc (create_variable_info_for): If + the symtab cannot tell us whether all refs to a variable + are explicit assume they are not. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119589 + PR tree-optimization/119586 + PR tree-optimization/119155 + * tree-vect-stmts.cc (vectorizable_store): Verify + DR_STEP_ALIGNMENT preserves DR_TARGET_ALIGNMENT when + VF > 1 and VMAT_STRIDED_SLP. Use vector aligned accesses when + we can. + (vectorizable_load): Likewise. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120143 + * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): + Move/update the original stmts, not the pattern stmts which + lack virtual operands and are not in the IL. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120089 + * tree-vect-stmts.cc (vect_stmt_relevant_p): Mark all + PHIs live when not already so and doing early-break + vectorization. + (vect_mark_stmts_to_be_vectorized): Skip virtual PHIs. + * tree-vect-slp.cc (vect_analyze_slp): Robustify handling + of early-break forced IVs. + +2025-05-08 Pengxuan Zheng <quic_pzheng@quicinc.com> + + * config/aarch64/aarch64-protos.h (aarch64_exact_log2_inverse): New. + * config/aarch64/aarch64-simd.md (aarch64_simd_vec_set_zero<mode>): + Update pattern accordingly. + * config/aarch64/aarch64.cc (aarch64_exact_log2_inverse): New. + * simplify-rtx.cc (simplify_context::simplify_ternary_operation): + Canonicalize vec_merge. + +2025-05-07 Jeff Law <jlaw@ventanamicro.com> + + PR target/120137 + PR target/120154 + * config/riscv/riscv-vect-permconst.cc (process_bb): Verify each + canonicalized element fits into the vector element mode. + +2025-05-07 Dongyan Chen <chendongyan@isrc.iscas.ac.cn> + + * common/config/riscv/riscv-common.cc: New extension. + * config/riscv/riscv.opt: Ditto. + +2025-05-07 Richard Earnshaw <rearnsha@arm.com> + + PR target/91323 + * config/arm/arm.cc (arm_select_cc_mode): Use CCFPEmode for LTGT. + +2025-05-07 Richard Earnshaw <rearnsha@arm.com> + + PR target/110796 + PR target/118446 + * config/arm/arm.h (REVERSIBLE_CC_MODE): FP modes are only + reversible if flag_finite_math_only. + * config/arm/arm.cc (arm_select_cc_mode): Return CCFPmode for all + FP comparisons if flag_finite_math_only. + +2025-05-07 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/111276 + * gimple-fold.cc (arith_code_with_undefined_signed_overflow): Make static. + (gimple_with_undefined_signed_overflow): New function. + * gimple-fold.h (arith_code_with_undefined_signed_overflow): Remove. + (gimple_with_undefined_signed_overflow): Add declaration. + * tree-if-conv.cc (if_convertible_gimple_assign_stmt_p): Use + gimple_with_undefined_signed_overflow instead of manually + checking lhs and the code of the stmt. + (predicate_statements): Likewise. + * tree-ssa-ifcombine.cc (ifcombine_rewrite_to_defined_overflow): Likewise. + * tree-ssa-loop-im.cc (move_computations_worker): Likewise. + * tree-ssa-reassoc.cc (update_range_test): Likewise. Reformat. + * tree-scalar-evolution.cc (final_value_replacement_loop): Use + gimple_with_undefined_signed_overflow instead of + arith_code_with_undefined_signed_overflow. + * tree-ssa-loop-split.cc (split_loop): Likewise. + +2025-05-07 Andrew Pinski <quic_apinski@quicinc.com> + + * tree-ssa-loop-im.cc (compute_invariantness): Hoist to the always executed point + if ignorning the cost. + +2025-05-07 Jan Hubicka <hubicka@ucw.cz> + + * config/i386/i386.cc (ix86_vector_costs::add_stmt_cost): Add FLOAT_EXPR; + FIX_TRUNC_EXPR and vec_promote_demote costs. + +2025-05-07 Jennifer Schmitz <jschmitz@nvidia.com> + + PR target/117978 + * config/aarch64/aarch64-protos.h: Declare + aarch64_emit_load_store_through_mode and aarch64_sve_maskloadstore. + * config/aarch64/aarch64-sve.md + (maskload<mode><vpred>): New define_expand folding maskloads with + certain predicate patterns to ASIMD loads. + (*aarch64_maskload<mode><vpred>): Renamed from maskload<mode><vpred>. + (maskstore<mode><vpred>): New define_expand folding maskstores with + certain predicate patterns to ASIMD stores. + (*aarch64_maskstore<mode><vpred>): Renamed from maskstore<mode><vpred>. + * config/aarch64/aarch64.cc + (aarch64_emit_load_store_through_mode): New function emitting a + load/store through subregs of a given mode. + (aarch64_emit_sve_pred_move): Refactor to use + aarch64_emit_load_store_through_mode. + (aarch64_expand_maskloadstore): New function to emit ASIMD loads/stores + for maskloads/stores with SVE predicates with VL1, VL2, VL4, VL8, or + VL16 patterns. + (aarch64_partial_ptrue_length): New function returning number of leading + set bits in a predicate. + +2025-05-07 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + * config/s390/s390-protos.h (s390_expand_cstoreti4): New + function. + * config/s390/s390.cc (s390_expand_cstoreti4): New function. + * config/s390/s390.md (CC_SUZ): New mode iterator. + (l): New mode attribute. + (cc_tolower): New mode attribute. + * config/s390/vector.md (cstoreti4): New expander. + (*vec_cmpv2di_lane0_<cc_tolower>): New insn. + (*vec_cmpti_<cc_tolower>): New insn. + +2025-05-07 H.J. Lu <hjl.tools@gmail.com> + + PR target/120036 + * config/i386/i386-features.cc (ix86_get_vector_load_mode): + Handle 8/4/2 bytes. + (remove_redundant_vector_load): If the mode size is smaller than + its natural size, first insert an extra move with a QI vector + SUBREG of the same size to avoid validate_subreg failure. + +2025-05-07 hongtao.liu <hongtao.liu@intel.com> + + PR gcov-profile/118508 + * auto-profile.cc + (autofdo_source_profile::get_callsite_total_count): Fix name + mismatch for fortran. + +2025-05-07 Jeff Law <jlaw@ventanamicro.com> + + * config/riscv/riscv.md (*branch<ANYI:mode>_shiftedarith_equals_zero): + Avoid generating unnecessary andi. Fix formatting. + 2025-05-06 Dongyan Chen <chendongyan@isrc.iscas.ac.cn> * common/config/riscv/riscv-common.cc: New extension. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 9687431..b11e7ca 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20250507 +20250511 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 55b4cd7..e3af923 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1850,6 +1850,7 @@ OBJS = \ # Objects in libcommon.a, potentially used by all host binaries and with # no target dependencies. OBJS-libcommon = diagnostic-spec.o diagnostic.o diagnostic-color.o \ + diagnostic-format-html.o \ diagnostic-format-json.o \ diagnostic-format-sarif.o \ diagnostic-format-text.o \ diff --git a/gcc/cobol/ChangeLog b/gcc/cobol/ChangeLog index c2bf3f3..87aeaba 100644 --- a/gcc/cobol/ChangeLog +++ b/gcc/cobol/ChangeLog @@ -1,3 +1,72 @@ +2025-05-10 Robert Dubner <rdubner@symas.com> + + PR cobol/119337 + * Make-lang.in: Change how $(FLEX) is invoked. + * cdf.y: Change parser tokens. + * gcobc: Changed how name is inferred for PR119337 + * gcobol.1: Documentation for SOURCE format heuristic + * genapi.cc: Eliminate __gg__odo_violation. + (parser_display_field): Change comment. + * genutil.cc:Eliminate __gg__odo_violation. + (REFER): New macro for analyzing subscript/refmod calculations. + (get_integer_value): Likewise. + (get_data_offset): Eliminate __gg__odo_violation. + (scale_by_power_of_ten_N): Eliminate unnecessary var_decl_rdigits operation. + (refer_is_clean): Check for FldLiteralN. + (REFER_CHECK): Eliminate. + (refer_refmod_length): Streamline var_decl_rdigits processing. + (refer_fill_depends): Likewise. + (refer_offset): Streamline processing when FldLiteralN. + (refer_size): Tag with REFER macro. + (refer_size_dest): Likewise. + (refer_size_source): Likewise. + * genutil.h (get_integer_value): Delete declaration for odo_violation; + change comment for get_integer_value + (REFER_CHECK): Delete declaration. + (refer_check): Delete #define. + * lexio.cc (is_fixed_format): Changes for source format auto-detect. + (is_reference_format): Likewise. + (check_source_format_directive): Likewise. + (valid_sequence_area): Likewise. + (is_p): Likewise. + (is_program_id): Likewise. + (likely_nist_file): Likewise. + (infer_reference_format): Likewise. + (cdftext::free_form_reference_format): Likewise. + * parse.y: Token changes. + * parse_ante.h (class tokenset_t): Likewise. + (class current_tokens_t): Likewise. + (cmd_or_env_special_of): Likewise. + * scan.l: Likewise. + * scan_ante.h (bcomputable): Likewise. + (keyword_alias_add): Likewise. + (struct bint_t): Likewise. + (binary_integer_usage): Likewise. + (binary_integer_usage_of): Likewise. + * scan_post.h (start_condition_str): Likewise. + * symbols.cc (symbol_table_init): Formatting. + * symbols.h (struct cbl_field_data_t): Add "input" method to field_data_t. + (keyword_alias_add): Add forward declaration. + (binary_integer_usage_of): Likewise. + * token_names.h: Change list of tokens. + * util.cc (iso_cobol_word): Change list of COBOL reserved words. + +2025-05-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR cobol/119217 + * symbols.h (NAME_MAX): Define fallback. + +2025-05-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR cobol/119217 + * dts.h (csub_match): Initialize rm_so, rm_eo fields explicitly. + +2025-05-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR cobol/119217 + * cdf-copy.cc (GLOB_BRACE): Define fallback. + (GLOB_TILDE): Likewise. + 2025-05-05 Robert Dubner <rdubner@symas.com> * cdf.y: Exceptions. diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in index 9b74dd3..a474123 100644 --- a/gcc/cobol/Make-lang.in +++ b/gcc/cobol/Make-lang.in @@ -157,7 +157,7 @@ cobol/cdf.cc: cobol/cdf.y FLEX_WARNING = warning, dangerous trailing context cobol/scan.cc: cobol/scan.l - $(FLEX) -o$@ $(LFLAGS) $< >$@~ 2>&1 + $(FLEX) -o$@ $(LFLAGS) $< 2>$@~ || { cat $@~ >&1; exit 1; } awk '! /$(FLEX_WARNING)/ {print > "/dev/stderr"; nerr++} \ END {print "$(FLEX):", NR, "messages" > "/dev/stderr"; \ exit nerr}' $@~ diff --git a/gcc/cobol/cdf-copy.cc b/gcc/cobol/cdf-copy.cc index 2e4bfb6..059596c 100644 --- a/gcc/cobol/cdf-copy.cc +++ b/gcc/cobol/cdf-copy.cc @@ -42,6 +42,16 @@ #include "util.h" #include "copybook.h" +// GLOB_BRACE and GLOB_TILDE are BSD extensions. Provide fallback definitions +// if necessary. +#ifndef GLOB_BRACE +#define GLOB_BRACE 0 +#endif + +#ifndef GLOB_TILDE +#define GLOB_TILDE 0 +#endif + #define COUNT_OF(X) (sizeof(X) / sizeof(X[0])) /* diff --git a/gcc/cobol/cdf.y b/gcc/cobol/cdf.y index 994bf6a..7680f48 100644 --- a/gcc/cobol/cdf.y +++ b/gcc/cobol/cdf.y @@ -193,7 +193,7 @@ apply_cdf_turn( const exception_turn_t& turn ) { %type <cdfarg> namelit name_any name_one %type <string> name subscript subscripts inof %token <boolean> BOOL -%token <number> FEATURE 363 NUMBER 302 EXCEPTION_NAME 280 "EXCEPTION NAME" +%token <number> FEATURE 365 NUMBER 303 EXCEPTION_NAME 280 "EXCEPTION NAME" %type <cdfval> cdf_expr %type <cdfval> cdf_relexpr cdf_reloper cdf_and cdf_bool_expr @@ -203,48 +203,48 @@ apply_cdf_turn( const exception_turn_t& turn ) { %type <file> filename %type <files> filenames -%token BY 476 -%token COPY 360 -%token CDF_DISPLAY 382 ">>DISPLAY" -%token IN 595 +%token BY 478 +%token COPY 362 +%token CDF_DISPLAY 384 ">>DISPLAY" +%token IN 597 %token NAME 286 -%token NUMSTR 304 "numeric literal" -%token OF 676 -%token PSEUDOTEXT 711 -%token REPLACING 733 -%token LITERAL 297 -%token SUPPRESS 374 - -%token LSUB 365 "(" -%token SUBSCRIPT 373 RSUB 370 ")" - -%token CDF_DEFINE 381 ">>DEFINE" -%token CDF_IF 383 ">>IF" -%token CDF_ELSE 384 ">>ELSE" -%token CDF_END_IF 385 ">>END-IF" -%token CDF_EVALUATE 386 ">>EVALUATE" -%token CDF_WHEN 387 ">>WHEN" -%token CDF_END_EVALUATE 388 ">>END-EVALUATE" - -%token AS 458 CONSTANT 359 DEFINED 361 +%token NUMSTR 305 "numeric literal" +%token OF 678 +%token PSEUDOTEXT 713 +%token REPLACING 735 +%token LITERAL 298 +%token SUPPRESS 376 + +%token LSUB 367 "(" +%token SUBSCRIPT 375 RSUB 372 ")" + +%token CDF_DEFINE 383 ">>DEFINE" +%token CDF_IF 385 ">>IF" +%token CDF_ELSE 386 ">>ELSE" +%token CDF_END_IF 387 ">>END-IF" +%token CDF_EVALUATE 388 ">>EVALUATE" +%token CDF_WHEN 389 ">>WHEN" +%token CDF_END_EVALUATE 390 ">>END-EVALUATE" + +%token AS 460 CONSTANT 361 DEFINED 363 %type <boolean> DEFINED -%token OTHER 688 PARAMETER_kw 366 "PARAMETER" -%token OFF 677 OVERRIDE 367 -%token THRU 929 -%token TRUE_kw 803 "True" +%token OTHER 690 PARAMETER_kw 368 "PARAMETER" +%token OFF 679 OVERRIDE 369 +%token THRU 931 +%token TRUE_kw 805 "True" -%token CALL_COBOL 389 "CALL" -%token CALL_VERBATIM 390 "CALL (as C)" +%token CALL_COBOL 391 "CALL" +%token CALL_VERBATIM 392 "CALL (as C)" -%token TURN 805 CHECKING 486 LOCATION 639 ON 679 WITH 831 +%token TURN 807 CHECKING 488 LOCATION 641 ON 681 WITH 833 -%left OR 930 -%left AND 931 -%right NOT 932 -%left '<' '>' '=' NE 933 LE 934 GE 935 +%left OR 932 +%left AND 933 +%right NOT 934 +%left '<' '>' '=' NE 935 LE 936 GE 937 %left '-' '+' %left '*' '/' -%right NEG 937 +%right NEG 939 %define api.prefix {ydf} %define api.token.prefix{YDF_} @@ -448,7 +448,6 @@ cdf_if: CDF_IF cdf_cond_expr { scanner_parsing(YDF_CDF_IF, $2); } | CDF_IF error { - ////if( scanner_parsing() ) yyerrok; } CDF_END_IF { // not pushed, don't pop if( ! scanner_parsing() ) YYACCEPT; } @@ -467,18 +466,17 @@ cdf_eval_obj: cdf_cond_expr ; cdf_cond_expr: BOOL - | NAME DEFINED[maybe] + | NAME DEFINED { auto p = dictionary.find($1); bool found = p != dictionary.end(); - if( !$maybe ) found = ! found; - if( ! found ) { - $$ = !$2; - dbgmsg("CDF: %s not found in dictionary (result %s)", + if( !$DEFINED ) found = ! found; + $$ = found; + if( found ) { + dbgmsg("CDF: %s found in dictionary (result %s)", $1, $$? "true" : "false"); } else { - $$ = $2; - dbgmsg("CDF: %s found in dictionary (result %s)", + dbgmsg("CDF: %s not found in dictionary (result %s)", $1, $$? "true" : "false"); } } diff --git a/gcc/cobol/dts.h b/gcc/cobol/dts.h index c345dc7..dfd7c4c 100644 --- a/gcc/cobol/dts.h +++ b/gcc/cobol/dts.h @@ -33,7 +33,8 @@ namespace dts { : input(input) , first(NULL), second(NULL), matched(false) { - static regmatch_t empty = { -1, -1 }; + static regmatch_t empty; + empty.rm_so = empty.rm_eo = -1; regmatch_t& self(*this); self = empty; } diff --git a/gcc/cobol/gcobc b/gcc/cobol/gcobc index 93e1bd302..1d469ed 100755 --- a/gcc/cobol/gcobc +++ b/gcc/cobol/gcobc @@ -142,6 +142,11 @@ do if [ "$pending_arg" ] then + case $pending_arg in + -o) output_name="$opt" # capture named output file + ;; + esac + opts="$opts $pending_arg $opt" pending_arg= continue @@ -392,7 +397,13 @@ do ;; # -main # -nomain - # -o + + -o) pending_arg=$opt + ;; + -o*) output_name=$opt ## non-empty means do not infer + opts="$opts $opt" + ;; + # -O0, -Ox -O | -O2 | -Os) warn "$opt" ;; @@ -432,7 +443,23 @@ do -x) mode= ;; - *) opts="$opts $opt" # pass through + -) output_name=a.out # nonnull to prevent overriding gcc default + opts="$opts /dev/stdin" + ;; + + *) if [ -z "$output_name" ] # first non-option argument is source file name + then + output_name=$(basename ${opt%.*}) + case $mode in + -c) output_name="$output_name".o + ;; + -shared) + output_name="$output_name".so + ;; + esac + opts="$opts -o $output_name" + fi + opts="$opts $opt" # pass through ;; esac done diff --git a/gcc/cobol/gcobol.1 b/gcc/cobol/gcobol.1 index 4377c14..0c3d2c1 100644 --- a/gcc/cobol/gcobol.1 +++ b/gcc/cobol/gcobol.1 @@ -97,8 +97,9 @@ Define a CDF name (for use with to have the value of .Ar expr . .It Fl E -Write the CDF-processed \*[lang] input to standard output in free-form -reference format. Certain non-\*[lang] markers are included in the +Write the CDF-processed \*[lang] input to standard output in +.Em "free-form reference format". +Certain non-\*[lang] markers are included in the output to indicate where copybook files were included. For line-number consistency with the input, blank lines are retained. .Pp @@ -147,13 +148,13 @@ and in that order. .It Fl ffixed-form Use strict -.Em "Reference Format" +.Em "fixed-form reference format" in reading the \*[lang] input: 72-character lines, with a 6-character sequence area, and an indicator column. Data past column 72 are ignored. .It Fl ffree-form Force the \*[lang] input to be interpreted as -.Em "free format" . +.Em "free-form reference format". Line breaks are insignificant, except that .Ql * at the start of a line acts as a comment marker. @@ -187,12 +188,23 @@ the entire program could appear on one line. .Pp By default, .Nm -auto-detects the source code format by examining the -.Em "sequence number area" -of the first line of the first file: if those characters are all -digits or blanks, the file is assumed to be in -.Em "reference format" , +auto-detects the source code format by examining the line that +contains the text "program-id". When there are characters on past column 72 +on that line, the file is assumed to be in +.Em "extended source format", with the indicator area in column 7. +Otherwise, columns 1-6 are examined. If those characters are all digits +or blanks, the file is assumed to be in +.Em "fixed-form reference format", +also with the indicator in column 7. + +If not auto-detected as +.Em "fixed-form reference format" +or +.Em "extended source format", +the file is assumed to be in +.Em "free-form reference format". + .Pp . .It Fl fcobol-exceptions Ar exception Op Ns , Ns Ar exception Ns ... @@ -1000,9 +1012,12 @@ to standard error as a warning message. may be one of: .Bl -tag -compact .It Sy FIXED -Source conforms to \*[lang] Reference Format with unlimited line length. +Source conforms to \*[lang] +.Em "fixed-form reference format" +with unlimited line length. .It Sy FREE -Line endings and indentation are ignored by the compiler, except that a +Source conforms to \*[lang] +.Em "free-form reference format". .Ql "*" at the beginning of a line is recognized as a comment. .El diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc index 204b1ae..70df86a 100644 --- a/gcc/cobol/genapi.cc +++ b/gcc/cobol/genapi.cc @@ -3564,7 +3564,6 @@ parser_enter_file(const char *filename) SET_VAR_DECL(var_decl_default_compute_error , INT , "__gg__default_compute_error"); SET_VAR_DECL(var_decl_rdigits , INT , "__gg__rdigits"); - SET_VAR_DECL(var_decl_odo_violation , INT , "__gg__odo_violation"); SET_VAR_DECL(var_decl_unique_prog_id , SIZE_T , "__gg__unique_prog_id"); SET_VAR_DECL(var_decl_entry_location , VOID_P , "__gg__entry_pointer"); @@ -5100,6 +5099,16 @@ parser_display_field(cbl_field_t *field) DISPLAY_NO_ADVANCE); } +/* + * The first parameter to parser_display is the "device" upon which to display + * the data. Besides normal devices, these may include elements that define the + * Unix command line and environment: + * 1. ARG_NUM_e, the ARGUMENT-NUMBER + * 2. ARG_VALUE_e, the ARGUMENT-VALUE + * 3. ENV_NAME_e, the ENVIRONMENT-NAME + * 4. ENV_VALUE_e, the ENVIRONMENT-VALUE + * that need special care and feeding. + */ void parser_display( const struct cbl_special_name_t *upon, struct cbl_refer_t refs[], diff --git a/gcc/cobol/genutil.cc b/gcc/cobol/genutil.cc index 94e57f4..3235c38 100644 --- a/gcc/cobol/genutil.cc +++ b/gcc/cobol/genutil.cc @@ -68,7 +68,6 @@ tree var_decl_exception_paragraph; // const char *__gg__exception_paragraph; tree var_decl_default_compute_error; // int __gg__default_compute_error; tree var_decl_rdigits; // int __gg__rdigits; -tree var_decl_odo_violation; // int __gg__odo_violation; tree var_decl_unique_prog_id; // size_t __gg__unique_prog_id; tree var_decl_entry_location; // This is for managing ENTRY statements @@ -107,6 +106,18 @@ tree var_decl_treeplet_4s; // SIZE_T_P , "__gg__treeplet_4s" tree var_decl_nop; // int __gg__nop; tree var_decl_main_called; // int __gg__main_called; +#if 0 +#define REFER +#else +#define REFER do \ + { \ + if( getenv("REFER") ) \ + { \ + fprintf(stderr, "REFER %s\n", __func__); \ + } \ + }while(0); +#endif + int get_scaled_rdigits(cbl_field_t *field) { @@ -231,8 +242,6 @@ get_integer_value(tree value, } - - Analyze(); // Call this routine when you know the result has to be an integer with no // rdigits. This routine became necessary the first time I saw an @@ -287,6 +296,11 @@ static tree get_data_offset(cbl_refer_t &refer, int *pflags = NULL) { + REFER; + if( getenv("REFER") ) + { + fprintf(stderr, " %s %s\n", refer.field->name, refer.field->data.initial); + } Analyze(); // This routine returns a tree which is the size_t offset to the data in the // refer/field @@ -351,6 +365,7 @@ get_data_offset(cbl_refer_t &refer, { // The subscript isn't an integer set_exception_code(ec_bound_subscript_e); + gg_assign(var_decl_rdigits, integer_zero_node); } ELSE { @@ -408,7 +423,7 @@ get_data_offset(cbl_refer_t &refer, get_integer_value(value64, depending_on); IF( subscript, ge_op, value64 ) { - gg_assign(var_decl_odo_violation, integer_one_node); + set_exception_code(ec_bound_odo_e); } ELSE ENDIF @@ -439,6 +454,7 @@ get_data_offset(cbl_refer_t &refer, { // refmod offset is not an integer, and has to be set_exception_code(ec_bound_ref_mod_e); + gg_assign(var_decl_rdigits, integer_zero_node); } ELSE ENDIF @@ -1139,17 +1155,9 @@ scale_by_power_of_ten_N(tree value, Analyzer.Message("takes int N"); if( N == 0 ) { - if( check_for_fractional ) - { - gg_assign(var_decl_rdigits, integer_zero_node); - } } else if( N > 0 ) { - if( check_for_fractional ) - { - gg_assign(var_decl_rdigits, integer_zero_node); - } tree value_type = TREE_TYPE(value); FIXED_WIDE_INT(128) power_of_ten = get_power_of_ten(N); gg_assign(value, gg_multiply(value, wide_int_to_tree( value_type, @@ -1169,7 +1177,6 @@ scale_by_power_of_ten_N(tree value, gg_assign(var_decl_rdigits, integer_one_node); } ELSE - gg_assign(var_decl_rdigits, integer_zero_node); ENDIF } gg_assign(value, gg_divide(value, wide_int_to_tree( value_type, @@ -1722,11 +1729,14 @@ get_literal_string(cbl_field_t *field) bool refer_is_clean(cbl_refer_t &refer) { - if( !refer.field ) + if( !refer.field || refer.field->type == FldLiteralN ) { // It is routine for a refer to have no field. It happens when the parser - // passes us a refer for an optional parameter that has been ommitted, for + // passes us a refer for an optional parameter that has been omitted, for // example. + + // It is also the case that a FldLiteralN will never have suscripts, or the + // like. return true; } @@ -1739,38 +1749,6 @@ refer_is_clean(cbl_refer_t &refer) ; } -void -REFER_CHECK(const char *func, - int line, - cbl_refer_t &refer - ) - { - static int counter=1; - - if( counter == 5 ) - { - fprintf(stderr, "DING! %d\n", counter); - } - - - fprintf(stderr, - "ct REFER_CHECK(%d): %s():%d %s\n", - counter, - func, - line, - refer.field->name); - - gg_printf("rt REFER_CHECK(%d): %s():%d %s (%s)\n", - build_int_cst_type(INT, counter), - gg_string_literal(func), - build_int_cst_type(INT, line), - gg_string_literal(refer.field->name), - gg_string_literal(cbl_field_type_str(refer.field->type)), - NULL_TREE); - counter+=1; - } - - /* This routine returns the length portion of a refmod(start:length) reference. It extracts both the start and the length so that it can add them together to make sure that result falls within refer.capacity. @@ -1779,6 +1757,7 @@ static tree // size_t refer_refmod_length(cbl_refer_t &refer) { + REFER; Analyze(); if( refer.refmod.from || refer.refmod.len ) { @@ -1797,6 +1776,7 @@ refer_refmod_length(cbl_refer_t &refer) { set_exception_code(ec_bound_ref_mod_e); gg_assign(refstart, gg_cast(LONG, integer_one_node)); + gg_assign(var_decl_rdigits, integer_zero_node); } ELSE ENDIF @@ -1835,6 +1815,7 @@ refer_refmod_length(cbl_refer_t &refer) // length is not an integer set_exception_code(ec_bound_ref_mod_e); gg_assign(reflen, gg_cast(LONG, integer_one_node)); + gg_assign(var_decl_rdigits, integer_zero_node); } ELSE { @@ -1898,6 +1879,7 @@ static tree // size_t refer_fill_depends(cbl_refer_t &refer) { + REFER; // This returns a positive number which is the amount a depends-limited // capacity needs to be reduced. Analyze(); @@ -1928,6 +1910,7 @@ refer_fill_depends(cbl_refer_t &refer) // This needs to evaluate to an integer set_exception_code(ec_bound_odo_e); gg_assign(value64, build_int_cst_type(TREE_TYPE(value64), odo->occurs.bounds.upper)); + gg_assign(var_decl_rdigits, integer_zero_node); } ELSE ENDIF @@ -1973,27 +1956,27 @@ tree // size_t refer_offset(cbl_refer_t &refer, int *pflags) { + // This routine calculates the effect of a refer offset on the + // refer.field->data location. When there are subscripts, the data location + // gets augmented by the (subscript-1)*element_size calculation. And when + // there is a refmod, the data location additionally gets augmented by + // (refmod.from-1) + + REFER; if( !refer.field ) { + // It's common for the field to be missing. It generally means that an + // optional parameter wasn't supplied. return size_t_zero_node; } - if( !refer.nsubscript ) - { - return get_data_offset(refer); - } - - Analyze(); - - tree retval = gg_define_variable(SIZE_T); - gg_assign(var_decl_odo_violation, integer_zero_node); - gg_assign(retval, get_data_offset(refer, pflags)); - IF( var_decl_odo_violation, ne_op, integer_zero_node ) + if( refer.field->type == FldLiteralN || refer.field->type == FldLiteralA ) { - set_exception_code(ec_bound_odo_e); + // We know that literals have no offset + return size_t_zero_node; } - ELSE - ENDIF + + tree retval = get_data_offset(refer, pflags); return retval; } @@ -2001,6 +1984,7 @@ static tree refer_size(cbl_refer_t &refer, refer_type_t refer_type) { + REFER; Analyze(); static tree retval = gg_define_variable(SIZE_T, "..rs_retval", vs_file_static); @@ -2042,12 +2026,14 @@ refer_size(cbl_refer_t &refer, refer_type_t refer_type) tree // size_t refer_size_dest(cbl_refer_t &refer) { + REFER; return refer_size(refer, refer_dest); } tree // size_t refer_size_source(cbl_refer_t &refer) { + REFER; /* There are oddities involved with refer_size_source and refer_size_dest. See the comments in refer_has_depends for some explanation. There are other considerations, as well. For example, consider a move, where you diff --git a/gcc/cobol/genutil.h b/gcc/cobol/genutil.h index c216dba..8244481 100644 --- a/gcc/cobol/genutil.h +++ b/gcc/cobol/genutil.h @@ -56,7 +56,6 @@ extern tree var_decl_exception_paragraph; // const char *__gg__exception_para extern tree var_decl_default_compute_error; // int __gg__default_compute_error; extern tree var_decl_rdigits; // int __gg__rdigits; -extern tree var_decl_odo_violation; // int __gg__odo_violation; extern tree var_decl_unique_prog_id; // size_t __gg__unique_prog_id; extern tree var_decl_entry_location; // This is for managing ENTRY statements @@ -121,7 +120,7 @@ void set_exception_code_func(ec_type_t ec, #define set_exception_code(ec) set_exception_code_func(ec, __LINE__) bool process_this_exception(ec_type_t ec); #define CHECK_FOR_FRACTIONAL_DIGITS true -void get_integer_value(tree value, +void get_integer_value(tree value, // This is always a LONG cbl_field_t *field, tree offset=NULL, // size_t bool check_for_fractional_digits=false); @@ -146,12 +145,6 @@ tree refer_offset(cbl_refer_t &refer, tree refer_size_source(cbl_refer_t &refer); tree refer_size_dest(cbl_refer_t &refer); -void REFER_CHECK( const char *func, - int line, - cbl_refer_t &refer - ); -#define refer_check(a) REFER_CHECK(__func__, __LINE__, a) - tree qualified_data_location(cbl_refer_t &refer); void build_array_of_treeplets( int ngroup, diff --git a/gcc/cobol/lexio.cc b/gcc/cobol/lexio.cc index a992166..2db1af2 100644 --- a/gcc/cobol/lexio.cc +++ b/gcc/cobol/lexio.cc @@ -46,8 +46,22 @@ static struct { first_file = false; return tf; } + inline bool is_fixed() const { return column == 7; } + inline bool is_reffmt() const { return is_fixed() && right_margin == 73; } + inline bool is_free() const { return ! is_fixed(); } + + const char * description() const { + if( is_reffmt() ) return "REFERENCE"; + if( is_fixed() ) return "FIXED"; + if( is_free() ) return "FREE"; + gcc_unreachable(); + } } indicator = { true, false, 0, 0 }; +// public source format test functions +bool is_fixed_format() { return indicator.is_fixed(); } +bool is_reference_format() { return indicator.is_reffmt(); } + static bool debug_mode = false; /* @@ -86,10 +100,6 @@ cobol_set_indicator_column( int column ) indicator.column = column; } -bool is_fixed_format() { return indicator.column == 7; } -bool is_reference_format() { - return indicator.column == 7 && indicator.right_margin == 73; -} bool include_debug() { return indicator.column == 7 && debug_mode; } bool set_debug( bool tf ) { return debug_mode = tf && is_fixed_format(); } @@ -348,13 +358,14 @@ check_source_format_directive( filespan_t& mfile ) { gcc_assert(cm[3].length() == 4 || cm[3].length() == 5); break; } - mfile.cur = const_cast<char*>(cm[0].second); + dbgmsg( "%s:%d: %s format set, on line " HOST_SIZE_T_PRINT_UNSIGNED, __func__, __LINE__, indicator.column == 7? "FIXED" : "FREE", (fmt_size_t)mfile.lineno() ); - erase_line(const_cast<char*>(cm[0].first), - const_cast<char*>(cm[0].second)); + char *bol = indicator.is_fixed()? mfile.cur : const_cast<char*>(cm[0].first); + erase_line(bol, const_cast<char*>(cm[0].second)); + mfile.cur = const_cast<char*>(cm[0].second); } } @@ -393,33 +404,22 @@ struct buffer_t : public bytespan_t { } }; -static bool -valid_sequence_area( const char *p, const char *eodata ) { - const char *pend = p + 6; - if ( eodata < pend ) return false; +static inline bool is_p( char ch ) { return TOUPPER(ch) == 'P'; } - for( ; p < pend; p++ ) { - if( ! (ISDIGIT(*p) || *p == SPACE) ) { - return false; +static bool +is_program_id( const char *p, const char *eol ) { + static const std::string program_id("PROGRAM-ID"); + auto eop = p + program_id.size(); + if( eop < eol ) { + // PROGRAM-ID must be followed by a dot, perhaps with intervening whitespace. + for( const char *dot=eop; dot < eol && *dot != '.'; dot++ ) { + if( !ISSPACE(*dot) ) return false; } + std::string line (p, eop); + std::transform(line.begin(), line.end(), line.begin(), ::toupper); + return line == program_id; } - return true; // characters either digits or blanks -} - -// Inspect the 2nd line for telltale signs of a NIST file. -// If true, caller sets right margin to 73, indicating Reference Format -static bool -likely_nist_file( const char *p, const char *eodata ) { - if( (p = std::find(p, eodata, '\n')) == eodata ) return false; - if ( eodata < ++p + 80 ) return false; - p += 72; - - return - ISALPHA(p[0]) && ISALPHA(p[1]) && - ISDIGIT(p[2]) && ISDIGIT(p[3]) && ISDIGIT(p[4]) && - p[5] == '4' && - p[6] == '.' && - p[7] == '2'; + return false; } const char * esc( size_t len, const char input[] ); @@ -1620,6 +1620,54 @@ cdftext::map_file( int fd ) { bool lexio_dialect_mf(); +/* + * A valid sequence area is 6 digits or blanks at the begining of the line that + * contains PROGRAM-ID. Return NULL if no valid sequence area, else return + * pointer to BOL. + */ +static const char * +valid_sequence_area( const char *data, const char *eodata ) { + + for( const char *p = data; + (p = std::find_if(p, eodata, is_p)) != eodata; + p++ ) + { + auto eol = std::find(p, eodata, '\n'); + if( p == data || ISSPACE(p[-1]) ) { + if( is_program_id(p, eol) ) { // found program-id token + const char *bol = p; + for( ; data <= bol-1 && bol[-1] != '\n'; --bol ) + ; + if( 6 < p - bol ) { + if( std::all_of(bol, bol+6, ::isdigit) ) { + return bol; + } + if( std::all_of(bol, bol+6, ::isblank) ) { + return bol; + } + break; + } + } + } + } + return nullptr; +} + +/* + * Reference Format -- valid COBOL between columns 8 and 72 -- has data after + * column 72 on the PROGRAM-ID line. Extended Reference Format (that allows + * longer lines) has no reason to follow the PROGRAM-ID with more stuff. + */ +static bool +infer_reference_format( const char *bol, const char *eodata ) { + assert(bol); + auto eol = std::find(bol, eodata, '\n'); + if( 72 < eol - bol ) { + return ! std::all_of(bol + 72, eol, ::isspace); + } + return false; +} + filespan_t cdftext::free_form_reference_format( int input ) { filespan_t source_buffer = map_file(input); @@ -1638,27 +1686,19 @@ cdftext::free_form_reference_format( int input ) { } current( mfile.data ); /* - * If the format is not explicitly set on the command line, test the - * first 6 bytes of the first file to determine the format - * heuristically. If the first 6 characters are only digits or - * blanks, then the file is in fixed format. + * Infer source code format. */ - if( indicator.inference_pending() ) { - const char *p = mfile.data; - while( p < mfile.eodata ) { - const char * pend = - std::find(p, const_cast<const char *>(mfile.eodata), '\n'); - if( 6 < pend - p ) break; - p = pend; - if( p < mfile.eodata) p++; + const char *bol = valid_sequence_area(mfile.data, mfile.eodata); + if( bol ) { + indicator.column = 7; + if( infer_reference_format(bol, mfile.eodata) ) { + indicator.right_margin = 73; + } } - if( valid_sequence_area(p, mfile.eodata) ) indicator.column = 7; - if( likely_nist_file(p, mfile.eodata) ) indicator.right_margin = 73; - dbgmsg("%s:%d: %s%s format detected", __func__, __LINE__, - indicator.column == 7? "FIXED" : "FREE", - indicator.right_margin == 73? "" : "-extended"); + dbgmsg("%s:%d: %s format detected", __func__, __LINE__, + indicator.description()); } while( mfile.next_line() ) { diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y index c6b40fa..cecdd22 100644 --- a/gcc/cobol/parse.y +++ b/gcc/cobol/parse.y @@ -332,7 +332,7 @@ NUMED "NUMERIC-EDITED picture" NUMED_CR "NUMERIC-EDITED CR picture" NUMED_DB "NUMERIC-EDITED DB picture" -%token <number> NINEDOT NINES NINEV PIC_P +%token <number> NINEDOT NINES NINEV PIC_P ONES %token <string> SPACES %token <literal> LITERAL %token <number> END EOP @@ -341,7 +341,7 @@ %token <number> NUMBER NEGATIVE %token <numstr> NUMSTR "numeric literal" %token <number> OVERFLOW_kw "OVERFLOW" -%token <computational> COMPUTATIONAL +%token <computational> BINARY_INTEGER COMPUTATIONAL %token <boolean> PERFORM BACKWARD %token <number> POSITIVE @@ -573,12 +573,12 @@ THAN TIME TIMES TO TOP TOP_LEVEL - TRACKS TRACK_AREA TRAILING TRANSFORM TRIM TRUE_kw "True" TRY - TURN TYPE TYPEDEF + TRACKS TRACK_AREA TRAILING TRANSFORM TRIM TRUE_kw "True" + TRY TURN TYPE TYPEDEF - ULENGTH UNBOUNDED UNIT UNITS UNIT_RECORD UNTIL UP UPON - UPOS UPPER_CASE USAGE USING USUBSTR USUPPLEMENTARY - UTILITY UUID4 UVALID UWIDTH + ULENGTH UNBOUNDED UNIT UNITS UNIT_RECORD UNTIL + UP UPON UPOS UPPER_CASE USAGE USING + USUBSTR USUPPLEMENTARY UTILITY UUID4 UVALID UWIDTH VALUE VARIANCE VARYING VOLATILE @@ -659,7 +659,7 @@ %type <number> star_cbl_opt close_how %type <number> test_before usage_clause1 might_be -%type <boolean> all optional sign_leading on_off initialized strong +%type <boolean> all optional sign_leading on_off initialized strong is_signed %type <number> count data_clauses data_clause %type <number> nine nines nps relop spaces_etc reserved_value signed %type <number> variable_type @@ -801,7 +801,7 @@ %type <switches> upsi_entry -%type <special> acceptable disp_target +%type <special> acceptable disp_upon %type <display> disp_body %type <false_domain> domains domain @@ -2508,23 +2508,14 @@ dev_mnemonic: device_name is NAME } | NAME[device] is NAME[name] { - static const std::map< std::string, special_name_t > fujitsus - { // Fujitsu calls these "function names", not device names - { "ARGUMENT-NUMBER", ARG_NUM_e }, - { "ARGUMENT-VALUE", ARG_VALUE_e } , - { "ENVIRONMENT-NAME", ENV_NAME_e }, - { "ENVIRONMENT-VALUE", ENV_VALUE_e }, - }; - std::string device($device); - std::transform($device, $device + strlen($device), - device.begin(), toupper); - auto p = fujitsus.find(device.c_str()); - if( p == fujitsus.end() ) { + auto p = cmd_or_env_special_of($device); + if( !p ) { error_msg(@device, "%s is not a device name"); + YYERROR; } - cbl_special_name_t special = { 0, p->second }; - if( !namcpy(@name, special.name, $name) ) YYERROR; + cbl_special_name_t special = { 0, *p }; + namcpy(@name, special.name, $name); symbol_special_add(PROGRAM, &special); } @@ -3286,7 +3277,7 @@ index_field1: ctx_name[name] field.data = data; if( !namcpy(@name, field.name, $name) ) YYERROR; - auto symbol = symbol_field(PROGRAM, 0, $name); + auto symbol = symbol_field(PROGRAM, field.parent, $name); if( symbol ) { auto field( cbl_field_of(symbol) ); error_msg(@name, "'%s' already defined on line %d", @@ -4104,7 +4095,13 @@ picture_clause: PIC signed nps[fore] nines nps[aft] gcc_unreachable(); } } + | PIC ones ; +ones: ONES + { + cbl_unimplemented("Boolean type not implemented"); + } + ; alphanum_pic: alphanum_part { current_field()->set_attr($1.attr); @@ -4213,8 +4210,99 @@ usage_clause: usage_clause1[type] } } ; -usage_clause1: usage COMPUTATIONAL[comp] native +usage_clause1: usage BIT + { + cbl_unimplemented("Boolean type not implemented"); + } +| usage BINARY_INTEGER [comp] is_signed { + // action for BINARY_INTEGER is repeated for COMPUTATIONAL, below. + // If it changes, consolidate in a function. + bool infer = true; + cbl_field_t *field = current_field(); + + if( ! $is_signed ) { + $comp.signable = false; + } + + // Some binary types have defined capacity; + switch($comp.type) { + // COMPUTATIONAL and COMP-5 rely on PICTURE. + case FldNumericBinary: + field->attr |= big_endian_e; + __attribute__((fallthrough)); + case FldNumericBin5: + // If no capacity yet, then no picture, infer $comp.capacity. + // If field has capacity, ensure USAGE is compatible. + if( field->data.capacity > 0 ) { // PICTURE before USAGE + infer = false; + switch( field->type ) { + case FldAlphanumeric: // PIC X COMP-5 or COMP-X + assert( field->data.digits == 0 ); + assert( field->data.rdigits == 0 ); + if( dialect_mf() ) { + field->type = $comp.type; + field->clear_attr(signable_e); + } else { + error_msg(@comp, "numeric USAGE invalid " + "with Alpnanumeric PICTURE"); + dialect_error(@1, "Alpnanumeric COMP-5 or COMP-X", "mf"); + YYERROR; + } + break; + case FldNumericDisplay: // PIC 9 COMP-5 or COMP-X + if( $comp.capacity == 0xFF ) { // comp-x is a bit like comp-5 + assert( field->data.digits == field->data.capacity ); + if( ! dialect_mf() ) { + dialect_error(@1, "COMP-X", "mf"); + } + } + field->type = $comp.type; + field->data.capacity = type_capacity(field->type, + field->data.digits); + break; + default: break; + } + } + break; + case FldPacked: // comp-6 is unsigned comp-3 + assert(! $comp.signable); // else PACKED_DECIMAL from scanner + field->attr |= separate_e; + if( ! dialect_mf() ) { + dialect_error(@1, "COMP-6", "mf"); + } + if( field->type == FldNumericDisplay ) {// PICTURE before USAGE + infer = false; + assert(field->data.capacity > 0); + field->type = $comp.type; + field->data.capacity = type_capacity(field->type, + field->data.digits); + } + break; + default: + break; + } + + if( infer ) { + if( $comp.capacity > 0 ) { + if( field->data.capacity > 0 ) { + error_msg(@comp, "%s is BINARY type, incompatible with PICTURE", + field->name); + YYERROR; + } + field->data.capacity = $comp.capacity; + field->type = $comp.type; + if( $comp.signable ) { + field->attr = (field->attr | signable_e); + } + } + } + $$ = $comp.type; + } + | usage COMPUTATIONAL[comp] native + { + // logic below duplicates BINARY_INTEGER, above. + // If it changes, consolidate in a function. bool infer = true; cbl_field_t *field = current_field(); @@ -4238,7 +4326,8 @@ usage_clause1: usage COMPUTATIONAL[comp] native field->clear_attr(signable_e); } else { error_msg(@comp, "numeric USAGE invalid " - "with Alpnanumeric PICTURE"); + "with Alpnanumeric PICTURE"); + dialect_error(@1, "Alpnanumeric COMP-5 or COMP-X", "mf"); YYERROR; } break; @@ -5429,7 +5518,7 @@ disp_body: disp_vargs[vargs] $$.special = NULL; $$.vargs = $vargs; } - | disp_vargs[vargs] UPON disp_target[special] + | disp_vargs[vargs] UPON disp_upon[special] { $$.special = $special; $$.vargs = $vargs; @@ -5441,17 +5530,25 @@ disp_vargs: DISPLAY vargs { } ; -disp_target: device_name { +disp_upon: device_name { $$ = symbol_special($1.id); } | NAME { - symbol_elem_t *e = symbol_special(PROGRAM, $1); + symbol_elem_t *e = symbol_special(PROGRAM, $NAME); if( !e ) { - error_msg(@NAME, "no such special name '%s'", $NAME); - YYERROR; - } - $$ = cbl_special_name_of(e); + const special_name_t *special_type = cmd_or_env_special_of($NAME); + if( !special_type ) { + error_msg(@NAME, "no such special name '%s'", $NAME); + YYERROR; + } + // Add the name now, as a convenience. + cbl_special_name_t special = { 0, *special_type }; + namcpy(@NAME, special.name, $NAME); + + e = symbol_special_add(PROGRAM, &special); + } + $$ = cbl_special_name_of(e); } ; @@ -8961,6 +9058,19 @@ inspect: INSPECT backward inspected TALLYING tallies error_msg(@all, "ALL must be part of a figurative constant"); YYERROR; } + } else { + cbl_field_t *match = $match->field, + *replace = $replace_oper->field; + if( is_literal(match) && is_literal(replace) ) { + if( !$match->all && !$replace_oper->all) { + if( match->data.capacity != replace->data.capacity ) { + error_msg(@match, "'%s', size %u NOT EQUAL '%s', size %u", + nice_name_of(match), match->data.capacity, + nice_name_of(replace), replace->data.capacity); + YYERROR; + } + } + } } if( is_constant($inspected->field) ) { auto name = nice_name_of($inspected->field); @@ -10918,6 +11028,11 @@ sign: %empty | SIGN ; +is_signed: %empty { $$ = true; } + | SIGNED_kw { $$ = true; } + | UNSIGNED_kw { $$ = false; } + ; + start_after: %empty %prec AFTER | START AFTER varg ; @@ -11245,7 +11360,7 @@ tokenset_t::tokenset_t() { #include "token_names.h" } -bool iso_cobol_word( const std::string& name, bool include_intrinsics ); +bool iso_cobol_word( const std::string& name, bool include_context ); // Look up the lowercase form of a keyword, excluding some CDF names. int @@ -11276,8 +11391,13 @@ tokenset_t::find( const cbl_name_t name, bool include_intrinsics ) { } } - //// if( ! iso_cobol_word(uppercase(name), include_intrinsics) ) return 0; - + /* + * The input name may be one of: + * 1. an intrinsic function name (OK if include_intrinsics) + * 2. an ISO/GCC reserved word or context-sensitive word (OK) + * 3. a token in our token list for convenience, such as BINARY_INTEGER (bzzt) + */ + cbl_name_t lname; std::transform(name, name + strlen(name) + 1, lname, ftolower); auto p = tokens.find(lname); @@ -11286,9 +11406,10 @@ tokenset_t::find( const cbl_name_t name, bool include_intrinsics ) { if( token == SECTION ) yylval.number = 0; - if( include_intrinsics ) return token; - - return intrinsic_cname(token)? 0 : token; + if( include_intrinsics && intrinsic_cname(token) ) return token; + if( iso_cobol_word(uppercase(name), true) ) return token; + + return 0; } int diff --git a/gcc/cobol/parse_ante.h b/gcc/cobol/parse_ante.h index f3a002a..0369f7b 100644 --- a/gcc/cobol/parse_ante.h +++ b/gcc/cobol/parse_ante.h @@ -928,10 +928,11 @@ teed_up_names() { } class tokenset_t { - std::vector<const char *>token_names; - std::map <std::string, int> tokens; - std::set<std::string> cobol_words; - + // token_names is initialized from a generated header file. + std::vector<const char *>token_names; // position indicates token value + std::map <std::string, int> tokens; // aliases + std::set<std::string> cobol_words; // Anything in COBOL-WORDS may appear only once. + public: static std::string lowercase( const cbl_name_t name ) { cbl_name_t lname; @@ -949,40 +950,56 @@ class tokenset_t { tokenset_t(); int find( const cbl_name_t name, bool include_intrinsics ); - bool equate( const YYLTYPE& loc, int token, const cbl_name_t name ) { + bool equate( const YYLTYPE& loc, int token, + const cbl_name_t name, const cbl_name_t verb = "EQUATE") { auto lname( lowercase(name) ); auto cw = cobol_words.insert(lname); if( ! cw.second ) { - error_msg(loc, "COBOL-WORDS EQUATE: %s may appear but once", name); + error_msg(loc, "COBOL-WORDS %s: %s may appear but once", verb, name); return false; } auto p = tokens.find(lowercase(name)); bool fOK = p == tokens.end(); if( fOK ) { // name not already in use tokens[lname] = token; + dbgmsg("%s:%d: %d has alias %s", __func__, __LINE__, token, name); } else { - error_msg(loc, "EQUATE: %s already defined as a token", name); + error_msg(loc, "%s: %s already defined as a token", verb, name); } return fOK; } - bool undefine( const YYLTYPE& loc, const cbl_name_t name ) { + bool undefine( const YYLTYPE& loc, + const cbl_name_t name, const cbl_name_t verb = "UNDEFINE" ) { auto lname( lowercase(name) ); auto cw = cobol_words.insert(lname); if( ! cw.second ) { - error_msg(loc, "COBOL-WORDS UNDEFINE: %s may appear but once", name); + error_msg(loc, "COBOL-WORDS %s: %s may appear but once", verb, name); return false; } + + // Do not erase generic, multi-type tokens COMPUTATIONAL and BINARY_INTEGER. + if( binary_integer_usage_of(name) ) { + dbgmsg("%s:%d: generic %s remains valid as a token", __func__, __LINE__, name); + return true; + } + auto p = tokens.find(lname); bool fOK = p != tokens.end(); if( fOK ) { // name in use tokens.erase(p); } else { - error_msg(loc, "UNDEFINE: %s not defined as a token", name); + error_msg(loc, "%s: %s not defined as a token", verb, name); } + dbgmsg("%s:%d: %s removed as a valid token name", __func__, __LINE__, name); return fOK; } - bool substitute( const YYLTYPE& loc, const cbl_name_t extant, int token, const cbl_name_t name ) { - return equate( loc, token, name ) && undefine( loc, extant ); + + bool substitute( const YYLTYPE& loc, + const cbl_name_t extant, int token, const cbl_name_t name ) { + return + equate( loc, token, name, "SUBSTITUTE" ) + && + undefine( loc, extant, "SUBSTITUTE" ); } bool reserve( const YYLTYPE& loc, const cbl_name_t name ) { auto lname( lowercase(name) ); @@ -1018,24 +1035,42 @@ class current_tokens_t { int find( const cbl_name_t name, bool include_intrinsics ) { return tokens.find(name, include_intrinsics); } - bool equate( const YYLTYPE& loc, cbl_name_t keyword, const cbl_name_t name ) { - int token = keyword_tok(keyword); - if( 0 == token ) { - error_msg(loc, "EQUATE %s: not a valid token", keyword); - return false; + bool equate( const YYLTYPE& loc, cbl_name_t keyword, const cbl_name_t alias ) { + int token; + if( 0 == (token = binary_integer_usage_of(keyword)) ) { + if( 0 == (token = keyword_tok(keyword)) ) { + error_msg(loc, "EQUATE %s: not a valid token", keyword); + return false; + } } - return tokens.equate(loc, token, name); + auto name = keyword_alias_add(tokens.uppercase(keyword), + tokens.uppercase(alias)); + if( name != keyword ) { + error_msg(loc, "EQUATE: %s is already an alias for %s", alias, name.c_str()); + return false; + } + return tokens.equate(loc, token, alias); } bool undefine( const YYLTYPE& loc, cbl_name_t keyword ) { return tokens.undefine(loc, keyword); } - bool substitute( const YYLTYPE& loc, cbl_name_t keyword, const cbl_name_t name ) { - int token = keyword_tok(keyword); - if( 0 == token ) { - error_msg(loc, "SUBSTITUTE %s: not a valid token", keyword); - return false; + bool substitute( const YYLTYPE& loc, cbl_name_t keyword, const cbl_name_t alias ) { + int token; + if( 0 == (token = binary_integer_usage_of(keyword)) ) { + if( 0 == (token = keyword_tok(keyword)) ) { + error_msg(loc, "SUBSTITUTE %s: not a valid token", keyword); + return false; + } } - return tokens.substitute(loc, keyword, token, name); + auto name = keyword_alias_add(tokens.uppercase(keyword), + tokens.uppercase(alias)); + if( name != keyword ) { + error_msg(loc, "SUBSTITUTE: %s is already an alias for %s", alias, name.c_str()); + return false; + } + + dbgmsg("%s:%d: %s (%d) will have alias %s", __func__, __LINE__, keyword, token, alias); + return tokens.substitute(loc, keyword, token, alias); } bool reserve( const YYLTYPE& loc, const cbl_name_t name ) { return tokens.reserve(loc, name); @@ -3118,6 +3153,21 @@ special_of( const char F[], int L, const char name[] ) { } #define special_of( F ) special_of(__func__, __LINE__, (F)) +static const special_name_t * +cmd_or_env_special_of( std::string name ) { + static const std::map< std::string, special_name_t > fujitsus + { // Fujitsu calls these "function names", not device names + { "ARGUMENT-NUMBER", ARG_NUM_e }, + { "ARGUMENT-VALUE", ARG_VALUE_e } , + { "ENVIRONMENT-NAME", ENV_NAME_e }, + { "ENVIRONMENT-VALUE", ENV_VALUE_e }, + }; + + std::transform(name.begin(), name.end(), name.begin(), ::toupper); + auto p = fujitsus.find(name.c_str()); + return p != fujitsus.end()? &p->second : nullptr; +} + static inline void parser_add2( struct cbl_num_result_t& to, struct cbl_refer_t from ) { diff --git a/gcc/cobol/scan.l b/gcc/cobol/scan.l index f2a0bbe..dfc0c30 100644 --- a/gcc/cobol/scan.l +++ b/gcc/cobol/scan.l @@ -98,7 +98,6 @@ NP P+|(P{COUNT}) UNSIGNED [[:space:]]+UNSIGNED SIGNED [[:space:]]+SIGNED -DBLLONG (LONG-LONG|DOUBLE) ALNUM [AX9]+ @@ -976,20 +975,19 @@ USE({SPC}FOR)? { return USE; } COMP(UTATIONAL)? { return ucomputable(FldNumericBinary, 0); } BINARY { return scomputable(FldNumericBinary, 0); } - BINARY-CHAR{SIGNED} { return scomputable(FldNumericBin5, 1); } - BINARY-CHAR{UNSIGNED} { return ucomputable(FldNumericBin5, 1); } - BINARY-CHAR { return scomputable(FldNumericBin5, 1); } - BINARY-SHORT{SIGNED} { return scomputable(FldNumericBin5, 2); } - BINARY-SHORT{UNSIGNED} { return ucomputable(FldNumericBin5, 2); } - BINARY-SHORT { return scomputable(FldNumericBin5, 2); } - BINARY-LONG{SIGNED} { return scomputable(FldNumericBin5, 4); } - BINARY-LONG{UNSIGNED} { return ucomputable(FldNumericBin5, 4); } - BINARY-LONG { return scomputable(FldNumericBin5, 4); } - BINARY-{DBLLONG}{SIGNED} { return scomputable(FldNumericBin5, 8); } - BINARY-{DBLLONG}{UNSIGNED} { return ucomputable(FldNumericBin5, 8); } - BINARY-{DBLLONG} { return scomputable(FldNumericBin5, 8); } + BINARY-CHAR { return bcomputable(FldNumericBin5, 1); } + BINARY-SHORT { return bcomputable(FldNumericBin5, 2); } + BINARY-LONG { return bcomputable(FldNumericBin5, 4); } + BINARY-DOUBLE { return bcomputable(FldNumericBin5, 8); } + BINARY-LONG-LONG { if( ! dialect_mf() ) { + error_msg(yylloc, "%s requires -dialect mf", yytext); + } + return bcomputable(FldNumericBin5, 8); + } + BIT { not_implemented("USAGE type: BIT"); return BIT; } + FLOAT-BINARY-32 { return ucomputable(FldFloat, 4); } FLOAT-BINARY-64 { return ucomputable(FldFloat, 8); } FLOAT-BINARY-128 { return ucomputable(FldFloat, 16); } @@ -1003,6 +1001,9 @@ USE({SPC}FOR)? { return USE; } FLOAT-LONG { return ucomputable(FldFloat, 8); } FLOAT-SHORT { return ucomputable(FldFloat, 4); } + SIGNED { return SIGNED_kw; } + UNSIGNED { return UNSIGNED_kw; } + INDEX { return INDEX; } MESSAGE-TAG { not_implemented("USAGE type: MESSAGE-TAG"); } NATIONAL { not_implemented("USAGE type: NATIONAL"); @@ -1117,10 +1118,14 @@ USE({SPC}FOR)? { return USE; } FD/[[:blank:]]+ { parsing.need_level(false); return FD; } SD/[[:blank:]]+ { parsing.need_level(false); return SD; } - {NAME} { // NAME here is never a token name + {NAME} { // NAME here might be a token alias + int token; + if( 0 != (token = binary_integer_usage(yytext)) ) { + return token; + } if( is_integer_token() ) return numstr_of(yytext); ydflval.string = yylval.string = xstrdup(yytext); - auto token = typed_name(yytext); + token = typed_name(yytext); return token == NAME88? NAME : token; } @@ -1204,6 +1209,11 @@ USE({SPC}FOR)? { return USE; } {N9}/{N9}*[,.]? { yylval.number = ndigit(yyleng); return picset(NINES); } P+/[,.]?\r?\n { yylval.number = yyleng; return picset(PIC_P); } + 1{1,31}/({COUNT}|[(]{NAME}[)]) { + yy_push_state(picture_count); + yylval.string = xstrdup(yytext); return picset(ONES); } + 1{1,31} { yylval.string = xstrdup(yytext); return picset(ONES); } + {ALNUM}/{COUNT}({ALNUM}{COUNT}?)+ { yy_push_state(picture_count); yylval.string = xstrdup(yytext); return picset(ALNUM); } @@ -1613,15 +1623,17 @@ USE({SPC}FOR)? { return USE; } *--p = '\0'; } - int token = keyword_tok(yylval.string); - if( token ) return token; + int token; + if( 0 != (token = binary_integer_usage(yylval.string)) )return token; + if( 0 != (token = keyword_tok(yylval.string)) ) return token; if( is_integer_token() ) return numstr_of(yylval.string); return typed_name(yylval.string); } {NAME}/{OSPC}{DOTSEP} { assert(YY_START == procedure_div); - int token = keyword_tok(yytext); - if( token ) return token; + int token; + if( 0 != (token = binary_integer_usage(yytext)) ) return token; + if( 0 != (token = keyword_tok(yytext)) ) return token; if( is_integer_token() ) return numstr_of(yytext); ydflval.string = yylval.string = xstrdup(yytext); @@ -2468,6 +2480,7 @@ BASIS { yy_push_state(basis); return BASIS; } if( YY_START == quoted1 || YY_START == quoted2 ) { error_msg(yylloc, "syntax error: unterminated string '%s'", tmpstring); + return NO_CONDITION; cbl_internal_error(""); } yypop_buffer_state(); diff --git a/gcc/cobol/scan_ante.h b/gcc/cobol/scan_ante.h index 784c9b0..c8c93ed 100644 --- a/gcc/cobol/scan_ante.h +++ b/gcc/cobol/scan_ante.h @@ -498,6 +498,10 @@ update_location_col( const char str[], int correction = 0) { result = YY_NULL; \ } +#define bcomputable(T, C) \ + yylval.computational.type=T, \ + yylval.computational.capacity=C, \ + yylval.computational.signable=true, BINARY_INTEGER #define scomputable(T, C) \ yylval.computational.type=T, \ yylval.computational.capacity=C, \ @@ -511,6 +515,99 @@ static char *tmpstring = NULL; #define PROGRAM current_program_index() +// map of alias => canonical +static std::map <std::string, std::string> keyword_aliases; + +const std::string& +keyword_alias_add( const std::string& keyword, const std::string& alias ) { + auto p = keyword_aliases.find(alias); + if( p != keyword_aliases.end() ) return p->second; // error: do not overwrite + return keyword_aliases[alias] = keyword; +} + +/* + * Because numeric USAGE types don't have distinct tokens and may have aliases, + * we keep a table of their canonical names, which we use if we encounter an + * alias. + */ +struct bint_t { + int token; + cbl_field_type_t type; + uint32_t capacity; + bool signable; +}; +static const std::map <std::string, bint_t > binary_integers { + { "COMP-X", { COMPUTATIONAL, FldNumericBin5, 0xFF, false } }, + { "COMP-6", { COMPUTATIONAL, FldPacked, 0, false } }, + { "COMP-5", { COMPUTATIONAL, FldNumericBin5, 0, false } }, + { "COMP-4", { COMPUTATIONAL, FldNumericBinary, 0, true } }, + { "COMP-2", { COMPUTATIONAL, FldFloat, 8, false } }, + { "COMP-1", { COMPUTATIONAL, FldFloat, 4, false } }, + { "COMP", { COMPUTATIONAL, FldNumericBinary, 0, false } }, + { "COMPUTATIONAL-X", { COMPUTATIONAL, FldNumericBin5, 0xFF, false } }, + { "COMPUTATIONAL-6", { COMPUTATIONAL, FldPacked, 0, false } }, + { "COMPUTATIONAL-5", { COMPUTATIONAL, FldNumericBin5, 0, false } }, + { "COMPUTATIONAL-4", { COMPUTATIONAL, FldNumericBinary, 0, true } }, + { "COMPUTATIONAL-2", { COMPUTATIONAL, FldFloat, 8, false } }, + { "COMPUTATIONAL-1", { COMPUTATIONAL, FldFloat, 4, false } }, + { "COMPUTATIONAL", { COMPUTATIONAL, FldNumericBinary, 0, false } }, + { "BINARY", { BINARY_INTEGER, FldNumericBinary, 0, true } }, + { "BINARY-CHAR", { BINARY_INTEGER, FldNumericBin5, 1, true } }, + { "BINARY-SHORT", { BINARY_INTEGER, FldNumericBin5, 2, true } }, + { "BINARY-LONG", { BINARY_INTEGER, FldNumericBin5, 4, true } }, + { "BINARY-DOUBLE", { BINARY_INTEGER, FldNumericBin5, 8, true } }, + { "BINARY-LONG-LONG", { BINARY_INTEGER, FldNumericBin5, 8, true } }, + { "FLOAT-BINARY-32", { COMPUTATIONAL, FldFloat, 4, false } }, + { "FLOAT-BINARY-64", { COMPUTATIONAL, FldFloat, 8, false } }, + { "FLOAT-BINARY-128", { COMPUTATIONAL, FldFloat, 16, false } }, + { "FLOAT-EXTENDED", { COMPUTATIONAL, FldFloat, 16, false } }, + { "FLOAT-LONG", { COMPUTATIONAL, FldFloat, 8, false } }, + { "FLOAT-SHORT", { COMPUTATIONAL, FldFloat, 4, false } }, +}; + +static int +binary_integer_usage( const char name[]) { + cbl_name_t uname = {}; + std::transform(name, name + strlen(name), uname, ftoupper); + + dbgmsg("%s:%d: checking %s in %zu keyword_aliases", + __func__, __LINE__, uname, keyword_aliases.size() ); + + std::string key = uname; + auto alias = keyword_aliases.find(key); + if( alias != keyword_aliases.end() ) key = alias->second; + + auto p = binary_integers.find(key); + if( p == binary_integers.end() ) return 0; + + yylval.computational.type = p->second.type; + yylval.computational.capacity = p->second.capacity; + yylval.computational.signable = p->second.signable; + dbgmsg("%s:%d: %s has type %d", __func__, __LINE__, + uname, p->second.type ); + return p->second.token; +} + +int +binary_integer_usage_of( const char name[] ) { + cbl_name_t uname = {}; + std::transform(name, name + strlen(name), uname, ftoupper); + + auto p = binary_integers.find(uname); + if( p != binary_integers.end() ) { + int token = p->second.token; + switch( token ) { + case COMPUTATIONAL: + case BINARY_INTEGER: + return token; + default: + gcc_unreachable(); + assert(false); + } + } + return 0; +} + static uint32_t level_of( const char input[] ) { unsigned int output = 0; diff --git a/gcc/cobol/scan_post.h b/gcc/cobol/scan_post.h index dabb168..85feac8 100644 --- a/gcc/cobol/scan_post.h +++ b/gcc/cobol/scan_post.h @@ -33,13 +33,15 @@ start_condition_str( int sc ) { const char *state = "???"; switch(sc) { case INITIAL: state = "INITIAL"; break; + case addr_of: state = "addr_of"; break; case author_state: state = "author_state"; break; case basis: state = "basis"; break; case bool_state: state = "bool_state"; break; case cdf_state: state = "cdf_state"; break; case classify: state = "classify"; break; - case copy_state: state = "copy_state"; break; + case cobol_words: state = "cobol_words"; break; case comment_entries: state = "comment_entries"; break; + case copy_state: state = "copy_state"; break; case date_state: state = "date_state"; break; case datetime_fmt: state = "datetime_fmt"; break; case dot_state: state = "dot_state"; break; @@ -62,8 +64,8 @@ start_condition_str( int sc ) { case quoted2: state = "quoted2"; break; case quoteq: state = "quoteq"; break; case raising: state = "raising"; break; - case subscripts: state = "subscripts"; break; case sort_state: state = "sort_state"; break; + case subscripts: state = "subscripts"; break; } return state; } diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc index 13e78ee..1d0acf90 100644 --- a/gcc/cobol/symbols.cc +++ b/gcc/cobol/symbols.cc @@ -2294,7 +2294,7 @@ symbol_table_init(void) { "FILLER", 0, {}, {1,1,0,0, " "}, NULL }, { 0, FldAlphanumeric, FldInvalid, signable_e | global_e, 0,0,2, nonarray, 0, "DEBUG-CONTENTS", 0, {}, {76,76,0,0, NULL}, NULL }, -}; + }; // debug registers assert(table.nelem + COUNT_OF(debug_registers) < table.capacity); diff --git a/gcc/cobol/symbols.h b/gcc/cobol/symbols.h index adfa8d9..e272907 100644 --- a/gcc/cobol/symbols.h +++ b/gcc/cobol/symbols.h @@ -46,6 +46,11 @@ #include <string> #include <vector> +// Provide fallback definition. +#ifndef NAME_MAX +#define NAME_MAX 255 +#endif + #define PICTURE_MAX 64 extern const char *numed_message; @@ -343,9 +348,7 @@ struct cbl_field_data_t { cbl_field_data_t& valify() { assert(initial); - const size_t len = strlen(initial); - std::string input(len + 1, '\0'); // add a NUL - std::copy(initial, initial + len, input.begin()); + std::string input(initial); if( decimal_is_comma() ) { std::replace(input.begin(), input.end(), ',', '.'); } @@ -2206,6 +2209,10 @@ class name_queue_t : private std::queue<cbl_namelocs_t> }; +const std::string& keyword_alias_add( const std::string& keyword, + const std::string& alias ); +int binary_integer_usage_of( const char name[] ); + void tee_up_empty(); void tee_up_name( const YYLTYPE& loc, const char name[] ); cbl_namelist_t teed_up_names(); diff --git a/gcc/cobol/token_names.h b/gcc/cobol/token_names.h index d1e3b5d..682d68d 100644 --- a/gcc/cobol/token_names.h +++ b/gcc/cobol/token_names.h @@ -1,1373 +1,1377 @@ // generated by ./token_names.h.gen ../../build/gcc/cobol/parse.h -// Fri Mar 21 10:13:54 CET 2025 +// Thu May 8 18:53:33 EDT 2025 tokens = { - { "identification", IDENTIFICATION_DIV }, // 258 - { "environment", ENVIRONMENT_DIV }, // 259 - { "procedure", PROCEDURE_DIV }, // 260 - { "data", DATA_DIV }, // 261 - { "file", FILE_SECT }, // 262 - { "input-output", INPUT_OUTPUT_SECT }, // 263 - { "linkage", LINKAGE_SECT }, // 264 - { "local-storage", LOCAL_STORAGE_SECT }, // 265 - { "working-storage", WORKING_STORAGE_SECT }, // 266 - { "object-computer", OBJECT_COMPUTER }, // 267 - { "display-of", DISPLAY_OF }, // 268 - { "end-function", END_FUNCTION }, // 269 - { "end-program", END_PROGRAM }, // 270 - { "end-subprogram", END_SUBPROGRAM }, // 271 - { "justified", JUSTIFIED }, // 272 - { "returning", RETURNING }, // 273 - { "no-condition", NO_CONDITION }, // 274 - { "alnum", ALNUM }, // 275 - { "alphed", ALPHED }, // 276 - { "error", ERROR }, // 277 - { "exception", EXCEPTION }, // 278 - { "size-error", SIZE_ERROR }, // 279 - { "exception-name", EXCEPTION_NAME }, // 280 - { "level", LEVEL }, // 281 - { "level66", LEVEL66 }, // 282 - { "level78", LEVEL78 }, // 283 - { "level88", LEVEL88 }, // 284 - { "class-name", CLASS_NAME }, // 285 - { "name", NAME }, // 286 - { "name88", NAME88 }, // 287 - { "nume", NUME }, // 288 - { "numed", NUMED }, // 289 - { "numed-cr", NUMED_CR }, // 290 - { "numed-db", NUMED_DB }, // 291 - { "ninedot", NINEDOT }, // 292 - { "nines", NINES }, // 293 - { "ninev", NINEV }, // 294 - { "pic-p", PIC_P }, // 295 - { "spaces", SPACES }, // 296 - { "space", SPACES }, // 296 - { "literal", LITERAL }, // 297 - { "end", END }, // 298 - { "eop", EOP }, // 299 - { "filename", FILENAME }, // 300 - { "invalid", INVALID }, // 301 - { "number", NUMBER }, // 302 - { "negative", NEGATIVE }, // 303 - { "numstr", NUMSTR }, // 304 - { "overflow", OVERFLOW_kw }, // 305 - { "computational", COMPUTATIONAL }, // 306 - { "perform", PERFORM }, // 307 - { "backward", BACKWARD }, // 308 - { "positive", POSITIVE }, // 309 - { "pointer", POINTER }, // 310 - { "section", SECTION }, // 311 - { "standard-alphabet", STANDARD_ALPHABET }, // 312 - { "switch", SWITCH }, // 313 - { "upsi", UPSI }, // 314 - { "zero", ZERO }, // 315 - { "zeros", ZERO }, // 315 - { "zeroes", ZERO }, // 315 - { "sysin", SYSIN }, // 316 - { "sysipt", SYSIPT }, // 317 - { "sysout", SYSOUT }, // 318 - { "syslist", SYSLIST }, // 319 - { "syslst", SYSLST }, // 320 - { "syspunch", SYSPUNCH }, // 321 - { "syspch", SYSPCH }, // 322 - { "console", CONSOLE }, // 323 - { "c01", C01 }, // 324 - { "c02", C02 }, // 325 - { "c03", C03 }, // 326 - { "c04", C04 }, // 327 - { "c05", C05 }, // 328 - { "c06", C06 }, // 329 - { "c07", C07 }, // 330 - { "c08", C08 }, // 331 - { "c09", C09 }, // 332 - { "c10", C10 }, // 333 - { "c11", C11 }, // 334 - { "c12", C12 }, // 335 - { "csp", CSP }, // 336 - { "s01", S01 }, // 337 - { "s02", S02 }, // 338 - { "s03", S03 }, // 339 - { "s04", S04 }, // 340 - { "s05", S05 }, // 341 - { "afp-5a", AFP_5A }, // 342 - { "stdin", STDIN }, // 343 - { "stdout", STDOUT }, // 344 - { "stderr", STDERR }, // 345 - { "list", LIST }, // 346 - { "map", MAP }, // 347 - { "nolist", NOLIST }, // 348 - { "nomap", NOMAP }, // 349 - { "nosource", NOSOURCE }, // 350 - { "might-be", MIGHT_BE }, // 351 - { "function-udf", FUNCTION_UDF }, // 352 - { "function-udf-0", FUNCTION_UDF_0 }, // 353 - { "date-fmt", DATE_FMT }, // 354 - { "time-fmt", TIME_FMT }, // 355 - { "datetime-fmt", DATETIME_FMT }, // 356 - { "basis", BASIS }, // 357 - { "cbl", CBL }, // 358 - { "constant", CONSTANT }, // 359 - { "copy", COPY }, // 360 - { "defined", DEFINED }, // 361 - { "enter", ENTER }, // 362 - { "feature", FEATURE }, // 363 - { "insertt", INSERTT }, // 364 - { "lsub", LSUB }, // 365 - { "parameter", PARAMETER_kw }, // 366 - { "override", OVERRIDE }, // 367 - { "ready", READY }, // 368 - { "reset", RESET }, // 369 - { "rsub", RSUB }, // 370 - { "service-reload", SERVICE_RELOAD }, // 371 - { "star-cbl", STAR_CBL }, // 372 - { "subscript", SUBSCRIPT }, // 373 - { "suppress", SUPPRESS }, // 374 - { "title", TITLE }, // 375 - { "trace", TRACE }, // 376 - { "use", USE }, // 377 - { "cobol-words", COBOL_WORDS }, // 378 - { "equate", EQUATE }, // 379 - { "undefine", UNDEFINE }, // 380 - { "cdf-define", CDF_DEFINE }, // 381 - { "cdf-display", CDF_DISPLAY }, // 382 - { "cdf-if", CDF_IF }, // 383 - { "cdf-else", CDF_ELSE }, // 384 - { "cdf-end-if", CDF_END_IF }, // 385 - { "cdf-evaluate", CDF_EVALUATE }, // 386 - { "cdf-when", CDF_WHEN }, // 387 - { "cdf-end-evaluate", CDF_END_EVALUATE }, // 388 - { "call-cobol", CALL_COBOL }, // 389 - { "call-verbatim", CALL_VERBATIM }, // 390 - { "if", IF }, // 391 - { "then", THEN }, // 392 - { "else", ELSE }, // 393 - { "sentence", SENTENCE }, // 394 - { "accept", ACCEPT }, // 395 - { "add", ADD }, // 396 - { "alter", ALTER }, // 397 - { "call", CALL }, // 398 - { "cancel", CANCEL }, // 399 - { "close", CLOSE }, // 400 - { "compute", COMPUTE }, // 401 - { "continue", CONTINUE }, // 402 - { "delete", DELETE }, // 403 - { "display", DISPLAY }, // 404 - { "divide", DIVIDE }, // 405 - { "evaluate", EVALUATE }, // 406 - { "exit", EXIT }, // 407 - { "filler", FILLER_kw }, // 408 - { "goback", GOBACK }, // 409 - { "goto", GOTO }, // 410 - { "initialize", INITIALIZE }, // 411 - { "inspect", INSPECT }, // 412 - { "merge", MERGE }, // 413 - { "move", MOVE }, // 414 - { "multiply", MULTIPLY }, // 415 - { "open", OPEN }, // 416 - { "paragraph", PARAGRAPH }, // 417 - { "read", READ }, // 418 - { "release", RELEASE }, // 419 - { "return", RETURN }, // 420 - { "rewrite", REWRITE }, // 421 - { "search", SEARCH }, // 422 - { "set", SET }, // 423 - { "select", SELECT }, // 424 - { "sort", SORT }, // 425 - { "sort-merge", SORT_MERGE }, // 426 - { "string", STRING_kw }, // 427 - { "stop", STOP }, // 428 - { "subtract", SUBTRACT }, // 429 - { "start", START }, // 430 - { "unstring", UNSTRING }, // 431 - { "write", WRITE }, // 432 - { "when", WHEN }, // 433 - { "abs", ABS }, // 434 - { "access", ACCESS }, // 435 - { "acos", ACOS }, // 436 - { "actual", ACTUAL }, // 437 - { "advancing", ADVANCING }, // 438 - { "after", AFTER }, // 439 - { "all", ALL }, // 440 - { "allocate", ALLOCATE }, // 441 - { "alphabet", ALPHABET }, // 442 - { "alphabetic", ALPHABETIC }, // 443 - { "alphabetic-lower", ALPHABETIC_LOWER }, // 444 - { "alphabetic-upper", ALPHABETIC_UPPER }, // 445 - { "alphanumeric", ALPHANUMERIC }, // 446 - { "alphanumeric-edited", ALPHANUMERIC_EDITED }, // 447 - { "also", ALSO }, // 448 - { "alternate", ALTERNATE }, // 449 - { "annuity", ANNUITY }, // 450 - { "anum", ANUM }, // 451 - { "any", ANY }, // 452 - { "anycase", ANYCASE }, // 453 - { "apply", APPLY }, // 454 - { "are", ARE }, // 455 - { "area", AREA }, // 456 - { "areas", AREAS }, // 457 - { "as", AS }, // 458 - { "ascending", ASCENDING }, // 459 - { "activating", ACTIVATING }, // 460 - { "asin", ASIN }, // 461 - { "assign", ASSIGN }, // 462 - { "at", AT }, // 463 - { "atan", ATAN }, // 464 - { "based", BASED }, // 465 - { "baseconvert", BASECONVERT }, // 466 - { "before", BEFORE }, // 467 - { "binary", BINARY }, // 468 - { "bit", BIT }, // 469 - { "bit-of", BIT_OF }, // 470 - { "bit-to-char", BIT_TO_CHAR }, // 471 - { "blank", BLANK }, // 472 - { "block", BLOCK_kw }, // 473 - { "boolean-of-integer", BOOLEAN_OF_INTEGER }, // 474 - { "bottom", BOTTOM }, // 475 - { "by", BY }, // 476 - { "byte", BYTE }, // 477 - { "byte-length", BYTE_LENGTH }, // 478 - { "cf", CF }, // 479 - { "ch", CH }, // 480 - { "changed", CHANGED }, // 481 - { "char", CHAR }, // 482 - { "char-national", CHAR_NATIONAL }, // 483 - { "character", CHARACTER }, // 484 - { "characters", CHARACTERS }, // 485 - { "checking", CHECKING }, // 486 - { "class", CLASS }, // 487 - { "cobol", COBOL }, // 488 - { "code", CODE }, // 489 - { "code-set", CODESET }, // 490 - { "collating", COLLATING }, // 491 - { "column", COLUMN }, // 492 - { "combined-datetime", COMBINED_DATETIME }, // 493 - { "comma", COMMA }, // 494 - { "command-line", COMMAND_LINE }, // 495 - { "command-line-count", COMMAND_LINE_COUNT }, // 496 - { "commit", COMMIT }, // 497 - { "common", COMMON }, // 498 - { "concat", CONCAT }, // 499 - { "condition", CONDITION }, // 500 - { "configuration", CONFIGURATION_SECT }, // 501 - { "contains", CONTAINS }, // 502 - { "content", CONTENT }, // 503 - { "control", CONTROL }, // 504 - { "controls", CONTROLS }, // 505 - { "convert", CONVERT }, // 506 - { "converting", CONVERTING }, // 507 - { "corresponding", CORRESPONDING }, // 508 - { "cos", COS }, // 509 - { "count", COUNT }, // 510 - { "currency", CURRENCY }, // 511 - { "current", CURRENT }, // 512 - { "current-date", CURRENT_DATE }, // 513 - { "data", DATA }, // 514 - { "date", DATE }, // 515 - { "date-compiled", DATE_COMPILED }, // 516 - { "date-of-integer", DATE_OF_INTEGER }, // 517 - { "date-to-yyyymmdd", DATE_TO_YYYYMMDD }, // 518 - { "date-written", DATE_WRITTEN }, // 519 - { "day", DAY }, // 520 - { "day-of-integer", DAY_OF_INTEGER }, // 521 - { "day-of-week", DAY_OF_WEEK }, // 522 - { "day-to-yyyyddd", DAY_TO_YYYYDDD }, // 523 - { "dbcs", DBCS }, // 524 - { "de", DE }, // 525 - { "debugging", DEBUGGING }, // 526 - { "decimal-point", DECIMAL_POINT }, // 527 - { "declaratives", DECLARATIVES }, // 528 - { "default", DEFAULT }, // 529 - { "delimited", DELIMITED }, // 530 - { "delimiter", DELIMITER }, // 531 - { "depending", DEPENDING }, // 532 - { "descending", DESCENDING }, // 533 - { "detail", DETAIL }, // 534 - { "direct", DIRECT }, // 535 - { "direct-access", DIRECT_ACCESS }, // 536 - { "down", DOWN }, // 537 - { "duplicates", DUPLICATES }, // 538 - { "dynamic", DYNAMIC }, // 539 - { "e", E }, // 540 - { "ebcdic", EBCDIC }, // 541 - { "ec", EC }, // 542 - { "egcs", EGCS }, // 543 - { "entry", ENTRY }, // 544 - { "environment", ENVIRONMENT }, // 545 - { "equal", EQUAL }, // 546 - { "every", EVERY }, // 547 - { "examine", EXAMINE }, // 548 - { "exhibit", EXHIBIT }, // 549 - { "exp", EXP }, // 550 - { "exp10", EXP10 }, // 551 - { "extend", EXTEND }, // 552 - { "external", EXTERNAL }, // 553 - { "exception-file", EXCEPTION_FILE }, // 554 - { "exception-file-n", EXCEPTION_FILE_N }, // 555 - { "exception-location", EXCEPTION_LOCATION }, // 556 - { "exception-location-n", EXCEPTION_LOCATION_N }, // 557 - { "exception-statement", EXCEPTION_STATEMENT }, // 558 - { "exception-status", EXCEPTION_STATUS }, // 559 - { "factorial", FACTORIAL }, // 560 - { "false", FALSE_kw }, // 561 - { "fd", FD }, // 562 - { "file-control", FILE_CONTROL }, // 563 - { "file", FILE_KW }, // 564 - { "file-limit", FILE_LIMIT }, // 565 - { "final", FINAL }, // 566 - { "finally", FINALLY }, // 567 - { "find-string", FIND_STRING }, // 568 - { "first", FIRST }, // 569 - { "fixed", FIXED }, // 570 - { "footing", FOOTING }, // 571 - { "for", FOR }, // 572 - { "formatted-current-date", FORMATTED_CURRENT_DATE }, // 573 - { "formatted-date", FORMATTED_DATE }, // 574 - { "formatted-datetime", FORMATTED_DATETIME }, // 575 - { "formatted-time", FORMATTED_TIME }, // 576 - { "form-overflow", FORM_OVERFLOW }, // 577 - { "free", FREE }, // 578 - { "fraction-part", FRACTION_PART }, // 579 - { "from", FROM }, // 580 - { "function", FUNCTION }, // 581 - { "generate", GENERATE }, // 582 - { "giving", GIVING }, // 583 - { "global", GLOBAL }, // 584 - { "go", GO }, // 585 - { "group", GROUP }, // 586 - { "heading", HEADING }, // 587 - { "hex", HEX }, // 588 - { "hex-of", HEX_OF }, // 589 - { "hex-to-char", HEX_TO_CHAR }, // 590 - { "high-values", HIGH_VALUES }, // 591 - { "highest-algebraic", HIGHEST_ALGEBRAIC }, // 592 - { "hold", HOLD }, // 593 - { "ibm-360", IBM_360 }, // 594 - { "in", IN }, // 595 - { "include", INCLUDE }, // 596 - { "index", INDEX }, // 597 - { "indexed", INDEXED }, // 598 - { "indicate", INDICATE }, // 599 - { "initial", INITIAL_kw }, // 600 - { "initiate", INITIATE }, // 601 - { "input", INPUT }, // 602 - { "installation", INSTALLATION }, // 603 - { "interface", INTERFACE }, // 604 - { "integer", INTEGER }, // 605 - { "integer-of-boolean", INTEGER_OF_BOOLEAN }, // 606 - { "integer-of-date", INTEGER_OF_DATE }, // 607 - { "integer-of-day", INTEGER_OF_DAY }, // 608 - { "integer-of-formatted-date", INTEGER_OF_FORMATTED_DATE }, // 609 - { "integer-part", INTEGER_PART }, // 610 - { "into", INTO }, // 611 - { "intrinsic", INTRINSIC }, // 612 - { "invoke", INVOKE }, // 613 - { "i-o", IO }, // 614 - { "i-o-control", IO_CONTROL }, // 615 - { "is", IS }, // 616 - { "isnt", ISNT }, // 617 - { "kanji", KANJI }, // 618 - { "key", KEY }, // 619 - { "label", LABEL }, // 620 - { "last", LAST }, // 621 - { "leading", LEADING }, // 622 - { "left", LEFT }, // 623 - { "length", LENGTH }, // 624 - { "length-of", LENGTH_OF }, // 625 - { "limit", LIMIT }, // 626 - { "limits", LIMITS }, // 627 - { "line", LINE }, // 628 - { "lines", LINES }, // 629 - { "line-counter", LINE_COUNTER }, // 630 - { "linage", LINAGE }, // 631 - { "linkage", LINKAGE }, // 632 - { "locale", LOCALE }, // 633 - { "locale-compare", LOCALE_COMPARE }, // 634 - { "locale-date", LOCALE_DATE }, // 635 - { "locale-time", LOCALE_TIME }, // 636 - { "locale-time-from-seconds", LOCALE_TIME_FROM_SECONDS }, // 637 - { "local-storage", LOCAL_STORAGE }, // 638 - { "location", LOCATION }, // 639 - { "lock", LOCK }, // 640 - { "lock-on", LOCK_ON }, // 641 - { "log", LOG }, // 642 - { "log10", LOG10 }, // 643 - { "lower-case", LOWER_CASE }, // 644 - { "low-values", LOW_VALUES }, // 645 - { "lowest-algebraic", LOWEST_ALGEBRAIC }, // 646 - { "lparen", LPAREN }, // 647 - { "manual", MANUAL }, // 648 - { "maxx", MAXX }, // 649 - { "mean", MEAN }, // 650 - { "median", MEDIAN }, // 651 - { "midrange", MIDRANGE }, // 652 - { "minn", MINN }, // 653 - { "multiple", MULTIPLE }, // 654 - { "mod", MOD }, // 655 - { "mode", MODE }, // 656 - { "module-name", MODULE_NAME }, // 657 - { "named", NAMED }, // 658 - { "nat", NAT }, // 659 - { "national", NATIONAL }, // 660 - { "national-edited", NATIONAL_EDITED }, // 661 - { "national-of", NATIONAL_OF }, // 662 - { "native", NATIVE }, // 663 - { "nested", NESTED }, // 664 - { "next", NEXT }, // 665 - { "no", NO }, // 666 - { "note", NOTE }, // 667 - { "nulls", NULLS }, // 668 - { "null", NULLS }, // 668 - { "nullptr", NULLPTR }, // 669 - { "numeric", NUMERIC }, // 670 - { "numeric-edited", NUMERIC_EDITED }, // 671 - { "numval", NUMVAL }, // 672 - { "numval-c", NUMVAL_C }, // 673 - { "numval-f", NUMVAL_F }, // 674 - { "occurs", OCCURS }, // 675 - { "of", OF }, // 676 - { "off", OFF }, // 677 - { "omitted", OMITTED }, // 678 - { "on", ON }, // 679 - { "only", ONLY }, // 680 - { "optional", OPTIONAL }, // 681 - { "options", OPTIONS }, // 682 - { "ord", ORD }, // 683 - { "order", ORDER }, // 684 - { "ord-max", ORD_MAX }, // 685 - { "ord-min", ORD_MIN }, // 686 - { "organization", ORGANIZATION }, // 687 - { "other", OTHER }, // 688 - { "otherwise", OTHERWISE }, // 689 - { "output", OUTPUT }, // 690 - { "packed-decimal", PACKED_DECIMAL }, // 691 - { "padding", PADDING }, // 692 - { "page", PAGE }, // 693 - { "page-counter", PAGE_COUNTER }, // 694 - { "pf", PF }, // 695 - { "ph", PH }, // 696 - { "pi", PI }, // 697 - { "pic", PIC }, // 698 - { "picture", PICTURE }, // 699 - { "plus", PLUS }, // 700 - { "present-value", PRESENT_VALUE }, // 701 - { "print-switch", PRINT_SWITCH }, // 702 - { "procedure", PROCEDURE }, // 703 - { "procedures", PROCEDURES }, // 704 - { "proceed", PROCEED }, // 705 - { "process", PROCESS }, // 706 - { "program-id", PROGRAM_ID }, // 707 - { "program", PROGRAM_kw }, // 708 - { "property", PROPERTY }, // 709 - { "prototype", PROTOTYPE }, // 710 - { "pseudotext", PSEUDOTEXT }, // 711 - { "quotes", QUOTES }, // 712 - { "quote", QUOTES }, // 712 - { "random", RANDOM }, // 713 - { "random-seed", RANDOM_SEED }, // 714 - { "range", RANGE }, // 715 - { "raise", RAISE }, // 716 - { "raising", RAISING }, // 717 - { "rd", RD }, // 718 - { "record", RECORD }, // 719 - { "recording", RECORDING }, // 720 - { "records", RECORDS }, // 721 - { "recursive", RECURSIVE }, // 722 - { "redefines", REDEFINES }, // 723 - { "reel", REEL }, // 724 - { "reference", REFERENCE }, // 725 - { "relative", RELATIVE }, // 726 - { "rem", REM }, // 727 - { "remainder", REMAINDER }, // 728 - { "remarks", REMARKS }, // 729 - { "removal", REMOVAL }, // 730 - { "renames", RENAMES }, // 731 - { "replace", REPLACE }, // 732 - { "replacing", REPLACING }, // 733 - { "report", REPORT }, // 734 - { "reporting", REPORTING }, // 735 - { "reports", REPORTS }, // 736 - { "repository", REPOSITORY }, // 737 - { "rerun", RERUN }, // 738 - { "reserve", RESERVE }, // 739 - { "restricted", RESTRICTED }, // 740 - { "resume", RESUME }, // 741 - { "reverse", REVERSE }, // 742 - { "reversed", REVERSED }, // 743 - { "rewind", REWIND }, // 744 - { "rf", RF }, // 745 - { "rh", RH }, // 746 - { "right", RIGHT }, // 747 - { "rounded", ROUNDED }, // 748 - { "run", RUN }, // 749 - { "same", SAME }, // 750 - { "screen", SCREEN }, // 751 - { "sd", SD }, // 752 - { "seconds-from-formatted-time", SECONDS_FROM_FORMATTED_TIME }, // 753 - { "seconds-past-midnight", SECONDS_PAST_MIDNIGHT }, // 754 - { "security", SECURITY }, // 755 - { "separate", SEPARATE }, // 756 - { "sequence", SEQUENCE }, // 757 - { "sequential", SEQUENTIAL }, // 758 - { "sharing", SHARING }, // 759 - { "simple-exit", SIMPLE_EXIT }, // 760 - { "sign", SIGN }, // 761 - { "sin", SIN }, // 762 - { "size", SIZE }, // 763 - { "smallest-algebraic", SMALLEST_ALGEBRAIC }, // 764 - { "source", SOURCE }, // 765 - { "source-computer", SOURCE_COMPUTER }, // 766 - { "special-names", SPECIAL_NAMES }, // 767 - { "sqrt", SQRT }, // 768 - { "stack", STACK }, // 769 - { "standard", STANDARD }, // 770 - { "standard-1", STANDARD_1 }, // 771 - { "standard-deviation", STANDARD_DEVIATION }, // 772 - { "standard-compare", STANDARD_COMPARE }, // 773 - { "status", STATUS }, // 774 - { "strong", STRONG }, // 775 - { "substitute", SUBSTITUTE }, // 776 - { "sum", SUM }, // 777 - { "symbol", SYMBOL }, // 778 - { "symbolic", SYMBOLIC }, // 779 - { "synchronized", SYNCHRONIZED }, // 780 - { "tally", TALLY }, // 781 - { "tallying", TALLYING }, // 782 - { "tan", TAN }, // 783 - { "terminate", TERMINATE }, // 784 - { "test", TEST }, // 785 - { "test-date-yyyymmdd", TEST_DATE_YYYYMMDD }, // 786 - { "test-day-yyyyddd", TEST_DAY_YYYYDDD }, // 787 - { "test-formatted-datetime", TEST_FORMATTED_DATETIME }, // 788 - { "test-numval", TEST_NUMVAL }, // 789 - { "test-numval-c", TEST_NUMVAL_C }, // 790 - { "test-numval-f", TEST_NUMVAL_F }, // 791 - { "than", THAN }, // 792 - { "time", TIME }, // 793 - { "times", TIMES }, // 794 - { "to", TO }, // 795 - { "top", TOP }, // 796 - { "top-level", TOP_LEVEL }, // 797 - { "tracks", TRACKS }, // 798 - { "track-area", TRACK_AREA }, // 799 - { "trailing", TRAILING }, // 800 - { "transform", TRANSFORM }, // 801 - { "trim", TRIM }, // 802 - { "true", TRUE_kw }, // 803 - { "try", TRY }, // 804 - { "turn", TURN }, // 805 - { "type", TYPE }, // 806 - { "typedef", TYPEDEF }, // 807 - { "ulength", ULENGTH }, // 808 - { "unbounded", UNBOUNDED }, // 809 - { "unit", UNIT }, // 810 - { "units", UNITS }, // 811 - { "unit-record", UNIT_RECORD }, // 812 - { "until", UNTIL }, // 813 - { "up", UP }, // 814 - { "upon", UPON }, // 815 - { "upos", UPOS }, // 816 - { "upper-case", UPPER_CASE }, // 817 - { "usage", USAGE }, // 818 - { "using", USING }, // 819 - { "usubstr", USUBSTR }, // 820 - { "usupplementary", USUPPLEMENTARY }, // 821 - { "utility", UTILITY }, // 822 - { "uuid4", UUID4 }, // 823 - { "uvalid", UVALID }, // 824 - { "uwidth", UWIDTH }, // 825 - { "value", VALUE }, // 826 - { "variance", VARIANCE }, // 827 - { "varying", VARYING }, // 828 - { "volatile", VOLATILE }, // 829 - { "when-compiled", WHEN_COMPILED }, // 830 - { "with", WITH }, // 831 - { "working-storage", WORKING_STORAGE }, // 832 - { "xml", XML }, // 833 - { "xmlgenerate", XMLGENERATE }, // 834 - { "xmlparse", XMLPARSE }, // 835 - { "year-to-yyyy", YEAR_TO_YYYY }, // 836 - { "yyyyddd", YYYYDDD }, // 837 - { "yyyymmdd", YYYYMMDD }, // 838 - { "arithmetic", ARITHMETIC }, // 839 - { "attribute", ATTRIBUTE }, // 840 - { "auto", AUTO }, // 841 - { "automatic", AUTOMATIC }, // 842 - { "away-from-zero", AWAY_FROM_ZERO }, // 843 - { "background-color", BACKGROUND_COLOR }, // 844 - { "bell", BELL }, // 845 - { "binary-encoding", BINARY_ENCODING }, // 846 - { "blink", BLINK }, // 847 - { "capacity", CAPACITY }, // 848 - { "center", CENTER }, // 849 - { "classification", CLASSIFICATION }, // 850 - { "cycle", CYCLE }, // 851 - { "decimal-encoding", DECIMAL_ENCODING }, // 852 - { "entry-convention", ENTRY_CONVENTION }, // 853 - { "eol", EOL }, // 854 - { "eos", EOS }, // 855 - { "erase", ERASE }, // 856 - { "expands", EXPANDS }, // 857 - { "float-binary", FLOAT_BINARY }, // 858 - { "float-decimal", FLOAT_DECIMAL }, // 859 - { "foreground-color", FOREGROUND_COLOR }, // 860 - { "forever", FOREVER }, // 861 - { "full", FULL }, // 862 - { "highlight", HIGHLIGHT }, // 863 - { "high-order-left", HIGH_ORDER_LEFT }, // 864 - { "high-order-right", HIGH_ORDER_RIGHT }, // 865 - { "ignoring", IGNORING }, // 866 - { "implements", IMPLEMENTS }, // 867 - { "initialized", INITIALIZED }, // 868 - { "intermediate", INTERMEDIATE }, // 869 - { "lc-all", LC_ALL_kw }, // 870 - { "lc-collate", LC_COLLATE_kw }, // 871 - { "lc-ctype", LC_CTYPE_kw }, // 872 - { "lc-messages", LC_MESSAGES_kw }, // 873 - { "lc-monetary", LC_MONETARY_kw }, // 874 - { "lc-numeric", LC_NUMERIC_kw }, // 875 - { "lc-time", LC_TIME_kw }, // 876 - { "lowlight", LOWLIGHT }, // 877 - { "nearest-away-from-zero", NEAREST_AWAY_FROM_ZERO }, // 878 - { "nearest-even", NEAREST_EVEN }, // 879 - { "nearest-toward-zero", NEAREST_TOWARD_ZERO }, // 880 - { "none", NONE }, // 881 - { "normal", NORMAL }, // 882 - { "numbers", NUMBERS }, // 883 - { "prefixed", PREFIXED }, // 884 - { "previous", PREVIOUS }, // 885 - { "prohibited", PROHIBITED }, // 886 - { "relation", RELATION }, // 887 - { "required", REQUIRED }, // 888 - { "reverse-video", REVERSE_VIDEO }, // 889 - { "rounding", ROUNDING }, // 890 - { "seconds", SECONDS }, // 891 - { "secure", SECURE }, // 892 - { "short", SHORT }, // 893 - { "signed", SIGNED_kw }, // 894 - { "standard-binary", STANDARD_BINARY }, // 895 - { "standard-decimal", STANDARD_DECIMAL }, // 896 - { "statement", STATEMENT }, // 897 - { "step", STEP }, // 898 - { "structure", STRUCTURE }, // 899 - { "toward-greater", TOWARD_GREATER }, // 900 - { "toward-lesser", TOWARD_LESSER }, // 901 - { "truncation", TRUNCATION }, // 902 - { "ucs-4", UCS_4 }, // 903 - { "underline", UNDERLINE }, // 904 - { "unsigned", UNSIGNED_kw }, // 905 - { "utf-16", UTF_16 }, // 906 - { "utf-8", UTF_8 }, // 907 - { "address", ADDRESS }, // 908 - { "end-accept", END_ACCEPT }, // 909 - { "end-add", END_ADD }, // 910 - { "end-call", END_CALL }, // 911 - { "end-compute", END_COMPUTE }, // 912 - { "end-delete", END_DELETE }, // 913 - { "end-display", END_DISPLAY }, // 914 - { "end-divide", END_DIVIDE }, // 915 - { "end-evaluate", END_EVALUATE }, // 916 - { "end-multiply", END_MULTIPLY }, // 917 - { "end-perform", END_PERFORM }, // 918 - { "end-read", END_READ }, // 919 - { "end-return", END_RETURN }, // 920 - { "end-rewrite", END_REWRITE }, // 921 - { "end-search", END_SEARCH }, // 922 - { "end-start", END_START }, // 923 - { "end-string", END_STRING }, // 924 - { "end-subtract", END_SUBTRACT }, // 925 - { "end-unstring", END_UNSTRING }, // 926 - { "end-write", END_WRITE }, // 927 - { "end-if", END_IF }, // 928 - { "thru", THRU }, // 929 - { "through", THRU }, // 929 - { "or", OR }, // 930 - { "and", AND }, // 931 - { "not", NOT }, // 932 - { "ne", NE }, // 933 - { "le", LE }, // 934 - { "ge", GE }, // 935 - { "pow", POW }, // 936 - { "neg", NEG }, // 937 + { "identification", IDENTIFICATION_DIV }, // 258 + { "environment", ENVIRONMENT_DIV }, // 259 + { "procedure", PROCEDURE_DIV }, // 260 + { "data", DATA_DIV }, // 261 + { "file", FILE_SECT }, // 262 + { "input-output", INPUT_OUTPUT_SECT }, // 263 + { "linkage", LINKAGE_SECT }, // 264 + { "local-storage", LOCAL_STORAGE_SECT }, // 265 + { "working-storage", WORKING_STORAGE_SECT }, // 266 + { "object-computer", OBJECT_COMPUTER }, // 267 + { "display-of", DISPLAY_OF }, // 268 + { "end-function", END_FUNCTION }, // 269 + { "end-program", END_PROGRAM }, // 270 + { "end-subprogram", END_SUBPROGRAM }, // 271 + { "justified", JUSTIFIED }, // 272 + { "returning", RETURNING }, // 273 + { "no-condition", NO_CONDITION }, // 274 + { "alnum", ALNUM }, // 275 + { "alphed", ALPHED }, // 276 + { "error", ERROR }, // 277 + { "exception", EXCEPTION }, // 278 + { "size-error", SIZE_ERROR }, // 279 + { "exception-name", EXCEPTION_NAME }, // 280 + { "level", LEVEL }, // 281 + { "level66", LEVEL66 }, // 282 + { "level78", LEVEL78 }, // 283 + { "level88", LEVEL88 }, // 284 + { "class-name", CLASS_NAME }, // 285 + { "name", NAME }, // 286 + { "name88", NAME88 }, // 287 + { "nume", NUME }, // 288 + { "numed", NUMED }, // 289 + { "numed-cr", NUMED_CR }, // 290 + { "numed-db", NUMED_DB }, // 291 + { "ninedot", NINEDOT }, // 292 + { "nines", NINES }, // 293 + { "ninev", NINEV }, // 294 + { "pic-p", PIC_P }, // 295 + { "ones", ONES }, // 296 + { "spaces", SPACES }, // 297 + { "space", SPACES }, // 297 + { "literal", LITERAL }, // 298 + { "end", END }, // 299 + { "eop", EOP }, // 300 + { "filename", FILENAME }, // 301 + { "invalid", INVALID }, // 302 + { "number", NUMBER }, // 303 + { "negative", NEGATIVE }, // 304 + { "numstr", NUMSTR }, // 305 + { "overflow", OVERFLOW_kw }, // 306 + { "binary-integer", BINARY_INTEGER }, // 307 + { "computational", COMPUTATIONAL }, // 308 + { "perform", PERFORM }, // 309 + { "backward", BACKWARD }, // 310 + { "positive", POSITIVE }, // 311 + { "pointer", POINTER }, // 312 + { "section", SECTION }, // 313 + { "standard-alphabet", STANDARD_ALPHABET }, // 314 + { "switch", SWITCH }, // 315 + { "upsi", UPSI }, // 316 + { "zero", ZERO }, // 317 + { "zeros", ZERO }, // 317 + { "zeroes", ZERO }, // 317 + { "sysin", SYSIN }, // 318 + { "sysipt", SYSIPT }, // 319 + { "sysout", SYSOUT }, // 320 + { "syslist", SYSLIST }, // 321 + { "syslst", SYSLST }, // 322 + { "syspunch", SYSPUNCH }, // 323 + { "syspch", SYSPCH }, // 324 + { "console", CONSOLE }, // 325 + { "c01", C01 }, // 326 + { "c02", C02 }, // 327 + { "c03", C03 }, // 328 + { "c04", C04 }, // 329 + { "c05", C05 }, // 330 + { "c06", C06 }, // 331 + { "c07", C07 }, // 332 + { "c08", C08 }, // 333 + { "c09", C09 }, // 334 + { "c10", C10 }, // 335 + { "c11", C11 }, // 336 + { "c12", C12 }, // 337 + { "csp", CSP }, // 338 + { "s01", S01 }, // 339 + { "s02", S02 }, // 340 + { "s03", S03 }, // 341 + { "s04", S04 }, // 342 + { "s05", S05 }, // 343 + { "afp-5a", AFP_5A }, // 344 + { "stdin", STDIN }, // 345 + { "stdout", STDOUT }, // 346 + { "stderr", STDERR }, // 347 + { "list", LIST }, // 348 + { "map", MAP }, // 349 + { "nolist", NOLIST }, // 350 + { "nomap", NOMAP }, // 351 + { "nosource", NOSOURCE }, // 352 + { "might-be", MIGHT_BE }, // 353 + { "function-udf", FUNCTION_UDF }, // 354 + { "function-udf-0", FUNCTION_UDF_0 }, // 355 + { "date-fmt", DATE_FMT }, // 356 + { "time-fmt", TIME_FMT }, // 357 + { "datetime-fmt", DATETIME_FMT }, // 358 + { "basis", BASIS }, // 359 + { "cbl", CBL }, // 360 + { "constant", CONSTANT }, // 361 + { "copy", COPY }, // 362 + { "defined", DEFINED }, // 363 + { "enter", ENTER }, // 364 + { "feature", FEATURE }, // 365 + { "insertt", INSERTT }, // 366 + { "lsub", LSUB }, // 367 + { "parameter", PARAMETER_kw }, // 368 + { "override", OVERRIDE }, // 369 + { "ready", READY }, // 370 + { "reset", RESET }, // 371 + { "rsub", RSUB }, // 372 + { "service-reload", SERVICE_RELOAD }, // 373 + { "star-cbl", STAR_CBL }, // 374 + { "subscript", SUBSCRIPT }, // 375 + { "suppress", SUPPRESS }, // 376 + { "title", TITLE }, // 377 + { "trace", TRACE }, // 378 + { "use", USE }, // 379 + { "cobol-words", COBOL_WORDS }, // 380 + { "equate", EQUATE }, // 381 + { "undefine", UNDEFINE }, // 382 + { "cdf-define", CDF_DEFINE }, // 383 + { "cdf-display", CDF_DISPLAY }, // 384 + { "cdf-if", CDF_IF }, // 385 + { "cdf-else", CDF_ELSE }, // 386 + { "cdf-end-if", CDF_END_IF }, // 387 + { "cdf-evaluate", CDF_EVALUATE }, // 388 + { "cdf-when", CDF_WHEN }, // 389 + { "cdf-end-evaluate", CDF_END_EVALUATE }, // 390 + { "call-cobol", CALL_COBOL }, // 391 + { "call-verbatim", CALL_VERBATIM }, // 392 + { "if", IF }, // 393 + { "then", THEN }, // 394 + { "else", ELSE }, // 395 + { "sentence", SENTENCE }, // 396 + { "accept", ACCEPT }, // 397 + { "add", ADD }, // 398 + { "alter", ALTER }, // 399 + { "call", CALL }, // 400 + { "cancel", CANCEL }, // 401 + { "close", CLOSE }, // 402 + { "compute", COMPUTE }, // 403 + { "continue", CONTINUE }, // 404 + { "delete", DELETE }, // 405 + { "display", DISPLAY }, // 406 + { "divide", DIVIDE }, // 407 + { "evaluate", EVALUATE }, // 408 + { "exit", EXIT }, // 409 + { "filler", FILLER_kw }, // 410 + { "goback", GOBACK }, // 411 + { "goto", GOTO }, // 412 + { "initialize", INITIALIZE }, // 413 + { "inspect", INSPECT }, // 414 + { "merge", MERGE }, // 415 + { "move", MOVE }, // 416 + { "multiply", MULTIPLY }, // 417 + { "open", OPEN }, // 418 + { "paragraph", PARAGRAPH }, // 419 + { "read", READ }, // 420 + { "release", RELEASE }, // 421 + { "return", RETURN }, // 422 + { "rewrite", REWRITE }, // 423 + { "search", SEARCH }, // 424 + { "set", SET }, // 425 + { "select", SELECT }, // 426 + { "sort", SORT }, // 427 + { "sort-merge", SORT_MERGE }, // 428 + { "string", STRING_kw }, // 429 + { "stop", STOP }, // 430 + { "subtract", SUBTRACT }, // 431 + { "start", START }, // 432 + { "unstring", UNSTRING }, // 433 + { "write", WRITE }, // 434 + { "when", WHEN }, // 435 + { "abs", ABS }, // 436 + { "access", ACCESS }, // 437 + { "acos", ACOS }, // 438 + { "actual", ACTUAL }, // 439 + { "advancing", ADVANCING }, // 440 + { "after", AFTER }, // 441 + { "all", ALL }, // 442 + { "allocate", ALLOCATE }, // 443 + { "alphabet", ALPHABET }, // 444 + { "alphabetic", ALPHABETIC }, // 445 + { "alphabetic-lower", ALPHABETIC_LOWER }, // 446 + { "alphabetic-upper", ALPHABETIC_UPPER }, // 447 + { "alphanumeric", ALPHANUMERIC }, // 448 + { "alphanumeric-edited", ALPHANUMERIC_EDITED }, // 449 + { "also", ALSO }, // 450 + { "alternate", ALTERNATE }, // 451 + { "annuity", ANNUITY }, // 452 + { "anum", ANUM }, // 453 + { "any", ANY }, // 454 + { "anycase", ANYCASE }, // 455 + { "apply", APPLY }, // 456 + { "are", ARE }, // 457 + { "area", AREA }, // 458 + { "areas", AREAS }, // 459 + { "as", AS }, // 460 + { "ascending", ASCENDING }, // 461 + { "activating", ACTIVATING }, // 462 + { "asin", ASIN }, // 463 + { "assign", ASSIGN }, // 464 + { "at", AT }, // 465 + { "atan", ATAN }, // 466 + { "based", BASED }, // 467 + { "baseconvert", BASECONVERT }, // 468 + { "before", BEFORE }, // 469 + { "binary", BINARY }, // 470 + { "bit", BIT }, // 471 + { "bit-of", BIT_OF }, // 472 + { "bit-to-char", BIT_TO_CHAR }, // 473 + { "blank", BLANK }, // 474 + { "block", BLOCK_kw }, // 475 + { "boolean-of-integer", BOOLEAN_OF_INTEGER }, // 476 + { "bottom", BOTTOM }, // 477 + { "by", BY }, // 478 + { "byte", BYTE }, // 479 + { "byte-length", BYTE_LENGTH }, // 480 + { "cf", CF }, // 481 + { "ch", CH }, // 482 + { "changed", CHANGED }, // 483 + { "char", CHAR }, // 484 + { "char-national", CHAR_NATIONAL }, // 485 + { "character", CHARACTER }, // 486 + { "characters", CHARACTERS }, // 487 + { "checking", CHECKING }, // 488 + { "class", CLASS }, // 489 + { "cobol", COBOL }, // 490 + { "code", CODE }, // 491 + { "code-set", CODESET }, // 492 + { "collating", COLLATING }, // 493 + { "column", COLUMN }, // 494 + { "combined-datetime", COMBINED_DATETIME }, // 495 + { "comma", COMMA }, // 496 + { "command-line", COMMAND_LINE }, // 497 + { "command-line-count", COMMAND_LINE_COUNT }, // 498 + { "commit", COMMIT }, // 499 + { "common", COMMON }, // 500 + { "concat", CONCAT }, // 501 + { "condition", CONDITION }, // 502 + { "configuration", CONFIGURATION_SECT }, // 503 + { "contains", CONTAINS }, // 504 + { "content", CONTENT }, // 505 + { "control", CONTROL }, // 506 + { "controls", CONTROLS }, // 507 + { "convert", CONVERT }, // 508 + { "converting", CONVERTING }, // 509 + { "corresponding", CORRESPONDING }, // 510 + { "cos", COS }, // 511 + { "count", COUNT }, // 512 + { "currency", CURRENCY }, // 513 + { "current", CURRENT }, // 514 + { "current-date", CURRENT_DATE }, // 515 + { "data", DATA }, // 516 + { "date", DATE }, // 517 + { "date-compiled", DATE_COMPILED }, // 518 + { "date-of-integer", DATE_OF_INTEGER }, // 519 + { "date-to-yyyymmdd", DATE_TO_YYYYMMDD }, // 520 + { "date-written", DATE_WRITTEN }, // 521 + { "day", DAY }, // 522 + { "day-of-integer", DAY_OF_INTEGER }, // 523 + { "day-of-week", DAY_OF_WEEK }, // 524 + { "day-to-yyyyddd", DAY_TO_YYYYDDD }, // 525 + { "dbcs", DBCS }, // 526 + { "de", DE }, // 527 + { "debugging", DEBUGGING }, // 528 + { "decimal-point", DECIMAL_POINT }, // 529 + { "declaratives", DECLARATIVES }, // 530 + { "default", DEFAULT }, // 531 + { "delimited", DELIMITED }, // 532 + { "delimiter", DELIMITER }, // 533 + { "depending", DEPENDING }, // 534 + { "descending", DESCENDING }, // 535 + { "detail", DETAIL }, // 536 + { "direct", DIRECT }, // 537 + { "direct-access", DIRECT_ACCESS }, // 538 + { "down", DOWN }, // 539 + { "duplicates", DUPLICATES }, // 540 + { "dynamic", DYNAMIC }, // 541 + { "e", E }, // 542 + { "ebcdic", EBCDIC }, // 543 + { "ec", EC }, // 544 + { "egcs", EGCS }, // 545 + { "entry", ENTRY }, // 546 + { "environment", ENVIRONMENT }, // 547 + { "equal", EQUAL }, // 548 + { "every", EVERY }, // 549 + { "examine", EXAMINE }, // 550 + { "exhibit", EXHIBIT }, // 551 + { "exp", EXP }, // 552 + { "exp10", EXP10 }, // 553 + { "extend", EXTEND }, // 554 + { "external", EXTERNAL }, // 555 + { "exception-file", EXCEPTION_FILE }, // 556 + { "exception-file-n", EXCEPTION_FILE_N }, // 557 + { "exception-location", EXCEPTION_LOCATION }, // 558 + { "exception-location-n", EXCEPTION_LOCATION_N }, // 559 + { "exception-statement", EXCEPTION_STATEMENT }, // 560 + { "exception-status", EXCEPTION_STATUS }, // 561 + { "factorial", FACTORIAL }, // 562 + { "false", FALSE_kw }, // 563 + { "fd", FD }, // 564 + { "file-control", FILE_CONTROL }, // 565 + { "file", FILE_KW }, // 566 + { "file-limit", FILE_LIMIT }, // 567 + { "final", FINAL }, // 568 + { "finally", FINALLY }, // 569 + { "find-string", FIND_STRING }, // 570 + { "first", FIRST }, // 571 + { "fixed", FIXED }, // 572 + { "footing", FOOTING }, // 573 + { "for", FOR }, // 574 + { "formatted-current-date", FORMATTED_CURRENT_DATE }, // 575 + { "formatted-date", FORMATTED_DATE }, // 576 + { "formatted-datetime", FORMATTED_DATETIME }, // 577 + { "formatted-time", FORMATTED_TIME }, // 578 + { "form-overflow", FORM_OVERFLOW }, // 579 + { "free", FREE }, // 580 + { "fraction-part", FRACTION_PART }, // 581 + { "from", FROM }, // 582 + { "function", FUNCTION }, // 583 + { "generate", GENERATE }, // 584 + { "giving", GIVING }, // 585 + { "global", GLOBAL }, // 586 + { "go", GO }, // 587 + { "group", GROUP }, // 588 + { "heading", HEADING }, // 589 + { "hex", HEX }, // 590 + { "hex-of", HEX_OF }, // 591 + { "hex-to-char", HEX_TO_CHAR }, // 592 + { "high-values", HIGH_VALUES }, // 593 + { "highest-algebraic", HIGHEST_ALGEBRAIC }, // 594 + { "hold", HOLD }, // 595 + { "ibm-360", IBM_360 }, // 596 + { "in", IN }, // 597 + { "include", INCLUDE }, // 598 + { "index", INDEX }, // 599 + { "indexed", INDEXED }, // 600 + { "indicate", INDICATE }, // 601 + { "initial", INITIAL_kw }, // 602 + { "initiate", INITIATE }, // 603 + { "input", INPUT }, // 604 + { "installation", INSTALLATION }, // 605 + { "interface", INTERFACE }, // 606 + { "integer", INTEGER }, // 607 + { "integer-of-boolean", INTEGER_OF_BOOLEAN }, // 608 + { "integer-of-date", INTEGER_OF_DATE }, // 609 + { "integer-of-day", INTEGER_OF_DAY }, // 610 + { "integer-of-formatted-date", INTEGER_OF_FORMATTED_DATE }, // 611 + { "integer-part", INTEGER_PART }, // 612 + { "into", INTO }, // 613 + { "intrinsic", INTRINSIC }, // 614 + { "invoke", INVOKE }, // 615 + { "i-o", IO }, // 616 + { "i-o-control", IO_CONTROL }, // 617 + { "is", IS }, // 618 + { "isnt", ISNT }, // 619 + { "kanji", KANJI }, // 620 + { "key", KEY }, // 621 + { "label", LABEL }, // 622 + { "last", LAST }, // 623 + { "leading", LEADING }, // 624 + { "left", LEFT }, // 625 + { "length", LENGTH }, // 626 + { "length-of", LENGTH_OF }, // 627 + { "limit", LIMIT }, // 628 + { "limits", LIMITS }, // 629 + { "line", LINE }, // 630 + { "lines", LINES }, // 631 + { "line-counter", LINE_COUNTER }, // 632 + { "linage", LINAGE }, // 633 + { "linkage", LINKAGE }, // 634 + { "locale", LOCALE }, // 635 + { "locale-compare", LOCALE_COMPARE }, // 636 + { "locale-date", LOCALE_DATE }, // 637 + { "locale-time", LOCALE_TIME }, // 638 + { "locale-time-from-seconds", LOCALE_TIME_FROM_SECONDS }, // 639 + { "local-storage", LOCAL_STORAGE }, // 640 + { "location", LOCATION }, // 641 + { "lock", LOCK }, // 642 + { "lock-on", LOCK_ON }, // 643 + { "log", LOG }, // 644 + { "log10", LOG10 }, // 645 + { "lower-case", LOWER_CASE }, // 646 + { "low-values", LOW_VALUES }, // 647 + { "lowest-algebraic", LOWEST_ALGEBRAIC }, // 648 + { "lparen", LPAREN }, // 649 + { "manual", MANUAL }, // 650 + { "maxx", MAXX }, // 651 + { "mean", MEAN }, // 652 + { "median", MEDIAN }, // 653 + { "midrange", MIDRANGE }, // 654 + { "minn", MINN }, // 655 + { "multiple", MULTIPLE }, // 656 + { "mod", MOD }, // 657 + { "mode", MODE }, // 658 + { "module-name", MODULE_NAME }, // 659 + { "named", NAMED }, // 660 + { "nat", NAT }, // 661 + { "national", NATIONAL }, // 662 + { "national-edited", NATIONAL_EDITED }, // 663 + { "national-of", NATIONAL_OF }, // 664 + { "native", NATIVE }, // 665 + { "nested", NESTED }, // 666 + { "next", NEXT }, // 667 + { "no", NO }, // 668 + { "note", NOTE }, // 669 + { "nulls", NULLS }, // 670 + { "null", NULLS }, // 670 + { "nullptr", NULLPTR }, // 671 + { "numeric", NUMERIC }, // 672 + { "numeric-edited", NUMERIC_EDITED }, // 673 + { "numval", NUMVAL }, // 674 + { "numval-c", NUMVAL_C }, // 675 + { "numval-f", NUMVAL_F }, // 676 + { "occurs", OCCURS }, // 677 + { "of", OF }, // 678 + { "off", OFF }, // 679 + { "omitted", OMITTED }, // 680 + { "on", ON }, // 681 + { "only", ONLY }, // 682 + { "optional", OPTIONAL }, // 683 + { "options", OPTIONS }, // 684 + { "ord", ORD }, // 685 + { "order", ORDER }, // 686 + { "ord-max", ORD_MAX }, // 687 + { "ord-min", ORD_MIN }, // 688 + { "organization", ORGANIZATION }, // 689 + { "other", OTHER }, // 690 + { "otherwise", OTHERWISE }, // 691 + { "output", OUTPUT }, // 692 + { "packed-decimal", PACKED_DECIMAL }, // 693 + { "padding", PADDING }, // 694 + { "page", PAGE }, // 695 + { "page-counter", PAGE_COUNTER }, // 696 + { "pf", PF }, // 697 + { "ph", PH }, // 698 + { "pi", PI }, // 699 + { "pic", PIC }, // 700 + { "picture", PICTURE }, // 701 + { "plus", PLUS }, // 702 + { "present-value", PRESENT_VALUE }, // 703 + { "print-switch", PRINT_SWITCH }, // 704 + { "procedure", PROCEDURE }, // 705 + { "procedures", PROCEDURES }, // 706 + { "proceed", PROCEED }, // 707 + { "process", PROCESS }, // 708 + { "program-id", PROGRAM_ID }, // 709 + { "program", PROGRAM_kw }, // 710 + { "property", PROPERTY }, // 711 + { "prototype", PROTOTYPE }, // 712 + { "pseudotext", PSEUDOTEXT }, // 713 + { "quotes", QUOTES }, // 714 + { "quote", QUOTES }, // 714 + { "random", RANDOM }, // 715 + { "random-seed", RANDOM_SEED }, // 716 + { "range", RANGE }, // 717 + { "raise", RAISE }, // 718 + { "raising", RAISING }, // 719 + { "rd", RD }, // 720 + { "record", RECORD }, // 721 + { "recording", RECORDING }, // 722 + { "records", RECORDS }, // 723 + { "recursive", RECURSIVE }, // 724 + { "redefines", REDEFINES }, // 725 + { "reel", REEL }, // 726 + { "reference", REFERENCE }, // 727 + { "relative", RELATIVE }, // 728 + { "rem", REM }, // 729 + { "remainder", REMAINDER }, // 730 + { "remarks", REMARKS }, // 731 + { "removal", REMOVAL }, // 732 + { "renames", RENAMES }, // 733 + { "replace", REPLACE }, // 734 + { "replacing", REPLACING }, // 735 + { "report", REPORT }, // 736 + { "reporting", REPORTING }, // 737 + { "reports", REPORTS }, // 738 + { "repository", REPOSITORY }, // 739 + { "rerun", RERUN }, // 740 + { "reserve", RESERVE }, // 741 + { "restricted", RESTRICTED }, // 742 + { "resume", RESUME }, // 743 + { "reverse", REVERSE }, // 744 + { "reversed", REVERSED }, // 745 + { "rewind", REWIND }, // 746 + { "rf", RF }, // 747 + { "rh", RH }, // 748 + { "right", RIGHT }, // 749 + { "rounded", ROUNDED }, // 750 + { "run", RUN }, // 751 + { "same", SAME }, // 752 + { "screen", SCREEN }, // 753 + { "sd", SD }, // 754 + { "seconds-from-formatted-time", SECONDS_FROM_FORMATTED_TIME }, // 755 + { "seconds-past-midnight", SECONDS_PAST_MIDNIGHT }, // 756 + { "security", SECURITY }, // 757 + { "separate", SEPARATE }, // 758 + { "sequence", SEQUENCE }, // 759 + { "sequential", SEQUENTIAL }, // 760 + { "sharing", SHARING }, // 761 + { "simple-exit", SIMPLE_EXIT }, // 762 + { "sign", SIGN }, // 763 + { "sin", SIN }, // 764 + { "size", SIZE }, // 765 + { "smallest-algebraic", SMALLEST_ALGEBRAIC }, // 766 + { "source", SOURCE }, // 767 + { "source-computer", SOURCE_COMPUTER }, // 768 + { "special-names", SPECIAL_NAMES }, // 769 + { "sqrt", SQRT }, // 770 + { "stack", STACK }, // 771 + { "standard", STANDARD }, // 772 + { "standard-1", STANDARD_1 }, // 773 + { "standard-deviation", STANDARD_DEVIATION }, // 774 + { "standard-compare", STANDARD_COMPARE }, // 775 + { "status", STATUS }, // 776 + { "strong", STRONG }, // 777 + { "substitute", SUBSTITUTE }, // 778 + { "sum", SUM }, // 779 + { "symbol", SYMBOL }, // 780 + { "symbolic", SYMBOLIC }, // 781 + { "synchronized", SYNCHRONIZED }, // 782 + { "tally", TALLY }, // 783 + { "tallying", TALLYING }, // 784 + { "tan", TAN }, // 785 + { "terminate", TERMINATE }, // 786 + { "test", TEST }, // 787 + { "test-date-yyyymmdd", TEST_DATE_YYYYMMDD }, // 788 + { "test-day-yyyyddd", TEST_DAY_YYYYDDD }, // 789 + { "test-formatted-datetime", TEST_FORMATTED_DATETIME }, // 790 + { "test-numval", TEST_NUMVAL }, // 791 + { "test-numval-c", TEST_NUMVAL_C }, // 792 + { "test-numval-f", TEST_NUMVAL_F }, // 793 + { "than", THAN }, // 794 + { "time", TIME }, // 795 + { "times", TIMES }, // 796 + { "to", TO }, // 797 + { "top", TOP }, // 798 + { "top-level", TOP_LEVEL }, // 799 + { "tracks", TRACKS }, // 800 + { "track-area", TRACK_AREA }, // 801 + { "trailing", TRAILING }, // 802 + { "transform", TRANSFORM }, // 803 + { "trim", TRIM }, // 804 + { "true", TRUE_kw }, // 805 + { "try", TRY }, // 806 + { "turn", TURN }, // 807 + { "type", TYPE }, // 808 + { "typedef", TYPEDEF }, // 809 + { "ulength", ULENGTH }, // 810 + { "unbounded", UNBOUNDED }, // 811 + { "unit", UNIT }, // 812 + { "units", UNITS }, // 813 + { "unit-record", UNIT_RECORD }, // 814 + { "until", UNTIL }, // 815 + { "up", UP }, // 816 + { "upon", UPON }, // 817 + { "upos", UPOS }, // 818 + { "upper-case", UPPER_CASE }, // 819 + { "usage", USAGE }, // 820 + { "using", USING }, // 821 + { "usubstr", USUBSTR }, // 822 + { "usupplementary", USUPPLEMENTARY }, // 823 + { "utility", UTILITY }, // 824 + { "uuid4", UUID4 }, // 825 + { "uvalid", UVALID }, // 826 + { "uwidth", UWIDTH }, // 827 + { "value", VALUE }, // 828 + { "variance", VARIANCE }, // 829 + { "varying", VARYING }, // 830 + { "volatile", VOLATILE }, // 831 + { "when-compiled", WHEN_COMPILED }, // 832 + { "with", WITH }, // 833 + { "working-storage", WORKING_STORAGE }, // 834 + { "xml", XML }, // 835 + { "xmlgenerate", XMLGENERATE }, // 836 + { "xmlparse", XMLPARSE }, // 837 + { "year-to-yyyy", YEAR_TO_YYYY }, // 838 + { "yyyyddd", YYYYDDD }, // 839 + { "yyyymmdd", YYYYMMDD }, // 840 + { "arithmetic", ARITHMETIC }, // 841 + { "attribute", ATTRIBUTE }, // 842 + { "auto", AUTO }, // 843 + { "automatic", AUTOMATIC }, // 844 + { "away-from-zero", AWAY_FROM_ZERO }, // 845 + { "background-color", BACKGROUND_COLOR }, // 846 + { "bell", BELL }, // 847 + { "binary-encoding", BINARY_ENCODING }, // 848 + { "blink", BLINK }, // 849 + { "capacity", CAPACITY }, // 850 + { "center", CENTER }, // 851 + { "classification", CLASSIFICATION }, // 852 + { "cycle", CYCLE }, // 853 + { "decimal-encoding", DECIMAL_ENCODING }, // 854 + { "entry-convention", ENTRY_CONVENTION }, // 855 + { "eol", EOL }, // 856 + { "eos", EOS }, // 857 + { "erase", ERASE }, // 858 + { "expands", EXPANDS }, // 859 + { "float-binary", FLOAT_BINARY }, // 860 + { "float-decimal", FLOAT_DECIMAL }, // 861 + { "foreground-color", FOREGROUND_COLOR }, // 862 + { "forever", FOREVER }, // 863 + { "full", FULL }, // 864 + { "highlight", HIGHLIGHT }, // 865 + { "high-order-left", HIGH_ORDER_LEFT }, // 866 + { "high-order-right", HIGH_ORDER_RIGHT }, // 867 + { "ignoring", IGNORING }, // 868 + { "implements", IMPLEMENTS }, // 869 + { "initialized", INITIALIZED }, // 870 + { "intermediate", INTERMEDIATE }, // 871 + { "lc-all", LC_ALL_kw }, // 872 + { "lc-collate", LC_COLLATE_kw }, // 873 + { "lc-ctype", LC_CTYPE_kw }, // 874 + { "lc-messages", LC_MESSAGES_kw }, // 875 + { "lc-monetary", LC_MONETARY_kw }, // 876 + { "lc-numeric", LC_NUMERIC_kw }, // 877 + { "lc-time", LC_TIME_kw }, // 878 + { "lowlight", LOWLIGHT }, // 879 + { "nearest-away-from-zero", NEAREST_AWAY_FROM_ZERO }, // 880 + { "nearest-even", NEAREST_EVEN }, // 881 + { "nearest-toward-zero", NEAREST_TOWARD_ZERO }, // 882 + { "none", NONE }, // 883 + { "normal", NORMAL }, // 884 + { "numbers", NUMBERS }, // 885 + { "prefixed", PREFIXED }, // 886 + { "previous", PREVIOUS }, // 887 + { "prohibited", PROHIBITED }, // 888 + { "relation", RELATION }, // 889 + { "required", REQUIRED }, // 890 + { "reverse-video", REVERSE_VIDEO }, // 891 + { "rounding", ROUNDING }, // 892 + { "seconds", SECONDS }, // 893 + { "secure", SECURE }, // 894 + { "short", SHORT }, // 895 + { "signed", SIGNED_kw }, // 896 + { "standard-binary", STANDARD_BINARY }, // 897 + { "standard-decimal", STANDARD_DECIMAL }, // 898 + { "statement", STATEMENT }, // 899 + { "step", STEP }, // 900 + { "structure", STRUCTURE }, // 901 + { "toward-greater", TOWARD_GREATER }, // 902 + { "toward-lesser", TOWARD_LESSER }, // 903 + { "truncation", TRUNCATION }, // 904 + { "ucs-4", UCS_4 }, // 905 + { "underline", UNDERLINE }, // 906 + { "unsigned", UNSIGNED_kw }, // 907 + { "utf-16", UTF_16 }, // 908 + { "utf-8", UTF_8 }, // 909 + { "address", ADDRESS }, // 910 + { "end-accept", END_ACCEPT }, // 911 + { "end-add", END_ADD }, // 912 + { "end-call", END_CALL }, // 913 + { "end-compute", END_COMPUTE }, // 914 + { "end-delete", END_DELETE }, // 915 + { "end-display", END_DISPLAY }, // 916 + { "end-divide", END_DIVIDE }, // 917 + { "end-evaluate", END_EVALUATE }, // 918 + { "end-multiply", END_MULTIPLY }, // 919 + { "end-perform", END_PERFORM }, // 920 + { "end-read", END_READ }, // 921 + { "end-return", END_RETURN }, // 922 + { "end-rewrite", END_REWRITE }, // 923 + { "end-search", END_SEARCH }, // 924 + { "end-start", END_START }, // 925 + { "end-string", END_STRING }, // 926 + { "end-subtract", END_SUBTRACT }, // 927 + { "end-unstring", END_UNSTRING }, // 928 + { "end-write", END_WRITE }, // 929 + { "end-if", END_IF }, // 930 + { "thru", THRU }, // 931 + { "through", THRU }, // 931 + { "or", OR }, // 932 + { "and", AND }, // 933 + { "not", NOT }, // 934 + { "ne", NE }, // 935 + { "le", LE }, // 936 + { "ge", GE }, // 937 + { "pow", POW }, // 938 + { "neg", NEG }, // 939 }; token_names = { - "IDENTIFICATION", // 0 (258) - "ENVIRONMENT", // 1 (259) - "PROCEDURE", // 2 (260) - "DATA", // 3 (261) - "FILE", // 4 (262) - "INPUT-OUTPUT", // 5 (263) - "LINKAGE", // 6 (264) - "LOCAL-STORAGE", // 7 (265) - "WORKING-STORAGE", // 8 (266) - "OBJECT-COMPUTER", // 9 (267) - "DISPLAY-OF", // 10 (268) - "END-FUNCTION", // 11 (269) - "END-PROGRAM", // 12 (270) - "END-SUBPROGRAM", // 13 (271) - "JUSTIFIED", // 14 (272) - "RETURNING", // 15 (273) - "NO-CONDITION", // 16 (274) - "ALNUM", // 17 (275) - "ALPHED", // 18 (276) - "ERROR", // 19 (277) - "EXCEPTION", // 20 (278) - "SIZE-ERROR", // 21 (279) - "EXCEPTION-NAME", // 22 (280) - "LEVEL", // 23 (281) - "LEVEL66", // 24 (282) - "LEVEL78", // 25 (283) - "LEVEL88", // 26 (284) - "CLASS-NAME", // 27 (285) - "NAME", // 28 (286) - "NAME88", // 29 (287) - "NUME", // 30 (288) - "NUMED", // 31 (289) - "NUMED-CR", // 32 (290) - "NUMED-DB", // 33 (291) - "NINEDOT", // 34 (292) - "NINES", // 35 (293) - "NINEV", // 36 (294) - "PIC-P", // 37 (295) - "SPACES", // 38 (296) - "LITERAL", // 39 (297) - "END", // 40 (298) - "EOP", // 41 (299) - "FILENAME", // 42 (300) - "INVALID", // 43 (301) - "NUMBER", // 44 (302) - "NEGATIVE", // 45 (303) - "NUMSTR", // 46 (304) - "OVERFLOW", // 47 (305) - "COMPUTATIONAL", // 48 (306) - "PERFORM", // 49 (307) - "BACKWARD", // 50 (308) - "POSITIVE", // 51 (309) - "POINTER", // 52 (310) - "SECTION", // 53 (311) - "STANDARD-ALPHABET", // 54 (312) - "SWITCH", // 55 (313) - "UPSI", // 56 (314) - "ZERO", // 57 (315) - "SYSIN", // 58 (316) - "SYSIPT", // 59 (317) - "SYSOUT", // 60 (318) - "SYSLIST", // 61 (319) - "SYSLST", // 62 (320) - "SYSPUNCH", // 63 (321) - "SYSPCH", // 64 (322) - "CONSOLE", // 65 (323) - "C01", // 66 (324) - "C02", // 67 (325) - "C03", // 68 (326) - "C04", // 69 (327) - "C05", // 70 (328) - "C06", // 71 (329) - "C07", // 72 (330) - "C08", // 73 (331) - "C09", // 74 (332) - "C10", // 75 (333) - "C11", // 76 (334) - "C12", // 77 (335) - "CSP", // 78 (336) - "S01", // 79 (337) - "S02", // 80 (338) - "S03", // 81 (339) - "S04", // 82 (340) - "S05", // 83 (341) - "AFP-5A", // 84 (342) - "STDIN", // 85 (343) - "STDOUT", // 86 (344) - "STDERR", // 87 (345) - "LIST", // 88 (346) - "MAP", // 89 (347) - "NOLIST", // 90 (348) - "NOMAP", // 91 (349) - "NOSOURCE", // 92 (350) - "MIGHT-BE", // 93 (351) - "FUNCTION-UDF", // 94 (352) - "FUNCTION-UDF-0", // 95 (353) - "DATE-FMT", // 96 (354) - "TIME-FMT", // 97 (355) - "DATETIME-FMT", // 98 (356) - "BASIS", // 99 (357) - "CBL", // 100 (358) - "CONSTANT", // 101 (359) - "COPY", // 102 (360) - "DEFINED", // 103 (361) - "ENTER", // 104 (362) - "FEATURE", // 105 (363) - "INSERTT", // 106 (364) - "LSUB", // 107 (365) - "PARAMETER", // 108 (366) - "OVERRIDE", // 109 (367) - "READY", // 110 (368) - "RESET", // 111 (369) - "RSUB", // 112 (370) - "SERVICE-RELOAD", // 113 (371) - "STAR-CBL", // 114 (372) - "SUBSCRIPT", // 115 (373) - "SUPPRESS", // 116 (374) - "TITLE", // 117 (375) - "TRACE", // 118 (376) - "USE", // 119 (377) - "COBOL-WORDS", // 120 (378) - "EQUATE", // 121 (379) - "UNDEFINE", // 122 (380) - "CDF-DEFINE", // 123 (381) - "CDF-DISPLAY", // 124 (382) - "CDF-IF", // 125 (383) - "CDF-ELSE", // 126 (384) - "CDF-END-IF", // 127 (385) - "CDF-EVALUATE", // 128 (386) - "CDF-WHEN", // 129 (387) - "CDF-END-EVALUATE", // 130 (388) - "CALL-COBOL", // 131 (389) - "CALL-VERBATIM", // 132 (390) - "IF", // 133 (391) - "THEN", // 134 (392) - "ELSE", // 135 (393) - "SENTENCE", // 136 (394) - "ACCEPT", // 137 (395) - "ADD", // 138 (396) - "ALTER", // 139 (397) - "CALL", // 140 (398) - "CANCEL", // 141 (399) - "CLOSE", // 142 (400) - "COMPUTE", // 143 (401) - "CONTINUE", // 144 (402) - "DELETE", // 145 (403) - "DISPLAY", // 146 (404) - "DIVIDE", // 147 (405) - "EVALUATE", // 148 (406) - "EXIT", // 149 (407) - "FILLER", // 150 (408) - "GOBACK", // 151 (409) - "GOTO", // 152 (410) - "INITIALIZE", // 153 (411) - "INSPECT", // 154 (412) - "MERGE", // 155 (413) - "MOVE", // 156 (414) - "MULTIPLY", // 157 (415) - "OPEN", // 158 (416) - "PARAGRAPH", // 159 (417) - "READ", // 160 (418) - "RELEASE", // 161 (419) - "RETURN", // 162 (420) - "REWRITE", // 163 (421) - "SEARCH", // 164 (422) - "SET", // 165 (423) - "SELECT", // 166 (424) - "SORT", // 167 (425) - "SORT-MERGE", // 168 (426) - "STRING", // 169 (427) - "STOP", // 170 (428) - "SUBTRACT", // 171 (429) - "START", // 172 (430) - "UNSTRING", // 173 (431) - "WRITE", // 174 (432) - "WHEN", // 175 (433) - "ABS", // 176 (434) - "ACCESS", // 177 (435) - "ACOS", // 178 (436) - "ACTUAL", // 179 (437) - "ADVANCING", // 180 (438) - "AFTER", // 181 (439) - "ALL", // 182 (440) - "ALLOCATE", // 183 (441) - "ALPHABET", // 184 (442) - "ALPHABETIC", // 185 (443) - "ALPHABETIC-LOWER", // 186 (444) - "ALPHABETIC-UPPER", // 187 (445) - "ALPHANUMERIC", // 188 (446) - "ALPHANUMERIC-EDITED", // 189 (447) - "ALSO", // 190 (448) - "ALTERNATE", // 191 (449) - "ANNUITY", // 192 (450) - "ANUM", // 193 (451) - "ANY", // 194 (452) - "ANYCASE", // 195 (453) - "APPLY", // 196 (454) - "ARE", // 197 (455) - "AREA", // 198 (456) - "AREAS", // 199 (457) - "AS", // 200 (458) - "ASCENDING", // 201 (459) - "ACTIVATING", // 202 (460) - "ASIN", // 203 (461) - "ASSIGN", // 204 (462) - "AT", // 205 (463) - "ATAN", // 206 (464) - "BASED", // 207 (465) - "BASECONVERT", // 208 (466) - "BEFORE", // 209 (467) - "BINARY", // 210 (468) - "BIT", // 211 (469) - "BIT-OF", // 212 (470) - "BIT-TO-CHAR", // 213 (471) - "BLANK", // 214 (472) - "BLOCK", // 215 (473) - "BOOLEAN-OF-INTEGER", // 216 (474) - "BOTTOM", // 217 (475) - "BY", // 218 (476) - "BYTE", // 219 (477) - "BYTE-LENGTH", // 220 (478) - "CF", // 221 (479) - "CH", // 222 (480) - "CHANGED", // 223 (481) - "CHAR", // 224 (482) - "CHAR-NATIONAL", // 225 (483) - "CHARACTER", // 226 (484) - "CHARACTERS", // 227 (485) - "CHECKING", // 228 (486) - "CLASS", // 229 (487) - "COBOL", // 230 (488) - "CODE", // 231 (489) - "CODE-SET", // 232 (490) - "COLLATING", // 233 (491) - "COLUMN", // 234 (492) - "COMBINED-DATETIME", // 235 (493) - "COMMA", // 236 (494) - "COMMAND-LINE", // 237 (495) - "COMMAND-LINE-COUNT", // 238 (496) - "COMMIT", // 239 (497) - "COMMON", // 240 (498) - "CONCAT", // 241 (499) - "CONDITION", // 242 (500) - "CONFIGURATION", // 243 (501) - "CONTAINS", // 244 (502) - "CONTENT", // 245 (503) - "CONTROL", // 246 (504) - "CONTROLS", // 247 (505) - "CONVERT", // 248 (506) - "CONVERTING", // 249 (507) - "CORRESPONDING", // 250 (508) - "COS", // 251 (509) - "COUNT", // 252 (510) - "CURRENCY", // 253 (511) - "CURRENT", // 254 (512) - "CURRENT-DATE", // 255 (513) - "DATA", // 256 (514) - "DATE", // 257 (515) - "DATE-COMPILED", // 258 (516) - "DATE-OF-INTEGER", // 259 (517) - "DATE-TO-YYYYMMDD", // 260 (518) - "DATE-WRITTEN", // 261 (519) - "DAY", // 262 (520) - "DAY-OF-INTEGER", // 263 (521) - "DAY-OF-WEEK", // 264 (522) - "DAY-TO-YYYYDDD", // 265 (523) - "DBCS", // 266 (524) - "DE", // 267 (525) - "DEBUGGING", // 268 (526) - "DECIMAL-POINT", // 269 (527) - "DECLARATIVES", // 270 (528) - "DEFAULT", // 271 (529) - "DELIMITED", // 272 (530) - "DELIMITER", // 273 (531) - "DEPENDING", // 274 (532) - "DESCENDING", // 275 (533) - "DETAIL", // 276 (534) - "DIRECT", // 277 (535) - "DIRECT-ACCESS", // 278 (536) - "DOWN", // 279 (537) - "DUPLICATES", // 280 (538) - "DYNAMIC", // 281 (539) - "E", // 282 (540) - "EBCDIC", // 283 (541) - "EC", // 284 (542) - "EGCS", // 285 (543) - "ENTRY", // 286 (544) - "ENVIRONMENT", // 287 (545) - "EQUAL", // 288 (546) - "EVERY", // 289 (547) - "EXAMINE", // 290 (548) - "EXHIBIT", // 291 (549) - "EXP", // 292 (550) - "EXP10", // 293 (551) - "EXTEND", // 294 (552) - "EXTERNAL", // 295 (553) - "EXCEPTION-FILE", // 296 (554) - "EXCEPTION-FILE-N", // 297 (555) - "EXCEPTION-LOCATION", // 298 (556) - "EXCEPTION-LOCATION-N", // 299 (557) - "EXCEPTION-STATEMENT", // 300 (558) - "EXCEPTION-STATUS", // 301 (559) - "FACTORIAL", // 302 (560) - "FALSE", // 303 (561) - "FD", // 304 (562) - "FILE-CONTROL", // 305 (563) - "FILE", // 306 (564) - "FILE-LIMIT", // 307 (565) - "FINAL", // 308 (566) - "FINALLY", // 309 (567) - "FIND-STRING", // 310 (568) - "FIRST", // 311 (569) - "FIXED", // 312 (570) - "FOOTING", // 313 (571) - "FOR", // 314 (572) - "FORMATTED-CURRENT-DATE", // 315 (573) - "FORMATTED-DATE", // 316 (574) - "FORMATTED-DATETIME", // 317 (575) - "FORMATTED-TIME", // 318 (576) - "FORM-OVERFLOW", // 319 (577) - "FREE", // 320 (578) - "FRACTION-PART", // 321 (579) - "FROM", // 322 (580) - "FUNCTION", // 323 (581) - "GENERATE", // 324 (582) - "GIVING", // 325 (583) - "GLOBAL", // 326 (584) - "GO", // 327 (585) - "GROUP", // 328 (586) - "HEADING", // 329 (587) - "HEX", // 330 (588) - "HEX-OF", // 331 (589) - "HEX-TO-CHAR", // 332 (590) - "HIGH-VALUES", // 333 (591) - "HIGHEST-ALGEBRAIC", // 334 (592) - "HOLD", // 335 (593) - "IBM-360", // 336 (594) - "IN", // 337 (595) - "INCLUDE", // 338 (596) - "INDEX", // 339 (597) - "INDEXED", // 340 (598) - "INDICATE", // 341 (599) - "INITIAL", // 342 (600) - "INITIATE", // 343 (601) - "INPUT", // 344 (602) - "INSTALLATION", // 345 (603) - "INTERFACE", // 346 (604) - "INTEGER", // 347 (605) - "INTEGER-OF-BOOLEAN", // 348 (606) - "INTEGER-OF-DATE", // 349 (607) - "INTEGER-OF-DAY", // 350 (608) - "INTEGER-OF-FORMATTED-DATE", // 351 (609) - "INTEGER-PART", // 352 (610) - "INTO", // 353 (611) - "INTRINSIC", // 354 (612) - "INVOKE", // 355 (613) - "I-O", // 356 (614) - "I-O-CONTROL", // 357 (615) - "IS", // 358 (616) - "ISNT", // 359 (617) - "KANJI", // 360 (618) - "KEY", // 361 (619) - "LABEL", // 362 (620) - "LAST", // 363 (621) - "LEADING", // 364 (622) - "LEFT", // 365 (623) - "LENGTH", // 366 (624) - "LENGTH-OF", // 367 (625) - "LIMIT", // 368 (626) - "LIMITS", // 369 (627) - "LINE", // 370 (628) - "LINES", // 371 (629) - "LINE-COUNTER", // 372 (630) - "LINAGE", // 373 (631) - "LINKAGE", // 374 (632) - "LOCALE", // 375 (633) - "LOCALE-COMPARE", // 376 (634) - "LOCALE-DATE", // 377 (635) - "LOCALE-TIME", // 378 (636) - "LOCALE-TIME-FROM-SECONDS", // 379 (637) - "LOCAL-STORAGE", // 380 (638) - "LOCATION", // 381 (639) - "LOCK", // 382 (640) - "LOCK-ON", // 383 (641) - "LOG", // 384 (642) - "LOG10", // 385 (643) - "LOWER-CASE", // 386 (644) - "LOW-VALUES", // 387 (645) - "LOWEST-ALGEBRAIC", // 388 (646) - "LPAREN", // 389 (647) - "MANUAL", // 390 (648) - "MAXX", // 391 (649) - "MEAN", // 392 (650) - "MEDIAN", // 393 (651) - "MIDRANGE", // 394 (652) - "MINN", // 395 (653) - "MULTIPLE", // 396 (654) - "MOD", // 397 (655) - "MODE", // 398 (656) - "MODULE-NAME", // 399 (657) - "NAMED", // 400 (658) - "NAT", // 401 (659) - "NATIONAL", // 402 (660) - "NATIONAL-EDITED", // 403 (661) - "NATIONAL-OF", // 404 (662) - "NATIVE", // 405 (663) - "NESTED", // 406 (664) - "NEXT", // 407 (665) - "NO", // 408 (666) - "NOTE", // 409 (667) - "NULLS", // 410 (668) - "NULLPTR", // 411 (669) - "NUMERIC", // 412 (670) - "NUMERIC-EDITED", // 413 (671) - "NUMVAL", // 414 (672) - "NUMVAL-C", // 415 (673) - "NUMVAL-F", // 416 (674) - "OCCURS", // 417 (675) - "OF", // 418 (676) - "OFF", // 419 (677) - "OMITTED", // 420 (678) - "ON", // 421 (679) - "ONLY", // 422 (680) - "OPTIONAL", // 423 (681) - "OPTIONS", // 424 (682) - "ORD", // 425 (683) - "ORDER", // 426 (684) - "ORD-MAX", // 427 (685) - "ORD-MIN", // 428 (686) - "ORGANIZATION", // 429 (687) - "OTHER", // 430 (688) - "OTHERWISE", // 431 (689) - "OUTPUT", // 432 (690) - "PACKED-DECIMAL", // 433 (691) - "PADDING", // 434 (692) - "PAGE", // 435 (693) - "PAGE-COUNTER", // 436 (694) - "PF", // 437 (695) - "PH", // 438 (696) - "PI", // 439 (697) - "PIC", // 440 (698) - "PICTURE", // 441 (699) - "PLUS", // 442 (700) - "PRESENT-VALUE", // 443 (701) - "PRINT-SWITCH", // 444 (702) - "PROCEDURE", // 445 (703) - "PROCEDURES", // 446 (704) - "PROCEED", // 447 (705) - "PROCESS", // 448 (706) - "PROGRAM-ID", // 449 (707) - "PROGRAM", // 450 (708) - "PROPERTY", // 451 (709) - "PROTOTYPE", // 452 (710) - "PSEUDOTEXT", // 453 (711) - "QUOTES", // 454 (712) - "RANDOM", // 455 (713) - "RANDOM-SEED", // 456 (714) - "RANGE", // 457 (715) - "RAISE", // 458 (716) - "RAISING", // 459 (717) - "RD", // 460 (718) - "RECORD", // 461 (719) - "RECORDING", // 462 (720) - "RECORDS", // 463 (721) - "RECURSIVE", // 464 (722) - "REDEFINES", // 465 (723) - "REEL", // 466 (724) - "REFERENCE", // 467 (725) - "RELATIVE", // 468 (726) - "REM", // 469 (727) - "REMAINDER", // 470 (728) - "REMARKS", // 471 (729) - "REMOVAL", // 472 (730) - "RENAMES", // 473 (731) - "REPLACE", // 474 (732) - "REPLACING", // 475 (733) - "REPORT", // 476 (734) - "REPORTING", // 477 (735) - "REPORTS", // 478 (736) - "REPOSITORY", // 479 (737) - "RERUN", // 480 (738) - "RESERVE", // 481 (739) - "RESTRICTED", // 482 (740) - "RESUME", // 483 (741) - "REVERSE", // 484 (742) - "REVERSED", // 485 (743) - "REWIND", // 486 (744) - "RF", // 487 (745) - "RH", // 488 (746) - "RIGHT", // 489 (747) - "ROUNDED", // 490 (748) - "RUN", // 491 (749) - "SAME", // 492 (750) - "SCREEN", // 493 (751) - "SD", // 494 (752) - "SECONDS-FROM-FORMATTED-TIME", // 495 (753) - "SECONDS-PAST-MIDNIGHT", // 496 (754) - "SECURITY", // 497 (755) - "SEPARATE", // 498 (756) - "SEQUENCE", // 499 (757) - "SEQUENTIAL", // 500 (758) - "SHARING", // 501 (759) - "SIMPLE-EXIT", // 502 (760) - "SIGN", // 503 (761) - "SIN", // 504 (762) - "SIZE", // 505 (763) - "SMALLEST-ALGEBRAIC", // 506 (764) - "SOURCE", // 507 (765) - "SOURCE-COMPUTER", // 508 (766) - "SPECIAL-NAMES", // 509 (767) - "SQRT", // 510 (768) - "STACK", // 511 (769) - "STANDARD", // 512 (770) - "STANDARD-1", // 513 (771) - "STANDARD-DEVIATION", // 514 (772) - "STANDARD-COMPARE", // 515 (773) - "STATUS", // 516 (774) - "STRONG", // 517 (775) - "SUBSTITUTE", // 518 (776) - "SUM", // 519 (777) - "SYMBOL", // 520 (778) - "SYMBOLIC", // 521 (779) - "SYNCHRONIZED", // 522 (780) - "TALLY", // 523 (781) - "TALLYING", // 524 (782) - "TAN", // 525 (783) - "TERMINATE", // 526 (784) - "TEST", // 527 (785) - "TEST-DATE-YYYYMMDD", // 528 (786) - "TEST-DAY-YYYYDDD", // 529 (787) - "TEST-FORMATTED-DATETIME", // 530 (788) - "TEST-NUMVAL", // 531 (789) - "TEST-NUMVAL-C", // 532 (790) - "TEST-NUMVAL-F", // 533 (791) - "THAN", // 534 (792) - "TIME", // 535 (793) - "TIMES", // 536 (794) - "TO", // 537 (795) - "TOP", // 538 (796) - "TOP-LEVEL", // 539 (797) - "TRACKS", // 540 (798) - "TRACK-AREA", // 541 (799) - "TRAILING", // 542 (800) - "TRANSFORM", // 543 (801) - "TRIM", // 544 (802) - "TRUE", // 545 (803) - "TRY", // 546 (804) - "TURN", // 547 (805) - "TYPE", // 548 (806) - "TYPEDEF", // 549 (807) - "ULENGTH", // 550 (808) - "UNBOUNDED", // 551 (809) - "UNIT", // 552 (810) - "UNITS", // 553 (811) - "UNIT-RECORD", // 554 (812) - "UNTIL", // 555 (813) - "UP", // 556 (814) - "UPON", // 557 (815) - "UPOS", // 558 (816) - "UPPER-CASE", // 559 (817) - "USAGE", // 560 (818) - "USING", // 561 (819) - "USUBSTR", // 562 (820) - "USUPPLEMENTARY", // 563 (821) - "UTILITY", // 564 (822) - "UUID4", // 565 (823) - "UVALID", // 566 (824) - "UWIDTH", // 567 (825) - "VALUE", // 568 (826) - "VARIANCE", // 569 (827) - "VARYING", // 570 (828) - "VOLATILE", // 571 (829) - "WHEN-COMPILED", // 572 (830) - "WITH", // 573 (831) - "WORKING-STORAGE", // 574 (832) - "XML", // 575 (833) - "XMLGENERATE", // 576 (834) - "XMLPARSE", // 577 (835) - "YEAR-TO-YYYY", // 578 (836) - "YYYYDDD", // 579 (837) - "YYYYMMDD", // 580 (838) - "ARITHMETIC", // 581 (839) - "ATTRIBUTE", // 582 (840) - "AUTO", // 583 (841) - "AUTOMATIC", // 584 (842) - "AWAY-FROM-ZERO", // 585 (843) - "BACKGROUND-COLOR", // 586 (844) - "BELL", // 587 (845) - "BINARY-ENCODING", // 588 (846) - "BLINK", // 589 (847) - "CAPACITY", // 590 (848) - "CENTER", // 591 (849) - "CLASSIFICATION", // 592 (850) - "CYCLE", // 593 (851) - "DECIMAL-ENCODING", // 594 (852) - "ENTRY-CONVENTION", // 595 (853) - "EOL", // 596 (854) - "EOS", // 597 (855) - "ERASE", // 598 (856) - "EXPANDS", // 599 (857) - "FLOAT-BINARY", // 600 (858) - "FLOAT-DECIMAL", // 601 (859) - "FOREGROUND-COLOR", // 602 (860) - "FOREVER", // 603 (861) - "FULL", // 604 (862) - "HIGHLIGHT", // 605 (863) - "HIGH-ORDER-LEFT", // 606 (864) - "HIGH-ORDER-RIGHT", // 607 (865) - "IGNORING", // 608 (866) - "IMPLEMENTS", // 609 (867) - "INITIALIZED", // 610 (868) - "INTERMEDIATE", // 611 (869) - "LC-ALL", // 612 (870) - "LC-COLLATE", // 613 (871) - "LC-CTYPE", // 614 (872) - "LC-MESSAGES", // 615 (873) - "LC-MONETARY", // 616 (874) - "LC-NUMERIC", // 617 (875) - "LC-TIME", // 618 (876) - "LOWLIGHT", // 619 (877) - "NEAREST-AWAY-FROM-ZERO", // 620 (878) - "NEAREST-EVEN", // 621 (879) - "NEAREST-TOWARD-ZERO", // 622 (880) - "NONE", // 623 (881) - "NORMAL", // 624 (882) - "NUMBERS", // 625 (883) - "PREFIXED", // 626 (884) - "PREVIOUS", // 627 (885) - "PROHIBITED", // 628 (886) - "RELATION", // 629 (887) - "REQUIRED", // 630 (888) - "REVERSE-VIDEO", // 631 (889) - "ROUNDING", // 632 (890) - "SECONDS", // 633 (891) - "SECURE", // 634 (892) - "SHORT", // 635 (893) - "SIGNED", // 636 (894) - "STANDARD-BINARY", // 637 (895) - "STANDARD-DECIMAL", // 638 (896) - "STATEMENT", // 639 (897) - "STEP", // 640 (898) - "STRUCTURE", // 641 (899) - "TOWARD-GREATER", // 642 (900) - "TOWARD-LESSER", // 643 (901) - "TRUNCATION", // 644 (902) - "UCS-4", // 645 (903) - "UNDERLINE", // 646 (904) - "UNSIGNED", // 647 (905) - "UTF-16", // 648 (906) - "UTF-8", // 649 (907) - "ADDRESS", // 650 (908) - "END-ACCEPT", // 651 (909) - "END-ADD", // 652 (910) - "END-CALL", // 653 (911) - "END-COMPUTE", // 654 (912) - "END-DELETE", // 655 (913) - "END-DISPLAY", // 656 (914) - "END-DIVIDE", // 657 (915) - "END-EVALUATE", // 658 (916) - "END-MULTIPLY", // 659 (917) - "END-PERFORM", // 660 (918) - "END-READ", // 661 (919) - "END-RETURN", // 662 (920) - "END-REWRITE", // 663 (921) - "END-SEARCH", // 664 (922) - "END-START", // 665 (923) - "END-STRING", // 666 (924) - "END-SUBTRACT", // 667 (925) - "END-UNSTRING", // 668 (926) - "END-WRITE", // 669 (927) - "END-IF", // 670 (928) - "THRU", // 671 (929) - "OR", // 672 (930) - "AND", // 673 (931) - "NOT", // 674 (932) - "NE", // 675 (933) - "LE", // 676 (934) - "GE", // 677 (935) - "POW", // 678 (936) - "NEG", // 679 (937) + "IDENTIFICATION", // 0 (258) + "ENVIRONMENT", // 1 (259) + "PROCEDURE", // 2 (260) + "DATA", // 3 (261) + "FILE", // 4 (262) + "INPUT-OUTPUT", // 5 (263) + "LINKAGE", // 6 (264) + "LOCAL-STORAGE", // 7 (265) + "WORKING-STORAGE", // 8 (266) + "OBJECT-COMPUTER", // 9 (267) + "DISPLAY-OF", // 10 (268) + "END-FUNCTION", // 11 (269) + "END-PROGRAM", // 12 (270) + "END-SUBPROGRAM", // 13 (271) + "JUSTIFIED", // 14 (272) + "RETURNING", // 15 (273) + "NO-CONDITION", // 16 (274) + "ALNUM", // 17 (275) + "ALPHED", // 18 (276) + "ERROR", // 19 (277) + "EXCEPTION", // 20 (278) + "SIZE-ERROR", // 21 (279) + "EXCEPTION-NAME", // 22 (280) + "LEVEL", // 23 (281) + "LEVEL66", // 24 (282) + "LEVEL78", // 25 (283) + "LEVEL88", // 26 (284) + "CLASS-NAME", // 27 (285) + "NAME", // 28 (286) + "NAME88", // 29 (287) + "NUME", // 30 (288) + "NUMED", // 31 (289) + "NUMED-CR", // 32 (290) + "NUMED-DB", // 33 (291) + "NINEDOT", // 34 (292) + "NINES", // 35 (293) + "NINEV", // 36 (294) + "PIC-P", // 37 (295) + "ONES", // 38 (296) + "SPACES", // 39 (297) + "LITERAL", // 40 (298) + "END", // 41 (299) + "EOP", // 42 (300) + "FILENAME", // 43 (301) + "INVALID", // 44 (302) + "NUMBER", // 45 (303) + "NEGATIVE", // 46 (304) + "NUMSTR", // 47 (305) + "OVERFLOW", // 48 (306) + "BINARY-INTEGER", // 49 (307) + "COMPUTATIONAL", // 50 (308) + "PERFORM", // 51 (309) + "BACKWARD", // 52 (310) + "POSITIVE", // 53 (311) + "POINTER", // 54 (312) + "SECTION", // 55 (313) + "STANDARD-ALPHABET", // 56 (314) + "SWITCH", // 57 (315) + "UPSI", // 58 (316) + "ZERO", // 59 (317) + "SYSIN", // 60 (318) + "SYSIPT", // 61 (319) + "SYSOUT", // 62 (320) + "SYSLIST", // 63 (321) + "SYSLST", // 64 (322) + "SYSPUNCH", // 65 (323) + "SYSPCH", // 66 (324) + "CONSOLE", // 67 (325) + "C01", // 68 (326) + "C02", // 69 (327) + "C03", // 70 (328) + "C04", // 71 (329) + "C05", // 72 (330) + "C06", // 73 (331) + "C07", // 74 (332) + "C08", // 75 (333) + "C09", // 76 (334) + "C10", // 77 (335) + "C11", // 78 (336) + "C12", // 79 (337) + "CSP", // 80 (338) + "S01", // 81 (339) + "S02", // 82 (340) + "S03", // 83 (341) + "S04", // 84 (342) + "S05", // 85 (343) + "AFP-5A", // 86 (344) + "STDIN", // 87 (345) + "STDOUT", // 88 (346) + "STDERR", // 89 (347) + "LIST", // 90 (348) + "MAP", // 91 (349) + "NOLIST", // 92 (350) + "NOMAP", // 93 (351) + "NOSOURCE", // 94 (352) + "MIGHT-BE", // 95 (353) + "FUNCTION-UDF", // 96 (354) + "FUNCTION-UDF-0", // 97 (355) + "DATE-FMT", // 98 (356) + "TIME-FMT", // 99 (357) + "DATETIME-FMT", // 100 (358) + "BASIS", // 101 (359) + "CBL", // 102 (360) + "CONSTANT", // 103 (361) + "COPY", // 104 (362) + "DEFINED", // 105 (363) + "ENTER", // 106 (364) + "FEATURE", // 107 (365) + "INSERTT", // 108 (366) + "LSUB", // 109 (367) + "PARAMETER", // 110 (368) + "OVERRIDE", // 111 (369) + "READY", // 112 (370) + "RESET", // 113 (371) + "RSUB", // 114 (372) + "SERVICE-RELOAD", // 115 (373) + "STAR-CBL", // 116 (374) + "SUBSCRIPT", // 117 (375) + "SUPPRESS", // 118 (376) + "TITLE", // 119 (377) + "TRACE", // 120 (378) + "USE", // 121 (379) + "COBOL-WORDS", // 122 (380) + "EQUATE", // 123 (381) + "UNDEFINE", // 124 (382) + "CDF-DEFINE", // 125 (383) + "CDF-DISPLAY", // 126 (384) + "CDF-IF", // 127 (385) + "CDF-ELSE", // 128 (386) + "CDF-END-IF", // 129 (387) + "CDF-EVALUATE", // 130 (388) + "CDF-WHEN", // 131 (389) + "CDF-END-EVALUATE", // 132 (390) + "CALL-COBOL", // 133 (391) + "CALL-VERBATIM", // 134 (392) + "IF", // 135 (393) + "THEN", // 136 (394) + "ELSE", // 137 (395) + "SENTENCE", // 138 (396) + "ACCEPT", // 139 (397) + "ADD", // 140 (398) + "ALTER", // 141 (399) + "CALL", // 142 (400) + "CANCEL", // 143 (401) + "CLOSE", // 144 (402) + "COMPUTE", // 145 (403) + "CONTINUE", // 146 (404) + "DELETE", // 147 (405) + "DISPLAY", // 148 (406) + "DIVIDE", // 149 (407) + "EVALUATE", // 150 (408) + "EXIT", // 151 (409) + "FILLER", // 152 (410) + "GOBACK", // 153 (411) + "GOTO", // 154 (412) + "INITIALIZE", // 155 (413) + "INSPECT", // 156 (414) + "MERGE", // 157 (415) + "MOVE", // 158 (416) + "MULTIPLY", // 159 (417) + "OPEN", // 160 (418) + "PARAGRAPH", // 161 (419) + "READ", // 162 (420) + "RELEASE", // 163 (421) + "RETURN", // 164 (422) + "REWRITE", // 165 (423) + "SEARCH", // 166 (424) + "SET", // 167 (425) + "SELECT", // 168 (426) + "SORT", // 169 (427) + "SORT-MERGE", // 170 (428) + "STRING", // 171 (429) + "STOP", // 172 (430) + "SUBTRACT", // 173 (431) + "START", // 174 (432) + "UNSTRING", // 175 (433) + "WRITE", // 176 (434) + "WHEN", // 177 (435) + "ABS", // 178 (436) + "ACCESS", // 179 (437) + "ACOS", // 180 (438) + "ACTUAL", // 181 (439) + "ADVANCING", // 182 (440) + "AFTER", // 183 (441) + "ALL", // 184 (442) + "ALLOCATE", // 185 (443) + "ALPHABET", // 186 (444) + "ALPHABETIC", // 187 (445) + "ALPHABETIC-LOWER", // 188 (446) + "ALPHABETIC-UPPER", // 189 (447) + "ALPHANUMERIC", // 190 (448) + "ALPHANUMERIC-EDITED", // 191 (449) + "ALSO", // 192 (450) + "ALTERNATE", // 193 (451) + "ANNUITY", // 194 (452) + "ANUM", // 195 (453) + "ANY", // 196 (454) + "ANYCASE", // 197 (455) + "APPLY", // 198 (456) + "ARE", // 199 (457) + "AREA", // 200 (458) + "AREAS", // 201 (459) + "AS", // 202 (460) + "ASCENDING", // 203 (461) + "ACTIVATING", // 204 (462) + "ASIN", // 205 (463) + "ASSIGN", // 206 (464) + "AT", // 207 (465) + "ATAN", // 208 (466) + "BASED", // 209 (467) + "BASECONVERT", // 210 (468) + "BEFORE", // 211 (469) + "BINARY", // 212 (470) + "BIT", // 213 (471) + "BIT-OF", // 214 (472) + "BIT-TO-CHAR", // 215 (473) + "BLANK", // 216 (474) + "BLOCK", // 217 (475) + "BOOLEAN-OF-INTEGER", // 218 (476) + "BOTTOM", // 219 (477) + "BY", // 220 (478) + "BYTE", // 221 (479) + "BYTE-LENGTH", // 222 (480) + "CF", // 223 (481) + "CH", // 224 (482) + "CHANGED", // 225 (483) + "CHAR", // 226 (484) + "CHAR-NATIONAL", // 227 (485) + "CHARACTER", // 228 (486) + "CHARACTERS", // 229 (487) + "CHECKING", // 230 (488) + "CLASS", // 231 (489) + "COBOL", // 232 (490) + "CODE", // 233 (491) + "CODE-SET", // 234 (492) + "COLLATING", // 235 (493) + "COLUMN", // 236 (494) + "COMBINED-DATETIME", // 237 (495) + "COMMA", // 238 (496) + "COMMAND-LINE", // 239 (497) + "COMMAND-LINE-COUNT", // 240 (498) + "COMMIT", // 241 (499) + "COMMON", // 242 (500) + "CONCAT", // 243 (501) + "CONDITION", // 244 (502) + "CONFIGURATION", // 245 (503) + "CONTAINS", // 246 (504) + "CONTENT", // 247 (505) + "CONTROL", // 248 (506) + "CONTROLS", // 249 (507) + "CONVERT", // 250 (508) + "CONVERTING", // 251 (509) + "CORRESPONDING", // 252 (510) + "COS", // 253 (511) + "COUNT", // 254 (512) + "CURRENCY", // 255 (513) + "CURRENT", // 256 (514) + "CURRENT-DATE", // 257 (515) + "DATA", // 258 (516) + "DATE", // 259 (517) + "DATE-COMPILED", // 260 (518) + "DATE-OF-INTEGER", // 261 (519) + "DATE-TO-YYYYMMDD", // 262 (520) + "DATE-WRITTEN", // 263 (521) + "DAY", // 264 (522) + "DAY-OF-INTEGER", // 265 (523) + "DAY-OF-WEEK", // 266 (524) + "DAY-TO-YYYYDDD", // 267 (525) + "DBCS", // 268 (526) + "DE", // 269 (527) + "DEBUGGING", // 270 (528) + "DECIMAL-POINT", // 271 (529) + "DECLARATIVES", // 272 (530) + "DEFAULT", // 273 (531) + "DELIMITED", // 274 (532) + "DELIMITER", // 275 (533) + "DEPENDING", // 276 (534) + "DESCENDING", // 277 (535) + "DETAIL", // 278 (536) + "DIRECT", // 279 (537) + "DIRECT-ACCESS", // 280 (538) + "DOWN", // 281 (539) + "DUPLICATES", // 282 (540) + "DYNAMIC", // 283 (541) + "E", // 284 (542) + "EBCDIC", // 285 (543) + "EC", // 286 (544) + "EGCS", // 287 (545) + "ENTRY", // 288 (546) + "ENVIRONMENT", // 289 (547) + "EQUAL", // 290 (548) + "EVERY", // 291 (549) + "EXAMINE", // 292 (550) + "EXHIBIT", // 293 (551) + "EXP", // 294 (552) + "EXP10", // 295 (553) + "EXTEND", // 296 (554) + "EXTERNAL", // 297 (555) + "EXCEPTION-FILE", // 298 (556) + "EXCEPTION-FILE-N", // 299 (557) + "EXCEPTION-LOCATION", // 300 (558) + "EXCEPTION-LOCATION-N", // 301 (559) + "EXCEPTION-STATEMENT", // 302 (560) + "EXCEPTION-STATUS", // 303 (561) + "FACTORIAL", // 304 (562) + "FALSE", // 305 (563) + "FD", // 306 (564) + "FILE-CONTROL", // 307 (565) + "FILE", // 308 (566) + "FILE-LIMIT", // 309 (567) + "FINAL", // 310 (568) + "FINALLY", // 311 (569) + "FIND-STRING", // 312 (570) + "FIRST", // 313 (571) + "FIXED", // 314 (572) + "FOOTING", // 315 (573) + "FOR", // 316 (574) + "FORMATTED-CURRENT-DATE", // 317 (575) + "FORMATTED-DATE", // 318 (576) + "FORMATTED-DATETIME", // 319 (577) + "FORMATTED-TIME", // 320 (578) + "FORM-OVERFLOW", // 321 (579) + "FREE", // 322 (580) + "FRACTION-PART", // 323 (581) + "FROM", // 324 (582) + "FUNCTION", // 325 (583) + "GENERATE", // 326 (584) + "GIVING", // 327 (585) + "GLOBAL", // 328 (586) + "GO", // 329 (587) + "GROUP", // 330 (588) + "HEADING", // 331 (589) + "HEX", // 332 (590) + "HEX-OF", // 333 (591) + "HEX-TO-CHAR", // 334 (592) + "HIGH-VALUES", // 335 (593) + "HIGHEST-ALGEBRAIC", // 336 (594) + "HOLD", // 337 (595) + "IBM-360", // 338 (596) + "IN", // 339 (597) + "INCLUDE", // 340 (598) + "INDEX", // 341 (599) + "INDEXED", // 342 (600) + "INDICATE", // 343 (601) + "INITIAL", // 344 (602) + "INITIATE", // 345 (603) + "INPUT", // 346 (604) + "INSTALLATION", // 347 (605) + "INTERFACE", // 348 (606) + "INTEGER", // 349 (607) + "INTEGER-OF-BOOLEAN", // 350 (608) + "INTEGER-OF-DATE", // 351 (609) + "INTEGER-OF-DAY", // 352 (610) + "INTEGER-OF-FORMATTED-DATE", // 353 (611) + "INTEGER-PART", // 354 (612) + "INTO", // 355 (613) + "INTRINSIC", // 356 (614) + "INVOKE", // 357 (615) + "I-O", // 358 (616) + "I-O-CONTROL", // 359 (617) + "IS", // 360 (618) + "ISNT", // 361 (619) + "KANJI", // 362 (620) + "KEY", // 363 (621) + "LABEL", // 364 (622) + "LAST", // 365 (623) + "LEADING", // 366 (624) + "LEFT", // 367 (625) + "LENGTH", // 368 (626) + "LENGTH-OF", // 369 (627) + "LIMIT", // 370 (628) + "LIMITS", // 371 (629) + "LINE", // 372 (630) + "LINES", // 373 (631) + "LINE-COUNTER", // 374 (632) + "LINAGE", // 375 (633) + "LINKAGE", // 376 (634) + "LOCALE", // 377 (635) + "LOCALE-COMPARE", // 378 (636) + "LOCALE-DATE", // 379 (637) + "LOCALE-TIME", // 380 (638) + "LOCALE-TIME-FROM-SECONDS", // 381 (639) + "LOCAL-STORAGE", // 382 (640) + "LOCATION", // 383 (641) + "LOCK", // 384 (642) + "LOCK-ON", // 385 (643) + "LOG", // 386 (644) + "LOG10", // 387 (645) + "LOWER-CASE", // 388 (646) + "LOW-VALUES", // 389 (647) + "LOWEST-ALGEBRAIC", // 390 (648) + "LPAREN", // 391 (649) + "MANUAL", // 392 (650) + "MAXX", // 393 (651) + "MEAN", // 394 (652) + "MEDIAN", // 395 (653) + "MIDRANGE", // 396 (654) + "MINN", // 397 (655) + "MULTIPLE", // 398 (656) + "MOD", // 399 (657) + "MODE", // 400 (658) + "MODULE-NAME", // 401 (659) + "NAMED", // 402 (660) + "NAT", // 403 (661) + "NATIONAL", // 404 (662) + "NATIONAL-EDITED", // 405 (663) + "NATIONAL-OF", // 406 (664) + "NATIVE", // 407 (665) + "NESTED", // 408 (666) + "NEXT", // 409 (667) + "NO", // 410 (668) + "NOTE", // 411 (669) + "NULLS", // 412 (670) + "NULLPTR", // 413 (671) + "NUMERIC", // 414 (672) + "NUMERIC-EDITED", // 415 (673) + "NUMVAL", // 416 (674) + "NUMVAL-C", // 417 (675) + "NUMVAL-F", // 418 (676) + "OCCURS", // 419 (677) + "OF", // 420 (678) + "OFF", // 421 (679) + "OMITTED", // 422 (680) + "ON", // 423 (681) + "ONLY", // 424 (682) + "OPTIONAL", // 425 (683) + "OPTIONS", // 426 (684) + "ORD", // 427 (685) + "ORDER", // 428 (686) + "ORD-MAX", // 429 (687) + "ORD-MIN", // 430 (688) + "ORGANIZATION", // 431 (689) + "OTHER", // 432 (690) + "OTHERWISE", // 433 (691) + "OUTPUT", // 434 (692) + "PACKED-DECIMAL", // 435 (693) + "PADDING", // 436 (694) + "PAGE", // 437 (695) + "PAGE-COUNTER", // 438 (696) + "PF", // 439 (697) + "PH", // 440 (698) + "PI", // 441 (699) + "PIC", // 442 (700) + "PICTURE", // 443 (701) + "PLUS", // 444 (702) + "PRESENT-VALUE", // 445 (703) + "PRINT-SWITCH", // 446 (704) + "PROCEDURE", // 447 (705) + "PROCEDURES", // 448 (706) + "PROCEED", // 449 (707) + "PROCESS", // 450 (708) + "PROGRAM-ID", // 451 (709) + "PROGRAM", // 452 (710) + "PROPERTY", // 453 (711) + "PROTOTYPE", // 454 (712) + "PSEUDOTEXT", // 455 (713) + "QUOTES", // 456 (714) + "RANDOM", // 457 (715) + "RANDOM-SEED", // 458 (716) + "RANGE", // 459 (717) + "RAISE", // 460 (718) + "RAISING", // 461 (719) + "RD", // 462 (720) + "RECORD", // 463 (721) + "RECORDING", // 464 (722) + "RECORDS", // 465 (723) + "RECURSIVE", // 466 (724) + "REDEFINES", // 467 (725) + "REEL", // 468 (726) + "REFERENCE", // 469 (727) + "RELATIVE", // 470 (728) + "REM", // 471 (729) + "REMAINDER", // 472 (730) + "REMARKS", // 473 (731) + "REMOVAL", // 474 (732) + "RENAMES", // 475 (733) + "REPLACE", // 476 (734) + "REPLACING", // 477 (735) + "REPORT", // 478 (736) + "REPORTING", // 479 (737) + "REPORTS", // 480 (738) + "REPOSITORY", // 481 (739) + "RERUN", // 482 (740) + "RESERVE", // 483 (741) + "RESTRICTED", // 484 (742) + "RESUME", // 485 (743) + "REVERSE", // 486 (744) + "REVERSED", // 487 (745) + "REWIND", // 488 (746) + "RF", // 489 (747) + "RH", // 490 (748) + "RIGHT", // 491 (749) + "ROUNDED", // 492 (750) + "RUN", // 493 (751) + "SAME", // 494 (752) + "SCREEN", // 495 (753) + "SD", // 496 (754) + "SECONDS-FROM-FORMATTED-TIME", // 497 (755) + "SECONDS-PAST-MIDNIGHT", // 498 (756) + "SECURITY", // 499 (757) + "SEPARATE", // 500 (758) + "SEQUENCE", // 501 (759) + "SEQUENTIAL", // 502 (760) + "SHARING", // 503 (761) + "SIMPLE-EXIT", // 504 (762) + "SIGN", // 505 (763) + "SIN", // 506 (764) + "SIZE", // 507 (765) + "SMALLEST-ALGEBRAIC", // 508 (766) + "SOURCE", // 509 (767) + "SOURCE-COMPUTER", // 510 (768) + "SPECIAL-NAMES", // 511 (769) + "SQRT", // 512 (770) + "STACK", // 513 (771) + "STANDARD", // 514 (772) + "STANDARD-1", // 515 (773) + "STANDARD-DEVIATION", // 516 (774) + "STANDARD-COMPARE", // 517 (775) + "STATUS", // 518 (776) + "STRONG", // 519 (777) + "SUBSTITUTE", // 520 (778) + "SUM", // 521 (779) + "SYMBOL", // 522 (780) + "SYMBOLIC", // 523 (781) + "SYNCHRONIZED", // 524 (782) + "TALLY", // 525 (783) + "TALLYING", // 526 (784) + "TAN", // 527 (785) + "TERMINATE", // 528 (786) + "TEST", // 529 (787) + "TEST-DATE-YYYYMMDD", // 530 (788) + "TEST-DAY-YYYYDDD", // 531 (789) + "TEST-FORMATTED-DATETIME", // 532 (790) + "TEST-NUMVAL", // 533 (791) + "TEST-NUMVAL-C", // 534 (792) + "TEST-NUMVAL-F", // 535 (793) + "THAN", // 536 (794) + "TIME", // 537 (795) + "TIMES", // 538 (796) + "TO", // 539 (797) + "TOP", // 540 (798) + "TOP-LEVEL", // 541 (799) + "TRACKS", // 542 (800) + "TRACK-AREA", // 543 (801) + "TRAILING", // 544 (802) + "TRANSFORM", // 545 (803) + "TRIM", // 546 (804) + "TRUE", // 547 (805) + "TRY", // 548 (806) + "TURN", // 549 (807) + "TYPE", // 550 (808) + "TYPEDEF", // 551 (809) + "ULENGTH", // 552 (810) + "UNBOUNDED", // 553 (811) + "UNIT", // 554 (812) + "UNITS", // 555 (813) + "UNIT-RECORD", // 556 (814) + "UNTIL", // 557 (815) + "UP", // 558 (816) + "UPON", // 559 (817) + "UPOS", // 560 (818) + "UPPER-CASE", // 561 (819) + "USAGE", // 562 (820) + "USING", // 563 (821) + "USUBSTR", // 564 (822) + "USUPPLEMENTARY", // 565 (823) + "UTILITY", // 566 (824) + "UUID4", // 567 (825) + "UVALID", // 568 (826) + "UWIDTH", // 569 (827) + "VALUE", // 570 (828) + "VARIANCE", // 571 (829) + "VARYING", // 572 (830) + "VOLATILE", // 573 (831) + "WHEN-COMPILED", // 574 (832) + "WITH", // 575 (833) + "WORKING-STORAGE", // 576 (834) + "XML", // 577 (835) + "XMLGENERATE", // 578 (836) + "XMLPARSE", // 579 (837) + "YEAR-TO-YYYY", // 580 (838) + "YYYYDDD", // 581 (839) + "YYYYMMDD", // 582 (840) + "ARITHMETIC", // 583 (841) + "ATTRIBUTE", // 584 (842) + "AUTO", // 585 (843) + "AUTOMATIC", // 586 (844) + "AWAY-FROM-ZERO", // 587 (845) + "BACKGROUND-COLOR", // 588 (846) + "BELL", // 589 (847) + "BINARY-ENCODING", // 590 (848) + "BLINK", // 591 (849) + "CAPACITY", // 592 (850) + "CENTER", // 593 (851) + "CLASSIFICATION", // 594 (852) + "CYCLE", // 595 (853) + "DECIMAL-ENCODING", // 596 (854) + "ENTRY-CONVENTION", // 597 (855) + "EOL", // 598 (856) + "EOS", // 599 (857) + "ERASE", // 600 (858) + "EXPANDS", // 601 (859) + "FLOAT-BINARY", // 602 (860) + "FLOAT-DECIMAL", // 603 (861) + "FOREGROUND-COLOR", // 604 (862) + "FOREVER", // 605 (863) + "FULL", // 606 (864) + "HIGHLIGHT", // 607 (865) + "HIGH-ORDER-LEFT", // 608 (866) + "HIGH-ORDER-RIGHT", // 609 (867) + "IGNORING", // 610 (868) + "IMPLEMENTS", // 611 (869) + "INITIALIZED", // 612 (870) + "INTERMEDIATE", // 613 (871) + "LC-ALL", // 614 (872) + "LC-COLLATE", // 615 (873) + "LC-CTYPE", // 616 (874) + "LC-MESSAGES", // 617 (875) + "LC-MONETARY", // 618 (876) + "LC-NUMERIC", // 619 (877) + "LC-TIME", // 620 (878) + "LOWLIGHT", // 621 (879) + "NEAREST-AWAY-FROM-ZERO", // 622 (880) + "NEAREST-EVEN", // 623 (881) + "NEAREST-TOWARD-ZERO", // 624 (882) + "NONE", // 625 (883) + "NORMAL", // 626 (884) + "NUMBERS", // 627 (885) + "PREFIXED", // 628 (886) + "PREVIOUS", // 629 (887) + "PROHIBITED", // 630 (888) + "RELATION", // 631 (889) + "REQUIRED", // 632 (890) + "REVERSE-VIDEO", // 633 (891) + "ROUNDING", // 634 (892) + "SECONDS", // 635 (893) + "SECURE", // 636 (894) + "SHORT", // 637 (895) + "SIGNED", // 638 (896) + "STANDARD-BINARY", // 639 (897) + "STANDARD-DECIMAL", // 640 (898) + "STATEMENT", // 641 (899) + "STEP", // 642 (900) + "STRUCTURE", // 643 (901) + "TOWARD-GREATER", // 644 (902) + "TOWARD-LESSER", // 645 (903) + "TRUNCATION", // 646 (904) + "UCS-4", // 647 (905) + "UNDERLINE", // 648 (906) + "UNSIGNED", // 649 (907) + "UTF-16", // 650 (908) + "UTF-8", // 651 (909) + "ADDRESS", // 652 (910) + "END-ACCEPT", // 653 (911) + "END-ADD", // 654 (912) + "END-CALL", // 655 (913) + "END-COMPUTE", // 656 (914) + "END-DELETE", // 657 (915) + "END-DISPLAY", // 658 (916) + "END-DIVIDE", // 659 (917) + "END-EVALUATE", // 660 (918) + "END-MULTIPLY", // 661 (919) + "END-PERFORM", // 662 (920) + "END-READ", // 663 (921) + "END-RETURN", // 664 (922) + "END-REWRITE", // 665 (923) + "END-SEARCH", // 666 (924) + "END-START", // 667 (925) + "END-STRING", // 668 (926) + "END-SUBTRACT", // 669 (927) + "END-UNSTRING", // 670 (928) + "END-WRITE", // 671 (929) + "END-IF", // 672 (930) + "THRU", // 673 (931) + "OR", // 674 (932) + "AND", // 675 (933) + "NOT", // 676 (934) + "NE", // 677 (935) + "LE", // 678 (936) + "GE", // 679 (937) + "POW", // 680 (938) + "NEG", // 681 (939) }; diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc index edf4aa8..87b19b6 100644 --- a/gcc/cobol/util.cc +++ b/gcc/cobol/util.cc @@ -2331,6 +2331,75 @@ bool fisprint(int c) // 8.9 Reserved words static const std::set<std::string> reserved_words = { + // GCC COBOL keywords + "COMMAND-LINE", + "COMMAND-LINE-COUNT", + + // GCC device names + "C01", + "C02", + "C03", + "C04", + "C05", + "C06", + "C07", + "C08", + "C09", + "C10", + "C11", + "C12", + "CONSOLE", + "S01", + "S02", + "S03", + "S04", + "S05", + "STDERR", + "STDIN", + "STDOUT", + "SYSIN", + "SYSIPT", + "SYSLIST", + "SYSLST", + "SYSOUT", + "SYSPCH", + "SYSPUNCH", + "UPSI", + + // IBM keywords that GCC recognizes + "BASIS", + "CBL", + "ENTER", + "READY", + "TITLE", + "TRACE", + "ALTER", + "COBOL", + "DATE-COMPILED", + "DATE-WRITTEN", + "DBCS", + "DEBUGGING", + "EGCS", + "ENTRY", + "EVERY", + "INSTALLATION", + "I-O-CONTROL", + "KANJI", + "LABEL", + "NULLS", + "PADDING", + "PROCEDURES", + "PROCEED", + "RECORDING", + "RERUN", + "REVERSED", + "SECURITY", + "TALLY", + "VOLATILE", + "XML", + "END-START", + + // ISO 2023 keywords "ACCEPT", "ACCESS", "ACTIVE-CLASS", @@ -2497,8 +2566,6 @@ static const std::set<std::string> reserved_words = { "FLOAT-EXTENDED", "FLOAT-INFINITY", "FLOAT-LONG", - "FLOAT-NOT-A-NUMBER", - "FLOAT-NOT-A-NUMBER-", "FLOAT-NOT-A-NUMBER-", "FLOAT-SHORT", "FOOTING", @@ -2856,10 +2923,11 @@ static const std::set<std::string> context_sensitive_words = { }; // Is the input a COBOL word, per ISO/IEC 1989:2023 (E) ? +// We add a few GCC-specific keywords, and our supported IBM keywords. bool -iso_cobol_word( const std::string& name, bool include_intrinsics ) { +iso_cobol_word( const std::string& name, bool include_context ) { auto ok = 1 == reserved_words.count(name); - if( include_intrinsics && !ok ) { + if( include_context && !ok ) { ok = 1 == context_sensitive_words.count(name); } return ok; diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 0233e1a..e06cd5f 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -274,6 +274,12 @@ struct riscv_ext_version int minor_version; }; +struct riscv_profiles +{ + const char *profile_name; + const char *profile_string; +}; + /* All standard extensions defined in all supported ISA spec. */ static const struct riscv_ext_version riscv_ext_version_table[] = { @@ -327,6 +333,7 @@ static const struct riscv_ext_version riscv_ext_version_table[] = {"zalrsc", ISA_SPEC_CLASS_NONE, 1, 0}, {"zabha", ISA_SPEC_CLASS_NONE, 1, 0}, {"zacas", ISA_SPEC_CLASS_NONE, 1, 0}, + {"zama16b", ISA_SPEC_CLASS_NONE, 1, 0}, {"zba", ISA_SPEC_CLASS_NONE, 1, 0}, {"zbb", ISA_SPEC_CLASS_NONE, 1, 0}, @@ -501,6 +508,47 @@ static const struct riscv_ext_version riscv_combine_info[] = {NULL, ISA_SPEC_CLASS_NONE, 0, 0} }; +/* This table records the mapping form RISC-V Profiles into march string. */ +static const riscv_profiles riscv_profiles_table[] = +{ + /* RVI20U only contains the base extension 'i' as mandatory extension. */ + {"rvi20u64", "rv64i"}, + {"rvi20u32", "rv32i"}, + + /* RVA20U contains the 'i,m,a,f,d,c,zicsr,zicntr,ziccif,ziccrse,ziccamoa, + zicclsm,za128rs' as mandatory extensions. */ + {"rva20u64", "rv64imafdc_zicsr_zicntr_ziccif_ziccrse_ziccamoa" + "_zicclsm_za128rs"}, + + /* RVA22U contains the 'i,m,a,f,d,c,zicsr,zihintpause,zba,zbb,zbs,zicntr, + zihpm,ziccif,ziccrse,ziccamoa, zicclsm,zic64b,za64rs,zicbom,zicbop,zicboz, + zfhmin,zkt' as mandatory extensions. */ + {"rva22u64", "rv64imafdc_zicsr_zicntr_ziccif_ziccrse_ziccamoa" + "_zicclsm_zic64b_za64rs_zihintpause_zba_zbb_zbs_zicbom_zicbop" + "_zicboz_zfhmin_zkt"}, + + /* RVA23 contains all mandatory base ISA for RVA22U64 and the new extension + 'v,zihintntl,zvfhmin,zvbb,zvkt,zicond,zimop,zcmop,zfa,zawrs' as mandatory + extensions. */ + {"rva23u64", "rv64imafdcv_zicsr_zicntr_zihpm_ziccif_ziccrse_ziccamoa" + "_zicclsm_zic64b_za64rs_zihintpause_zba_zbb_zbs_zicbom_zicbop" + "_zicboz_zfhmin_zkt_zvfhmin_zvbb_zvkt_zihintntl_zicond_zimop_zcmop_zcb" + "_zfa_zawrs"}, + + /* RVB23 contains all mandatory base ISA for RVA22U64 and the new extension + 'zihintntl,zicond,zimop,zcmop,zfa,zawrs' as mandatory + extensions. */ + {"rvb23u64", "rv64imafdc_zicsr_zicntr_zihpm_ziccif_ziccrse_ziccamoa" + "_zicclsm_zic64b_za64rs_zihintpause_zba_zbb_zbs_zicbom_zicbop" + "_zicboz_zfhmin_zkt_zihintntl_zicond_zimop_zcmop_zcb" + "_zfa_zawrs"}, + + /* Currently we do not define S/M mode Profiles in gcc part. */ + + /* Terminate the list. */ + {NULL, NULL} +}; + static const riscv_cpu_info riscv_cpu_tables[] = { #define RISCV_CORE(CORE_NAME, ARCH, TUNE) \ @@ -1108,6 +1156,52 @@ riscv_subset_list::parsing_subset_version (const char *ext, return p; } +/* Parsing RISC-V Profiles in -march string. + Return string with mandatory extensions of Profiles. */ +std::string +riscv_subset_list::parse_profiles (const char *arch) +{ + /* Checking if input string contains a Profiles. + There are two cases use Profiles in -march option: + + 1. Only use Profiles in '-march' as input + 2. Mixed Profiles with other extensions + + Use '_' to split Profiles and other extension. */ + std::string p(arch); + const size_t p_len = p.size(); + + for (int i = 0; riscv_profiles_table[i].profile_name != nullptr; ++i) + { + const std::string& p_name = riscv_profiles_table[i].profile_name; + const std::string& p_str = riscv_profiles_table[i].profile_string; + size_t pos = p.find(p_name); + /* Find profile at the begin. */ + if (pos == 0 && pos + p_name.size() <= p_len) + { + size_t after_pos = pos + p_name.size(); + std::string after_part = p.substr(after_pos); + + /* If there're only profile, return the profile_string directly. */ + if (after_part[0] == '\0') + return p_str; + + /* If isn't '_' after profile, need to add it and mention the user. */ + if (after_part[0] != '_') + { + warning_at (m_loc, 0, "Should use \"%c\" to contact Profiles with other " + "extensions", '_'); + return p_str + "_" + after_part; + } + + /* Return 'profiles_additional' extensions. */ + return p_str + after_part; + } + } + /* Not found profile, return directly. */ + return p; +} + /* Parsing function for base extensions, rv[32|64][i|e|g] Return Value: @@ -1134,8 +1228,8 @@ riscv_subset_list::parse_base_ext (const char *p) } else { - error_at (m_loc, "%<-march=%s%>: ISA string must begin with rv32 or rv64", - m_arch); + error_at (m_loc, "%<-march=%s%>: ISA string must begin with rv32, rv64 " + "or Profiles", m_arch); return NULL; } @@ -1526,8 +1620,10 @@ riscv_subset_list::parse (const char *arch, location_t loc) return NULL; riscv_subset_list *subset_list = new riscv_subset_list (arch, loc); + const char *p = arch; - p = subset_list->parse_base_ext (p); + std::string a = subset_list->parse_profiles(p); + p = subset_list->parse_base_ext (a.c_str()); if (p == NULL) goto fail; @@ -1657,6 +1753,7 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] = RISCV_EXT_FLAG_ENTRY ("zalrsc", x_riscv_za_subext, MASK_ZALRSC), RISCV_EXT_FLAG_ENTRY ("zabha", x_riscv_za_subext, MASK_ZABHA), RISCV_EXT_FLAG_ENTRY ("zacas", x_riscv_za_subext, MASK_ZACAS), + RISCV_EXT_FLAG_ENTRY ("zama16b", x_riscv_za_subext, MASK_ZAMA16B), RISCV_EXT_FLAG_ENTRY ("zba", x_riscv_zb_subext, MASK_ZBA), RISCV_EXT_FLAG_ENTRY ("zbb", x_riscv_zb_subext, MASK_ZBB), diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index c83c35c..c935e7b 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -1055,6 +1055,7 @@ void aarch64_subvti_scratch_regs (rtx, rtx, rtx *, rtx *, rtx *, rtx *); void aarch64_expand_subvti (rtx, rtx, rtx, rtx, rtx, rtx, rtx, bool); +int aarch64_exact_log2_inverse (unsigned int, rtx); /* Initialize builtins for SIMD intrinsics. */ diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index e2afe87..1099e74 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -1193,12 +1193,14 @@ (define_insn "aarch64_simd_vec_set_zero<mode>" [(set (match_operand:VALL_F16 0 "register_operand" "=w") (vec_merge:VALL_F16 - (match_operand:VALL_F16 1 "aarch64_simd_imm_zero" "") - (match_operand:VALL_F16 3 "register_operand" "0") + (match_operand:VALL_F16 1 "register_operand" "0") + (match_operand:VALL_F16 3 "aarch64_simd_imm_zero" "") (match_operand:SI 2 "immediate_operand" "i")))] - "TARGET_SIMD && exact_log2 (INTVAL (operands[2])) >= 0" + "TARGET_SIMD && aarch64_exact_log2_inverse (<nunits>, operands[2]) >= 0" { - int elt = ENDIAN_LANE_N (<nunits>, exact_log2 (INTVAL (operands[2]))); + int elt = ENDIAN_LANE_N (<nunits>, + aarch64_exact_log2_inverse (<nunits>, + operands[2])); operands[2] = GEN_INT ((HOST_WIDE_INT) 1 << elt); return "ins\\t%0.<Vetype>[%p2], <vwcore>zr"; } diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index f39af6e..bf7569f 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -702,6 +702,23 @@ } ) +;; Fold predicated loads/stores with a PTRUE predicate to unpredicated +;; loads/stores after RA. +(define_insn_and_split "*aarch64_sve_ptrue<mode>_ldr_str" + [(set (match_operand:SVE_FULL 0 "aarch64_sve_nonimmediate_operand" "=Utr,w") + (unspec:SVE_FULL + [(match_operand:<VPRED> 1 "aarch64_simd_imm_one") + (match_operand:SVE_FULL 2 "aarch64_sve_nonimmediate_operand" "w,Utr")] + UNSPEC_PRED_X))] + "TARGET_SVE && reload_completed + && (<MODE>mode == VNx16QImode || !BYTES_BIG_ENDIAN) + && ((REG_P (operands[0]) && MEM_P (operands[2])) + || (REG_P (operands[2]) && MEM_P (operands[0])))" + "#" + "&& 1" + [(set (match_dup 0) + (match_dup 2))]) + ;; Unpredicated moves that cannot use LDR and STR, i.e. partial vectors ;; or vectors for which little-endian ordering isn't acceptable. Memory ;; accesses require secondary reloads. @@ -3984,8 +4001,8 @@ (match_operand:SVE_I_SIMD_DI 3 "aarch64_sve_<sve_imm_con>_operand"))] UNSPEC_PRED_X))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 ; attrs: movprfx ] - [ w , Upl , %0 , <sve_imm_con> ; * ] # + {@ [ cons: =0 , 1 , %2 , 3 ; attrs: movprfx ] + [ w , Upl , 0 , <sve_imm_con> ; * ] # [ w , Upl , 0 , w ; * ] <sve_int_op>\t%Z0.<Vetype>, %1/m, %Z0.<Vetype>, %Z3.<Vetype> [ ?&w , Upl , w , <sve_imm_con> ; yes ] # [ ?&w , Upl , w , w ; yes ] movprfx\t%Z0, %Z2\;<sve_int_op>\t%Z0.<Vetype>, %1/m, %Z0.<Vetype>, %Z3.<Vetype> @@ -4114,8 +4131,8 @@ (match_operand:SVE_I 1 "register_operand") (match_operand:SVE_I 2 "aarch64_sve_add_operand")))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 ; attrs: movprfx ] - [ w , %0 , vsa ; * ] add\t%0.<Vetype>, %0.<Vetype>, #%D2 + {@ [ cons: =0 , %1 , 2 ; attrs: movprfx ] + [ w , 0 , vsa ; * ] add\t%0.<Vetype>, %0.<Vetype>, #%D2 [ w , 0 , vsn ; * ] sub\t%0.<Vetype>, %0.<Vetype>, #%N2 [ w , 0 , vsi ; * ] << aarch64_output_sve_vector_inc_dec ("%0.<Vetype>", operands[2]); [ ?w , w , vsa ; yes ] movprfx\t%0, %1\;add\t%0.<Vetype>, %0.<Vetype>, #%D2 @@ -4333,8 +4350,8 @@ (match_dup 3))] UNSPEC_PRED_X)))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 ; attrs: movprfx ] - [ w , Upl , %0 , w ; * ] <su>abd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 ; attrs: movprfx ] + [ w , Upl , 0 , w ; * ] <su>abd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , w ; yes ] movprfx\t%0, %2\;<su>abd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> } ) @@ -4548,8 +4565,8 @@ MUL_HIGHPART)] UNSPEC_PRED_X))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 ; attrs: movprfx ] - [ w , Upl , %0 , w ; * ] <su>mulh\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 ; attrs: movprfx ] + [ w , Upl , 0 , w ; * ] <su>mulh\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , w ; yes ] movprfx\t%0, %2\;<su>mulh\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> } ) @@ -4603,8 +4620,8 @@ (match_operand:SVE_FULL_I 4 "aarch64_simd_imm_zero")] UNSPEC_SEL))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 ] - [ &w , Upl , %0 , w ] movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_int_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 ] + [ &w , Upl , 0 , w ] movprfx\t%0.<Vetype>, %1/z, %0.<Vetype>\;<sve_int_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ &w , Upl , w , w ] movprfx\t%0.<Vetype>, %1/z, %2.<Vetype>\;<sve_int_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> } [(set_attr "movprfx" "yes")]) @@ -4748,8 +4765,8 @@ (match_operand:SVE_I 1 "register_operand") (match_operand:SVE_I 2 "aarch64_sve_logical_operand")))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 ; attrs: movprfx ] - [ w , %0 , vsl ; * ] <logical>\t%0.<Vetype>, %0.<Vetype>, #%C2 + {@ [ cons: =0 , %1 , 2 ; attrs: movprfx ] + [ w , 0 , vsl ; * ] <logical>\t%0.<Vetype>, %0.<Vetype>, #%C2 [ ?w , w , vsl ; yes ] movprfx\t%0, %1\;<logical>\t%0.<Vetype>, %0.<Vetype>, #%C2 [ w , w , w ; * ] <logical>\t%0.d, %1.d, %2.d } @@ -5788,8 +5805,8 @@ (match_operand:SVE_FULL_F 3 "aarch64_sve_float_arith_with_sub_operand")] SVE_COND_FP_ADD))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 , 4 ; attrs: movprfx ] - [ w , Upl , %0 , vsA , i ; * ] fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 + {@ [ cons: =0 , 1 , %2 , 3 , 4 ; attrs: movprfx ] + [ w , Upl , 0 , vsA , i ; * ] fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 [ w , Upl , 0 , vsN , i ; * ] fsub\t%0.<Vetype>, %1/m, %0.<Vetype>, #%N3 [ w , Upl , w , w , Z ; * ] # [ w , Upl , 0 , w , Ui1 ; * ] fadd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> @@ -6263,8 +6280,8 @@ UNSPEC_COND_FSUB)] UNSPEC_COND_FABS))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 ; attrs: movprfx ] - [ w , Upl , %0 , w ; * ] fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 ; attrs: movprfx ] + [ w , Upl , 0 , w ; * ] fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , w ; yes ] movprfx\t%0, %2\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> } "&& !rtx_equal_p (operands[1], operands[5])" @@ -6286,8 +6303,8 @@ UNSPEC_COND_FSUB)] UNSPEC_COND_FABS))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 ; attrs: movprfx ] - [ w , Upl , %0 , w ; * ] fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 ; attrs: movprfx ] + [ w , Upl , 0 , w ; * ] fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , w ; yes ] movprfx\t%0, %2\;fabd\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> } ) @@ -6527,8 +6544,8 @@ (match_operand:SVE_FULL_F 3 "aarch64_sve_float_mul_operand")] SVE_COND_FP_MUL))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 , 4 ; attrs: movprfx ] - [ w , Upl , %0 , vsM , i ; * ] fmul\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 + {@ [ cons: =0 , 1 , %2 , 3 , 4 ; attrs: movprfx ] + [ w , Upl , 0 , vsM , i ; * ] fmul\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 [ w , Upl , w , w , Z ; * ] # [ w , Upl , 0 , w , Ui1 ; * ] fmul\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , vsM , i ; yes ] movprfx\t%0, %2\;fmul\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 @@ -6761,8 +6778,8 @@ (match_operand:SVE_FULL_F 3 "aarch64_sve_float_maxmin_operand")] SVE_COND_FP_MAXMIN))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 ; attrs: movprfx ] - [ w , Upl , %0 , vsB ; * ] <sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 + {@ [ cons: =0 , 1 , %2 , 3 ; attrs: movprfx ] + [ w , Upl , 0 , vsB ; * ] <sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 [ w , Upl , 0 , w ; * ] <sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , vsB ; yes ] movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, #%3 [ ?&w , Upl , w , w ; yes ] movprfx\t%0, %2\;<sve_fp_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> @@ -7070,8 +7087,8 @@ UNSPEC_PRED_X) (match_operand:SVE_I 4 "register_operand")))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 , 4 ; attrs: movprfx ] - [ w , Upl , %0 , w , w ; * ] mad\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 , 4 ; attrs: movprfx ] + [ w , Upl , 0 , w , w ; * ] mad\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype> [ w , Upl , w , w , 0 ; * ] mla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , w , w ; yes ] movprfx\t%0, %4\;mla\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype> } @@ -7212,8 +7229,8 @@ (match_operand:SVE_I 3 "register_operand"))] UNSPEC_PRED_X)))] "TARGET_SVE" - {@ [ cons: =0 , 1 , 2 , 3 , 4 ; attrs: movprfx ] - [ w , Upl , %0 , w , w ; * ] msb\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 , 4 ; attrs: movprfx ] + [ w , Upl , 0 , w , w ; * ] msb\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype> [ w , Upl , w , w , 0 ; * ] mls\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , w , w ; yes ] movprfx\t%0, %4\;mls\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype> } @@ -7494,8 +7511,8 @@ (match_operand:SVE_FULL_F_BF 4 "register_operand")] SVE_COND_FP_TERNARY))] "TARGET_SVE && (<supports_bf16> || !<is_bf16>)" - {@ [ cons: =0 , 1 , 2 , 3 , 4 ; attrs: movprfx , is_rev ] - [ w , Upl , %w , w , 0 ; * , * ] <b><sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 , 4 ; attrs: movprfx , is_rev ] + [ w , Upl , w , w , 0 ; * , * ] <b><sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype> [ w , Upl , 0 , w , w ; * , true ] <b><sve_fmad_op>\t%0.<Vetype>, %1/m, %3.<Vetype>, %4.<Vetype> [ ?&w , Upl , w , w , w ; yes , * ] movprfx\t%0, %4\;<b><sve_fmla_op>\t%0.<Vetype>, %1/m, %2.<Vetype>, %3.<Vetype> } diff --git a/gcc/config/aarch64/aarch64-sve2.md b/gcc/config/aarch64/aarch64-sve2.md index 3e08e09..871cf0b 100644 --- a/gcc/config/aarch64/aarch64-sve2.md +++ b/gcc/config/aarch64/aarch64-sve2.md @@ -784,8 +784,8 @@ (match_operand:SVE_FULL_I 2 "register_operand")) (match_operand:SVE_FULL_I 3 "register_operand")))] "TARGET_SVE2p1_OR_SME" - {@ [cons: =0, 1, 2, 3; attrs: movprfx] - [ w, %0, w, w; * ] <su>clamp\t%0.<Vetype>, %2.<Vetype>, %3.<Vetype> + {@ [cons: =0, %1, 2, 3; attrs: movprfx] + [ w, 0, w, w; * ] <su>clamp\t%0.<Vetype>, %2.<Vetype>, %3.<Vetype> [ ?&w, w, w, w; yes ] movprfx\t%0, %1\;<su>clamp\t%0.<Vetype>, %2.<Vetype>, %3.<Vetype> } ) @@ -804,8 +804,8 @@ (match_operand:SVE_FULL_I 3 "register_operand"))] UNSPEC_PRED_X))] "TARGET_SVE2p1_OR_SME" - {@ [cons: =0, 1, 2, 3; attrs: movprfx] - [ w, %0, w, w; * ] # + {@ [cons: =0, %1, 2, 3; attrs: movprfx] + [ w, 0, w, w; * ] # [ ?&w, w, w, w; yes ] # } "&& true" @@ -1373,8 +1373,8 @@ (match_operand:SVE_CLAMP_F 3 "register_operand")] UNSPEC_FMINNM))] "" - {@ [cons: =0, 1, 2, 3; attrs: movprfx] - [ w, %0, w, w; * ] <b>fclamp\t%0.<Vetype>, %2.<Vetype>, %3.<Vetype> + {@ [cons: =0, %1, 2, 3; attrs: movprfx] + [ w, 0, w, w; * ] <b>fclamp\t%0.<Vetype>, %2.<Vetype>, %3.<Vetype> [ ?&w, w, w, w; yes ] movprfx\t%0, %1\;<b>fclamp\t%0.<Vetype>, %2.<Vetype>, %3.<Vetype> } ) @@ -1393,8 +1393,8 @@ (match_operand:SVE_CLAMP_F 3 "register_operand")] UNSPEC_COND_FMINNM))] "" - {@ [cons: =0, 1, 2, 3; attrs: movprfx] - [ w, %0, w, w; * ] # + {@ [cons: =0, %1, 2, 3; attrs: movprfx] + [ w, 0, w, w; * ] # [ ?&w, w, w, w; yes ] # } "&& true" @@ -1626,8 +1626,8 @@ (match_operand:SVE_FULL_I 2 "register_operand")))] UNSPEC_PRED_X))] "TARGET_SVE2" - {@ [ cons: =0 , 1 , 2 ; attrs: movprfx ] - [ w , %0 , w ; * ] nbsl\t%0.d, %0.d, %2.d, %0.d + {@ [ cons: =0 , %1 , 2 ; attrs: movprfx ] + [ w , 0 , w ; * ] nbsl\t%0.d, %0.d, %2.d, %0.d [ ?&w , w , w ; yes ] movprfx\t%0, %1\;nbsl\t%0.d, %0.d, %2.d, %0.d } "&& !CONSTANT_P (operands[3])" @@ -1648,8 +1648,8 @@ (match_operand:SVE_FULL_I 2 "register_operand")))] UNSPEC_PRED_X))] "TARGET_SVE2" - {@ [ cons: =0 , 1 , 2 ; attrs: movprfx ] - [ w , %0 , w ; * ] nbsl\t%0.d, %0.d, %2.d, %2.d + {@ [ cons: =0 , %1 , 2 ; attrs: movprfx ] + [ w , 0 , w ; * ] nbsl\t%0.d, %0.d, %2.d, %2.d [ ?&w , w , w ; yes ] movprfx\t%0, %1\;nbsl\t%0.d, %0.d, %2.d, %2.d } "&& !CONSTANT_P (operands[3])" @@ -2951,8 +2951,8 @@ UNSPEC_COND_FABS)] SVE_COND_SMAXMIN))] "TARGET_FAMINMAX && TARGET_SVE2_OR_SME2" - {@ [ cons: =0 , 1 , 2 , 3 ; attrs: movprfx ] - [ w , Upl , %0 , w ; * ] <faminmax_cond_uns_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> + {@ [ cons: =0 , 1 , %2 , 3 ; attrs: movprfx ] + [ w , Upl , 0 , w ; * ] <faminmax_cond_uns_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> [ ?&w , Upl , w , w ; yes ] movprfx\t%0, %2\;<faminmax_cond_uns_op>\t%0.<Vetype>, %1/m, %0.<Vetype>, %3.<Vetype> } "&& (!rtx_equal_p (operands[1], operands[5]) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 2dc5f4c..9e3f288 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -23914,6 +23914,16 @@ aarch64_strided_registers_p (rtx *operands, unsigned int num_operands, return true; } +/* Return the base 2 logarithm of the bit inverse of OP masked by the lowest + NELTS bits, if OP is a power of 2. Otherwise, returns -1. */ + +int +aarch64_exact_log2_inverse (unsigned int nelts, rtx op) +{ + return exact_log2 ((~INTVAL (op)) + & ((HOST_WIDE_INT_1U << nelts) - 1)); +} + /* Bounds-check lanes. Ensure OPERAND lies between LOW (inclusive) and HIGH (exclusive). */ void diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index c678f7a..5c30484 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -2182,9 +2182,9 @@ "aarch64_mem_pair_offset (operands[4], <MODE>mode) && known_eq (INTVAL (operands[5]), INTVAL (operands[4]) + GET_MODE_SIZE (<MODE>mode))" - {@ [cons: =&0, 1, =2, =3; attrs: type ] - [ rk, 0, r, r; load_<ldpstp_sz>] ldp\t%<w>2, %<w>3, [%0, %4]! - [ rk, 0, w, w; neon_load1_2reg ] ldp\t%<v>2, %<v>3, [%0, %4]! + {@ [cons: =0, 1, =2, =3; attrs: type ] + [ &rk, 0, r, r; load_<ldpstp_sz>] ldp\t%<w>2, %<w>3, [%0, %4]! + [ rk, 0, w, w; neon_load1_2reg ] ldp\t%<v>2, %<v>3, [%0, %4]! } ) @@ -2238,9 +2238,9 @@ INTVAL (operands[4]) + GET_MODE_SIZE (<MODE>mode)) && !reg_overlap_mentioned_p (operands[0], operands[2]) && !reg_overlap_mentioned_p (operands[0], operands[3])" - {@ [cons: =&0, 1, 2, 3; attrs: type ] - [ rk, 0, rYZ, rYZ; store_<ldpstp_sz>] stp\t%<w>2, %<w>3, [%0, %4]! - [ rk, 0, w, w; neon_store1_2reg ] stp\t%<v>2, %<v>3, [%0, %4]! + {@ [cons: =0, 1, 2, 3; attrs: type ] + [ &rk, 0, rYZ, rYZ; store_<ldpstp_sz>] stp\t%<w>2, %<w>3, [%0, %4]! + [ rk, 0, w, w; neon_store1_2reg ] stp\t%<v>2, %<v>3, [%0, %4]! } ) @@ -2486,15 +2486,15 @@ (match_operand:GPI 1 "register_operand") (match_operand:GPI 2 "aarch64_pluslong_operand")))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type , arch ] - [ rk , %rk , I ; alu_imm , * ] add\t%<w>0, %<w>1, %2 - [ rk , rk , r ; alu_sreg , * ] add\t%<w>0, %<w>1, %<w>2 - [ w , w , w ; neon_add , simd ] add\t%<rtn>0<vas>, %<rtn>1<vas>, %<rtn>2<vas> - [ rk , rk , J ; alu_imm , * ] sub\t%<w>0, %<w>1, #%n2 - [ r , rk , Uaa ; multiple , * ] # - [ r , 0 , Uai ; alu_imm , sve ] << aarch64_output_sve_scalar_inc_dec (operands[2]); - [ rk , rk , Uav ; alu_imm , sve ] << aarch64_output_sve_addvl_addpl (operands[2]); - [ rk , rk , UaV ; alu_imm , sme ] << aarch64_output_addsvl_addspl (operands[2]); + {@ [ cons: =0 , %1 , 2 ; attrs: type , arch ] + [ rk , rk , I ; alu_imm , * ] add\t%<w>0, %<w>1, %2 + [ rk , rk , r ; alu_sreg , * ] add\t%<w>0, %<w>1, %<w>2 + [ w , w , w ; neon_add , simd ] add\t%<rtn>0<vas>, %<rtn>1<vas>, %<rtn>2<vas> + [ rk , rk , J ; alu_imm , * ] sub\t%<w>0, %<w>1, #%n2 + [ r , rk , Uaa ; multiple , * ] # + [ r , 0 , Uai ; alu_imm , sve ] << aarch64_output_sve_scalar_inc_dec (operands[2]); + [ rk , rk , Uav ; alu_imm , sve ] << aarch64_output_sve_addvl_addpl (operands[2]); + [ rk , rk , UaV ; alu_imm , sme ] << aarch64_output_addsvl_addspl (operands[2]); } ;; The "alu_imm" types for INC/DEC and ADDVL/ADDPL are just placeholders. ) @@ -2507,11 +2507,11 @@ (plus:SI (match_operand:SI 1 "register_operand") (match_operand:SI 2 "aarch64_pluslong_operand"))))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type ] - [ rk , %rk , I ; alu_imm ] add\t%w0, %w1, %2 - [ rk , rk , r ; alu_sreg ] add\t%w0, %w1, %w2 - [ rk , rk , J ; alu_imm ] sub\t%w0, %w1, #%n2 - [ r , rk , Uaa ; multiple ] # + {@ [ cons: =0 , %1 , 2 ; attrs: type ] + [ rk , rk , I ; alu_imm ] add\t%w0, %w1, %2 + [ rk , rk , r ; alu_sreg ] add\t%w0, %w1, %w2 + [ rk , rk , J ; alu_imm ] sub\t%w0, %w1, #%n2 + [ r , rk , Uaa ; multiple ] # } ) @@ -2580,14 +2580,14 @@ (match_operand:GPI 1 "register_operand") (match_operand:GPI 2 "aarch64_pluslong_or_poly_operand")))] "TARGET_SVE && operands[0] != stack_pointer_rtx" - {@ [ cons: =0 , 1 , 2 ; attrs: type ] - [ r , %rk , I ; alu_imm ] add\t%<w>0, %<w>1, %2 - [ r , rk , r ; alu_sreg ] add\t%<w>0, %<w>1, %<w>2 - [ r , rk , J ; alu_imm ] sub\t%<w>0, %<w>1, #%n2 - [ r , rk , Uaa ; multiple ] # - [ r , 0 , Uai ; alu_imm ] << aarch64_output_sve_scalar_inc_dec (operands[2]); - [ r , rk , Uav ; alu_imm ] << aarch64_output_sve_addvl_addpl (operands[2]); - [ &r , rk , Uat ; multiple ] # + {@ [ cons: =0 , %1 , 2 ; attrs: type ] + [ r , rk , I ; alu_imm ] add\t%<w>0, %<w>1, %2 + [ r , rk , r ; alu_sreg ] add\t%<w>0, %<w>1, %<w>2 + [ r , rk , J ; alu_imm ] sub\t%<w>0, %<w>1, #%n2 + [ r , rk , Uaa ; multiple ] # + [ r , 0 , Uai ; alu_imm ] << aarch64_output_sve_scalar_inc_dec (operands[2]); + [ r , rk , Uav ; alu_imm ] << aarch64_output_sve_addvl_addpl (operands[2]); + [ &r , rk , Uat ; multiple ] # } "&& epilogue_completed && !reg_overlap_mentioned_p (operands[0], operands[1]) @@ -2759,10 +2759,10 @@ (set (match_operand:GPI 0 "register_operand") (plus:GPI (match_dup 1) (match_dup 2)))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type ] - [ r , %rk , r ; alus_sreg ] adds\t%<w>0, %<w>1, %<w>2 - [ r , rk , I ; alus_imm ] adds\t%<w>0, %<w>1, %2 - [ r , rk , J ; alus_imm ] subs\t%<w>0, %<w>1, #%n2 + {@ [ cons: =0 , %1 , 2 ; attrs: type ] + [ r , rk , r ; alus_sreg ] adds\t%<w>0, %<w>1, %<w>2 + [ r , rk , I ; alus_imm ] adds\t%<w>0, %<w>1, %2 + [ r , rk , J ; alus_imm ] subs\t%<w>0, %<w>1, #%n2 } ) @@ -2776,10 +2776,10 @@ (set (match_operand:DI 0 "register_operand") (zero_extend:DI (plus:SI (match_dup 1) (match_dup 2))))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type ] - [ r , %rk , r ; alus_sreg ] adds\t%w0, %w1, %w2 - [ r , rk , I ; alus_imm ] adds\t%w0, %w1, %2 - [ r , rk , J ; alus_imm ] subs\t%w0, %w1, #%n2 + {@ [ cons: =0 , %1 , 2 ; attrs: type ] + [ r , rk , r ; alus_sreg ] adds\t%w0, %w1, %w2 + [ r , rk , I ; alus_imm ] adds\t%w0, %w1, %2 + [ r , rk , J ; alus_imm ] subs\t%w0, %w1, #%n2 } ) @@ -2980,10 +2980,10 @@ (match_operand:GPI 1 "aarch64_plus_operand")) (const_int 0)))] "" - {@ [ cons: 0 , 1 ; attrs: type ] - [ %r , r ; alus_sreg ] cmn\t%<w>0, %<w>1 - [ r , I ; alus_imm ] cmn\t%<w>0, %1 - [ r , J ; alus_imm ] cmp\t%<w>0, #%n1 + {@ [ cons: %0 , 1 ; attrs: type ] + [ r , r ; alus_sreg ] cmn\t%<w>0, %<w>1 + [ r , I ; alus_imm ] cmn\t%<w>0, %1 + [ r , J ; alus_imm ] cmp\t%<w>0, #%n1 } ) @@ -5091,8 +5091,8 @@ (LOGICAL:GPI (match_operand:GPI 1 "register_operand") (match_operand:GPI 2 "aarch64_logical_operand")))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type , arch ] - [ r , %r , r ; logic_reg , * ] <logical>\t%<w>0, %<w>1, %<w>2 + {@ [ cons: =0 , %1 , 2 ; attrs: type , arch ] + [ r , r , r ; logic_reg , * ] <logical>\t%<w>0, %<w>1, %<w>2 [ rk , r , <lconst> ; logic_imm , * ] <logical>\t%<w>0, %<w>1, %2 [ w , 0 , <lconst> ; * , sve ] <logical>\t%Z0.<s>, %Z0.<s>, #%2 [ w , w , w ; neon_logic , simd ] <logical>\t%0.<Vbtype>, %1.<Vbtype>, %2.<Vbtype> @@ -5106,8 +5106,8 @@ (LOGICAL:SI (match_operand:SI 1 "register_operand") (match_operand:SI 2 "aarch64_logical_operand"))))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type ] - [ r , %r , r ; logic_reg ] <logical>\t%w0, %w1, %w2 + {@ [ cons: =0 , %1 , 2 ; attrs: type ] + [ r , r , r ; logic_reg ] <logical>\t%w0, %w1, %w2 [ rk , r , K ; logic_imm ] <logical>\t%w0, %w1, %2 } ) @@ -5121,8 +5121,8 @@ (set (match_operand:GPI 0 "register_operand") (and:GPI (match_dup 1) (match_dup 2)))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type ] - [ r , %r , r ; logics_reg ] ands\t%<w>0, %<w>1, %<w>2 + {@ [ cons: =0 , %1 , 2 ; attrs: type ] + [ r , r , r ; logics_reg ] ands\t%<w>0, %<w>1, %<w>2 [ r , r , <lconst> ; logics_imm ] ands\t%<w>0, %<w>1, %2 } ) @@ -5137,8 +5137,8 @@ (set (match_operand:DI 0 "register_operand") (zero_extend:DI (and:SI (match_dup 1) (match_dup 2))))] "" - {@ [ cons: =0 , 1 , 2 ; attrs: type ] - [ r , %r , r ; logics_reg ] ands\t%w0, %w1, %w2 + {@ [ cons: =0 , %1 , 2 ; attrs: type ] + [ r , r , r ; logics_reg ] ands\t%w0, %w1, %w2 [ r , r , K ; logics_imm ] ands\t%w0, %w1, %2 } ) @@ -5722,9 +5722,9 @@ (match_operand:GPI 1 "aarch64_logical_operand")) (const_int 0)))] "" - {@ [ cons: 0 , 1 ; attrs: type ] - [ %r , r ; logics_reg ] tst\t%<w>0, %<w>1 - [ r , <lconst> ; logics_imm ] tst\t%<w>0, %1 + {@ [ cons: %0 , 1 ; attrs: type ] + [ r , r ; logics_reg ] tst\t%<w>0, %<w>1 + [ r , <lconst> ; logics_imm ] tst\t%<w>0, %1 } ) diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index d587d25..743cc38 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -28,16 +28,15 @@ along with GCC; see the file COPYING3. If not see #undef TARGET_SEH #define TARGET_SEH (TARGET_64BIT_MS_ABI && flag_unwind_tables) +#undef PREFERRED_STACK_BOUNDARY_DEFAULT +#define PREFERRED_STACK_BOUNDARY_DEFAULT \ + (TARGET_64BIT ? 128 : MIN_STACK_BOUNDARY) + /* Win64 with SEH cannot represent DRAP stack frames. Disable its use. Force the use of different mechanisms to allocate aligned local data. */ #undef MAX_STACK_ALIGNMENT #define MAX_STACK_ALIGNMENT (TARGET_SEH ? 128 : MAX_OFILE_ALIGNMENT) -/* 32-bit Windows aligns the stack on a 4-byte boundary but SSE instructions - may require 16-byte alignment. */ -#undef STACK_REALIGN_DEFAULT -#define STACK_REALIGN_DEFAULT (TARGET_64BIT ? 0 : 1) - /* Support hooks for SEH. */ #undef TARGET_ASM_UNWIND_EMIT #define TARGET_ASM_UNWIND_EMIT i386_pe_seh_unwind_emit diff --git a/gcc/config/i386/i386-features.cc b/gcc/config/i386/i386-features.cc index 1ba5ac4..13e6c2a 100644 --- a/gcc/config/i386/i386-features.cc +++ b/gcc/config/i386/i386-features.cc @@ -518,15 +518,17 @@ scalar_chain::build (bitmap candidates, unsigned insn_uid, bitmap disallowed) instead of using a scalar one. */ int -general_scalar_chain::vector_const_cost (rtx exp) +general_scalar_chain::vector_const_cost (rtx exp, basic_block bb) { gcc_assert (CONST_INT_P (exp)); if (standard_sse_constant_p (exp, vmode)) return ix86_cost->sse_op; + if (optimize_bb_for_size_p (bb)) + return COSTS_N_BYTES (8); /* We have separate costs for SImode and DImode, use SImode costs for smaller modes. */ - return ix86_cost->sse_load[smode == DImode ? 1 : 0]; + return COSTS_N_INSNS (ix86_cost->sse_load[smode == DImode ? 1 : 0]) / 2; } /* Compute a gain for chain conversion. */ @@ -547,7 +549,7 @@ general_scalar_chain::compute_convert_gain () smaller modes than SImode the int load/store costs need to be adjusted as well. */ unsigned sse_cost_idx = smode == DImode ? 1 : 0; - unsigned m = smode == DImode ? (TARGET_64BIT ? 1 : 2) : 1; + int m = smode == DImode ? (TARGET_64BIT ? 1 : 2) : 1; EXECUTE_IF_SET_IN_BITMAP (insns, 0, insn_uid, bi) { @@ -555,26 +557,55 @@ general_scalar_chain::compute_convert_gain () rtx def_set = single_set (insn); rtx src = SET_SRC (def_set); rtx dst = SET_DEST (def_set); + basic_block bb = BLOCK_FOR_INSN (insn); int igain = 0; if (REG_P (src) && REG_P (dst)) - igain += 2 * m - ix86_cost->xmm_move; + { + if (optimize_bb_for_size_p (bb)) + /* reg-reg move is 2 bytes, while SSE 3. */ + igain += COSTS_N_BYTES (2 * m - 3); + else + /* Move costs are normalized to reg-reg move having cost 2. */ + igain += COSTS_N_INSNS (2 * m - ix86_cost->xmm_move) / 2; + } else if (REG_P (src) && MEM_P (dst)) - igain - += m * ix86_cost->int_store[2] - ix86_cost->sse_store[sse_cost_idx]; + { + if (optimize_bb_for_size_p (bb)) + /* Integer load/store is 3+ bytes and SSE 4+. */ + igain += COSTS_N_BYTES (3 * m - 4); + else + igain + += COSTS_N_INSNS (m * ix86_cost->int_store[2] + - ix86_cost->sse_store[sse_cost_idx]) / 2; + } else if (MEM_P (src) && REG_P (dst)) - igain += m * ix86_cost->int_load[2] - ix86_cost->sse_load[sse_cost_idx]; + { + if (optimize_bb_for_size_p (bb)) + igain += COSTS_N_BYTES (3 * m - 4); + else + igain += COSTS_N_INSNS (m * ix86_cost->int_load[2] + - ix86_cost->sse_load[sse_cost_idx]) / 2; + } else { /* For operations on memory operands, include the overhead of explicit load and store instructions. */ if (MEM_P (dst)) - igain += optimize_insn_for_size_p () - ? -COSTS_N_BYTES (8) - : (m * (ix86_cost->int_load[2] - + ix86_cost->int_store[2]) - - (ix86_cost->sse_load[sse_cost_idx] + - ix86_cost->sse_store[sse_cost_idx])); + { + if (optimize_bb_for_size_p (bb)) + /* ??? This probably should account size difference + of SSE and integer load rather than full SSE load. */ + igain -= COSTS_N_BYTES (8); + else + { + int cost = (m * (ix86_cost->int_load[2] + + ix86_cost->int_store[2]) + - (ix86_cost->sse_load[sse_cost_idx] + + ix86_cost->sse_store[sse_cost_idx])); + igain += COSTS_N_INSNS (cost) / 2; + } + } switch (GET_CODE (src)) { @@ -595,7 +626,7 @@ general_scalar_chain::compute_convert_gain () igain += ix86_cost->shift_const - ix86_cost->sse_op; if (CONST_INT_P (XEXP (src, 0))) - igain -= vector_const_cost (XEXP (src, 0)); + igain -= vector_const_cost (XEXP (src, 0), bb); break; case ROTATE: @@ -631,16 +662,17 @@ general_scalar_chain::compute_convert_gain () igain += m * ix86_cost->add; if (CONST_INT_P (XEXP (src, 0))) - igain -= vector_const_cost (XEXP (src, 0)); + igain -= vector_const_cost (XEXP (src, 0), bb); if (CONST_INT_P (XEXP (src, 1))) - igain -= vector_const_cost (XEXP (src, 1)); + igain -= vector_const_cost (XEXP (src, 1), bb); if (MEM_P (XEXP (src, 1))) { - if (optimize_insn_for_size_p ()) + if (optimize_bb_for_size_p (bb)) igain -= COSTS_N_BYTES (m == 2 ? 3 : 5); else - igain += m * ix86_cost->int_load[2] - - ix86_cost->sse_load[sse_cost_idx]; + igain += COSTS_N_INSNS + (m * ix86_cost->int_load[2] + - ix86_cost->sse_load[sse_cost_idx]) / 2; } break; @@ -698,7 +730,7 @@ general_scalar_chain::compute_convert_gain () case CONST_INT: if (REG_P (dst)) { - if (optimize_insn_for_size_p ()) + if (optimize_bb_for_size_p (bb)) { /* xor (2 bytes) vs. xorps (3 bytes). */ if (src == const0_rtx) @@ -722,14 +754,14 @@ general_scalar_chain::compute_convert_gain () /* DImode can be immediate for TARGET_64BIT and SImode always. */ igain += m * COSTS_N_INSNS (1); - igain -= vector_const_cost (src); + igain -= vector_const_cost (src, bb); } } else if (MEM_P (dst)) { igain += (m * ix86_cost->int_store[2] - ix86_cost->sse_store[sse_cost_idx]); - igain -= vector_const_cost (src); + igain -= vector_const_cost (src, bb); } break; @@ -737,13 +769,14 @@ general_scalar_chain::compute_convert_gain () if (XVECEXP (XEXP (src, 1), 0, 0) == const0_rtx) { // movd (4 bytes) replaced with movdqa (4 bytes). - if (!optimize_insn_for_size_p ()) - igain += ix86_cost->sse_to_integer - ix86_cost->xmm_move; + if (!optimize_bb_for_size_p (bb)) + igain += COSTS_N_INSNS (ix86_cost->sse_to_integer + - ix86_cost->xmm_move) / 2; } else { // pshufd; movd replaced with pshufd. - if (optimize_insn_for_size_p ()) + if (optimize_bb_for_size_p (bb)) igain += COSTS_N_BYTES (4); else igain += ix86_cost->sse_to_integer; @@ -769,11 +802,11 @@ general_scalar_chain::compute_convert_gain () /* Cost the integer to sse and sse to integer moves. */ if (!optimize_function_for_size_p (cfun)) { - cost += n_sse_to_integer * ix86_cost->sse_to_integer; + cost += n_sse_to_integer * COSTS_N_INSNS (ix86_cost->sse_to_integer) / 2; /* ??? integer_to_sse but we only have that in the RA cost table. Assume sse_to_integer/integer_to_sse are the same which they are at the moment. */ - cost += n_integer_to_sse * ix86_cost->sse_to_integer; + cost += n_integer_to_sse * COSTS_N_INSNS (ix86_cost->integer_to_sse) / 2; } else if (TARGET_64BIT || smode == SImode) { @@ -1508,13 +1541,13 @@ general_scalar_chain::convert_insn (rtx_insn *insn) with numerous special cases. */ static int -timode_immed_const_gain (rtx cst) +timode_immed_const_gain (rtx cst, basic_block bb) { /* movabsq vs. movabsq+vmovq+vunpacklqdq. */ if (CONST_WIDE_INT_P (cst) && CONST_WIDE_INT_NUNITS (cst) == 2 && CONST_WIDE_INT_ELT (cst, 0) == CONST_WIDE_INT_ELT (cst, 1)) - return optimize_insn_for_size_p () ? -COSTS_N_BYTES (9) + return optimize_bb_for_size_p (bb) ? -COSTS_N_BYTES (9) : -COSTS_N_INSNS (2); /* 2x movabsq ~ vmovdqa. */ return 0; @@ -1546,33 +1579,34 @@ timode_scalar_chain::compute_convert_gain () rtx src = SET_SRC (def_set); rtx dst = SET_DEST (def_set); HOST_WIDE_INT op1val; + basic_block bb = BLOCK_FOR_INSN (insn); int scost, vcost; int igain = 0; switch (GET_CODE (src)) { case REG: - if (optimize_insn_for_size_p ()) + if (optimize_bb_for_size_p (bb)) igain = MEM_P (dst) ? COSTS_N_BYTES (6) : COSTS_N_BYTES (3); else igain = COSTS_N_INSNS (1); break; case MEM: - igain = optimize_insn_for_size_p () ? COSTS_N_BYTES (7) + igain = optimize_bb_for_size_p (bb) ? COSTS_N_BYTES (7) : COSTS_N_INSNS (1); break; case CONST_INT: if (MEM_P (dst) && standard_sse_constant_p (src, V1TImode)) - igain = optimize_insn_for_size_p () ? COSTS_N_BYTES (11) : 1; + igain = optimize_bb_for_size_p (bb) ? COSTS_N_BYTES (11) : 1; break; case CONST_WIDE_INT: /* 2 x mov vs. vmovdqa. */ if (MEM_P (dst)) - igain = optimize_insn_for_size_p () ? COSTS_N_BYTES (3) + igain = optimize_bb_for_size_p (bb) ? COSTS_N_BYTES (3) : COSTS_N_INSNS (1); break; @@ -1587,14 +1621,14 @@ timode_scalar_chain::compute_convert_gain () if (!MEM_P (dst)) igain = COSTS_N_INSNS (1); if (CONST_SCALAR_INT_P (XEXP (src, 1))) - igain += timode_immed_const_gain (XEXP (src, 1)); + igain += timode_immed_const_gain (XEXP (src, 1), bb); break; case ASHIFT: case LSHIFTRT: /* See ix86_expand_v1ti_shift. */ op1val = INTVAL (XEXP (src, 1)); - if (optimize_insn_for_size_p ()) + if (optimize_bb_for_size_p (bb)) { if (op1val == 64 || op1val == 65) scost = COSTS_N_BYTES (5); @@ -1628,7 +1662,7 @@ timode_scalar_chain::compute_convert_gain () case ASHIFTRT: /* See ix86_expand_v1ti_ashiftrt. */ op1val = INTVAL (XEXP (src, 1)); - if (optimize_insn_for_size_p ()) + if (optimize_bb_for_size_p (bb)) { if (op1val == 64 || op1val == 127) scost = COSTS_N_BYTES (7); @@ -1706,7 +1740,7 @@ timode_scalar_chain::compute_convert_gain () case ROTATERT: /* See ix86_expand_v1ti_rotate. */ op1val = INTVAL (XEXP (src, 1)); - if (optimize_insn_for_size_p ()) + if (optimize_bb_for_size_p (bb)) { scost = COSTS_N_BYTES (13); if ((op1val & 31) == 0) @@ -1738,16 +1772,16 @@ timode_scalar_chain::compute_convert_gain () { if (GET_CODE (XEXP (src, 0)) == AND) /* and;and;or (9 bytes) vs. ptest (5 bytes). */ - igain = optimize_insn_for_size_p() ? COSTS_N_BYTES (4) - : COSTS_N_INSNS (2); + igain = optimize_bb_for_size_p (bb) ? COSTS_N_BYTES (4) + : COSTS_N_INSNS (2); /* or (3 bytes) vs. ptest (5 bytes). */ - else if (optimize_insn_for_size_p ()) + else if (optimize_bb_for_size_p (bb)) igain = -COSTS_N_BYTES (2); } else if (XEXP (src, 1) == const1_rtx) /* and;cmp -1 (7 bytes) vs. pcmpeqd;pxor;ptest (13 bytes). */ - igain = optimize_insn_for_size_p() ? -COSTS_N_BYTES (6) - : -COSTS_N_INSNS (1); + igain = optimize_bb_for_size_p (bb) ? -COSTS_N_BYTES (6) + : -COSTS_N_INSNS (1); break; default: @@ -3338,12 +3372,12 @@ replace_vector_const (machine_mode vector_mode, rtx vector_const, /* Get the single SET instruction. */ rtx set = single_set (insn); - rtx dest = SET_SRC (set); - machine_mode mode = GET_MODE (dest); + rtx src = SET_SRC (set); + machine_mode mode = GET_MODE (src); rtx replace; /* Replace the source operand with VECTOR_CONST. */ - if (SUBREG_P (dest) || mode == vector_mode) + if (SUBREG_P (src) || mode == vector_mode) replace = vector_const; else { diff --git a/gcc/config/i386/i386-features.h b/gcc/config/i386/i386-features.h index 24b0c4e..7f7c0f7 100644 --- a/gcc/config/i386/i386-features.h +++ b/gcc/config/i386/i386-features.h @@ -188,7 +188,7 @@ class general_scalar_chain : public scalar_chain private: void convert_insn (rtx_insn *insn) final override; - int vector_const_cost (rtx exp); + int vector_const_cost (rtx exp, basic_block bb); rtx convert_rotate (enum rtx_code, rtx op0, rtx op1, rtx_insn *insn); }; diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index fd36ea8..9c24a92 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -7942,6 +7942,15 @@ ix86_update_stack_boundary (void) if (ix86_tls_descriptor_calls_expanded_in_cfun && crtl->preferred_stack_boundary < 128) crtl->preferred_stack_boundary = 128; + + /* For 32-bit MS ABI, both the incoming and preferred stack boundaries + are 32 bits, but if force_align_arg_pointer is specified, it should + prefer 128 bits for a backward-compatibility reason, which is also + what the doc suggests. */ + if (lookup_attribute ("force_align_arg_pointer", + TYPE_ATTRIBUTES (TREE_TYPE (current_function_decl))) + && crtl->preferred_stack_boundary < 128) + crtl->preferred_stack_boundary = 128; } /* Handle the TARGET_GET_DRAP_RTX hook. Return NULL if no DRAP is diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 6a38de3..18fa97a 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -179,6 +179,7 @@ struct processor_costs { const int xmm_move, ymm_move, /* cost of moving XMM and YMM register. */ zmm_move; const int sse_to_integer; /* cost of moving SSE register to integer. */ + const int integer_to_sse; /* cost of moving integer register to SSE. */ const int gather_static, gather_per_elt; /* Cost of gather load is computed as static + per_item * nelts. */ const int scatter_static, scatter_per_elt; /* Cost of gather store is diff --git a/gcc/config/i386/x86-tune-costs.h b/gcc/config/i386/x86-tune-costs.h index 6cce70a..e509129 100644 --- a/gcc/config/i386/x86-tune-costs.h +++ b/gcc/config/i386/x86-tune-costs.h @@ -107,6 +107,7 @@ struct processor_costs ix86_size_cost = {/* costs for tuning for size */ in 128bit, 256bit and 512bit */ 4, 4, 6, /* cost of moving XMM,YMM,ZMM register */ 4, /* cost of moving SSE register to integer. */ + 4, /* cost of moving integer register to SSE. */ COSTS_N_BYTES (5), 0, /* Gather load static, per_elt. */ COSTS_N_BYTES (5), 0, /* Gather store static, per_elt. */ 0, /* size of l1 cache */ @@ -227,6 +228,7 @@ struct processor_costs i386_cost = { /* 386 specific costs */ {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 3, /* cost of moving SSE register to integer. */ + 3, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 0, /* size of l1 cache */ @@ -345,6 +347,7 @@ struct processor_costs i486_cost = { /* 486 specific costs */ {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 3, /* cost of moving SSE register to integer. */ + 3, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 4, /* size of l1 cache. 486 has 8kB cache @@ -465,6 +468,7 @@ struct processor_costs pentium_cost = { {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 3, /* cost of moving SSE register to integer. */ + 3, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 8, /* size of l1 cache. */ @@ -576,6 +580,7 @@ struct processor_costs lakemont_cost = { {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 3, /* cost of moving SSE register to integer. */ + 3, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 8, /* size of l1 cache. */ @@ -702,6 +707,7 @@ struct processor_costs pentiumpro_cost = { {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 3, /* cost of moving SSE register to integer. */ + 3, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 8, /* size of l1 cache. */ @@ -819,6 +825,7 @@ struct processor_costs geode_cost = { {2, 2, 8, 16, 32}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 2, 2, /* Gather load static, per_elt. */ 2, 2, /* Gather store static, per_elt. */ 64, /* size of l1 cache. */ @@ -936,6 +943,7 @@ struct processor_costs k6_cost = { {2, 2, 8, 16, 32}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 2, 2, /* Gather load static, per_elt. */ 2, 2, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -1059,6 +1067,7 @@ struct processor_costs athlon_cost = { {4, 4, 10, 10, 20}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 5, /* cost of moving SSE register to integer. */ + 5, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 64, /* size of l1 cache. */ @@ -1184,6 +1193,7 @@ struct processor_costs k8_cost = { {4, 4, 10, 10, 20}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 5, /* cost of moving SSE register to integer. */ + 5, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 64, /* size of l1 cache. */ @@ -1322,6 +1332,7 @@ struct processor_costs amdfam10_cost = { {4, 4, 5, 10, 20}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 3, /* cost of moving SSE register to integer. */ + 3, /* cost of moving integer register to SSE. */ 4, 4, /* Gather load static, per_elt. */ 4, 4, /* Gather store static, per_elt. */ 64, /* size of l1 cache. */ @@ -1452,6 +1463,7 @@ const struct processor_costs bdver_cost = { {10, 10, 10, 40, 60}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 16, /* cost of moving SSE register to integer. */ + 16, /* cost of moving integer register to SSE. */ 12, 12, /* Gather load static, per_elt. */ 10, 10, /* Gather store static, per_elt. */ 16, /* size of l1 cache. */ @@ -1603,6 +1615,7 @@ struct processor_costs znver1_cost = { {8, 8, 8, 16, 32}, /* cost of unaligned stores. */ 2, 3, 6, /* cost of moving XMM,YMM,ZMM register. */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ /* VGATHERDPD is 23 uops and throughput is 9, VGATHERDPD is 35 uops, throughput 12. Approx 9 uops do not depend on vector size and every load is 7 uops. */ @@ -1770,6 +1783,7 @@ struct processor_costs znver2_cost = { 2, 2, 3, /* cost of moving XMM,YMM,ZMM register. */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ /* VGATHERDPD is 23 uops and throughput is 9, VGATHERDPD is 35 uops, throughput 12. Approx 9 uops do not depend on vector size and every load is 7 uops. */ @@ -1912,6 +1926,7 @@ struct processor_costs znver3_cost = { 2, 2, 3, /* cost of moving XMM,YMM,ZMM register. */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ /* VGATHERDPD is 15 uops and throughput is 4, VGATHERDPS is 23 uops, throughput 9. Approx 7 uops do not depend on vector size and every load is 4 uops. */ @@ -2056,6 +2071,7 @@ struct processor_costs znver4_cost = { 2, 2, 2, /* cost of moving XMM,YMM,ZMM register. */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ /* VGATHERDPD is 17 uops and throughput is 4, VGATHERDPS is 24 uops, throughput 5. Approx 7 uops do not depend on vector size and every load is 5 uops. */ @@ -2204,6 +2220,7 @@ struct processor_costs znver5_cost = { 2, 2, 2, /* cost of moving XMM,YMM,ZMM register. */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ /* TODO: gather and scatter instructions are currently disabled in x86-tune.def. In some cases they are however a win, see PR116582 @@ -2372,6 +2389,7 @@ struct processor_costs skylake_cost = { {8, 8, 8, 8, 16}, /* cost of unaligned stores. */ 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 20, 8, /* Gather load static, per_elt. */ 22, 10, /* Gather store static, per_elt. */ 64, /* size of l1 cache. */ @@ -2508,6 +2526,7 @@ struct processor_costs icelake_cost = { {8, 8, 8, 8, 16}, /* cost of unaligned stores. */ 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 20, 8, /* Gather load static, per_elt. */ 22, 10, /* Gather store static, per_elt. */ 64, /* size of l1 cache. */ @@ -2638,6 +2657,7 @@ struct processor_costs alderlake_cost = { {8, 8, 8, 10, 15}, /* cost of unaligned storess. */ 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 18, 6, /* Gather load static, per_elt. */ 18, 6, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -2761,6 +2781,7 @@ const struct processor_costs btver1_cost = { {10, 10, 12, 48, 96}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 14, /* cost of moving SSE register to integer. */ + 14, /* cost of moving integer register to SSE. */ 10, 10, /* Gather load static, per_elt. */ 10, 10, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -2881,6 +2902,7 @@ const struct processor_costs btver2_cost = { {10, 10, 12, 48, 96}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 14, /* cost of moving SSE register to integer. */ + 14, /* cost of moving integer register to SSE. */ 10, 10, /* Gather load static, per_elt. */ 10, 10, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -3000,6 +3022,7 @@ struct processor_costs pentium4_cost = { {32, 32, 32, 64, 128}, /* cost of unaligned stores. */ 12, 24, 48, /* cost of moving XMM,YMM,ZMM register */ 20, /* cost of moving SSE register to integer. */ + 20, /* cost of moving integer register to SSE. */ 16, 16, /* Gather load static, per_elt. */ 16, 16, /* Gather store static, per_elt. */ 8, /* size of l1 cache. */ @@ -3122,6 +3145,7 @@ struct processor_costs nocona_cost = { {24, 24, 24, 48, 96}, /* cost of unaligned stores. */ 6, 12, 24, /* cost of moving XMM,YMM,ZMM register */ 20, /* cost of moving SSE register to integer. */ + 20, /* cost of moving integer register to SSE. */ 12, 12, /* Gather load static, per_elt. */ 12, 12, /* Gather store static, per_elt. */ 8, /* size of l1 cache. */ @@ -3242,6 +3266,7 @@ struct processor_costs atom_cost = { {16, 16, 16, 32, 64}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 8, /* cost of moving SSE register to integer. */ + 8, /* cost of moving integer register to SSE. */ 8, 8, /* Gather load static, per_elt. */ 8, 8, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -3362,6 +3387,7 @@ struct processor_costs slm_cost = { {16, 16, 16, 32, 64}, /* cost of unaligned stores. */ 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ 8, /* cost of moving SSE register to integer. */ + 8, /* cost of moving integer register to SSE. */ 8, 8, /* Gather load static, per_elt. */ 8, 8, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -3494,6 +3520,7 @@ struct processor_costs tremont_cost = { {6, 6, 6, 10, 15}, /* cost of unaligned storess. */ 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 18, 6, /* Gather load static, per_elt. */ 18, 6, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -3616,6 +3643,7 @@ struct processor_costs intel_cost = { {10, 10, 10, 10, 10}, /* cost of unaligned loads. */ 2, 2, 2, /* cost of moving XMM,YMM,ZMM register */ 4, /* cost of moving SSE register to integer. */ + 4, /* cost of moving integer register to SSE. */ 6, 6, /* Gather load static, per_elt. */ 6, 6, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -3731,15 +3759,16 @@ struct processor_costs lujiazui_cost = { {6, 6, 6}, /* cost of loading integer registers in QImode, HImode and SImode. Relative to reg-reg move (2). */ - {6, 6, 6}, /* cost of storing integer registers. */ + {6, 6, 6}, /* cost of storing integer registers. */ {6, 6, 6, 10, 15}, /* cost of loading SSE register - in 32bit, 64bit, 128bit, 256bit and 512bit. */ + in 32bit, 64bit, 128bit, 256bit and 512bit. */ {6, 6, 6, 10, 15}, /* cost of storing SSE register - in 32bit, 64bit, 128bit, 256bit and 512bit. */ + in 32bit, 64bit, 128bit, 256bit and 512bit. */ {6, 6, 6, 10, 15}, /* cost of unaligned loads. */ {6, 6, 6, 10, 15}, /* cost of unaligned storess. */ - 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */ - 6, /* cost of moving SSE register to integer. */ + 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */ + 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 18, 6, /* Gather load static, per_elt. */ 18, 6, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -3864,6 +3893,7 @@ struct processor_costs yongfeng_cost = { {8, 8, 8, 12, 15}, /* cost of unaligned storess. */ 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */ 8, /* cost of moving SSE register to integer. */ + 8, /* cost of moving integer register to SSE. */ 18, 6, /* Gather load static, per_elt. */ 18, 6, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -3987,6 +4017,7 @@ struct processor_costs shijidadao_cost = { {8, 8, 8, 12, 15}, /* cost of unaligned storess. */ 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */ 8, /* cost of moving SSE register to integer. */ + 8, /* cost of moving integer register to SSE. */ 18, 6, /* Gather load static, per_elt. */ 18, 6, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -4116,6 +4147,7 @@ struct processor_costs generic_cost = { {6, 6, 6, 10, 15}, /* cost of unaligned storess. */ 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */ 6, /* cost of moving SSE register to integer. */ + 6, /* cost of moving integer register to SSE. */ 18, 6, /* Gather load static, per_elt. */ 18, 6, /* Gather store static, per_elt. */ 32, /* size of l1 cache. */ @@ -4249,6 +4281,7 @@ struct processor_costs core_cost = { {6, 6, 6, 6, 12}, /* cost of unaligned stores. */ 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */ 2, /* cost of moving SSE register to integer. */ + 2, /* cost of moving integer register to SSE. */ /* VGATHERDPD is 7 uops, rec throughput 5, while VGATHERDPD is 9 uops, rec. throughput 6. So 5 uops statically and one uops per load. */ diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md index 95df533..c226c39 100644 --- a/gcc/config/riscv/bitmanip.md +++ b/gcc/config/riscv/bitmanip.md @@ -1222,7 +1222,7 @@ we can't keep it in 64 bit variable.) then use clmul instruction to implement the CRC, otherwise (TARGET_ZBKB) generate table based using brev. */ - if ((TARGET_ZBKC || TARGET_ZBC) && <ANYI:MODE>mode < word_mode) + if ((TARGET_ZBKC || TARGET_ZBC || TARGET_ZVBC) && <ANYI:MODE>mode < word_mode) expand_reversed_crc_using_clmul (<ANYI:MODE>mode, <ANYI1:MODE>mode, operands); else if (TARGET_ZBKB) @@ -1254,7 +1254,8 @@ (match_operand:SUBX 3)] UNSPEC_CRC))] /* We don't support the case when data's size is bigger than CRC's size. */ - "(TARGET_ZBKC || TARGET_ZBC) && <SUBX:MODE>mode >= <SUBX1:MODE>mode" + "(TARGET_ZBKC || TARGET_ZBC || TARGET_ZVBC) + && <SUBX:MODE>mode >= <SUBX1:MODE>mode" { /* If we have the ZBC or ZBKC extension (ie, clmul) and it is possible to store the quotient within a single variable diff --git a/gcc/config/riscv/iterators.md b/gcc/config/riscv/iterators.md index 214c20b..584b345 100644 --- a/gcc/config/riscv/iterators.md +++ b/gcc/config/riscv/iterators.md @@ -262,6 +262,9 @@ (define_code_attr fix_uns [(fix "fix") (unsigned_fix "fixuns")]) +(define_code_attr OPTAB [(ior "IOR") + (xor "XOR")]) + ;; ------------------------------------------------------------------- ;; Code Attributes diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md index c9a638c..23690792 100644 --- a/gcc/config/riscv/predicates.md +++ b/gcc/config/riscv/predicates.md @@ -380,14 +380,6 @@ (and (match_code "const_int") (match_test "SINGLE_BIT_MASK_OPERAND (UINTVAL (op))"))) -;; Register, small constant or single bit constant for use in -;; bseti/binvi. -(define_predicate "arith_or_zbs_operand" - (ior (match_operand 0 "const_arith_operand") - (match_operand 0 "register_operand") - (and (match_test "TARGET_ZBS") - (match_operand 0 "single_bit_mask_operand")))) - (define_predicate "not_single_bit_mask_operand" (and (match_code "const_int") (match_test "SINGLE_BIT_MASK_OPERAND (~UINTVAL (op))"))) @@ -689,3 +681,7 @@ (define_predicate "bitpos_mask_operand" (and (match_code "const_int") (match_test "TARGET_64BIT ? INTVAL (op) == 63 : INTVAL (op) == 31"))) + +(define_predicate "reg_or_const_int_operand" + (ior (match_operand 0 "const_int_operand") + (match_operand 0 "register_operand"))) diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index b0d5bbb..271a9a3 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -140,6 +140,7 @@ extern void riscv_expand_sssub (rtx, rtx, rtx); extern void riscv_expand_ustrunc (rtx, rtx); extern void riscv_expand_sstrunc (rtx, rtx); extern int riscv_register_move_cost (machine_mode, reg_class_t, reg_class_t); +extern bool synthesize_ior_xor (rtx_code, rtx [3]); #ifdef RTX_CODE extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx, bool *invert_ptr = 0); diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h index 559e708..7b3fdae 100644 --- a/gcc/config/riscv/riscv-subset.h +++ b/gcc/config/riscv/riscv-subset.h @@ -82,6 +82,8 @@ private: const char *parse_single_multiletter_ext (const char *, const char *, const char *, bool); + std::string parse_profiles (const char*); + void handle_implied_ext (const char *); bool check_implied_ext (); void handle_combine_ext (); diff --git a/gcc/config/riscv/riscv-vect-permconst.cc b/gcc/config/riscv/riscv-vect-permconst.cc index feecc7e..8e13cf8 100644 --- a/gcc/config/riscv/riscv-vect-permconst.cc +++ b/gcc/config/riscv/riscv-vect-permconst.cc @@ -203,6 +203,24 @@ vector_permconst::process_bb (basic_block bb) if (bias < 0 || bias > 16384 / 8) continue; + /* We need to verify that each element would be a valid value + in the inner mode after applying the bias. */ + machine_mode inner = GET_MODE_INNER (GET_MODE (cvec)); + HOST_WIDE_INT precision = GET_MODE_PRECISION (inner).to_constant (); + int i; + for (i = 0; i < CONST_VECTOR_NUNITS (cvec).to_constant (); i++) + { + HOST_WIDE_INT val = INTVAL (CONST_VECTOR_ELT (cvec, i)) - bias; + if (val != sext_hwi (val, precision)) + break; + } + + /* If the loop terminated early, then we found a case where the + adjusted constant would not fit, so we can't record the constant + for this case (it's unlikely to be useful anyway. */ + if (i != CONST_VECTOR_NUNITS (cvec).to_constant ()) + continue; + /* At this point we have a load of a constant integer vector from the constant pool. That constant integer vector is hopefully a permutation constant. We need to make a copy of the vector and @@ -211,7 +229,7 @@ vector_permconst::process_bb (basic_block bb) XXX This violates structure sharing conventions. */ rtvec_def *nvec = gen_rtvec (CONST_VECTOR_NUNITS (cvec).to_constant ()); - for (int i = 0; i < CONST_VECTOR_NUNITS (cvec).to_constant (); i++) + for (i = 0; i < CONST_VECTOR_NUNITS (cvec).to_constant (); i++) nvec->elem[i] = GEN_INT (INTVAL (CONST_VECTOR_ELT (cvec, i)) - bias); rtx copy = gen_rtx_CONST_VECTOR (GET_MODE (cvec), nvec); diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 3ee88db..8b77a35 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -14035,17 +14035,53 @@ expand_crc_using_clmul (scalar_mode crc_mode, scalar_mode data_mode, rtx data = gen_rtx_ZERO_EXTEND (word_mode, operands[2]); riscv_expand_op (XOR, word_mode, a0, crc, data); - if (TARGET_64BIT) - emit_insn (gen_riscv_clmul_di (a0, a0, t0)); - else - emit_insn (gen_riscv_clmul_si (a0, a0, t0)); + if (TARGET_ZBKC || TARGET_ZBC) + { + if (TARGET_64BIT) + emit_insn (gen_riscv_clmul_di (a0, a0, t0)); + else + emit_insn (gen_riscv_clmul_si (a0, a0, t0)); - riscv_expand_op (LSHIFTRT, word_mode, a0, a0, - gen_int_mode (crc_size, word_mode)); - if (TARGET_64BIT) - emit_insn (gen_riscv_clmul_di (a0, a0, t1)); + riscv_expand_op (LSHIFTRT, word_mode, a0, a0, + gen_int_mode (crc_size, word_mode)); + if (TARGET_64BIT) + emit_insn (gen_riscv_clmul_di (a0, a0, t1)); + else + emit_insn (gen_riscv_clmul_si (a0, a0, t1)); + } else - emit_insn (gen_riscv_clmul_si (a0, a0, t1)); + { + machine_mode vmode; + if (!riscv_vector::get_vector_mode (DImode, 1).exists (&vmode)) + gcc_unreachable (); + + rtx vec = gen_reg_rtx (vmode); + + insn_code icode1 = code_for_pred_broadcast (vmode); + rtx ops1[] = {vec, a0}; + emit_nonvlmax_insn (icode1, UNARY_OP, ops1, CONST1_RTX (Pmode)); + + rtx rvv1di_reg = gen_rtx_SUBREG (RVVM1DImode, vec, 0); + insn_code icode2 = code_for_pred_vclmul_scalar (UNSPEC_VCLMUL, + E_RVVM1DImode); + rtx ops2[] = {rvv1di_reg, rvv1di_reg, t0}; + emit_nonvlmax_insn (icode2, riscv_vector::BINARY_OP, ops2, CONST1_RTX + (Pmode)); + + rtx shift_amount = gen_int_mode (data_size, Pmode); + insn_code icode3 = code_for_pred_scalar (LSHIFTRT, vmode); + rtx ops3[] = {vec, vec, shift_amount}; + emit_nonvlmax_insn (icode3, BINARY_OP, ops3, CONST1_RTX (Pmode)); + + insn_code icode4 = code_for_pred_vclmul_scalar (UNSPEC_VCLMULH, + E_RVVM1DImode); + rtx ops4[] = {rvv1di_reg, rvv1di_reg, t1}; + emit_nonvlmax_insn (icode4, riscv_vector::BINARY_OP, ops4, CONST1_RTX + (Pmode)); + + rtx vec_low_lane = gen_lowpart (DImode, vec); + riscv_emit_move (a0, vec_low_lane); + } if (crc_size > data_size) { @@ -14094,19 +14130,53 @@ expand_reversed_crc_using_clmul (scalar_mode crc_mode, scalar_mode data_mode, rtx a0 = gen_reg_rtx (word_mode); riscv_expand_op (XOR, word_mode, a0, crc, data); - if (TARGET_64BIT) - emit_insn (gen_riscv_clmul_di (a0, a0, t0)); - else - emit_insn (gen_riscv_clmul_si (a0, a0, t0)); + if (TARGET_ZBKC || TARGET_ZBC) + { + if (TARGET_64BIT) + emit_insn (gen_riscv_clmul_di (a0, a0, t0)); + else + emit_insn (gen_riscv_clmul_si (a0, a0, t0)); - rtx num_shift = gen_int_mode (GET_MODE_BITSIZE (word_mode) - data_size, - word_mode); - riscv_expand_op (ASHIFT, word_mode, a0, a0, num_shift); + rtx num_shift = gen_int_mode (BITS_PER_WORD - data_size, word_mode); + riscv_expand_op (ASHIFT, word_mode, a0, a0, num_shift); - if (TARGET_64BIT) - emit_insn (gen_riscv_clmulh_di (a0, a0, t1)); + if (TARGET_64BIT) + emit_insn (gen_riscv_clmulh_di (a0, a0, t1)); + else + emit_insn (gen_riscv_clmulh_si (a0, a0, t1)); + } else - emit_insn (gen_riscv_clmulh_si (a0, a0, t1)); + { + machine_mode vmode; + if (!riscv_vector::get_vector_mode (DImode, 1).exists (&vmode)) + gcc_unreachable (); + + rtx vec = gen_reg_rtx (vmode); + insn_code icode1 = code_for_pred_broadcast (vmode); + rtx ops1[] = {vec, a0}; + emit_nonvlmax_insn (icode1, UNARY_OP, ops1, CONST1_RTX (Pmode)); + + rtx rvv1di_reg = gen_rtx_SUBREG (RVVM1DImode, vec, 0); + insn_code icode2 = code_for_pred_vclmul_scalar (UNSPEC_VCLMUL, + E_RVVM1DImode); + rtx ops2[] = {rvv1di_reg, rvv1di_reg, t0}; + emit_nonvlmax_insn (icode2, riscv_vector::BINARY_OP, ops2, CONST1_RTX + (Pmode)); + + rtx shift_amount = gen_int_mode (BITS_PER_WORD - data_size, Pmode); + insn_code icode3 = code_for_pred_scalar (ASHIFT, vmode); + rtx ops3[] = {vec, vec, shift_amount}; + emit_nonvlmax_insn (icode3, BINARY_OP, ops3, CONST1_RTX (Pmode)); + + insn_code icode4 = code_for_pred_vclmul_scalar (UNSPEC_VCLMULH, + E_RVVM1DImode); + rtx ops4[] = {rvv1di_reg, rvv1di_reg, t1}; + emit_nonvlmax_insn (icode4, riscv_vector::BINARY_OP, ops4, CONST1_RTX + (Pmode)); + + rtx vec_low_lane = gen_lowpart (DImode, vec); + riscv_emit_move (a0, vec_low_lane); + } if (crc_size > data_size) { @@ -14140,6 +14210,205 @@ bool need_shadow_stack_push_pop_p () return is_zicfiss_p () && riscv_save_return_addr_reg_p (); } +/* Synthesize OPERANDS[0] = OPERANDS[1] CODE OPERANDS[2]. + + OPERANDS[0] and OPERANDS[1] will be a REG and may be the same + REG. + + OPERANDS[2] is a CONST_INT. + + CODE is IOR or XOR. + + Return TRUE if the operation was fully synthesized and the caller + need not generate additional code. Return FALSE if the operation + was not synthesized and the caller is responsible for emitting the + proper sequence. */ + +bool +synthesize_ior_xor (rtx_code code, rtx operands[3]) +{ + /* Trivial cases that don't need synthesis. */ + if (SMALL_OPERAND (INTVAL (operands[2])) + || ((TARGET_ZBS || TARGET_XTHEADBS || TARGET_ZBKB) + && single_bit_mask_operand (operands[2], word_mode))) + return false; + + /* The number of instructions to synthesize the constant is a good + estimate of the budget. That does not account for out of order + execution an fusion in the constant synthesis those would naturally + decrease the budget. It also does not account for the IOR/XOR at + the end of the sequence which would increase the budget. */ + int budget = (TARGET_ZBS ? riscv_const_insns (operands[2], true) : -1); + int original_budget = budget; + + /* Bits we need to set in operands[0]. As we synthesize the operation, + we clear bits in IVAL. Once IVAL is zero, then synthesis of the + operation is complete. */ + unsigned HOST_WIDE_INT ival = INTVAL (operands[2]); + + /* Check if we want to use [x]ori. Then get the remaining bits + and decrease the budget by one. */ + if ((ival & HOST_WIDE_INT_UC (0x7ff)) != 0) + { + ival &= ~HOST_WIDE_INT_UC (0x7ff); + budget--; + } + + /* Check for bseti cases. For each remaining bit in ival, + decrease the budget by one. */ + while (ival) + { + HOST_WIDE_INT tmpval = HOST_WIDE_INT_UC (1) << ctz_hwi (ival); + ival &= ~tmpval; + budget--; + } + + /* If we're flipping all but a small number of bits we can pre-flip + the outliers, then flip all the bits, which would restore those + bits that were pre-flipped. */ + if ((TARGET_ZBS || TARGET_XTHEADBS || TARGET_ZBKB) + && budget < 0 + && code == XOR + && popcount_hwi (~INTVAL (operands[2])) < original_budget) + { + /* Pre-flipping bits we want to preserve. */ + rtx input = operands[1]; + ival = ~INTVAL (operands[2]); + while (ival) + { + HOST_WIDE_INT tmpval = HOST_WIDE_INT_UC (1) << ctz_hwi (ival); + rtx x = GEN_INT (tmpval); + x = gen_rtx_XOR (word_mode, input, x); + emit_insn (gen_rtx_SET (operands[0], x)); + input = operands[0]; + ival &= ~tmpval; + } + + /* Now flip all the bits, which restores the bits we were + preserving. */ + rtx x = gen_rtx_NOT (word_mode, input); + emit_insn (gen_rtx_SET (operands[0], x)); + return true; + } + + /* One more approach we can try. If our budget is 3+ instructions, + then we can try to rotate the source so that the bits we want to + set are in the low 11 bits. We then use [x]ori to set those low + bits, then rotate things back into their proper place. */ + if ((TARGET_ZBB || TARGET_XTHEADBB || TARGET_ZBKB) + && budget < 0 + && popcount_hwi (INTVAL (operands[2])) <= 11 + && riscv_const_insns (operands[2], true) >= 3) + { + ival = INTVAL (operands[2]); + /* First see if the constant trivially fits into 11 bits in the LSB. */ + int lsb = ctz_hwi (ival); + int msb = BITS_PER_WORD - 1 - clz_hwi (ival); + if (msb - lsb + 1 <= 11) + { + /* Rotate the source right by LSB bits. */ + rtx x = GEN_INT (lsb); + x = gen_rtx_ROTATERT (word_mode, operands[1], x); + emit_insn (gen_rtx_SET (operands[0], x)); + + /* Shift the constant right by LSB bits. */ + x = GEN_INT (ival >> lsb); + + /* Perform the IOR/XOR operation. */ + x = gen_rtx_fmt_ee (code, word_mode, operands[0], x); + emit_insn (gen_rtx_SET (operands[0], x)); + + /* And rotate left to put everything back in place, we don't + have rotate left by a constant, so use rotate right by + an adjusted constant. */ + x = GEN_INT (BITS_PER_WORD - lsb); + x = gen_rtx_ROTATERT (word_mode, operands[1], x); + emit_insn (gen_rtx_SET (operands[0], x)); + return true; + } + + /* Maybe the bits are split between the high and low parts + of the constant. A bit more complex, but still manageable. + + Conceptually we want to rotate left the constant by the number + of leading zeros after masking off all but the low 11 bits. */ + int rotcount = clz_hwi (ival & 0x7ff) - (BITS_PER_WORD - 11); + + /* Rotate the constant left by MSB bits. */ + ival = (ival << rotcount) | (ival >> (BITS_PER_WORD - rotcount)); + + /* Now we can do the same tests as before. */ + lsb = ctz_hwi (ival); + msb = BITS_PER_WORD - clz_hwi (ival); + if ((INTVAL (operands[2]) & HOST_WIDE_INT_UC (0x7ff)) != 0 + && msb - lsb + 1 <= 11) + { + /* Rotate the source left by ROTCOUNT bits, we don't have + rotate left by a constant, so use rotate right by an + adjusted constant. */ + rtx x = GEN_INT (BITS_PER_WORD - rotcount); + x = gen_rtx_ROTATERT (word_mode, operands[1], x); + emit_insn (gen_rtx_SET (operands[0], x)); + + /* We've already rotated the constant. So perform the IOR/XOR + operation. */ + x = GEN_INT (ival); + x = gen_rtx_fmt_ee (code, word_mode, operands[0], x); + emit_insn (gen_rtx_SET (operands[0], x)); + + /* And rotate right to put everything into its proper place. */ + x = GEN_INT (rotcount); + x = gen_rtx_ROTATERT (word_mode, operands[0], x); + emit_insn (gen_rtx_SET (operands[0], x)); + return true; + } + } + + /* If after accounting for bseti the remaining budget has + gone to less than zero, it forces the value into a + register and performs the IOR operation. It returns + TRUE to the caller so the caller knows code generation + is complete. */ + if (budget < 0) + { + rtx x = force_reg (word_mode, operands[2]); + x = gen_rtx_fmt_ee (code, word_mode, operands[1], x); + emit_insn (gen_rtx_SET (operands[0], x)); + return true; + } + + /* Synthesis is better than loading the constant. */ + ival = INTVAL (operands[2]); + rtx input = operands[1]; + + /* Emit the [x]ori insn that sets the low 11 bits into + the proper state. */ + if ((ival & HOST_WIDE_INT_UC (0x7ff)) != 0) + { + rtx x = GEN_INT (ival & HOST_WIDE_INT_UC (0x7ff)); + x = gen_rtx_fmt_ee (code, word_mode, input, x); + emit_insn (gen_rtx_SET (operands[0], x)); + input = operands[0]; + ival &= ~HOST_WIDE_INT_UC (0x7ff); + } + + /* We figure out a single bit as a constant and + generate a CONST_INT node for that. Then we + construct the IOR node, then the SET node and + emit it. An IOR with a suitable constant that is + a single bit will be implemented with a bseti. */ + while (ival) + { + HOST_WIDE_INT tmpval = HOST_WIDE_INT_UC (1) << ctz_hwi (ival); + rtx x = GEN_INT (tmpval); + x = gen_rtx_fmt_ee (code, word_mode, input, x); + emit_insn (gen_rtx_SET (operands[0], x)); + input = operands[0]; + ival &= ~tmpval; + } + return true; +} + /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP #define TARGET_ASM_ALIGNED_HI_OP "\t.half\t" diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 259997f..154b49d 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1767,8 +1767,15 @@ (define_expand "<optab><mode>3" [(set (match_operand:X 0 "register_operand") (any_or:X (match_operand:X 1 "register_operand" "") - (match_operand:X 2 "arith_or_zbs_operand" "")))] - "") + (match_operand:X 2 "reg_or_const_int_operand" "")))] + "" + +{ + /* If synthesis of the logical op is successful, then no further code + generation is necessary. Else just generate code normally. */ + if (CONST_INT_P (operands[2]) && synthesize_ior_xor (<OPTAB>, operands)) + DONE; +}) (define_insn "*<optab><mode>3" [(set (match_operand:X 0 "register_operand" "=r,r") diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt index 9e471be..80593ee 100644 --- a/gcc/config/riscv/riscv.opt +++ b/gcc/config/riscv/riscv.opt @@ -274,6 +274,8 @@ Mask(ZA64RS) Var(riscv_za_subext) Mask(ZA128RS) Var(riscv_za_subext) +Mask(ZAMA16B) Var(riscv_za_subext) + TargetVariable int riscv_zb_subext diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bcce377..f9b93e6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,27 @@ +2025-05-10 Jason Merrill <jason@redhat.com> + + PR c++/120204 + * pt.cc (tsubst_baselink): Always error if lookup fails. + +2025-05-09 Jason Merrill <jason@redhat.com> + + * decl2.cc (determine_visibility): Ignore args for friend templates. + +2025-05-09 Jason Merrill <jason@redhat.com> + + PR c++/99599 + PR c++/120185 + * class.cc (type_has_converting_constructor): Handle null parm. + * pt.cc (fn_type_unification): Skip early non-dep checking if + no concepts. + +2025-05-08 Jason Merrill <jason@redhat.com> + + PR c++/99599 + * cp-tree.h (type_has_converting_constructor): Declare. + * class.cc (type_has_converting_constructor): New. + * pt.cc (conversion_may_instantiate_p): Don't check completeness. + 2025-05-05 Simon Martin <simon@nasilyan.com> * cp-tree.h (parsing_default_capturing_generic_lambda_in_template): diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc index 6767ac1..2764bb5 100644 --- a/gcc/cp/class.cc +++ b/gcc/cp/class.cc @@ -5724,6 +5724,50 @@ type_has_user_provided_constructor (tree t) return false; } +/* Returns true iff class T has a constructor that accepts a single argument + and does not have a single parameter of type reference to T. + + This does not exclude explicit constructors because they are still + considered for conversions within { } even though choosing one is + ill-formed. */ + +bool +type_has_converting_constructor (tree t) +{ + if (!CLASS_TYPE_P (t)) + return false; + + if (!TYPE_HAS_USER_CONSTRUCTOR (t)) + return false; + + for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter) + { + tree fn = *iter; + tree parm = FUNCTION_FIRST_USER_PARMTYPE (fn); + if (parm == NULL_TREE) + /* Varargs. */ + return true; + if (parm == void_list_node + || !sufficient_parms_p (TREE_CHAIN (parm))) + /* Can't accept a single argument, so won't be considered for + conversion. */ + continue; + if (TREE_CODE (fn) == TEMPLATE_DECL + || TREE_CHAIN (parm) != void_list_node) + /* Not a simple single parameter. */ + return true; + if (TYPE_MAIN_VARIANT (non_reference (TREE_VALUE (parm))) + != DECL_CONTEXT (fn)) + /* The single parameter has the wrong type. */ + return true; + if (get_constraints (fn)) + /* Constrained. */ + return true; + } + + return false; +} + /* Returns true iff class T has a user-provided or explicit constructor. */ bool diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a42c07a..175ab28 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7056,6 +7056,7 @@ extern tree in_class_defaulted_default_constructor (tree); extern bool user_provided_p (tree); extern bool type_has_user_provided_constructor (tree); extern bool type_has_non_user_provided_default_constructor (tree); +extern bool type_has_converting_constructor (tree); extern bool vbase_has_user_provided_move_assign (tree); extern tree default_init_uninitialized_part (tree); extern bool trivial_default_constructor_is_constexpr (tree); diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 21156f1..15db1d6 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -3160,7 +3160,9 @@ determine_visibility (tree decl) && !attr) { int depth = TMPL_ARGS_DEPTH (args); - if (DECL_VISIBILITY_SPECIFIED (decl)) + if (DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P (TI_TEMPLATE (tinfo))) + /* Class template args don't affect template friends. */; + else if (DECL_VISIBILITY_SPECIFIED (decl)) { /* A class template member with explicit visibility overrides the class visibility, so we need to apply diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 7b296d1..0d64a1c 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -17477,10 +17477,18 @@ tsubst_baselink (tree baselink, tree object_type, if (!baselink) { - if ((complain & tf_error) - && constructor_name_p (name, qualifying_scope)) - error ("cannot call constructor %<%T::%D%> directly", - qualifying_scope, name); + if (complain & tf_error) + { + if (constructor_name_p (name, qualifying_scope)) + error ("cannot call constructor %<%T::%D%> directly", + qualifying_scope, name); + else + /* Lookup succeeded at parse time, but failed during + instantiation; must be because we're trying to refer to it + while forming its declaration (c++/120204). */ + error ("declaration of %<%T::%D%> depends on itself", + qualifying_scope, name); + } return error_mark_node; } @@ -23254,7 +23262,7 @@ fn_type_unification (tree fn, conversions that we know are not going to induce template instantiation (PR99599). */ if (strict == DEDUCE_CALL - && incomplete + && incomplete && flag_concepts && check_non_deducible_conversions (parms, args, nargs, fn, strict, flags, convs, explain_p, /*noninst_only_p=*/true)) @@ -23501,9 +23509,13 @@ maybe_adjust_types_for_deduction (tree tparms, return result; } -/* Return true if computing a conversion from FROM to TO might induce template - instantiation. Conversely, if this predicate returns false then computing - the conversion definitely won't induce template instantiation. */ +/* Return true if computing a conversion from FROM to TO might consider + user-defined conversions, which could lead to arbitrary template + instantiations (e.g. g++.dg/cpp2a/concepts-nondep1.C). If this predicate + returns false then computing the conversion definitely won't try UDCs. + + Note that this restriction parallels LOOKUP_DEFAULTED for CWG1092, but in + this case we want the early filter to pass instead of fail. */ static bool conversion_may_instantiate_p (tree to, tree from) @@ -23511,36 +23523,14 @@ conversion_may_instantiate_p (tree to, tree from) to = non_reference (to); from = non_reference (from); - bool ptr_conv_p = false; - if (TYPE_PTR_P (to) - && TYPE_PTR_P (from)) - { - to = TREE_TYPE (to); - from = TREE_TYPE (from); - ptr_conv_p = true; - } - - /* If one of the types is a not-yet-instantiated class template - specialization, then computing the conversion might instantiate - it in order to inspect bases, conversion functions and/or - converting constructors. */ - if ((CLASS_TYPE_P (to) - && !COMPLETE_TYPE_P (to) - && CLASSTYPE_TEMPLATE_INSTANTIATION (to)) - || (CLASS_TYPE_P (from) - && !COMPLETE_TYPE_P (from) - && CLASSTYPE_TEMPLATE_INSTANTIATION (from))) - return true; - - /* Converting from one pointer type to another, or between - reference-related types, always yields a standard conversion. */ - if (ptr_conv_p || reference_related_p (to, from)) + /* Converting between reference-related types is a standard conversion. */ + if (reference_related_p (to, from)) return false; /* Converting to a non-aggregate class type will consider its user-declared constructors, which might induce instantiation. */ if (CLASS_TYPE_P (to) - && CLASSTYPE_NON_AGGREGATE (to)) + && type_has_converting_constructor (to)) return true; /* Similarly, converting from a class type will consider its conversion @@ -23549,7 +23539,7 @@ conversion_may_instantiate_p (tree to, tree from) && TYPE_HAS_CONVERSION (from)) return true; - /* Otherwise, computing this conversion definitely won't induce + /* Otherwise, computing this conversion won't risk arbitrary template instantiation. */ return false; } diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc b/gcc/diagnostic-format-html.cc index 24c6f8c..2d642df 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc +++ b/gcc/diagnostic-format-html.cc @@ -1,6 +1,5 @@ -/* Verify that we can write a non-trivial diagnostic output format - as a plugin (XHTML). - Copyright (C) 2018-2024 Free Software Foundation, Inc. +/* HTML output for diagnostics. + Copyright (C) 2024-2025 Free Software Foundation, Inc. Contributed by David Malcolm <dmalcolm@redhat.com>. This file is part of GCC. @@ -19,35 +18,21 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ - #include "config.h" -#define INCLUDE_LIST #define INCLUDE_MAP -#define INCLUDE_MEMORY #define INCLUDE_VECTOR #include "system.h" #include "coretypes.h" #include "diagnostic.h" #include "diagnostic-metadata.h" -#include "diagnostic-path.h" -#include "cpplib.h" -#include "logical-location.h" -#include "diagnostic-client-data-hooks.h" -#include "diagnostic-diagram.h" -#include "text-art/canvas.h" #include "diagnostic-format.h" +#include "diagnostic-format-html.h" +#include "diagnostic-output-file.h" #include "diagnostic-buffer.h" -#include "ordered-hash-map.h" -#include "sbitmap.h" #include "selftest.h" #include "selftest-diagnostic.h" -#include "selftest-diagnostic-show-locus.h" -#include "text-range-label.h" #include "pretty-print-format-impl.h" -#include "pretty-print-urlifier.h" #include "intl.h" -#include "gcc-plugin.h" -#include "plugin-version.h" namespace xml { @@ -58,8 +43,6 @@ namespace xml { # pragma GCC diagnostic ignored "-Wformat-diag" #endif -static void write_escaped_text (const char *text); - struct node { virtual ~node () {} @@ -246,17 +229,17 @@ element::set_attr (const char *name, label_text value) } // namespace xml -class xhtml_builder; +class html_builder; /* Concrete buffering implementation subclass for HTML output. */ -class diagnostic_xhtml_format_buffer : public diagnostic_per_format_buffer +class diagnostic_html_format_buffer : public diagnostic_per_format_buffer { public: - friend class xhtml_builder; - friend class xhtml_output_format; + friend class html_builder; + friend class html_output_format; - diagnostic_xhtml_format_buffer (xhtml_builder &builder) + diagnostic_html_format_buffer (html_builder &builder) : m_builder (builder) {} @@ -272,11 +255,11 @@ public: } private: - xhtml_builder &m_builder; + html_builder &m_builder; std::vector<std::unique_ptr<xml::element>> m_results; }; -/* A class for managing XHTML output of diagnostics. +/* A class for managing HTML output of diagnostics. Implemented: - message text @@ -291,18 +274,18 @@ private: - paths */ -class xhtml_builder +class html_builder { public: - friend class diagnostic_xhtml_format_buffer; + friend class diagnostic_html_format_buffer; - xhtml_builder (diagnostic_context &context, + html_builder (diagnostic_context &context, pretty_printer &pp, const line_maps *line_maps); void on_report_diagnostic (const diagnostic_info &diagnostic, diagnostic_t orig_diag_kind, - diagnostic_xhtml_format_buffer *buffer); + diagnostic_html_format_buffer *buffer); void emit_diagram (const diagnostic_diagram &diagram); void end_group (); @@ -350,12 +333,12 @@ make_span (label_text class_) return span; } -/* class diagnostic_xhtml_format_buffer : public diagnostic_per_format_buffer. */ +/* class diagnostic_html_format_buffer : public diagnostic_per_format_buffer. */ void -diagnostic_xhtml_format_buffer::dump (FILE *out, int indent) const +diagnostic_html_format_buffer::dump (FILE *out, int indent) const { - fprintf (out, "%*sdiagnostic_xhtml_format_buffer:\n", indent, ""); + fprintf (out, "%*sdiagnostic_html_format_buffer:\n", indent, ""); int idx = 0; for (auto &result : m_results) { @@ -367,40 +350,40 @@ diagnostic_xhtml_format_buffer::dump (FILE *out, int indent) const } bool -diagnostic_xhtml_format_buffer::empty_p () const +diagnostic_html_format_buffer::empty_p () const { return m_results.empty (); } void -diagnostic_xhtml_format_buffer::move_to (diagnostic_per_format_buffer &base) +diagnostic_html_format_buffer::move_to (diagnostic_per_format_buffer &base) { - diagnostic_xhtml_format_buffer &dest - = static_cast<diagnostic_xhtml_format_buffer &> (base); + diagnostic_html_format_buffer &dest + = static_cast<diagnostic_html_format_buffer &> (base); for (auto &&result : m_results) dest.m_results.push_back (std::move (result)); m_results.clear (); } void -diagnostic_xhtml_format_buffer::clear () +diagnostic_html_format_buffer::clear () { m_results.clear (); } void -diagnostic_xhtml_format_buffer::flush () +diagnostic_html_format_buffer::flush () { for (auto &&result : m_results) m_builder.m_diagnostics_element->add_child (std::move (result)); m_results.clear (); } -/* class xhtml_builder. */ +/* class html_builder. */ -/* xhtml_builder's ctor. */ +/* html_builder's ctor. */ -xhtml_builder::xhtml_builder (diagnostic_context &context, +html_builder::html_builder (diagnostic_context &context, pretty_printer &pp, const line_maps *line_maps) : m_context (context), @@ -440,12 +423,12 @@ xhtml_builder::xhtml_builder (diagnostic_context &context, } } -/* Implementation of "on_report_diagnostic" for XHTML output. */ +/* Implementation of "on_report_diagnostic" for HTML output. */ void -xhtml_builder::on_report_diagnostic (const diagnostic_info &diagnostic, - diagnostic_t orig_diag_kind, - diagnostic_xhtml_format_buffer *buffer) +html_builder::on_report_diagnostic (const diagnostic_info &diagnostic, + diagnostic_t orig_diag_kind, + diagnostic_html_format_buffer *buffer) { if (diagnostic.kind == DK_ICE || diagnostic.kind == DK_ICE_NOBT) { @@ -476,13 +459,13 @@ xhtml_builder::on_report_diagnostic (const diagnostic_info &diagnostic, } std::unique_ptr<xml::element> -xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, - diagnostic_t orig_diag_kind) +html_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, + diagnostic_t orig_diag_kind) { - class xhtml_token_printer : public token_printer + class html_token_printer : public token_printer { public: - xhtml_token_printer (xhtml_builder &builder, + html_token_printer (html_builder &builder, xml::element &parent_element) : m_builder (builder) { @@ -557,7 +540,7 @@ xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, m_open_elements.pop_back (); } - xhtml_builder &m_builder; + html_builder &m_builder; /* We maintain a stack of currently "open" elements. Children are added to the topmost open element. */ std::vector<xml::element *> m_open_elements; @@ -568,7 +551,7 @@ xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, // TODO: might be nice to emulate the text output format, but colorize it auto message_span = make_span (label_text::borrow ("gcc-message")); - xhtml_token_printer tok_printer (*this, *message_span.get ()); + html_token_printer tok_printer (*this, *message_span.get ()); m_printer->set_token_printer (&tok_printer); pp_output_formatted_text (m_printer, m_context.get_urlifier ()); m_printer->set_token_printer (nullptr); @@ -642,10 +625,10 @@ xhtml_builder::make_element_for_diagnostic (const diagnostic_info &diagnostic, } /* Implementation of diagnostic_context::m_diagrams.m_emission_cb - for XHTML output. */ + for HTML output. */ void -xhtml_builder::emit_diagram (const diagnostic_diagram &/*diagram*/) +html_builder::emit_diagram (const diagnostic_diagram &/*diagram*/) { /* We must be within the emission of a top-level diagnostic. */ gcc_assert (m_cur_diagnostic_element); @@ -653,10 +636,10 @@ xhtml_builder::emit_diagram (const diagnostic_diagram &/*diagram*/) // TODO } -/* Implementation of "end_group_cb" for XHTML output. */ +/* Implementation of "end_group_cb" for HTML output. */ void -xhtml_builder::end_group () +html_builder::end_group () { if (m_cur_diagnostic_element) m_diagnostics_element->add_child (std::move (m_cur_diagnostic_element)); @@ -668,17 +651,17 @@ xhtml_builder::end_group () Flush it all to OUTF. */ void -xhtml_builder::flush_to_file (FILE *outf) +html_builder::flush_to_file (FILE *outf) { auto top = m_document.get (); top->dump (outf); fprintf (outf, "\n"); } -class xhtml_output_format : public diagnostic_output_format +class html_output_format : public diagnostic_output_format { public: - ~xhtml_output_format () + ~html_output_format () { /* Any diagnostics should have been handled by now. If not, then something's gone wrong with diagnostic @@ -690,19 +673,19 @@ public: void dump (FILE *out, int indent) const override { - fprintf (out, "%*sxhtml_output_format\n", indent, ""); + fprintf (out, "%*shtml_output_format\n", indent, ""); diagnostic_output_format::dump (out, indent); } std::unique_ptr<diagnostic_per_format_buffer> make_per_format_buffer () final override { - return std::make_unique<diagnostic_xhtml_format_buffer> (m_builder); + return std::make_unique<diagnostic_html_format_buffer> (m_builder); } void set_buffer (diagnostic_per_format_buffer *base_buffer) final override { - diagnostic_xhtml_format_buffer *buffer - = static_cast<diagnostic_xhtml_format_buffer *> (base_buffer); + diagnostic_html_format_buffer *buffer + = static_cast<diagnostic_html_format_buffer *> (base_buffer); m_buffer = buffer; } @@ -752,66 +735,39 @@ public: } protected: - xhtml_output_format (diagnostic_context &context, - const line_maps *line_maps) + html_output_format (diagnostic_context &context, + const line_maps *line_maps) : diagnostic_output_format (context), m_builder (context, *get_printer (), line_maps), m_buffer (nullptr) {} - xhtml_builder m_builder; - diagnostic_xhtml_format_buffer *m_buffer; + html_builder m_builder; + diagnostic_html_format_buffer *m_buffer; }; -class xhtml_stream_output_format : public xhtml_output_format +class html_file_output_format : public html_output_format { public: - xhtml_stream_output_format (diagnostic_context &context, - const line_maps *line_maps, - FILE *stream) - : xhtml_output_format (context, line_maps), - m_stream (stream) - { - } - ~xhtml_stream_output_format () + html_file_output_format (diagnostic_context &context, + const line_maps *line_maps, + diagnostic_output_file output_file) + : html_output_format (context, line_maps), + m_output_file (std::move (output_file)) { - m_builder.flush_to_file (m_stream); + gcc_assert (m_output_file.get_open_file ()); + gcc_assert (m_output_file.get_filename ()); } - bool machine_readable_stderr_p () const final override + ~html_file_output_format () { - return m_stream == stderr; + m_builder.flush_to_file (m_output_file.get_open_file ()); } -private: - FILE *m_stream; -}; - -class xhtml_file_output_format : public xhtml_output_format -{ -public: - xhtml_file_output_format (diagnostic_context &context, - const line_maps *line_maps, - const char *base_file_name) - : xhtml_output_format (context, line_maps), - m_base_file_name (xstrdup (base_file_name)) - { - } - ~xhtml_file_output_format () + void dump (FILE *out, int indent) const override { - char *filename = concat (m_base_file_name, ".xhtml", nullptr); - free (m_base_file_name); - m_base_file_name = nullptr; - FILE *outf = fopen (filename, "w"); - if (!outf) - { - const char *errstr = xstrerror (errno); - fnotice (stderr, "error: unable to open '%s' for writing: %s\n", - filename, errstr); - free (filename); - return; - } - m_builder.flush_to_file (outf); - fclose (outf); - free (filename); + fprintf (out, "%*shtml_file_output_format: %s\n", + indent, "", + m_output_file.get_filename ()); + diagnostic_output_format::dump (out, indent); } bool machine_readable_stderr_p () const final override { @@ -819,68 +775,76 @@ public: } private: - char *m_base_file_name; + diagnostic_output_file m_output_file; }; -/* Populate CONTEXT in preparation for XHTML output (either to stderr, or - to a file). */ +/* Attempt to open BASE_FILE_NAME.html for writing. + Return a non-null diagnostic_output_file, + or return a null diagnostic_output_file and complain to CONTEXT + using LINE_MAPS. */ -static void -diagnostic_output_format_init_xhtml (diagnostic_context &context, - std::unique_ptr<xhtml_output_format> fmt) +diagnostic_output_file +diagnostic_output_format_open_html_file (diagnostic_context &context, + line_maps *line_maps, + const char *base_file_name) { - /* Don't colorize the text. */ - pp_show_color (fmt->get_printer ()) = false; - context.set_show_highlight_colors (false); - - context.set_output_format (std::move (fmt)); -} - -/* Populate CONTEXT in preparation for XHTML output to stderr. */ + if (!base_file_name) + { + rich_location richloc (line_maps, UNKNOWN_LOCATION); + context.emit_diagnostic_with_group + (DK_ERROR, richloc, nullptr, 0, + "unable to determine filename for HTML output"); + return diagnostic_output_file (); + } -void -diagnostic_output_format_init_xhtml_stderr (diagnostic_context &context, - const line_maps *line_maps) -{ - gcc_assert (line_maps); - auto format = std::make_unique<xhtml_stream_output_format> (context, - line_maps, - stderr); - diagnostic_output_format_init_xhtml (context, std::move (format)); + label_text filename = label_text::take (concat (base_file_name, + ".html", + nullptr)); + FILE *outf = fopen (filename.get (), "w"); + if (!outf) + { + rich_location richloc (line_maps, UNKNOWN_LOCATION); + context.emit_diagnostic_with_group + (DK_ERROR, richloc, nullptr, 0, + "unable to open %qs for HTML output: %m", + filename.get ()); + return diagnostic_output_file (); + } + return diagnostic_output_file (outf, true, std::move (filename)); } -/* Populate CONTEXT in preparation for XHTML output to a file named - BASE_FILE_NAME.xhtml. */ - -void -diagnostic_output_format_init_xhtml_file (diagnostic_context &context, - const line_maps *line_maps, - const char *base_file_name) -{ - gcc_assert (line_maps); - auto format = std::make_unique<xhtml_file_output_format> (context, - line_maps, - base_file_name); - diagnostic_output_format_init_xhtml (context, std::move (format)); +std::unique_ptr<diagnostic_output_format> +make_html_sink (diagnostic_context &context, + const line_maps &line_maps, + diagnostic_output_file output_file) +{ + auto sink + = std::make_unique<html_file_output_format> (context, + &line_maps, + std::move (output_file)); + sink->update_printer (); + return sink; } #if CHECKING_P namespace selftest { -/* A subclass of xhtml_output_format for writing selftests. +/* A subclass of html_output_format for writing selftests. The XML output is cached internally, rather than written out to a file. */ -class test_xhtml_diagnostic_context : public test_diagnostic_context +class test_html_diagnostic_context : public test_diagnostic_context { public: - test_xhtml_diagnostic_context () + test_html_diagnostic_context () { - auto format = std::make_unique<xhtml_buffered_output_format> (*this, - line_table); - m_format = format.get (); // borrowed - diagnostic_output_format_init_xhtml (*this, std::move (format)); + auto sink = std::make_unique<html_buffered_output_format> (*this, + line_table); + sink->update_printer (); + m_format = sink.get (); // borrowed + + set_output_format (std::move (sink)); } const xml::document &get_document () const @@ -889,12 +853,12 @@ public: } private: - class xhtml_buffered_output_format : public xhtml_output_format + class html_buffered_output_format : public html_output_format { public: - xhtml_buffered_output_format (diagnostic_context &context, - const line_maps *line_maps) - : xhtml_output_format (context, line_maps) + html_buffered_output_format (diagnostic_context &context, + const line_maps *line_maps) + : html_output_format (context, line_maps) { } bool machine_readable_stderr_p () const final override @@ -903,17 +867,17 @@ private: } }; - xhtml_output_format *m_format; // borrowed + html_output_format *m_format; // borrowed }; - /* Test of reporting a diagnostic at UNKNOWN_LOCATION to a - diagnostic_context and examining the generated XML document. - Verify various basic properties. */ +/* Test of reporting a diagnostic at UNKNOWN_LOCATION to a + diagnostic_context and examining the generated XML document. + Verify various basic properties. */ static void test_simple_log () { - test_xhtml_diagnostic_context dc; + test_html_diagnostic_context dc; rich_location richloc (line_table, UNKNOWN_LOCATION); dc.report (DK_ERROR, richloc, nullptr, 0, "this is a test: %i", 42); @@ -945,8 +909,8 @@ test_simple_log () /* Run all of the selftests within this file. */ -static void -xhtml_format_selftests () +void +diagnostic_format_html_cc_tests () { test_simple_log (); } @@ -954,32 +918,3 @@ xhtml_format_selftests () } // namespace selftest #endif /* CHECKING_P */ - -/* Plugin hooks. */ - -int plugin_is_GPL_compatible; - -/* Entrypoint for the plugin. */ - -int -plugin_init (struct plugin_name_args *plugin_info, - struct plugin_gcc_version *version) -{ - const char *plugin_name = plugin_info->base_name; - int argc = plugin_info->argc; - struct plugin_argument *argv = plugin_info->argv; - - if (!plugin_default_version_check (version, &gcc_version)) - return 1; - - global_dc->set_output_format - (std::make_unique<xhtml_stream_output_format> (*global_dc, - line_table, - stderr)); - -#if CHECKING_P - selftest::xhtml_format_selftests (); -#endif - - return 0; -} diff --git a/gcc/diagnostic-format-html.h b/gcc/diagnostic-format-html.h new file mode 100644 index 0000000..ff5edca --- /dev/null +++ b/gcc/diagnostic-format-html.h @@ -0,0 +1,37 @@ +/* HTML output for diagnostics. + Copyright (C) 2024-2025 Free Software Foundation, Inc. + Contributed by David Malcolm <dmalcolm@redhat.com>. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef GCC_DIAGNOSTIC_FORMAT_HTML_H +#define GCC_DIAGNOSTIC_FORMAT_HTML_H + +#include "diagnostic-format.h" +#include "diagnostic-output-file.h" + +extern diagnostic_output_file +diagnostic_output_format_open_html_file (diagnostic_context &context, + line_maps *line_maps, + const char *base_file_name); + +extern std::unique_ptr<diagnostic_output_format> +make_html_sink (diagnostic_context &context, + const line_maps &line_maps, + diagnostic_output_file output_file); + +#endif /* ! GCC_DIAGNOSTIC_FORMAT_HTML_H */ diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b1964b3..a0f1a93 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1268,7 +1268,7 @@ See RS/6000 and PowerPC Options. -mfence-tso -mno-fence-tso -mdiv -mno-div -misa-spec=@var{ISA-spec-string} --march=@var{ISA-string} +-march=@var{ISA-string|Profiles|Profiles_ISA-string} -mtune=@var{processor-string} -mpreferred-stack-boundary=@var{num} -msmall-data-limit=@var{N-bytes} @@ -6072,6 +6072,22 @@ in this release. @end table +@item experimental-html +Emit diagnostics to a file in HTML format. This scheme is experimental, +and may go away in future GCC releases. The details of the output are +also subject to change. + +Supported keys are: + +@table @gcctabopt + +@item file=@var{FILENAME} +Specify the filename to write the HTML output to, potentially with a +leading absolute or relative path. If not specified, it defaults to +@file{@var{source}.html}. + +@end table + @end table For example, @@ -6091,7 +6107,7 @@ In EBNF: @var{diagnostics-output-specifier} = @var{diagnostics-output-name} | @var{diagnostics-output-name}, ":", @var{key-value-pairs}; -@var{diagnostics-output-name} = "text" | "sarif"; +@var{diagnostics-output-name} = "text" | "sarif" | "experimental-html"; @var{key-value-pairs} = @var{key-value-pair} | @var{key-value-pair} "," @var{key-value-pairs}; @@ -31099,11 +31115,16 @@ The default is @option{-misa-spec=20191213} unless GCC has been configured with @option{--with-isa-spec=} specifying a different default version. @opindex march -@item -march=@var{ISA-string} -Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be -lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and -@samp{rv32imaf}. Additionally, a special value @option{help} -(@option{-march=help}) is accepted to list all supported extensions. +@item -march=@var{ISA-string|Profiles|Profile_ISA-string} +Generate code for given RISC-V ISA or Profiles or a combination of them +(e.g.@: @samp{rv64im} @samp{rvi20u64} @samp{rvi20u64_zbb}). ISA strings and +Profiles must be lower-case. Examples include @samp{rv64i}, @samp{rv32g}, +@samp{rv32e}, @samp{rv32imaf}, @samp{rva22u64} and @samp{rva23u64}. +To combine Profiles and optional RISC-V ISA extention, the profile should start +at the beginning of the option, then use underline connect ISA-string (e.g.@: +@samp{rvi20u64_zca_zcb} @samp{rva23u64_zacas}). Additionally, a special value +@option{help} (@option{-march=help}) is accepted to list all supported +extensions. The syntax of the ISA string is defined as follows: @@ -1190,7 +1190,10 @@ canon_address (rtx mem, address = strip_offset_and_add (address, offset); if (ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (mem)) - && const_or_frame_p (address)) + && const_or_frame_p (address) + /* Literal addresses can alias any base, avoid creating a + group for them. */ + && ! CONST_SCALAR_INT_P (address)) { group_info *group = get_group_info (address); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e6d9fa6..b3f63e0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,33 @@ +2025-05-10 Harald Anlauf <anlauf@gmx.de> + + PR fortran/102891 + * dependency.cc (gfc_ref_needs_temporary_p): Within an array + reference, inquiry references of complex variables generally + need a temporary. + +2025-05-10 Jakub Jelinek <jakub@redhat.com> + + PR fortran/120193 + * trans-types.cc (gfc_init_types): For flag_unsigned use + build_distinct_type_copy or build_variant_type_copy from + gfc_character_types[index_char] if index_char > -1 instead of + gfc_character_types[index_char] or + gfc_build_unsigned_type (&gfc_unsigned_kinds[index]). + +2025-05-08 Harald Anlauf <anlauf@gmx.de> + + PR fortran/120179 + * match.cc (gfc_match_do): Do not attempt to match end-of-statement + twice. + +2025-05-07 Paul Thomas <pault@gcc.gnu.org> + and Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/119948 + * primary.cc (match_variable): Module procedures with sym the + same as result can be treated as variables, although marked + external. + 2025-05-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/120049 diff --git a/gcc/fortran/dependency.cc b/gcc/fortran/dependency.cc index 57c0c49..aa8a57a 100644 --- a/gcc/fortran/dependency.cc +++ b/gcc/fortran/dependency.cc @@ -944,8 +944,12 @@ gfc_ref_needs_temporary_p (gfc_ref *ref) types), not in characters. */ return subarray_p; - case REF_COMPONENT: case REF_INQUIRY: + /* Within an array reference, inquiry references of complex + variables generally need a temporary. */ + return subarray_p; + + case REF_COMPONENT: break; } diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 46310a0..4740c36 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2028,6 +2028,9 @@ typedef struct gfc_symbol This is legal in Fortran, but can cause problems with autogenerated C prototypes for C23. */ unsigned ext_dummy_arglist_mismatch:1; + /* Set if the formal arglist has already been resolved, to avoid + trying to generate it again from actual arguments. */ + unsigned formal_resolved:1; /* Reference counter, used for memory management. diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc index 474ba81..a99a757 100644 --- a/gcc/fortran/match.cc +++ b/gcc/fortran/match.cc @@ -2892,7 +2892,7 @@ gfc_match_do (void) locus where = gfc_current_locus; if (gfc_match_eos () == MATCH_YES) - break; + goto concurr_ok; else if (gfc_match ("local ( ") == MATCH_YES) { @@ -3141,6 +3141,7 @@ gfc_match_do (void) if (gfc_match_eos () != MATCH_YES) goto concurr_cleanup; +concurr_ok: if (label != NULL && !gfc_reference_st_label (label, ST_LABEL_DO_TARGET)) goto concurr_cleanup; diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 1e62e94..bf1aa70 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -533,7 +533,8 @@ gfc_resolve_formal_arglist (gfc_symbol *proc) } } } - + if (sym) + sym->formal_resolved = 1; gfc_current_ns = orig_current_ns; } @@ -3472,7 +3473,7 @@ resolve_function (gfc_expr *expr) &expr->where, &sym->formal_at); } } - else + else if (!sym->formal_resolved) { gfc_get_formal_from_actual_arglist (sym, expr->value.function.actual); sym->formal_at = expr->where; @@ -4033,7 +4034,7 @@ resolve_call (gfc_code *c) &c->loc, &csym->formal_at); } } - else + else if (!csym->formal_resolved) { gfc_get_formal_from_actual_arglist (csym, c->ext.actual); csym->formal_at = c->loc; diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc index 3374778..f898075 100644 --- a/gcc/fortran/trans-types.cc +++ b/gcc/fortran/trans-types.cc @@ -1140,11 +1140,6 @@ gfc_init_types (void) } gfc_character1_type_node = gfc_character_types[0]; - /* The middle end only recognizes a single unsigned type. For - compatibility of existing test cases, let's just use the - character type. The reader of tree dumps is expected to be able - to deal with this. */ - if (flag_unsigned) { for (index = 0; gfc_unsigned_kinds[index].kind != 0;++index) @@ -1159,18 +1154,26 @@ gfc_init_types (void) break; } } - if (index_char > 0) + if (index_char > -1) { - gfc_unsigned_types[index] = gfc_character_types[index_char]; + type = gfc_character_types[index_char]; + if (TYPE_STRING_FLAG (type)) + { + type = build_distinct_type_copy (type); + TYPE_CANONICAL (type) + = TYPE_CANONICAL (gfc_character_types[index_char]); + } + else + type = build_variant_type_copy (type); + TYPE_NAME (type) = NULL_TREE; + TYPE_STRING_FLAG (type) = 0; } else - { - type = gfc_build_unsigned_type (&gfc_unsigned_kinds[index]); - gfc_unsigned_types[index] = type; - snprintf (name_buf, sizeof(name_buf), "unsigned(kind=%d)", - gfc_integer_kinds[index].kind); - PUSH_TYPE (name_buf, type); - } + type = gfc_build_unsigned_type (&gfc_unsigned_kinds[index]); + gfc_unsigned_types[index] = type; + snprintf (name_buf, sizeof(name_buf), "unsigned(kind=%d)", + gfc_integer_kinds[index].kind); + PUSH_TYPE (name_buf, type); } } diff --git a/gcc/gcov.cc b/gcc/gcov.cc index e1ad801..0dfe513 100644 --- a/gcc/gcov.cc +++ b/gcc/gcov.cc @@ -3591,7 +3591,7 @@ print_source_line (FILE *f, const vector<const char *> &source_lines, Returns 1 if the path was printed, 0 otherwise. */ static unsigned print_prime_path_lines (FILE *gcov_file, const function_info &fn, - const vector<unsigned> &path, size_t pathno) + const vector<unsigned> &path, unsigned pathno) { const bool is_covered = fn.paths.covered_p (pathno); if (is_covered && !flag_prime_paths_lines_covered) @@ -3600,9 +3600,9 @@ print_prime_path_lines (FILE *gcov_file, const function_info &fn, return 0; if (is_covered) - fprintf (gcov_file, "path %zu covered: lines", pathno); + fprintf (gcov_file, "path %u covered: lines", pathno); else - fprintf (gcov_file, "path %zu not covered: lines", pathno); + fprintf (gcov_file, "path %u not covered: lines", pathno); for (size_t k = 0; k != path.size (); ++k) { @@ -3658,7 +3658,7 @@ print_inlined_separator (FILE *gcov_file, unsigned current_index, const Returns 1 if the path was printed, 0 otherwise. */ static unsigned print_prime_path_source (FILE *gcov_file, const function_info &fn, - const vector<unsigned> &path, size_t pathno) + const vector<unsigned> &path, unsigned pathno) { const bool is_covered = fn.paths.covered_p (pathno); if (is_covered && !flag_prime_paths_source_covered) @@ -3667,9 +3667,9 @@ print_prime_path_source (FILE *gcov_file, const function_info &fn, return 0; if (is_covered) - fprintf (gcov_file, "path %zu covered:\n", pathno); + fprintf (gcov_file, "path %u covered:\n", pathno); else - fprintf (gcov_file, "path %zu not covered:\n", pathno); + fprintf (gcov_file, "path %u not covered:\n", pathno); unsigned current = fn.src; for (size_t k = 0; k != path.size (); ++k) { @@ -3728,19 +3728,19 @@ output_path_coverage (FILE *gcov_file, const function_info *fn) if (fn->paths.paths.empty ()) fnotice (gcov_file, "path coverage omitted\n"); else - fnotice (gcov_file, "paths covered %u of %zu\n", - fn->paths.covered_paths (), fn->paths.paths.size ()); + fnotice (gcov_file, "paths covered %u of " HOST_SIZE_T_PRINT_UNSIGNED "\n", + fn->paths.covered_paths (), (fmt_size_t)fn->paths.paths.size ()); if (flag_prime_paths_lines_uncovered || flag_prime_paths_lines_covered) { - size_t pathno = 0; + unsigned pathno = 0; for (const vector<unsigned> &path : fn->paths.paths) print_prime_path_lines (gcov_file, *fn, path, pathno++); } if (flag_prime_paths_source_uncovered || flag_prime_paths_source_covered) { - size_t pathno = 0; + unsigned pathno = 0; for (const vector<unsigned> &path : fn->paths.paths) print_prime_path_source (gcov_file, *fn, path, pathno++); } diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc index 80f1976..ac01328 100644 --- a/gcc/gensupport.cc +++ b/gcc/gensupport.cc @@ -656,7 +656,7 @@ public: i.e. if rtx is the relevant match_operand or match_scratch then [ns..ns + len) should equal itoa (XINT (rtx, 0)), and if set_attr then [ns..ns + len) should equal XSTR (rtx, 0). */ - conlist (const char *ns, unsigned int len, bool numeric) + conlist (const char *ns, unsigned int len, bool numeric, file_location loc) { /* Trim leading whitespaces. */ while (len > 0 && ISBLANK (*ns)) @@ -670,16 +670,26 @@ public: if (!ISBLANK (ns[i])) break; - /* Parse off any modifiers. */ - while (len > 0 && !ISALNUM (*ns)) - { - con += *(ns++); - len--; - } + /* Only numeric values can have modifiers. */ + if (numeric) + /* Parse off any modifiers. */ + while (len > 0 && !ISALNUM (*ns)) + { + if (*ns != '=' && *ns != '+' && *ns != '%') + error_at (loc, "`%c` is not a valid operand modifier", *ns); + con += *(ns++); + len--; + } name.assign (ns, len); if (numeric) - idx = strtol (name.c_str (), (char **)NULL, 10); + { + char *endstr; + /* There should only be a numeric value now... */ + idx = strtol (name.c_str (), &endstr, 10); + if (*endstr != '\0') + error_at (loc, "operand number expected, found %s", name.c_str ()); + } } /* Adds a character to the end of the string. */ @@ -832,7 +842,7 @@ parse_section_layout (file_location loc, const char **templ, const char *label, *templ += len; if (val == ',') (*templ)++; - list.push_back (conlist (name_start, len, numeric)); + list.push_back (conlist (name_start, len, numeric, loc)); } } } @@ -845,7 +855,8 @@ parse_section_layout (file_location loc, const char **templ, const char *label, static void parse_section (const char **templ, unsigned int n_elems, unsigned int alt_no, - vec_conlist &list, file_location loc, const char *name) + vec_conlist &list, file_location loc, const char *name, + const char *invalid_chars = NULL) { unsigned int i; @@ -856,6 +867,10 @@ parse_section (const char **templ, unsigned int n_elems, unsigned int alt_no, { if (**templ == 0 || **templ == '\n') fatal_at (loc, "missing ']'"); + if (invalid_chars + && strchr (invalid_chars, **templ)) + error_at (loc, "'%c' is not permitted in an alternative for a %s", + **templ, name); list[i].add (**templ); if (**templ == ',') { @@ -981,7 +996,7 @@ convert_syntax (rtx x, file_location loc) /* Parse the constraint list, then the attribute list. */ if (tconvec.size () > 0) parse_section (&templ, tconvec.size (), alt_no, tconvec, loc, - "constraint"); + "constraint", "=+%"); if (attrvec.size () > 0) { diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index 7721795..e63fd6f 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -6246,14 +6246,33 @@ replace_stmt_with_simplification (gimple_stmt_iterator *gsi, false, NULL_TREE))) gimple_cond_set_condition (cond_stmt, code, ops[0], ops[1]); else if (code == SSA_NAME) - gimple_cond_set_condition (cond_stmt, NE_EXPR, ops[0], - build_zero_cst (TREE_TYPE (ops[0]))); + { + /* If setting the gimple cond to the same thing, + return false as nothing changed. */ + if (gimple_cond_code (cond_stmt) == NE_EXPR + && operand_equal_p (gimple_cond_lhs (cond_stmt), ops[0]) + && integer_zerop (gimple_cond_rhs (cond_stmt))) + return false; + gimple_cond_set_condition (cond_stmt, NE_EXPR, ops[0], + build_zero_cst (TREE_TYPE (ops[0]))); + } else if (code == INTEGER_CST) { + /* Make into the canonical form `1 != 0` and `0 != 0`. + If already in the canonical form return false + saying nothing has been done. */ if (integer_zerop (ops[0])) - gimple_cond_make_false (cond_stmt); + { + if (gimple_cond_false_canonical_p (cond_stmt)) + return false; + gimple_cond_make_false (cond_stmt); + } else - gimple_cond_make_true (cond_stmt); + { + if (gimple_cond_true_canonical_p (cond_stmt)) + return false; + gimple_cond_make_true (cond_stmt); + } } else if (!inplace) { @@ -10592,10 +10611,12 @@ arith_code_with_undefined_signed_overflow (tree_code code) /* Return true if STMT has an operation that operates on a signed integer types involves undefined behavior on overflow and the - operation can be expressed with unsigned arithmetic. */ + operation can be expressed with unsigned arithmetic. + Also returns true if STMT is a VCE that needs to be rewritten + if moved to be executed unconditionally. */ bool -gimple_with_undefined_signed_overflow (gimple *stmt) +gimple_needing_rewrite_undefined (gimple *stmt) { if (!is_gimple_assign (stmt)) return false; @@ -10606,6 +10627,16 @@ gimple_with_undefined_signed_overflow (gimple *stmt) if (!INTEGRAL_TYPE_P (lhs_type) && !POINTER_TYPE_P (lhs_type)) return false; + tree rhs = gimple_assign_rhs1 (stmt); + /* VCE from integral types to a integral types but with + a smaller precision need to be changed into casts + to be well defined. */ + if (gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR + && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0))) + && is_gimple_val (TREE_OPERAND (rhs, 0)) + && TYPE_PRECISION (lhs_type) + < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (rhs, 0)))) + return true; if (!TYPE_OVERFLOW_UNDEFINED (lhs_type)) return false; if (!arith_code_with_undefined_signed_overflow @@ -10625,19 +10656,39 @@ gimple_with_undefined_signed_overflow (gimple *stmt) contain a modified form of STMT itself. */ static gimple_seq -rewrite_to_defined_overflow (gimple_stmt_iterator *gsi, gimple *stmt, - bool in_place) +rewrite_to_defined_unconditional (gimple_stmt_iterator *gsi, gimple *stmt, + bool in_place) { + gcc_assert (gimple_needing_rewrite_undefined (stmt)); if (dump_file && (dump_flags & TDF_DETAILS)) { - fprintf (dump_file, "rewriting stmt with undefined signed " - "overflow "); + fprintf (dump_file, "rewriting stmt for being uncondtional defined"); print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); } - + gimple_seq stmts = NULL; + /* VCE from integral types to another integral types but with + smaller precisions need to be changed into casts + to be well defined. */ + if (gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR) + { + tree rhs = gimple_assign_rhs1 (stmt); + tree new_rhs = TREE_OPERAND (rhs, 0); + gcc_assert (TYPE_PRECISION (TREE_TYPE (rhs)) + < TYPE_PRECISION (TREE_TYPE (new_rhs))); + gcc_assert (is_gimple_val (new_rhs)); + gimple_assign_set_rhs_code (stmt, NOP_EXPR); + gimple_assign_set_rhs1 (stmt, new_rhs); + if (in_place) + update_stmt (stmt); + else + { + gimple_set_modified (stmt, true); + gimple_seq_add_stmt (&stmts, stmt); + } + return stmts; + } tree lhs = gimple_assign_lhs (stmt); tree type = unsigned_type_for (TREE_TYPE (lhs)); - gimple_seq stmts = NULL; if (gimple_assign_rhs_code (stmt) == ABS_EXPR) gimple_assign_set_rhs_code (stmt, ABSU_EXPR); else @@ -10672,15 +10723,15 @@ rewrite_to_defined_overflow (gimple_stmt_iterator *gsi, gimple *stmt, } void -rewrite_to_defined_overflow (gimple_stmt_iterator *gsi) +rewrite_to_defined_unconditional (gimple_stmt_iterator *gsi) { - rewrite_to_defined_overflow (gsi, gsi_stmt (*gsi), true); + rewrite_to_defined_unconditional (gsi, gsi_stmt (*gsi), true); } gimple_seq -rewrite_to_defined_overflow (gimple *stmt) +rewrite_to_defined_unconditional (gimple *stmt) { - return rewrite_to_defined_overflow (nullptr, stmt, false); + return rewrite_to_defined_unconditional (nullptr, stmt, false); } /* The valueization hook we use for the gimple_build API simplification. diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h index 5fcfdcd..afecbb8 100644 --- a/gcc/gimple-fold.h +++ b/gcc/gimple-fold.h @@ -59,9 +59,9 @@ extern tree gimple_get_virt_method_for_vtable (HOST_WIDE_INT, tree, extern tree gimple_fold_indirect_ref (tree); extern bool gimple_fold_builtin_sprintf (gimple_stmt_iterator *); extern bool gimple_fold_builtin_snprintf (gimple_stmt_iterator *); -extern bool gimple_with_undefined_signed_overflow (gimple *); -extern void rewrite_to_defined_overflow (gimple_stmt_iterator *); -extern gimple_seq rewrite_to_defined_overflow (gimple *); +extern bool gimple_needing_rewrite_undefined (gimple *); +extern void rewrite_to_defined_unconditional (gimple_stmt_iterator *); +extern gimple_seq rewrite_to_defined_unconditional (gimple *); extern void replace_call_with_value (gimple_stmt_iterator *, tree); extern tree tree_vec_extract (gimple_stmt_iterator *, tree, tree, tree, tree); extern void gsi_replace_with_seq_vops (gimple_stmt_iterator *, gimple_seq); diff --git a/gcc/gimple.h b/gcc/gimple.h index 032365f..977ff1c 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -3875,6 +3875,21 @@ gimple_cond_true_p (const gcond *gs) return false; } +/* Check if conditional statement GS is in the caonical form of 'if (1 != 0)'. */ + +inline bool +gimple_cond_true_canonical_p (const gcond *gs) +{ + tree lhs = gimple_cond_lhs (gs); + tree rhs = gimple_cond_rhs (gs); + tree_code code = gimple_cond_code (gs); + if (code == NE_EXPR + && lhs == boolean_true_node + && rhs == boolean_false_node) + return true; + return false; +} + /* Check if conditional statement GS is of the form 'if (1 != 1)', 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */ @@ -3900,6 +3915,21 @@ gimple_cond_false_p (const gcond *gs) return false; } +/* Check if conditional statement GS is in the caonical form of 'if (0 != 0)'. */ + +inline bool +gimple_cond_false_canonical_p (const gcond *gs) +{ + tree lhs = gimple_cond_lhs (gs); + tree rhs = gimple_cond_rhs (gs); + tree_code code = gimple_cond_code (gs); + if (code == NE_EXPR + && lhs == boolean_false_node + && rhs == boolean_false_node) + return true; + return false; +} + /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */ inline void diff --git a/gcc/opts-diagnostic.cc b/gcc/opts-diagnostic.cc index 1eec010..34c3906 100644 --- a/gcc/opts-diagnostic.cc +++ b/gcc/opts-diagnostic.cc @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic.h" #include "diagnostic-color.h" #include "diagnostic-format.h" +#include "diagnostic-format-html.h" #include "diagnostic-format-text.h" #include "diagnostic-format-sarif.h" #include "selftest.h" @@ -217,6 +218,17 @@ public: const scheme_name_and_params &parsed_arg) const final override; }; +class html_scheme_handler : public output_factory::scheme_handler +{ +public: + html_scheme_handler () : scheme_handler ("experimental-html") {} + + std::unique_ptr<diagnostic_output_format> + make_sink (const context &ctxt, + const char *unparsed_arg, + const scheme_name_and_params &parsed_arg) const final override; +}; + /* struct context. */ void @@ -318,6 +330,7 @@ output_factory::output_factory () { m_scheme_handlers.push_back (std::make_unique<text_scheme_handler> ()); m_scheme_handlers.push_back (std::make_unique<sarif_scheme_handler> ()); + m_scheme_handlers.push_back (std::make_unique<html_scheme_handler> ()); } const output_factory::scheme_handler * @@ -525,6 +538,53 @@ sarif_scheme_handler::make_sink (const context &ctxt, return sink; } +/* class html_scheme_handler : public output_factory::scheme_handler. */ + +std::unique_ptr<diagnostic_output_format> +html_scheme_handler::make_sink (const context &ctxt, + const char *unparsed_arg, + const scheme_name_and_params &parsed_arg) const +{ + label_text filename; + for (auto& iter : parsed_arg.m_kvs) + { + const std::string &key = iter.first; + const std::string &value = iter.second; + if (key == "file") + { + filename = label_text::take (xstrdup (value.c_str ())); + continue; + } + + /* Key not found. */ + auto_vec<const char *> known_keys; + known_keys.safe_push ("file"); + ctxt.report_unknown_key (unparsed_arg, key, get_scheme_name (), known_keys); + return nullptr; + } + + diagnostic_output_file output_file; + if (filename.get ()) + output_file = ctxt.open_output_file (std::move (filename)); + else + // Default filename + { + const char *basename = (ctxt.m_opts.x_dump_base_name + ? ctxt.m_opts.x_dump_base_name + : ctxt.m_opts.x_main_input_basename); + output_file = diagnostic_output_format_open_html_file (ctxt.m_dc, + line_table, + basename); + } + if (!output_file) + return nullptr; + + auto sink = make_html_sink (ctxt.m_dc, + *line_table, + std::move (output_file)); + return sink; +} + } // namespace diagnostics_output_spec } // namespace gcc diff --git a/gcc/selftest-run-tests.cc b/gcc/selftest-run-tests.cc index 3c12e8a..959e5d0 100644 --- a/gcc/selftest-run-tests.cc +++ b/gcc/selftest-run-tests.cc @@ -98,6 +98,7 @@ selftest::run_tests () rely on. */ diagnostic_color_cc_tests (); diagnostic_show_locus_cc_tests (); + diagnostic_format_html_cc_tests (); diagnostic_format_json_cc_tests (); diagnostic_format_sarif_cc_tests (); edit_context_cc_tests (); diff --git a/gcc/selftest.h b/gcc/selftest.h index a0d2473..7e1d94c 100644 --- a/gcc/selftest.h +++ b/gcc/selftest.h @@ -221,6 +221,7 @@ extern void bitmap_cc_tests (); extern void cgraph_cc_tests (); extern void convert_cc_tests (); extern void diagnostic_color_cc_tests (); +extern void diagnostic_format_html_cc_tests (); extern void diagnostic_format_json_cc_tests (); extern void diagnostic_format_sarif_cc_tests (); extern void diagnostic_path_cc_tests (); diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc index 7bcbe11..b34fd2f 100644 --- a/gcc/simplify-rtx.cc +++ b/gcc/simplify-rtx.cc @@ -7387,6 +7387,13 @@ simplify_context::simplify_ternary_operation (rtx_code code, machine_mode mode, return gen_rtx_CONST_VECTOR (mode, v); } + if (swap_commutative_operands_p (op0, op1) + /* Two operands have same precedence, then first bit of mask + select first operand. */ + || (!swap_commutative_operands_p (op1, op0) && !(sel & 1))) + return simplify_gen_ternary (code, mode, mode, op1, op0, + GEN_INT (~sel & mask)); + /* Replace (vec_merge (vec_merge a b m) c n) with (vec_merge b c n) if no element from a appears in the result. */ if (GET_CODE (op0) == VEC_MERGE) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2ebcef..5a6b911 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,343 @@ +2025-05-10 Robert Dubner <rdubner@symas.com> + + * cobol.dg/group1/simple-if.cob: Make explicitly >>SOURCE FREE + +2025-05-10 Harald Anlauf <anlauf@gmx.de> + + PR fortran/102891 + * gfortran.dg/transfer_array_subref.f90: New test. + +2025-05-10 Jan Hubicka <hubicka@ucw.cz> + + * gcc.target/i386/minmax-6.c: xfail test that pmax is used. + * gcc.target/i386/minmax-7.c: xfall test that pmin is used. + +2025-05-10 Jakub Jelinek <jakub@redhat.com> + + PR fortran/120193 + * gfortran.dg/guality/pr120193.f90: New test. + +2025-05-10 Filip Kastl <fkastl@suse.cz> + + * gcc.target/aarch64/pr99988.c: Add -fno-bit-tests. + +2025-05-10 Filip Kastl <fkastl@suse.cz> + + PR tree-optimization/120080 + * gcc.dg/tree-ssa/pr120080.c: New test. + +2025-05-10 Co-authored-by: Jeff Law <jlaw@ventanamicro.com> + + * gcc.target/riscv/ior-synthesis-1.c: New test. + * gcc.target/riscv/ior-synthesis-2.c: New test. + * gcc.target/riscv/xor-synthesis-1.c: New test. + * gcc.target/riscv/xor-synthesis-2.c: New test. + * gcc.target/riscv/xor-synthesis-3.c: New test. + +2025-05-10 Anton Blanchard <antonb@tenstorrent.com> + + * gcc.target/riscv/rvv/base/crc-builtin-zvbc.c: New test. + +2025-05-10 Alexandre Oliva <oliva@adacore.com> + + * gcc.dg/pr87600.h (REG1, REG2): Test for __PPC__ as well. + * gcc.dg/pr89313.c (REG): Likewise. + +2025-05-10 Alexandre Oliva <oliva@adacore.com> + + * gcc.target/powerpc/block-cmp-8.c: Require powerpc64 + instruction execution support. + +2025-05-10 Jason Merrill <jason@redhat.com> + + PR c++/120204 + * g++.dg/cpp1y/constexpr-recursion3.C: New test. + +2025-05-09 Jason Merrill <jason@redhat.com> + + PR c++/99599 + PR c++/120185 + * g++.dg/cpp2a/concepts-nondep6.C: New test. + +2025-05-09 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt106.adb: New test. + * gnat.dg/opt106_pkg1.ads, gnat.dg/opt106_pkg1.adb: New helper. + * gnat.dg/opt106_pkg2.ads, gnat.dg/opt106_pkg2.adb: Likewise. + +2025-05-09 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/120182 + * gcc.dg/torture/pr120182.c: New testcase. + +2025-05-09 Richard Biener <rguenther@suse.de> + + PR tree-optimization/119960 + * gcc.dg/vect/bb-slp-pr119960-1.c: New testcase. + +2025-05-09 Christophe Lyon <christophe.lyon@linaro.org> + + * g++.dg/cpp2a/constinit16.C: Require tls. + +2025-05-09 Christophe Lyon <christophe.lyon@linaro.org> + + * g++.dg/cpp2a/decomp2.C: Require tls_runtime. + +2025-05-09 Jiawei <jiawei@iscas.ac.cn> + + * gcc.dg/pr119160.c: Limit backends. + +2025-05-09 Jennifer Schmitz <jschmitz@nvidia.com> + + * gcc.target/aarch64/sve/ptrue_ldr_str.c: New test. + * gcc.target/aarch64/sve/acle/general/attributes_6.c: Adjust + expected outcome. + * gcc.target/aarch64/sve/cost_model_14.c: Adjust expected outcome. + * gcc.target/aarch64/sve/cost_model_4.c: Adjust expected outcome. + * gcc.target/aarch64/sve/cost_model_5.c: Adjust expected outcome. + * gcc.target/aarch64/sve/cost_model_6.c: Adjust expected outcome. + * gcc.target/aarch64/sve/cost_model_7.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_f16.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_f32.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_f64.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_mf8.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_s16.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_s32.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_s64.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_s8.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_u16.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_u32.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_u64.c: Adjust expected outcome. + * gcc.target/aarch64/sve/pcs/varargs_2_u8.c: Adjust expected outcome. + * gcc.target/aarch64/sve/peel_ind_2.c: Adjust expected outcome. + * gcc.target/aarch64/sve/single_1.c: Adjust expected outcome. + * gcc.target/aarch64/sve/single_2.c: Adjust expected outcome. + * gcc.target/aarch64/sve/single_3.c: Adjust expected outcome. + * gcc.target/aarch64/sve/single_4.c: Adjust expected outcome. + +2025-05-09 David Malcolm <dmalcolm@redhat.com> + + PR other/116792 + * gcc.dg/plugin/diagnostic_plugin_xhtml_format.cc: Move to + gcc/diagnostic-format-html.cc. + * gcc.dg/html-output/html-output.exp: New support script. + * gcc.dg/html-output/missing-semicolon.c: New test. + * gcc.dg/html-output/missing-semicolon.py: New test script. + * gcc.dg/plugin/diagnostic-test-xhtml-1.c: Deleted test. + * gcc.dg/plugin/plugin.exp (plugin_test_list): Drop moved plugin + and its deleted test. + * lib/gcc-dg.exp (load_lib): Add load_lib of scanhtml.exp. + * lib/htmltest.py: New support script. + * lib/scanhtml.exp: New support script, based on scansarif.exp. + +2025-05-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i8.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u8.c: New test. + +2025-05-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i8.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u8.c: New test. + +2025-05-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Add test + helper macros. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i8.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u16.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u32.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u64.c: New test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u8.c: New test. + +2025-05-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h: Rename VX_BINARY + to VX_BINARY_CASE_0 for underlying case 1. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i16.c: Take the + new name for test. + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i8.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u16.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u8.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i16.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i8.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u16.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u8.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i16.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i8.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u16.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u8.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i16.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i8.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u16.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u32.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u64.c: Ditto + * gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u8.c: Ditto + +2025-05-09 Pan Li <pan2.li@intel.com> + + * gcc.target/riscv/rvv/rvv.exp: Separate test running of + rvv vx_vf. + +2025-05-08 Harald Anlauf <anlauf@gmx.de> + + PR fortran/120179 + * gfortran.dg/do_concurrent_basic.f90: Extend testcase. + +2025-05-08 Jason Merrill <jason@redhat.com> + + PR c++/99599 + * g++.dg/cpp2a/concepts-recursive-sat4.C: Adjust again. + * g++.dg/cpp2a/concepts-nondep5.C: New test. + +2025-05-08 Andrew Pinski <quic_apinski@quicinc.com> + + PR testsuite/120168 + * gcc.dg/tree-ssa/pr31261.c: Use `signed char` instead + of plain char. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120043 + * gcc.dg/torture/pr120043.c: New testcase. + +2025-05-08 Jakub Jelinek <jakub@redhat.com> + + PR libfortran/120152 + PR libfortran/120153 + PR libfortran/120158 + * gfortran.dg/pr120152_1.f90: New test. + * gfortran.dg/pr120152_2.f90: New test. + * gfortran.dg/pr120153.f90: New test. + * gfortran.dg/pr120158.f90: New test. + +2025-05-08 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/116938 + * gcc.dg/tree-ssa/phi-opt-40.c: Update to expect ABSU_EXPR. + * gcc.dg/tree-ssa/phi-opt-41.c: Likewise. + +2025-05-08 Andrew Pinski <quic_apinski@quicinc.com> + + PR tree-optimization/120122 + PR tree-optimization/116939 + * gcc.dg/torture/pr120122-1.c: New test. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR ipa/120146 + * g++.dg/ipa/pr120146.C: New testcase. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120143 + * gcc.dg/vect/vect-early-break_135-pr120143.c: New testcase. + +2025-05-08 Richard Biener <rguenther@suse.de> + + PR tree-optimization/120089 + * gcc.dg/vect/vect-early-break_134-pr120089.c: New testcase. + +2025-05-07 Jeff Law <jlaw@ventanamicro.com> + + PR target/120137 + PR target/120154 + * gcc.target/riscv/pr120137.c: New test. + * gcc.target/riscv/pr120154.c: New test. + +2025-05-07 Dongyan Chen <chendongyan@isrc.iscas.ac.cn> + + * gcc.target/riscv/arch-48.c: New test. + +2025-05-07 Richard Earnshaw <rearnsha@arm.com> + + PR target/110796 + PR target/118446 + * gcc.target/arm/armv8_2-fp16-arith-1.c: Adjust due to no-longer + emitting VCMPE when -ffast-math.. + +2025-05-07 Jakub Jelinek <jakub@redhat.com> + + PR preprocessor/108900 + PR preprocessor/116047 + PR preprocessor/120061 + * gcc.dg/plugin/plugin.exp: Add location-overflow-test-pr116047.c + and location-overflow-test-pr120061.c. + * gcc.dg/plugin/location_overflow_plugin.cc (plugin_init): Don't error + on unknown values, instead just break. Handle 0x4fHHHHHH arguments + differently. + * gcc.dg/plugin/location-overflow-test-pr116047.c: New test. + * gcc.dg/plugin/location-overflow-test-pr116047-1.h: New test. + * gcc.dg/plugin/location-overflow-test-pr116047-2.h: New test. + * gcc.dg/plugin/location-overflow-test-pr120061.c: New test. + * gcc.dg/plugin/location-overflow-test-pr120061-1.h: New test. + * gcc.dg/plugin/location-overflow-test-pr120061-2.h: New test. + +2025-05-07 Jan Hubicka <hubicka@ucw.cz> + + * gcc.target/i386/pr119919.c: Add -mtune=znver1 + +2025-05-07 Jennifer Schmitz <jschmitz@nvidia.com> + + PR target/117978 + * gcc.target/aarch64/sve/acle/general/whilelt_5.c: Adjust expected + outcome. + * gcc.target/aarch64/sve/ldst_ptrue_pat_128_to_neon.c: New test. + * gcc.target/aarch64/sve/while_7.c: Adjust expected outcome. + * gcc.target/aarch64/sve/while_9.c: Adjust expected outcome. + +2025-05-07 Stefan Schulze Frielinghaus <stefansf@gcc.gnu.org> + + * gcc.target/s390/vector/cstoreti-1.c: New test. + * gcc.target/s390/vector/cstoreti-2.c: New test. + +2025-05-07 H.J. Lu <hjl.tools@gmail.com> + + PR target/120036 + * g++.target/i386/pr120036.C: New test. + * gcc.target/i386/pr117839-3a.c: Likewise. + * gcc.target/i386/pr117839-3b.c: Likewise. + +2025-05-07 Paul Thomas <pault@gcc.gnu.org> + and Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/119948 + * gfortran.dg/pr119948.f90: Update to incorporate failing test, + where module procedure is the result. Test submodule cases. + +2025-05-07 Jeff Law <jlaw@ventanamicro.com> + + * g++.target/riscv/redundant-andi.C: New test. + 2025-05-06 Dongyan Chen <chendongyan@isrc.iscas.ac.cn> * gcc.target/riscv/arch-47.c: New test. diff --git a/gcc/testsuite/cobol.dg/group1/simple-if.cob b/gcc/testsuite/cobol.dg/group1/simple-if.cob index 6cf6ec6..bdf11ec 100644 --- a/gcc/testsuite/cobol.dg/group1/simple-if.cob +++ b/gcc/testsuite/cobol.dg/group1/simple-if.cob @@ -19,7 +19,7 @@ *> { dg-output {CORRECTLY_TRUE: A_4 NOT = B_4(\n|\r\n|\r)} } *> { dg-output {CORRECTLY_ELSE: A_4 NOT > B_4(\n|\r\n|\r)} } *> { dg-output { } } -* Not strictly Reference Format + >>SOURCE FREE IDENTIFICATION DIVISION. PROGRAM-ID. test. DATA DIVISION. diff --git a/gcc/testsuite/cobol.dg/group2/258_Nested_PERFORM.cob b/gcc/testsuite/cobol.dg/group2/258_Nested_PERFORM.cob new file mode 100644 index 0000000..383cd0a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/258_Nested_PERFORM.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/258_Nested_PERFORM.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + PROCEDURE DIVISION. + PERFORM 2 TIMES + DISPLAY "X" NO ADVANCING + END-DISPLAY + PERFORM 2 TIMES + DISPLAY "Y" NO ADVANCING + END-DISPLAY + END-PERFORM + END-PERFORM. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/258_Nested_PERFORM.out b/gcc/testsuite/cobol.dg/group2/258_Nested_PERFORM.out new file mode 100644 index 0000000..3c3d159 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/258_Nested_PERFORM.out @@ -0,0 +1 @@ +XYYXYY diff --git a/gcc/testsuite/cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.cob b/gcc/testsuite/cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.cob new file mode 100644 index 0000000..295caf5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + *> { dg-output-file "group2/259_PERFORM_VARYING_BY_-0.2.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 X PIC 9v9. + PROCEDURE DIVISION. + PERFORM VARYING X FROM 0.8 BY -0.2 + UNTIL X < 0.4 + DISPLAY "X" NO ADVANCING + END-DISPLAY + END-PERFORM. + IF X NOT = 0.2 + DISPLAY "WRONG X: " X END-DISPLAY + END-IF + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.out b/gcc/testsuite/cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.out new file mode 100644 index 0000000..dd6d86a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/259_PERFORM_VARYING_BY_-0.2.out @@ -0,0 +1 @@ +XXX diff --git a/gcc/testsuite/cobol.dg/group2/338_Default_Arithmetic__1_.cob b/gcc/testsuite/cobol.dg/group2/338_Default_Arithmetic__1_.cob new file mode 100644 index 0000000..5405dba --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/338_Default_Arithmetic__1_.cob @@ -0,0 +1,75 @@ + *> { dg-do run } + *> { dg-output-file "group2/338_Default_Arithmetic__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 NUM-A PIC 9(3) VALUE 399. + 01 NUM-B PIC 9(3) VALUE 211. + 01 NUM-C PIC 9(3)V99 VALUE 212.34. + 01 NUMV1 PIC 9(3)V9. + 01 PICX PIC X VALUE 'A'. + 01 RSLT PIC 9(3). + 01 RSLTV1 PIC 9(3).9. + 01 RSLTV2 PIC 9(3).99. + * + PROCEDURE DIVISION. + MAIN. + COMPUTE RSLT = NUM-A + 1.1. + DISPLAY 'Simple Compute RSLT IS ' RSLT + COMPUTE RSLT = ((NUM-A / 100) - (NUM-B / 100)) * 100 + DISPLAY 'Single Variable RSLT IS ' RSLT + COMPUTE RSLTV2, RSLT = ((NUM-A / 100) - (NUM-B / 100)) * 100 + DISPLAY 'Compute RSLT IS ' RSLT + DISPLAY 'Compute RSLTv99 IS ' RSLTV2 + COMPUTE RSLTV1, RSLT = ((NUM-A / 100) - (NUM-B / 100)) * 100 + DISPLAY 'Compute RSLT IS ' RSLT + DISPLAY 'Compute RSLTv9 IS ' RSLTV1 + MOVE 0 TO RSLT + ADD NUM-C TO RSLT. + DISPLAY 'Add RSLT IS ' RSLT. + MOVE 0 TO RSLT + ADD NUM-A NUM-C 10 TO RSLT. + DISPLAY 'Add RSLT IS ' RSLT. + SUBTRACT NUM-C FROM RSLT. + DISPLAY 'Subtract RSLT IS ' RSLT. + SUBTRACT NUM-A -10 FROM RSLT. + DISPLAY 'Subtract RSLT IS ' RSLT. + MOVE 0 TO RSLT + ADD NUM-A NUM-C TO RSLT GIVING RSLTV1. + DISPLAY 'Add RSLTv9 IS ' RSLTV1 + MULTIPLY NUM-A BY NUM-C GIVING RSLT. + DISPLAY 'Multiply RSLT IS ' RSLT. + MULTIPLY RSLT BY NUM-C. + DISPLAY 'Multiply RSLT IS ' RSLT. + DIVIDE NUM-A BY 10 GIVING RSLT. + DISPLAY 'Divide RSLT IS ' RSLT. + DIVIDE RSLT BY 4 GIVING RSLTV1. + DISPLAY 'Divide RSLTv9 IS ' RSLTV1. + DIVIDE RSLT BY 4 GIVING RSLT. + DISPLAY 'Divide RSLT IS ' RSLT. + + COMPUTE RSLTV1, RSLT = ((NUM-A / 100) - (NUM-B / 100)) * 100 + DISPLAY 'Simple RSLT IS ' RSLT + ' RSLTv9 IS ' RSLTV1. + + COMPUTE RSLTV1, RSLT = ((NUM-A / (100.55 + -0.550)) + - (NUM-B / (10.11 * 10 - 1.1))) + * (220 / 2.2) + DISPLAY 'Complex RSLT IS ' RSLT + ' RSLTv9 IS ' RSLTV1. + + COMPUTE RSLTV1, RSLT = ((NUM-A / (101 - 1)) + - (NUM-B / (10 * 10))) * (200 / 2) + DISPLAY 'Reduced RSLT IS ' RSLT + ' RSLTv9 IS ' RSLTV1. + MOVE NUM-A TO NUMV1. + IF ((NUMV1 / (101 - 1)) + - (NUM-B / (10 * 10))) * (200 / 2) EQUAL 188 + DISPLAY "Not Using ARITHMETIC-OSVS" + ELSE + DISPLAY "Using ARITHMETIC-OSVS" + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/338_Default_Arithmetic__1_.out b/gcc/testsuite/cobol.dg/group2/338_Default_Arithmetic__1_.out new file mode 100644 index 0000000..3137fc4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/338_Default_Arithmetic__1_.out @@ -0,0 +1,21 @@ +Simple Compute RSLT IS 400 +Single Variable RSLT IS 188 +Compute RSLT IS 188 +Compute RSLTv99 IS 188.00 +Compute RSLT IS 188 +Compute RSLTv9 IS 188.0 +Add RSLT IS 212 +Add RSLT IS 621 +Subtract RSLT IS 408 +Subtract RSLT IS 019 +Add RSLTv9 IS 611.3 +Multiply RSLT IS 723 +Multiply RSLT IS 723 +Divide RSLT IS 039 +Divide RSLTv9 IS 009.7 +Divide RSLT IS 009 +Simple RSLT IS 188 RSLTv9 IS 188.0 +Complex RSLT IS 188 RSLTv9 IS 188.0 +Reduced RSLT IS 188 RSLTv9 IS 188.0 +Not Using ARITHMETIC-OSVS + diff --git a/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob new file mode 100644 index 0000000..6fab992 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.cob @@ -0,0 +1,113 @@ + *> { dg-do run } + *> { dg-output-file "group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out" } + + identification division. + program-id. prog. + procedure division. + display "initialize zeroes" + call "prog-zeroes" + display "initialize low-value" + call "prog-low" + display "initialize spaces" + call "prog-space" + display "initialize high-value" + call "prog-high" + continue. + end program prog. + + identification division. + program-id. prog-space. + options. initialize working-storage spaces. + data division. + working-storage section. + 01 based-var based. + 02 based-x pic x(24) value "I am I, Don Quixote". + 02 based-9 pic 999 value 123. + 02 based-p pointer value NULL. + 01 allocated-pointer pointer. + procedure division. + display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)" + allocate 35 characters returning allocated-pointer + set address of based-var to allocated-pointer + call "reporter" using based-var + free allocated-pointer + goback. + end program prog-space. + + identification division. + program-id. prog-low. + options. initialize working-storage low-values. + data division. + working-storage section. + 01 based-var based. + 02 based-x pic x(24) value "I am I, Don Quixote". + 02 based-9 pic 999 value 123. + 02 based-p pointer value NULL. + 01 allocated-pointer pointer. + procedure division. + display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)" + allocate 35 characters returning allocated-pointer + set address of based-var to allocated-pointer + call "reporter" using based-var + free allocated-pointer + goback. + end program prog-low. + + identification division. + program-id. prog-zeroes. + options. initialize working-storage binary zeroes. + data division. + working-storage section. + 01 based-var based. + 02 based-x pic x(24) value "I am I, Don Quixote". + 02 based-9 pic 999 value 123. + 02 based-p pointer value NULL. + 01 allocated-pointer pointer. + procedure division. + display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)" + allocate 35 characters returning allocated-pointer + set address of based-var to allocated-pointer + call "reporter" using based-var + free allocated-pointer + goback. + end program prog-zeroes. + + identification division. + program-id. prog-high. + options. initialize working-storage high-values. + data division. + working-storage section. + 01 based-var based. + 02 based-x pic x(24) value "I am I, Don Quixote". + 02 based-9 pic 999 value 123. + 02 based-p pointer value NULL. + 01 allocated-pointer pointer. + procedure division. + display "allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero)" + allocate 35 characters returning allocated-pointer + set address of based-var to allocated-pointer + call "reporter" using based-var + free allocated-pointer + goback. + end program prog-high. + + identification division. + program-id. reporter. + data division. + linkage section. + 01 based-var based. + 02 based-x pic x(24). + 02 based-9 pic 999 . + 02 based-p pointer . + procedure division using based-var. + reportt. + display " (1) as allocated" + perform reportt2 + goback. + reportt2. + display " " """" based-x """" with no advancing + display space """" based-9 """" with no advancing + display space based-p. + continue. + end program reporter. + diff --git a/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out new file mode 100644 index 0000000..c141fdf --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ALLOCATE_Rule_8_OPTION_INITIALIZE_with_figconst.out @@ -0,0 +1,17 @@ +initialize zeroes +allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero) + (1) as allocated + "" "" 0x0000000000000000 +initialize low-value +allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero) + (1) as allocated + "" "" 0x0000000000000000 +initialize spaces +allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero) + (1) as allocated + " " " " 0x2020202020202020 +initialize high-value +allocate characters (ISO 2023 Rule 8: OPT_INIT if specified, otherwise defaultbyte, otherwise zero) + (1) as allocated + "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ" "¿¿¿" 0xffffffffffffffff + diff --git a/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_basic_default_versions.cob b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_basic_default_versions.cob new file mode 100644 index 0000000..abcba96 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_basic_default_versions.cob @@ -0,0 +1,73 @@ + *> { dg-do run } + *> { dg-output-file "group2/ALLOCATE___FREE_basic_default_versions.out" } + + program-id. prog. + data division. + working-storage section. + 01 based-var pic x(100) based. + 01 mem-pointer pointer. + 01 mem-size pic 999 value 100. + 01 counter pic 99 value zero. + procedure division. + allocate 100 characters returning mem-pointer. + if mem-pointer equal NULL + display "allocate 100 should not be NULL (1)" + else + add 1 to counter. + free mem-pointer + if mem-pointer not equal NULL + display "mem-pointer should be NULL again (1)" + else + add 1 to counter. + + allocate mem-size characters returning mem-pointer. + if mem-pointer equal null + display "allocate mem-size should not be NULL (2)" + else + add 1 to counter. + free mem-pointer + if mem-pointer not equal null + display "mem-pointer should be NULL again (2)" + else + add 1 to counter. + + allocate based-var + if address of based-var equal NULL + display "address of based-var should not be NULL (1)" + else + add 1 to counter + free based-var + if address of based-var not equal NULL + display "address of based-var be NULL (1)" + else + add 1 to counter. + + allocate based-var + if address of based-var equal NULL + display "address of based-var should not be NULL (2)" + else + add 1 to counter. + free address of based-var + if address of based-var not equal NULL + display "address of based-var be NULL (2)" + else + add 1 to counter. + + allocate based-var returning mem-pointer. + if address of based-var equal NULL + display "address of based-var should not be NULL (3)" + else + add 1 to counter. + if mem-pointer equal NULL + display "address of mem-pointer should not be NULL (3)" + else + add 1 to counter. + if address of based-var not equal mem-pointer + display "address of mem-pointer should be equal to mem-pointer (3)" + else + add 1 to counter. + + display "There were " counter " successful tests; should be 11." + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_basic_default_versions.out b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_basic_default_versions.out new file mode 100644 index 0000000..ab96696b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_basic_default_versions.out @@ -0,0 +1,2 @@ +There were 11 successful tests; should be 11. + diff --git a/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_with_BASED_item__1_.cob b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_with_BASED_item__1_.cob new file mode 100644 index 0000000..b4929b8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_with_BASED_item__1_.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + LINKAGE SECTION. + 01 MYFLD PIC X(6) BASED VALUE "ABCDEF". + PROCEDURE DIVISION. + ASTART SECTION. + A01. + ALLOCATE MYFLD INITIALIZED. + IF MYFLD NOT = "ABCDEF" + DISPLAY MYFLD + END-DISPLAY + END-IF. + FREE ADDRESS OF MYFLD. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_with_BASED_item__2_.cob b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_with_BASED_item__2_.cob new file mode 100644 index 0000000..9820784 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ALLOCATE___FREE_with_BASED_item__2_.cob @@ -0,0 +1,35 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 MYFLD BASED. + 03 MYFLDX PIC X. + 03 MYFLD9 PIC 9. + PROCEDURE DIVISION. + IF ADDRESS OF MYFLD NOT = NULL + DISPLAY "BASED ITEM WITH ADDRESS ON START" + END-DISPLAY + END-IF. + FREE MYFLD. + ALLOCATE MYFLD. + IF ADDRESS OF MYFLD = NULL + DISPLAY "BASED ITEM WITHOUT ADDRESS AFTER ALLOCATE" + END-DISPLAY + END-IF. + INITIALIZE MYFLD. + IF MYFLD NOT = " 0" + DISPLAY "BASED ITEM INITIALIZED WRONG: " + WITH NO ADVANCING + END-DISPLAY + DISPLAY MYFLD + END-DISPLAY + END-IF. + + FREE ADDRESS OF MYFLD. + IF ADDRESS OF MYFLD NOT = NULL + DISPLAY "BASED ITEM WITH ADDRESS AFTER FREE" + END-DISPLAY + END-IF. + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__1_.cob b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__1_.cob new file mode 100644 index 0000000..a4dc2e5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__1_.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + *> { dg-output-file "group2/ANY_LENGTH__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 P1 PIC X(6) VALUE "OKOKOK". + PROCEDURE DIVISION. + CALL "callee" USING P1 + END-CALL. + STOP RUN. + IDENTIFICATION DIVISION. + PROGRAM-ID. callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 P2 PIC 99. + LINKAGE SECTION. + 01 P1 PIC X ANY LENGTH. + PROCEDURE DIVISION USING P1. + MOVE FUNCTION LENGTH (P1) TO P2. + DISPLAY "The incoming ANY LENGTH is " P2 + DISPLAY "The incoming ANY LENGTH variable is " """" P1 """" + EXIT PROGRAM. + END PROGRAM callee. + END PROGRAM caller. + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__1_.out b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__1_.out new file mode 100644 index 0000000..f35acf2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__1_.out @@ -0,0 +1,3 @@ +The incoming ANY LENGTH is 06 +The incoming ANY LENGTH variable is "OKOKOK" + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__2_.cob b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__2_.cob new file mode 100644 index 0000000..8f152eb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__2_.cob @@ -0,0 +1,33 @@ + *> { dg-do run } + *> { dg-output-file "group2/ANY_LENGTH__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 P1 PIC X(2) VALUE "OK". + PROCEDURE DIVISION. + CALL "callee" USING P1 + END-CALL. + DISPLAY "On return, P1 is " """" P1 """" + STOP RUN. + IDENTIFICATION DIVISION. + PROGRAM-ID. callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 P2 PIC XXX. + LINKAGE SECTION. + 01 P1 PIC X ANY LENGTH. + PROCEDURE DIVISION USING P1. + MOVE P1 TO P2. + DISPLAY "P1 is " """" P1 """" + DISPLAY "P2 is " """" P2 """" + IF P2 NOT = "OK " + DISPLAY P2 + END-DISPLAY + END-IF. + MOVE SPACE TO P1. + EXIT PROGRAM. + END PROGRAM callee. + END PROGRAM caller. + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__2_.out b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__2_.out new file mode 100644 index 0000000..e2bc284 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__2_.out @@ -0,0 +1,4 @@ +P1 is "OK" +P2 is "OK " +On return, P1 is " " + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__3_.cob b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__3_.cob new file mode 100644 index 0000000..6603559 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__3_.cob @@ -0,0 +1,25 @@ + *> { dg-do run } + *> { dg-output-file "group2/ANY_LENGTH__3_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(20) VALUE ALL "X". + PROCEDURE DIVISION. + CALL "subprog" USING str. + IDENTIFICATION DIVISION. + PROGRAM-ID. subprog. + DATA DIVISION. + LINKAGE SECTION. + 01 str PIC X ANY LENGTH. + PROCEDURE DIVISION USING str. + MOVE "abcd" TO str + DISPLAY FUNCTION TRIM (str) + MOVE "abcd" TO str (5:) + DISPLAY FUNCTION TRIM (str) + MOVE ALL "a" TO str + DISPLAY FUNCTION TRIM (str). + END PROGRAM subprog. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__3_.out b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__3_.out new file mode 100644 index 0000000..7e58e05 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__3_.out @@ -0,0 +1,4 @@ +abcd +abcdabcd +aaaaaaaaaaaaaaaaaaaa + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__4_.cob b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__4_.cob new file mode 100644 index 0000000..b4dcddc --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__4_.cob @@ -0,0 +1,33 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 str PIC X(20) VALUE ALL "X". + + PROCEDURE DIVISION. + CALL "subprog" USING str + move ' 45' to str + CALL "subprog" USING str + . + + IDENTIFICATION DIVISION. + PROGRAM-ID. subprog. + + DATA DIVISION. + LINKAGE SECTION. + 01 str PIC X ANY LENGTH. + + PROCEDURE DIVISION USING str. + IF str = 'X' + DISPLAY 'X is X' + END-IF + IF str = space + DISPLAY 'X is space' + END-IF + . + END PROGRAM subprog. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__5_.cob b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__5_.cob new file mode 100644 index 0000000..fb8dfa9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__5_.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + *> { dg-output-file "group2/ANY_LENGTH__5_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + PROCEDURE DIVISION. + CALL "subprog" + GOBACK. + IDENTIFICATION DIVISION. + PROGRAM-ID. subprog. + DATA DIVISION. + LINKAGE SECTION. + 01 str1 PIC X ANY LENGTH. + 01 str2 PIC X ANY LENGTH. + PROCEDURE DIVISION USING optional str1 optional str2. + DISPLAY 'IN' WITH NO ADVANCING. + END PROGRAM subprog. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__5_.out b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__5_.out new file mode 100644 index 0000000..2c9e08f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/ANY_LENGTH__5_.out @@ -0,0 +1 @@ +IN diff --git a/gcc/testsuite/cobol.dg/group2/Alphanumeric_MOVE_with_truncation.cob b/gcc/testsuite/cobol.dg/group2/Alphanumeric_MOVE_with_truncation.cob new file mode 100644 index 0000000..76b1fb4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Alphanumeric_MOVE_with_truncation.cob @@ -0,0 +1,45 @@ + *> { dg-do run } + *> { dg-options "-Wno-truncate" } + *> { dg-output-file "group2/Alphanumeric_MOVE_with_truncation.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 x-left PIC X(03). + 01 x-right PIC X(03) JUSTIFIED RIGHT. + PROCEDURE DIVISION. + MOVE '1234' TO x-left, x-right + DISPLAY """" x-left """" space """" x-right """" + IF x-left not = '123' + OR x-right not = '234' + DISPLAY 'error with "1234":' + END-DISPLAY + DISPLAY x-left + END-DISPLAY + DISPLAY x-right + END-DISPLAY + END-IF + MOVE ' 3' TO x-left, x-right + DISPLAY """" x-left """" space """" x-right """" + IF x-left not = spaces + OR x-right not = ' 3' + DISPLAY 'error with " 3":' + END-DISPLAY + DISPLAY x-left + END-DISPLAY + DISPLAY x-right + END-DISPLAY + END-IF + MOVE '3 ' TO x-left, x-right + DISPLAY """" x-left """" space """" x-right """" + IF x-left not = '3' + OR x-right not = spaces + DISPLAY 'error with "3 ":' + END-DISPLAY + DISPLAY x-left + END-DISPLAY + DISPLAY x-right + END-DISPLAY + END-IF. + diff --git a/gcc/testsuite/cobol.dg/group2/Alphanumeric_MOVE_with_truncation.out b/gcc/testsuite/cobol.dg/group2/Alphanumeric_MOVE_with_truncation.out new file mode 100644 index 0000000..1bddffb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Alphanumeric_MOVE_with_truncation.out @@ -0,0 +1,4 @@ +"123" "234" +" " " 3" +"3 " " " + diff --git a/gcc/testsuite/cobol.dg/group2/Alphanumeric_and_binary_numeric.cob b/gcc/testsuite/cobol.dg/group2/Alphanumeric_and_binary_numeric.cob new file mode 100644 index 0000000..8ce12ee --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Alphanumeric_and_binary_numeric.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X-X PIC XXXX VALUE "0001". + 01 X-9 PIC 9999 COMP VALUE 1. + PROCEDURE DIVISION. + IF X-X = X-9 + STOP RUN + END-IF. + DISPLAY "NG" NO ADVANCING + END-DISPLAY + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/CALL_with_OMITTED_parameter.cob b/gcc/testsuite/cobol.dg/group2/CALL_with_OMITTED_parameter.cob new file mode 100644 index 0000000..0c5647c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CALL_with_OMITTED_parameter.cob @@ -0,0 +1,38 @@ + *> { dg-do run } + *> { dg-output-file "group2/CALL_with_OMITTED_parameter.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 P1 PIC X VALUE "A". + 01 P2 PIC X VALUE "B". + PROCEDURE DIVISION. + DISPLAY "Should see AB" + CALL "callee" USING P1 P2 + DISPLAY "Should see A" + CALL "callee" USING P1 + END-CALL. + DISPLAY "Should see A" + CALL "callee" USING P1 OMITTED + END-CALL. + STOP RUN. + END PROGRAM caller. + IDENTIFICATION DIVISION. + PROGRAM-ID. callee. + DATA DIVISION. + LINKAGE SECTION. + 01 P1 PIC X. + 01 P2 PIC X. + PROCEDURE DIVISION USING P1 OPTIONAL P2. + DISPLAY """" P1 WITH NO ADVANCING + IF P2 NOT OMITTED + DISPLAY P2 """" + END-DISPLAY + ELSE + DISPLAY """" + END-DISPLAY + END-IF. + EXIT PROGRAM. + END PROGRAM callee. + diff --git a/gcc/testsuite/cobol.dg/group2/CALL_with_OMITTED_parameter.out b/gcc/testsuite/cobol.dg/group2/CALL_with_OMITTED_parameter.out new file mode 100644 index 0000000..1a77e2c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CALL_with_OMITTED_parameter.out @@ -0,0 +1,7 @@ +Should see AB +"AB" +Should see A +"A" +Should see A +"A" + diff --git a/gcc/testsuite/cobol.dg/group2/CONTINUE_AFTER_1_SECONDS.cob b/gcc/testsuite/cobol.dg/group2/CONTINUE_AFTER_1_SECONDS.cob new file mode 100644 index 0000000..0c4e115 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CONTINUE_AFTER_1_SECONDS.cob @@ -0,0 +1,28 @@ + *> { dg-do run } + *> { dg-output-file "group2/CONTINUE_AFTER_1_SECONDS.out" } + + program-id. prog. + data division. + working-storage section. + 01 tod pic x(64). + 01 tstart pic 9999. + 01 tend pic 9999. + 01 tspan pic 9999. + procedure division. + accept tod from time + move tod(5:) to tstart + continue after 1.0 seconds. + accept tod from time + move tod(5:) to tend + if tend < tstart + compute tend = tend + 6000 + end-if + compute tspan = tend - tstart + if tspan >= 75 and tspan <= 125 + display "Looks good" + else + display "Looks bad! " tstart space tend space tspan + end-if + goback. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/CONTINUE_AFTER_1_SECONDS.out b/gcc/testsuite/cobol.dg/group2/CONTINUE_AFTER_1_SECONDS.out new file mode 100644 index 0000000..74b5c81 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CONTINUE_AFTER_1_SECONDS.out @@ -0,0 +1,2 @@ +Looks good + diff --git a/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN.cob b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN.cob new file mode 100644 index 0000000..f1ebd6a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + *> { dg-output-file "group2/CURRENCY_SIGN.out" } + + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + CURRENCY SIGN IS "Y". + + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 amount pic Y(6)9.99. + + PROCEDURE DIVISION. + Move 1512.34 to Amount + Display "Amount is #" Amount '#' with no advancing. + + GOBACK + . + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN.out b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN.out new file mode 100644 index 0000000..d49ed31 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN.out @@ -0,0 +1 @@ +Amount is # Y1512.34# diff --git a/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN_WITH_PICTURE_SYMBOL.cob b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN_WITH_PICTURE_SYMBOL.cob new file mode 100644 index 0000000..eff0822 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN_WITH_PICTURE_SYMBOL.cob @@ -0,0 +1,32 @@ + *> { dg-do run } + *> { dg-output-file "group2/CURRENCY_SIGN_WITH_PICTURE_SYMBOL.out" } + + PROGRAM-ID. prog. + + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + *> note the space after EUR / before ct. + CURRENCY SIGN IS "EUR " WITH PICTURE SYMBOL "U", + CURRENCY SIGN IS " ct (EUR)" WITH PICTURE SYMBOL "c", + Currency Sign is "$US" with Picture Symbol "$". + + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 EUROS PIC U99v99. + 77 cents PIC 9,999c. + 77 DOLLARS Pic $$,$$9.99. + + PROCEDURE DIVISION. + MOVE 12.34 TO EUROS + MULTIPLY euros BY 100 GIVING cents. + DISPLAY "#" EUROS "# equal #" cents '#'. + Move 1500 to DOLLARS + Display "Invoice amount #1 is " DOLLARS '.'. + Move 12.34 to DOLLARS + Display "Invoice amount #2 is " DOLLARS '.'. + + GOBACK + . + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN_WITH_PICTURE_SYMBOL.out b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN_WITH_PICTURE_SYMBOL.out new file mode 100644 index 0000000..861e65a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/CURRENCY_SIGN_WITH_PICTURE_SYMBOL.out @@ -0,0 +1,4 @@ +#EUR 12.34# equal #1,234 ct (EUR)# +Invoice amount #1 is $US1,500.00. +Invoice amount #2 is $US12.34. + diff --git a/gcc/testsuite/cobol.dg/group2/Class_check_with_reference_modification.cob b/gcc/testsuite/cobol.dg/group2/Class_check_with_reference_modification.cob new file mode 100644 index 0000000..62d6bc8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Class_check_with_reference_modification.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(6) VALUE "123 ". + PROCEDURE DIVISION. + IF X(1:3) NUMERIC + STOP RUN + END-IF. + DISPLAY "NG" NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.cob b/gcc/testsuite/cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.cob new file mode 100644 index 0000000..797c6fe --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.cob @@ -0,0 +1,76 @@ + *> { dg-do run } + *> { dg-output-file "group2/Complex_HEX__VALUE_and_MOVE.out" } + + identification division. + program-id. hex-init. + data division. + working-storage section. + 01 var-01020304. + 05 filler1. + 10 filler2 pic x(2) VALUE "33". + 10 as-value pic x(4) VALUE X'01020304'. + 10 filler3 pic x(2) VALUE "33". + 05 as-pointer redefines filler1 usage pointer. + + 01 var-low. + 05 filler1. + 10 filler2 pic x(2) VALUE "33". + 10 as-value pic x(4) VALUE LOW-VALUES. + 10 filler3 pic x(2) VALUE "33". + 05 as-pointer redefines filler1 usage pointer. + 01 var-space. + 05 filler1. + 10 filler2 pic x(2) VALUE "33". + 10 as-value pic x(4) VALUE SPACE. + 10 filler3 pic x(2) VALUE "33". + 05 as-pointer redefines filler1 usage pointer. + 01 var-quote. + 05 filler1. + 10 filler2 pic x(2) VALUE "33". + 10 as-value pic x(4) VALUE QUOTE. + 10 filler3 pic x(2) VALUE "33". + 05 as-pointer redefines filler1 usage pointer. + 01 var-zero. + 05 filler1. + 10 filler2 pic x(2) VALUE "33". + 10 as-value pic x(4) VALUE ZERO. + 10 filler3 pic x(2) VALUE "33". + 05 as-pointer redefines filler1 usage pointer. + 01 var-high. + 05 filler1. + 10 filler2 pic x(2) VALUE "33". + 10 as-value pic x(4) VALUE HIGH-VALUES. + 10 filler3 pic x(2) VALUE "33". + 05 as-pointer redefines filler1 usage pointer. + 01 move-target. + 05 filler1. + 10 filler2 pic x(2) VALUE "33". + 10 as-value pic x(4) VALUE "3333". + 10 filler3 pic x(2) VALUE "33". + 05 as-pointer redefines filler1 usage pointer. + procedure division. + display "the value is " as-pointer of var-01020304. + display "should be 0x3333040302013333" + display "var-low : " as-pointer of var-low + display "var-space: " as-pointer of var-space + display "var-quote: " as-pointer of var-quote + display "var-zero : " as-pointer of var-zero + display "var-high : " as-pointer of var-high + display "initial " as-pointer of move-target + move low-value to as-value of move-target + display "low-value " as-pointer of move-target + move space to as-value of move-target + display "space " as-pointer of move-target + move quote to as-value of move-target + display "quote " as-pointer of move-target + move zeroes to as-value of move-target + display "zeroes " as-pointer of move-target + move high-value to as-value of move-target + display "high-value " as-pointer of move-target + move X'01020304' to as-value of move-target + display "01020304 " as-pointer of move-target + move "33333333" to move-target + move X'00' to filler3 of move-target(1:1) + display "ref-mod " as-pointer of move-target + stop run. + diff --git a/gcc/testsuite/cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.out b/gcc/testsuite/cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.out new file mode 100644 index 0000000..366d0c2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Complex_HEX__VALUE_and_MOVE.out @@ -0,0 +1,16 @@ +the value is 0x3333040302013333 +should be 0x3333040302013333 +var-low : 0x3333000000003333 +var-space: 0x3333202020203333 +var-quote: 0x3333222222223333 +var-zero : 0x3333303030303333 +var-high : 0x3333ffffffff3333 +initial 0x3333333333333333 +low-value 0x3333000000003333 +space 0x3333202020203333 +quote 0x3333222222223333 +zeroes 0x3333303030303333 +high-value 0x3333ffffffff3333 +01020304 0x3333040302013333 +ref-mod 0x3300333333333333 + diff --git a/gcc/testsuite/cobol.dg/group2/Complex_IF.cob b/gcc/testsuite/cobol.dg/group2/Complex_IF.cob new file mode 100644 index 0000000..aa3ebde --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Complex_IF.cob @@ -0,0 +1,23 @@ + *> { dg-do run } + *> { dg-output-file "group2/Complex_IF.out" } + identification division. + program-id. phonebook. + data division. + working-storage section. + 01 name1 pic x(10) value "one". + 01 name2 pic x(10) value "two". + 01 flag pic x value 'a'. + procedure division. + move 'l' to flag + perform checkit + goback. + checkit. + if (name1 = name2 and flag = "F" or "f" ) + or flag = "L" or "l" + then + display "the test is TRUE" + else + display "the test is FALSE" + end-if. + end program phonebook. + diff --git a/gcc/testsuite/cobol.dg/group2/Complex_IF.out b/gcc/testsuite/cobol.dg/group2/Complex_IF.out new file mode 100644 index 0000000..ce94a61 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Complex_IF.out @@ -0,0 +1,2 @@ +the test is TRUE + diff --git a/gcc/testsuite/cobol.dg/group2/Concatenation_operator.cob b/gcc/testsuite/cobol.dg/group2/Concatenation_operator.cob new file mode 100644 index 0000000..fef757b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Concatenation_operator.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/Concatenation_operator.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 77 STR PIC X(05). + PROCEDURE DIVISION. + MOVE "OK" & " " + & "OK" + TO STR + DISPLAY STR NO ADVANCING + END-DISPLAY + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Concatenation_operator.out b/gcc/testsuite/cobol.dg/group2/Concatenation_operator.out new file mode 100644 index 0000000..618798a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Concatenation_operator.out @@ -0,0 +1 @@ +OK OK diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__1_.cob b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__1_.cob new file mode 100644 index 0000000..2362d15 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__1_.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + *> { dg-output-file "group2/DECIMAL-POINT_is_COMMA__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 99V99. + PROCEDURE DIVISION. + MOVE FUNCTION MIN (3,,,,,,5) TO X. + DISPLAY X + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__1_.out b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__1_.out new file mode 100644 index 0000000..0b9310e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__1_.out @@ -0,0 +1,2 @@ +00,50 + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__2_.cob b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__2_.cob new file mode 100644 index 0000000..b69ee3b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__2_.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + *> { dg-output-file "group2/DECIMAL-POINT_is_COMMA__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 99V99. + PROCEDURE DIVISION. + MOVE FUNCTION MIN (3,,,,,, 5) TO X. + DISPLAY X + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__2_.out b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__2_.out new file mode 100644 index 0000000..9dcfab9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__2_.out @@ -0,0 +1,2 @@ +03,00 + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__3_.cob b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__3_.cob new file mode 100644 index 0000000..114b9ea --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__3_.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + *> { dg-output-file "group2/DECIMAL-POINT_is_COMMA__3_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 99V99. + PROCEDURE DIVISION. + MOVE FUNCTION MIN (3,,,,,, 1,5) TO X. + DISPLAY X + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__3_.out b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__3_.out new file mode 100644 index 0000000..5a24d4d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__3_.out @@ -0,0 +1,2 @@ +01,50 + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__4_.cob b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__4_.cob new file mode 100644 index 0000000..d969c73 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__4_.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + *> { dg-output-file "group2/DECIMAL-POINT_is_COMMA__4_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 99V99. + PROCEDURE DIVISION. + MOVE FUNCTION MIN (3, 1,5) TO X. + DISPLAY X + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__4_.out b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__4_.out new file mode 100644 index 0000000..5a24d4d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__4_.out @@ -0,0 +1,2 @@ +01,50 + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__5_.cob b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__5_.cob new file mode 100644 index 0000000..2ca9881 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__5_.cob @@ -0,0 +1,23 @@ + *> { dg-do run } + *> { dg-output-file "group2/DECIMAL-POINT_is_COMMA__5_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + DECIMAL-POINT IS COMMA. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 99V99. + PROCEDURE DIVISION. + COMPUTE X=1 + ,1 + END-COMPUTE + DISPLAY X + END-DISPLAY. + COMPUTE X=1*,1 + END-COMPUTE + DISPLAY X + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__5_.out b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__5_.out new file mode 100644 index 0000000..809e6ae --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/DECIMAL-POINT_is_COMMA__5_.out @@ -0,0 +1,3 @@ +01,10 +00,10 + diff --git a/gcc/testsuite/cobol.dg/group2/EC-SIZE-TRUNCATION_EC-SIZE-OVERFLOW.cob b/gcc/testsuite/cobol.dg/group2/EC-SIZE-TRUNCATION_EC-SIZE-OVERFLOW.cob new file mode 100644 index 0000000..60310f7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EC-SIZE-TRUNCATION_EC-SIZE-OVERFLOW.cob @@ -0,0 +1,30 @@ + *> { dg-do run } + *> { dg-output-file "group2/EC-SIZE-TRUNCATION_EC-SIZE-OVERFLOW.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 x PIC 9 VALUE 1. + 01 y PIC 9. + 01 a COMP-1 VALUE 1.E20. + 01 b COMP-1 VALUE 1.E20. + PROCEDURE DIVISION. + DIVIDE x BY 0.1 GIVING y + DISPLAY FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + IF FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + NOT = 'EC-SIZE-TRUNCATION' + DISPLAY 'Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF. + SET LAST EXCEPTION TO OFF + MULTIPLY a BY b GIVING b + DISPLAY FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + IF FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + NOT = 'EC-SIZE-OVERFLOW' + DISPLAY 'Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF. + diff --git a/gcc/testsuite/cobol.dg/group2/EC-SIZE-TRUNCATION_EC-SIZE-OVERFLOW.out b/gcc/testsuite/cobol.dg/group2/EC-SIZE-TRUNCATION_EC-SIZE-OVERFLOW.out new file mode 100644 index 0000000..8c86ad2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EC-SIZE-TRUNCATION_EC-SIZE-OVERFLOW.out @@ -0,0 +1,3 @@ +EC-SIZE-TRUNCATION +EC-SIZE-OVERFLOW + diff --git a/gcc/testsuite/cobol.dg/group2/EC-SIZE-ZERO-DIVIDE__fixed_and_float.cob b/gcc/testsuite/cobol.dg/group2/EC-SIZE-ZERO-DIVIDE__fixed_and_float.cob new file mode 100644 index 0000000..8b5657b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EC-SIZE-ZERO-DIVIDE__fixed_and_float.cob @@ -0,0 +1,64 @@ + *> { dg-do run } + *> { dg-output-file "group2/EC-SIZE-ZERO-DIVIDE__fixed_and_float.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 x PIC 9 VALUE 0. + 01 y PIC 9 VALUE 0. + 01 fx comp-2 VALUE 0. + 01 fy comp-2 VALUE 0. + PROCEDURE DIVISION. + DISPLAY "Fixed-point divide by zero:" + DIVIDE x BY y GIVING y + DISPLAY "1 - """ FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) """" + IF FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + NOT = 'EC-SIZE-ZERO-DIVIDE' + DISPLAY '1 Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + SET LAST EXCEPTION TO OFF + DISPLAY "2 - """ FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) """" + IF FUNCTION EXCEPTION-STATUS NOT = SPACES + DISPLAY '2 Exception is not empty after reset: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + MOVE 0 TO y + COMPUTE y = x - 1 / y + 6.5 + DISPLAY "3 - """ FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) """" + IF FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + NOT = 'EC-SIZE-ZERO-DIVIDE' + DISPLAY '3 Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF. + SET LAST EXCEPTION TO OFF + DISPLAY "Floating-point divide by zero:" + DIVIDE fx BY fy GIVING fy + DISPLAY "4 - """ FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) """" + IF FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + NOT = 'EC-SIZE-ZERO-DIVIDE' + DISPLAY '4 Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + SET LAST EXCEPTION TO OFF + DISPLAY "5 - """ FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) """" + IF FUNCTION EXCEPTION-STATUS NOT = SPACES + DISPLAY '5 Exception is not empty after reset: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF + MOVE 0 TO fy + COMPUTE fy = fx - 1 / fy + 6.5 + DISPLAY "6 - """ FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) """" + IF FUNCTION TRIM(FUNCTION EXCEPTION-STATUS) + NOT = 'EC-SIZE-ZERO-DIVIDE' + DISPLAY '6 Wrong/missing exception: ' + FUNCTION EXCEPTION-STATUS + END-DISPLAY + END-IF. + diff --git a/gcc/testsuite/cobol.dg/group2/EC-SIZE-ZERO-DIVIDE__fixed_and_float.out b/gcc/testsuite/cobol.dg/group2/EC-SIZE-ZERO-DIVIDE__fixed_and_float.out new file mode 100644 index 0000000..93da1b8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EC-SIZE-ZERO-DIVIDE__fixed_and_float.out @@ -0,0 +1,9 @@ +Fixed-point divide by zero: +1 - "EC-SIZE-ZERO-DIVIDE" +2 - "" +3 - "EC-SIZE-ZERO-DIVIDE" +Floating-point divide by zero: +4 - "EC-SIZE-ZERO-DIVIDE" +5 - "" +6 - "EC-SIZE-ZERO-DIVIDE" + diff --git a/gcc/testsuite/cobol.dg/group2/EXIT_PARAGRAPH.cob b/gcc/testsuite/cobol.dg/group2/EXIT_PARAGRAPH.cob new file mode 100644 index 0000000..b637ecb --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EXIT_PARAGRAPH.cob @@ -0,0 +1,21 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 INDVAL PIC 9(4). + PROCEDURE DIVISION. + A01. + PERFORM VARYING INDVAL FROM 1 BY 1 UNTIL INDVAL > 10 + IF INDVAL > 2 + EXIT PARAGRAPH + END-IF + END-PERFORM. + A02. + IF INDVAL NOT = 3 + DISPLAY INDVAL NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM.cob b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM.cob new file mode 100644 index 0000000..d944ccd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-output-file "group2/EXIT_PERFORM.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + PROCEDURE DIVISION. + PERFORM 2 TIMES + DISPLAY "OK" NO ADVANCING + END-DISPLAY + EXIT PERFORM + DISPLAY "NOT OK" + END-DISPLAY + END-PERFORM + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM.out b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM.out new file mode 100644 index 0000000..d86bac9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM.out @@ -0,0 +1 @@ +OK diff --git a/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM_CYCLE.cob b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM_CYCLE.cob new file mode 100644 index 0000000..7d67bd1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM_CYCLE.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-output-file "group2/EXIT_PERFORM_CYCLE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + PROCEDURE DIVISION. + PERFORM 2 TIMES + DISPLAY "OK" NO ADVANCING + END-DISPLAY + EXIT PERFORM CYCLE + DISPLAY "NOT OK" + END-DISPLAY + END-PERFORM + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM_CYCLE.out b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM_CYCLE.out new file mode 100644 index 0000000..d65874e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EXIT_PERFORM_CYCLE.out @@ -0,0 +1 @@ +OKOK diff --git a/gcc/testsuite/cobol.dg/group2/EXIT_SECTION.cob b/gcc/testsuite/cobol.dg/group2/EXIT_SECTION.cob new file mode 100644 index 0000000..fc670f1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/EXIT_SECTION.cob @@ -0,0 +1,25 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 INDVAL PIC 9(4). + PROCEDURE DIVISION. + A01 SECTION. + A011. + PERFORM VARYING INDVAL FROM 1 BY 1 UNTIL INDVAL > 10 + IF INDVAL > 2 + EXIT SECTION + END-IF + END-PERFORM. + A012. + DISPLAY INDVAL NO ADVANCING + END-DISPLAY. + A02 SECTION. + IF INDVAL NOT = 3 + DISPLAY INDVAL NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/FLOAT-LONG_with_SIZE_ERROR.cob b/gcc/testsuite/cobol.dg/group2/FLOAT-LONG_with_SIZE_ERROR.cob new file mode 100644 index 0000000..d8c81a3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FLOAT-LONG_with_SIZE_ERROR.cob @@ -0,0 +1,43 @@ + *> { dg-do run } + *> { dg-output-file "group2/FLOAT-LONG_with_SIZE_ERROR.out" } + + identification division. + program-id. prog. + data division. + working-storage section. + *------------------------ + 77 counter pic s9(4) binary value zero. + * FLOAT-LONG + 77 doubleValue COMP-2 value 2. + 77 lastDoubleValue COMP-2. + ****************************************************************** + procedure division. + main section. + perform varying counter from 1 by 1 until + counter > 1060 + *> display 'counter: ' counter ', value: ' doubleValue + compute doubleValue = doubleValue * 2 + ON SIZE ERROR + display 'SIZE ERROR raised' + end-display + display 'SIZE ERROR, last value = ' doubleValue + end-display + exit perform + not ON SIZE ERROR + if doubleValue > lastdoubleValue + move doubleValue to lastdoubleValue + else + display 'math ERROR, last value > current: ' + lastdoubleValue ' > ' doubleValue + end-display + exit perform + end-if + end-compute + end-perform + display "counter is " counter + if not (counter >= 1023 and <=1025) + display ' ' + display 'counter is ' counter + end-if + goback. + diff --git a/gcc/testsuite/cobol.dg/group2/FLOAT-LONG_with_SIZE_ERROR.out b/gcc/testsuite/cobol.dg/group2/FLOAT-LONG_with_SIZE_ERROR.out new file mode 100644 index 0000000..208bd8a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FLOAT-LONG_with_SIZE_ERROR.out @@ -0,0 +1,4 @@ +SIZE ERROR raised +SIZE ERROR, last value = 8.98846567431157954E+307 +counter is +1023 + diff --git a/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT___FLOAT-LONG_w_o_SIZE_ERROR.cob b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT___FLOAT-LONG_w_o_SIZE_ERROR.cob new file mode 100644 index 0000000..e00676c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT___FLOAT-LONG_w_o_SIZE_ERROR.cob @@ -0,0 +1,164 @@ + *> { dg-do run } + *> { dg-output-file "group2/FLOAT-SHORT___FLOAT-LONG_w_o_SIZE_ERROR.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 CMP1 COMP-1. + 01 SV1 COMP-1. + 01 CMP2 COMP-2. + 01 SV2 COMP-2. + + PROCEDURE DIVISION. + CND-000. + + DISPLAY "--- COMP-1 ---" + COMPUTE CMP1 = (((1.0E7 / 2.1E0) / 3.1E0) - 5.0E-1) * 6.0E0 + DISPLAY "A: " CMP1 + COMPUTE CMP1 = (((1.0E7 / 2.9E0) / 3.9E0) - 5.0E-1) * 6.0E0 + DISPLAY "B: " CMP1 + MOVE ZERO TO CMP1. + COMPUTE CMP1 = 1.0E3 / 2.1E0 + ON SIZE ERROR DISPLAY "Z: " CMP1 " SIZE ERROR" + NOT ON SIZE ERROR DISPLAY "Z: " CMP1 " IS OK" + END-COMPUTE. + + DISPLAY " ..." + DISPLAY "--- COMP-2 ---" + COMPUTE CMP2 = (((1.0E7 / 2.1E0) / 3.1E0) - 5.0E-1) * 6.0E0 + *> because of possible rounding of intermediates and different + *> precision depending on math library / version: plain DISPLAY + IF CMP2 >= 9216586.86175114 AND <= 9216586.86175116 + DISPLAY "A ~ 9216586.86175115" + ELSE + DISPLAY "A: " CMP2 + END-IF + COMPUTE CMP2 = (((1.0E7 / 2.9E0) / 3.9E0) - 5.0E-1) * 6.0E0 + IF CMP2 >= 5305036.7877983 AND <= 5305036.7877985 + DISPLAY "B ~ 5305036.787798408" + ELSE + DISPLAY "B: " CMP2 + END-IF + MOVE ZERO TO CMP2. + COMPUTE CMP2 = 1.0E3 / 2.1E0 + ON SIZE ERROR DISPLAY "Z: " CMP2 " SIZE ERROR" + NOT ON SIZE ERROR + *> see note above + IF CMP2 >= 476.1904761904760 AND <= 476.1904761904763 + DISPLAY "Z ~ 476.1904761904761 IS OK" + ELSE + DISPLAY "Z: " CMP2 " IS OK" + END-IF + END-COMPUTE. + + DISPLAY " ..." + DISPLAY "--- 99 + 1 / 3 ---" + MOVE -1 TO CMP1, CMP2. + COMPUTE CMP1 = 99 + 1 / 3 + ON SIZE ERROR DISPLAY "CMP1: " CMP1 " SIZE ERROR" + NOT ON SIZE ERROR DISPLAY "CMP1: " CMP1 " IS OK" + END-COMPUTE. + COMPUTE CMP2 = 99 + 1 / 3 + ON SIZE ERROR DISPLAY "CMP2: " CMP2 " SIZE ERROR" + NOT ON SIZE ERROR DISPLAY "CMP2: " CMP2 " IS OK" + END-COMPUTE. + + DISPLAY " ..." + DISPLAY "--- 99 ---" + MOVE -1 TO CMP1, CMP2. + COMPUTE CMP1 = 99 + ON SIZE ERROR DISPLAY "CMP1: " CMP1 " SIZE ERROR" + NOT ON SIZE ERROR DISPLAY "CMP1: " CMP1 " IS OK" + END-COMPUTE. + COMPUTE CMP2 = 99 + ON SIZE ERROR DISPLAY "CMP2: " CMP2 " SIZE ERROR" + NOT ON SIZE ERROR DISPLAY "CMP2: " CMP2 " IS OK" + END-COMPUTE. + + CND-100-OK. + DISPLAY " ..." + DISPLAY "--- Test overflow ---" + + MOVE 990000 TO CMP1. + PERFORM 6500 TIMES + MOVE CMP1 TO SV1 + COMPUTE CMP1 = CMP1 * 10 + ON SIZE ERROR GO TO CND-350-ERR + END-COMPUTE + IF CMP1 < 9.0 + GO TO CND-350-ERR + END-IF + END-PERFORM. + DISPLAY "CMP1: " CMP1 " IS OK". + GO TO CND-350-OK. + CND-350-ERR. + DISPLAY "CMP1: after " SV1 " SIZE ERROR". + + CND-350-OK. + MOVE 9900000000 TO CMP2. + PERFORM 6500 TIMES + MOVE CMP2 TO SV2 + COMPUTE CMP2 = CMP2 * 10 + ON SIZE ERROR GO TO CND-380-ERR + END-COMPUTE + IF CMP2 < 9.0 + GO TO CND-380-ERR + END-IF + END-PERFORM. + DISPLAY "CMP2: " CMP2 " IS OK". + GO TO CND-500-OK. + CND-380-ERR. + *> because of possible rounding of intermediates and different + *> precision depending on math library / version: plain DISPLAY + IF SV2 >= 9.899999999999E+307 AND + <= 9.900000000001E+307 + DISPLAY "CMP2: after ~ 9.899999999999781E+307 SIZE ERROR" + ELSE + DISPLAY "CMP2: after " SV2 " SIZE ERROR" + END-IF + . + + CND-500-OK. + MOVE 0.000000099 TO CMP1. + PERFORM 350 TIMES + MOVE CMP1 TO SV1 + COMPUTE CMP1 = CMP1 / 10.0 + ON SIZE ERROR GO TO CND-500-ERR + END-COMPUTE + IF CMP1 = 0.0 + GO TO CND-500-ERR + END-IF + END-PERFORM. + DISPLAY "CMP1: " CMP1 " IS OK". + GO TO CND-600-OK. + CND-500-ERR. + DISPLAY "CMP1: after " SV1 " SIZE ERROR". + + CND-600-OK. + MOVE 0.000000099 TO CMP2. + PERFORM 350 TIMES + MOVE CMP2 TO SV2 + COMPUTE CMP2 = CMP2 / 10.0 + ON SIZE ERROR GO TO CND-600-ERR + END-COMPUTE + IF CMP2 = 0.0 + GO TO CND-600-ERR + END-IF + END-PERFORM. + DISPLAY "CMP2: " CMP2 " IS OK". + GO TO CND-600-XIT. + CND-600-ERR. + IF SV2 >= 9.8813129168249E-324 AND <= 9.881312916825E-324 + DISPLAY "CMP2: after ~ 9.881312916824931E-324 SIZE ERROR" + ELSE + DISPLAY "CMP2: after " SV2 " SIZE ERROR" + END-IF + . + CND-600-XIT. + + CND-999. + STOP RUN. + END PROGRAM prog. + diff --git a/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT___FLOAT-LONG_w_o_SIZE_ERROR.out b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT___FLOAT-LONG_w_o_SIZE_ERROR.out new file mode 100644 index 0000000..18fc770 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT___FLOAT-LONG_w_o_SIZE_ERROR.out @@ -0,0 +1,24 @@ +--- COMP-1 --- +A: 9.216587E+06 +B: 5.305037E+06 +Z: 476.1904907 IS OK + ... +--- COMP-2 --- +A ~ 9216586.86175115 +B ~ 5305036.787798408 +Z ~ 476.1904761904761 IS OK + ... +--- 99 + 1 / 3 --- +CMP1: 99.33333588 IS OK +CMP2: 99.3333333333333286 IS OK + ... +--- 99 --- +CMP1: 99 IS OK +CMP2: 99 IS OK + ... +--- Test overflow --- +CMP1: after 9.899998274E+37 SIZE ERROR +CMP2: after ~ 9.899999999999781E+307 SIZE ERROR +CMP1: after 1.401298464E-45 SIZE ERROR +CMP2: after ~ 9.881312916824931E-324 SIZE ERROR + diff --git a/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT_with_SIZE_ERROR.cob b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT_with_SIZE_ERROR.cob new file mode 100644 index 0000000..b194442 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT_with_SIZE_ERROR.cob @@ -0,0 +1,40 @@ + *> { dg-do run } + *> { dg-output-file "group2/FLOAT-SHORT_with_SIZE_ERROR.out" } + + identification division. + program-id. prog. + + data division. + working-storage section. + *------------------------ + 77 counter pic s9(4) binary value zero. + * FLOAT-SHORT (if binary-comp-1 is not active) + 77 floatValue COMP-1 value 2. + 77 lastFloatValue COMP-1. + + ****************************************************************** + procedure division. + main section. + perform varying counter from 1 by 1 until + counter > 130 + *> display 'counter: ' counter ', value: ' floatValue + compute floatValue = floatValue * 2 + ON SIZE ERROR + display 'SIZE ERROR, last value = ' floatValue + exit perform + not ON SIZE ERROR + if floatValue > lastFloatValue + move floatValue to lastFloatValue + else + display 'math ERROR, last value > current: ' + lastFloatValue ' > ' floatValue + exit perform + end-if + end-compute + end-perform + if counter not = 127 + display 'counter is ' counter + end-if + + goback. + diff --git a/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT_with_SIZE_ERROR.out b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT_with_SIZE_ERROR.out new file mode 100644 index 0000000..e5ba05f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/FLOAT-SHORT_with_SIZE_ERROR.out @@ -0,0 +1,2 @@ +SIZE ERROR, last value = 1.701411835E+38 + diff --git a/gcc/testsuite/cobol.dg/group2/Fixed_continuation_indicator.cob b/gcc/testsuite/cobol.dg/group2/Fixed_continuation_indicator.cob new file mode 100644 index 0000000..2c23e7b --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Fixed_continuation_indicator.cob @@ -0,0 +1,33 @@ + *> { dg-do run } + *> { dg-output-file "group2/Fixed_continuation_indicator.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(333) VALUE + '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX + - 'YZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV + - 'WXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST + - 'UVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQR + - 'STUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP + - 'QRSTUVWXYZ'. + PROCEDURE DIVISION. + DISPLAY X NO ADVANCING + END-DISPLAY. + DISPLAY '_' + END-DISPLAY. + MOVE + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567 + - "89abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345 + - "6789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123 + - "456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01 + - "23456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY + - "Z + - "0123456789" TO X. + DISPLAY X NO ADVANCING + END-DISPLAY. + DISPLAY '_' + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Fixed_continuation_indicator.out b/gcc/testsuite/cobol.dg/group2/Fixed_continuation_indicator.out new file mode 100644 index 0000000..2a472b8 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Fixed_continuation_indicator.out @@ -0,0 +1,3 @@ +0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ _ +abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 _ + diff --git a/gcc/testsuite/cobol.dg/group2/Index_and_parenthesized_expression.cob b/gcc/testsuite/cobol.dg/group2/Index_and_parenthesized_expression.cob new file mode 100644 index 0000000..88c24fd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Index_and_parenthesized_expression.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + *> { dg-output-file "group2/Index_and_parenthesized_expression.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 G. + 02 X PIC X OCCURS 1 INDEXED BY I. + PROCEDURE DIVISION. + IF I < (I + 2) + DISPLAY "OK" NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Index_and_parenthesized_expression.out b/gcc/testsuite/cobol.dg/group2/Index_and_parenthesized_expression.out new file mode 100644 index 0000000..d86bac9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Index_and_parenthesized_expression.out @@ -0,0 +1 @@ +OK diff --git a/gcc/testsuite/cobol.dg/group2/LENGTH_OF_omnibus.cob b/gcc/testsuite/cobol.dg/group2/LENGTH_OF_omnibus.cob new file mode 100644 index 0000000..7b24aed --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/LENGTH_OF_omnibus.cob @@ -0,0 +1,107 @@ + *> { dg-do run } + *> { dg-options "-dialect ibm" } + *> { dg-output-file "group2/LENGTH_OF_omnibus.out" } + + program-id. prog. + data division. + working-storage section. + 01 desc1. + 05 desc1-entry pic x(5) occurs 10. + + 01 desc2. + 05 desc2-table occurs 10 times. + 10 desc2-entry pic x(5). + + 01 desc3. + 05 desc3-outer occurs 1 to 5 times depending on desc3-lim. + 10 desc3-outer-txt pic x(7). + 10 desc3-inner occurs 11 times. + 15 desc3-inner-text pic x(13). + 77 desc3-lim binary-long. + + 77 msg pic x(64). + 77 should-be pic zzzz9. + 77 but-is pic zzzz9. + + procedure division. + + display "using LENGTH OF" + + move "Length of desc1" to msg + move 50 to should-be + move length of desc1 to but-is + perform result-is + + move "Length of desc1-entry" to msg + move 5 to should-be + move length of desc1-entry to but-is + perform result-is + + move "Length of desc1-entry(1)" to msg + move 5 to should-be + move length of desc1-entry(1) to but-is + perform result-is + + move "Length of desc2" to msg + move 50 to should-be + move length of desc2 to but-is + perform result-is + + move "Length of desc2-table" to msg + move 5 to should-be + move length of desc2-table to but-is + perform result-is + + move "Length of desc2-entry" to msg + move 5 to should-be + move length of desc2-entry to but-is + perform result-is + + move "Length of desc2-entry(1)" to msg + move 5 to should-be + move length of desc2-entry(1) to but-is + perform result-is + + move 5 to desc3-lim + + move "Length of desc3" to msg + move 750 to should-be + move length of desc3 to but-is + perform result-is + + move "Length of desc3-outer" to msg + move 150 to should-be + move length of desc3-outer to but-is + perform result-is + + move "Length of desc3-outer(1)" to msg + move 150 to should-be + move length of desc3-outer(1) to but-is + perform result-is + + move "Length of desc3-outer-txt" to msg + move 7 to should-be + move length of desc3-outer-txt to but-is + perform result-is + + move "Length of desc3-inner" to msg + move 13 to should-be + move length of desc3-inner to but-is + perform result-is + + move "Length of desc3-inner(1)" to msg + move 13 to should-be + move length of desc3-inner(1) to but-is + perform result-is + + goback. + result-is. + display function trim(msg) ": " with no advancing + if but-is equal to should-be + display function trim(but-is) + else + display "should be " function trim(should-be) + " but is " function trim(but-is) + end-if. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/LENGTH_OF_omnibus.out b/gcc/testsuite/cobol.dg/group2/LENGTH_OF_omnibus.out new file mode 100644 index 0000000..e4cf801 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/LENGTH_OF_omnibus.out @@ -0,0 +1,15 @@ +using LENGTH OF +Length of desc1: 50 +Length of desc1-entry: 5 +Length of desc1-entry(1): 5 +Length of desc2: 50 +Length of desc2-table: 5 +Length of desc2-entry: 5 +Length of desc2-entry(1): 5 +Length of desc3: 750 +Length of desc3-outer: 150 +Length of desc3-outer(1): 150 +Length of desc3-outer-txt: 7 +Length of desc3-inner: 13 +Length of desc3-inner(1): 13 + diff --git a/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__3__with_recursive_PROGRAM-ID.cob b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__3__with_recursive_PROGRAM-ID.cob new file mode 100644 index 0000000..a4410fa --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__3__with_recursive_PROGRAM-ID.cob @@ -0,0 +1,28 @@ + *> { dg-do run } + *> { dg-output-file "group2/LOCAL-STORAGE__3__with_recursive_PROGRAM-ID.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + PROCEDURE DIVISION. + CALL "callee" + END-CALL. + STOP RUN. + end program caller. + + IDENTIFICATION DIVISION. + PROGRAM-ID. callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 WRK-X PIC 999 VALUE 5. + LOCAL-STORAGE SECTION. + 01 LCL-X PIC 999 . + PROCEDURE DIVISION. + display "On entry: " wrk-x + move wrk-x to lcl-x + subtract 1 from wrk-x + if wrk-x > 0 + call "callee". + display "On exit: " lcl-x + goback. + end program callee. + diff --git a/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__3__with_recursive_PROGRAM-ID.out b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__3__with_recursive_PROGRAM-ID.out new file mode 100644 index 0000000..839de4f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__3__with_recursive_PROGRAM-ID.out @@ -0,0 +1,11 @@ +On entry: 005 +On entry: 004 +On entry: 003 +On entry: 002 +On entry: 001 +On exit: 001 +On exit: 002 +On exit: 003 +On exit: 004 +On exit: 005 + diff --git a/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__4__with_recursive_PROGRAM-ID_..._USING.cob b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__4__with_recursive_PROGRAM-ID_..._USING.cob new file mode 100644 index 0000000..64d0072 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__4__with_recursive_PROGRAM-ID_..._USING.cob @@ -0,0 +1,28 @@ + *> { dg-do run } + *> { dg-output-file "group2/LOCAL-STORAGE__4__with_recursive_PROGRAM-ID_..._USING.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + PROCEDURE DIVISION. + CALL "callee" + END-CALL. + STOP RUN. + end program caller. + + IDENTIFICATION DIVISION. + PROGRAM-ID. callee. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 WRK-X PIC 999 VALUE 5. + LOCAL-STORAGE SECTION. + 01 LCL-X PIC 999 . + PROCEDURE DIVISION. + display "On entry: " wrk-x + move wrk-x to lcl-x + subtract 1 from wrk-x + if wrk-x > 0 + call "callee". + display "On exit: " lcl-x + goback. + end program callee. + diff --git a/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__4__with_recursive_PROGRAM-ID_..._USING.out b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__4__with_recursive_PROGRAM-ID_..._USING.out new file mode 100644 index 0000000..839de4f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/LOCAL-STORAGE__4__with_recursive_PROGRAM-ID_..._USING.out @@ -0,0 +1,11 @@ +On entry: 005 +On entry: 004 +On entry: 003 +On entry: 002 +On entry: 001 +On exit: 001 +On exit: 002 +On exit: 003 +On exit: 004 +On exit: 005 + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_Z_literal_.cob b/gcc/testsuite/cobol.dg/group2/MOVE_Z_literal_.cob new file mode 100644 index 0000000..c92ab35 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_Z_literal_.cob @@ -0,0 +1,34 @@ + *> { dg-do run } + *> { dg-output-file "group2/MOVE_Z_literal_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC XXXX. + 01 XRED REDEFINES X. + 03 XBYTE1 PIC X. + 03 XBYTE2 PIC X. + 03 XBYTE3 PIC X. + 03 XBYTE4 PIC X. + PROCEDURE DIVISION. + MOVE Z"012" TO X. + IF XBYTE1 = "0" AND + XBYTE2 = "1" AND + XBYTE3 = "2" AND + XBYTE4 = LOW-VALUE + DISPLAY "OK" NO ADVANCING + END-DISPLAY + ELSE + DISPLAY "X = " X (1:3) NO ADVANCING + END-DISPLAY + IF XBYTE4 = LOW-VALUE + DISPLAY " WITH LOW-VALUE" + END-DISPLAY + ELSE + DISPLAY " WITHOUT LOW-VALUE BUT '" XBYTE4 "'" + END-DISPLAY + END-IF + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_Z_literal_.out b/gcc/testsuite/cobol.dg/group2/MOVE_Z_literal_.out new file mode 100644 index 0000000..d86bac9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_Z_literal_.out @@ -0,0 +1 @@ +OK diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_indexes.cob b/gcc/testsuite/cobol.dg/group2/MOVE_indexes.cob new file mode 100644 index 0000000..9ededd2c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_indexes.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 G. + 02 X PIC X OCCURS 10 INDEXED I. + PROCEDURE DIVISION. + SET I TO ZERO. + SET X(1) TO I + IF X(1) NOT = "0" + DISPLAY X(1) NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_integer_literal_to_alphanumeric.cob b/gcc/testsuite/cobol.dg/group2/MOVE_integer_literal_to_alphanumeric.cob new file mode 100644 index 0000000..61be48f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_integer_literal_to_alphanumeric.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + *> { dg-output-file "group2/MOVE_integer_literal_to_alphanumeric.out" } + + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(04) VALUE SPACES. + PROCEDURE DIVISION. + MOVE 0 TO X. + DISPLAY X NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_integer_literal_to_alphanumeric.out b/gcc/testsuite/cobol.dg/group2/MOVE_integer_literal_to_alphanumeric.out new file mode 100644 index 0000000..4af5951 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_integer_literal_to_alphanumeric.out @@ -0,0 +1 @@ +0 diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_JUSTIFIED_item.cob b/gcc/testsuite/cobol.dg/group2/MOVE_to_JUSTIFIED_item.cob new file mode 100644 index 0000000..37f813f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_JUSTIFIED_item.cob @@ -0,0 +1,31 @@ + *> { dg-do run } + *> { dg-output-file "group2/MOVE_to_JUSTIFIED_item.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 SRC-1 PIC S9(04) VALUE 11. + 01 SRC-2 PIC S9(04) COMP VALUE 22. + 01 SRC-3 PIC S9(04) COMP-5 VALUE 33. + 01 SRC-4 PIC S9(04)PP VALUE 4400. + 01 SRC-5 PIC S9(04)PPPPP VALUE 55500000. + 01 EDT-FLD PIC X(07) JUSTIFIED RIGHT. + PROCEDURE DIVISION. + MOVE SRC-1 TO EDT-FLD. + DISPLAY '>' EDT-FLD '<' + END-DISPLAY. + MOVE SRC-2 TO EDT-FLD. + DISPLAY '>' EDT-FLD '<' + END-DISPLAY. + MOVE SRC-3 TO EDT-FLD. + DISPLAY '>' EDT-FLD '<' + END-DISPLAY. + MOVE SRC-4 TO EDT-FLD. + DISPLAY '>' EDT-FLD '<' + END-DISPLAY. + MOVE SRC-5 TO EDT-FLD. + DISPLAY '>' EDT-FLD '<' + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_JUSTIFIED_item.out b/gcc/testsuite/cobol.dg/group2/MOVE_to_JUSTIFIED_item.out new file mode 100644 index 0000000..5e300fa --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_JUSTIFIED_item.out @@ -0,0 +1,6 @@ +> 0011< +> 0022< +> 0033< +> 004400< +>5500000< + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__1_.cob b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__1_.cob new file mode 100644 index 0000000..86ef0ae --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__1_.cob @@ -0,0 +1,35 @@ + *> { dg-do run } + *> { dg-output-file "group2/MOVE_to_edited_item__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 SRC-1 PIC S99V99 VALUE 1.10. + 01 SRC-2 PIC S99V99 VALUE 0.02. + 01 SRC-3 PIC S99V99 VALUE -0.03. + 01 SRC-4 PIC S99V99 VALUE -0.04. + 01 SRC-5 PIC S99V99 VALUE -0.05. + 01 EDT-1 PIC -(04)9. + 01 EDT-2 PIC -(04)9. + 01 EDT-3 PIC -(04)9. + 01 EDT-4 PIC +(04)9. + 01 EDT-5 PIC -(05). + PROCEDURE DIVISION. + MOVE SRC-1 TO EDT-1. + MOVE SRC-2 TO EDT-2. + MOVE SRC-3 TO EDT-3. + MOVE SRC-4 TO EDT-4. + MOVE SRC-5 TO EDT-5. + DISPLAY '>' EDT-1 '<' + END-DISPLAY. + DISPLAY '>' EDT-2 '<' + END-DISPLAY. + DISPLAY '>' EDT-3 '<' + END-DISPLAY. + DISPLAY '>' EDT-4 '<' + END-DISPLAY. + DISPLAY '>' EDT-5 '<' + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__1_.out b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__1_.out new file mode 100644 index 0000000..9557d50 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__1_.out @@ -0,0 +1,6 @@ +> 1< +> 0< +> 0< +> +0< +> < + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__2_.cob b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__2_.cob new file mode 100644 index 0000000..cde8096 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__2_.cob @@ -0,0 +1,35 @@ + *> { dg-do run } + *> { dg-output-file "group2/MOVE_to_edited_item__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 SRC-1 PIC S99V99 VALUE -0.06. + 01 SRC-2 PIC S99V99 VALUE -0.07. + 01 SRC-3 PIC S99V99 VALUE -0.08. + 01 SRC-4 PIC S99V99 VALUE -0.09. + 01 SRC-5 PIC S99V99 VALUE -1.10. + 01 EDT-1 PIC 9(04)-. + 01 EDT-2 PIC 9(04)+. + 01 EDT-3 PIC Z(04)+. + 01 EDT-4 PIC 9(04)DB. + 01 EDT-5 PIC 9(04)DB. + PROCEDURE DIVISION. + MOVE SRC-1 TO EDT-1. + MOVE SRC-2 TO EDT-2. + MOVE SRC-3 TO EDT-3. + MOVE SRC-4 TO EDT-4. + MOVE SRC-5 TO EDT-5. + DISPLAY '>' EDT-1 '<' + END-DISPLAY. + DISPLAY '>' EDT-2 '<' + END-DISPLAY. + DISPLAY '>' EDT-3 '<' + END-DISPLAY. + DISPLAY '>' EDT-4 '<' + END-DISPLAY. + DISPLAY '>' EDT-5 '<' + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__2_.out b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__2_.out new file mode 100644 index 0000000..a704296 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_edited_item__2_.out @@ -0,0 +1,6 @@ +>0000 < +>0000+< +> < +>0000 < +>0001DB< + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_item_with_simple_and_floating_insertion.cob b/gcc/testsuite/cobol.dg/group2/MOVE_to_item_with_simple_and_floating_insertion.cob new file mode 100644 index 0000000..92711a9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_item_with_simple_and_floating_insertion.cob @@ -0,0 +1,23 @@ + *> { dg-do run } + *> { dg-output-file "group2/MOVE_to_item_with_simple_and_floating_insertion.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 num-1 PIC -*B*99. + 01 num-2 PIC $BB**,***.**. + 01 num-3 PIC $BB--,---.--. + + PROCEDURE DIVISION. + MOVE -123 TO num-1 + DISPLAY ">" num-1 "<" + + MOVE 1234.56 TO num-2 + DISPLAY ">" num-2 "<" + + MOVE 1234.56 TO num-3 + DISPLAY ">" num-3 "<" + . + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_item_with_simple_and_floating_insertion.out b/gcc/testsuite/cobol.dg/group2/MOVE_to_item_with_simple_and_floating_insertion.out new file mode 100644 index 0000000..9012693 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_item_with_simple_and_floating_insertion.out @@ -0,0 +1,4 @@ +>-**123< +>$ *1,234.56< +>$ 1,234.56< + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_to_itself.cob b/gcc/testsuite/cobol.dg/group2/MOVE_to_itself.cob new file mode 100644 index 0000000..475b5d9 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_to_itself.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 99 VALUE 12. + PROCEDURE DIVISION. + MOVE X TO X. + IF X NOT = 12 + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_with_group_refmod.cob b/gcc/testsuite/cobol.dg/group2/MOVE_with_group_refmod.cob new file mode 100644 index 0000000..834d81d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_with_group_refmod.cob @@ -0,0 +1,16 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 G. + 02 X PIC 9999 VALUE 1234. + PROCEDURE DIVISION. + MOVE "99" TO G(3:2). + IF G NOT = "1299" + DISPLAY G NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_with_refmod.cob b/gcc/testsuite/cobol.dg/group2/MOVE_with_refmod.cob new file mode 100644 index 0000000..455951a --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_with_refmod.cob @@ -0,0 +1,15 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 9(4) VALUE 0. + PROCEDURE DIVISION. + MOVE "1" TO X(1:1). + IF X NOT = 1000 + DISPLAY X NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/MOVE_with_refmod__variable_.cob b/gcc/testsuite/cobol.dg/group2/MOVE_with_refmod__variable_.cob new file mode 100644 index 0000000..b3fb550 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/MOVE_with_refmod__variable_.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC X(4) VALUE "1234". + 01 Y PIC X(4) VALUE "abcd". + 01 I PIC 9 VALUE 1. + PROCEDURE DIVISION. + MOVE X(1:I) TO Y. + IF Y NOT = "1 " + DISPLAY Y NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Multi-target_MOVE_with_subscript_re-evaluation.cob b/gcc/testsuite/cobol.dg/group2/Multi-target_MOVE_with_subscript_re-evaluation.cob new file mode 100644 index 0000000..6aa9388 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Multi-target_MOVE_with_subscript_re-evaluation.cob @@ -0,0 +1,35 @@ + *> { dg-do run } + *> { dg-output-file "group2/Multi-target_MOVE_with_subscript_re-evaluation.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. mover. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 FILLER. + 02 ADATA VALUE "654321". + 02 A REDEFINES ADATA PIC 9 OCCURS 6 TIMES. + 02 B PIC 9. + 02 CDATA VALUE "999999". + 02 C REDEFINES CDATA PIC 9 OCCURS 6 TIMES. + 01 TEMP PIC 9. + PROCEDURE DIVISION. + INITIALIZE CDATA ALL TO VALUE + MOVE 2 TO B + MOVE A(B) TO B, C(B) + *> That should pick up 5, move it to B, and then move 5 to C(5), + IF CDATA NOT EQUAL TO "999959" + DISPLAY CDATA " Should be ""999959"", but isn't" + ELSE + DISPLAY CDATA " Should be ""999959""". + *> See 14.9.25.4 MOVE General Rules + INITIALIZE CDATA ALL TO VALUE + MOVE 2 TO B + MOVE A(B) TO TEMP + MOVE TEMP TO B + MOVE TEMP TO C(B) + IF CDATA NOT EQUAL TO "999959" + DISPLAY CDATA " Should be ""999959"", but isn't" + ELSE + DISPLAY CDATA " Should be ""999959""". + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Multi-target_MOVE_with_subscript_re-evaluation.out b/gcc/testsuite/cobol.dg/group2/Multi-target_MOVE_with_subscript_re-evaluation.out new file mode 100644 index 0000000..30076d7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Multi-target_MOVE_with_subscript_re-evaluation.out @@ -0,0 +1,3 @@ +999959 Should be "999959" +999959 Should be "999959" + diff --git a/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__1_.cob b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__1_.cob new file mode 100644 index 0000000..6b38f79 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__1_.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + *> { dg-output-file "group2/Non-numeric_data_in_numeric_items__1_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X. + 03 X-NUM PIC 9(06) VALUE 123. + 77 NUM PIC 9(06). + PROCEDURE DIVISION. + MOVE x"0000" TO X (2:2) + IF X-NUM NUMERIC + DISPLAY "low-value is numeric" UPON SYSERR + END-DISPLAY + END-IF + MOVE x"01" TO X (3:1) + IF X-NUM NUMERIC + DISPLAY "SOH is numeric" UPON SYSERR + END-DISPLAY + END-IF + MOVE X-NUM TO NUM + DISPLAY "test over" + END-DISPLAY + * + GOBACK. + diff --git a/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__1_.out b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__1_.out new file mode 100644 index 0000000..ac61d84 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__1_.out @@ -0,0 +1,2 @@ +test over + diff --git a/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__2_.cob b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__2_.cob new file mode 100644 index 0000000..e80071f --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__2_.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + *> { dg-output-file "group2/Non-numeric_data_in_numeric_items__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog2. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X. + 03 X-NUM PIC 9(06) PACKED-DECIMAL VALUE 123. + 77 NUM PIC 9(06). + PROCEDURE DIVISION. + MOVE x"0A" TO X (2:1) + IF X-NUM NUMERIC + DISPLAY "bad prog" + END-DISPLAY + END-IF + MOVE X-NUM TO NUM + DISPLAY "test over" + END-DISPLAY + * + GOBACK. + diff --git a/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__2_.out b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__2_.out new file mode 100644 index 0000000..ac61d84 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Non-numeric_data_in_numeric_items__2_.out @@ -0,0 +1,2 @@ +test over + diff --git a/gcc/testsuite/cobol.dg/group2/Non-overflow_after_overflow.cob b/gcc/testsuite/cobol.dg/group2/Non-overflow_after_overflow.cob new file mode 100644 index 0000000..fb6cdc7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Non-overflow_after_overflow.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X PIC 9(2) VALUE 0. + 01 Y PIC 9(2) VALUE 0. + PROCEDURE DIVISION. + COMPUTE X = 100 + END-COMPUTE. + COMPUTE Y = 99 + END-COMPUTE. + IF Y NOT = 99 + DISPLAY Y NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/OCCURS_clause_with_1_entry.cob b/gcc/testsuite/cobol.dg/group2/OCCURS_clause_with_1_entry.cob new file mode 100644 index 0000000..f244407 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/OCCURS_clause_with_1_entry.cob @@ -0,0 +1,40 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 D1. + 03 FILLER OCCURS 1. + 05 D1-ENTRY PIC X(03) value '123'. + 01 D2. + 03 D2-ENTRY PIC X(03) value 'ABC' OCCURS 1. + 01 D1TOR. + 03 FILLER PIC X(03) value '456'. + 01 D1-R REDEFINES D1TOR. + 03 FILLER OCCURS 1. + 05 D1-R-ENTRY PIC X(03). + 01 D2TOR. + 03 FILLER PIC X(03) value 'DEF'. + 01 D2-R REDEFINES D2TOR. + 03 D2-R-ENTRY PIC X(03) OCCURS 1. + + PROCEDURE DIVISION. + IF D1-ENTRY (1) NOT = "123" + DISPLAY D1-ENTRY (1) + END-DISPLAY + END-IF. + IF D2-ENTRY (1) NOT = "ABC" + DISPLAY D2-ENTRY (1) + END-DISPLAY + END-IF. + IF D1-R-ENTRY (1) NOT = "456" + DISPLAY D1-R-ENTRY (1) + END-DISPLAY + END-IF. + IF D2-R-ENTRY (1) NOT = "DEF" + DISPLAY D2-R-ENTRY (1) + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/OSVS_Arithmetic_Test__2_.cob b/gcc/testsuite/cobol.dg/group2/OSVS_Arithmetic_Test__2_.cob new file mode 100644 index 0000000..ff047bf --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/OSVS_Arithmetic_Test__2_.cob @@ -0,0 +1,40 @@ + *> { dg-do run } + *> { dg-output-file "group2/OSVS_Arithmetic_Test__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 VAL PIC S9(7)V99 COMP-3 VALUE 20500. + 01 DIV1 PIC S9(7)V99 COMP-3 VALUE 0.9. + 01 DIV2 PIC S9(7)V99 COMP-3 VALUE 33.45. + 01 DIV3 PIC S9(7)V99 COMP-3 VALUE 9. + 01 MUL1 PIC S9(7)V99 COMP-3 VALUE 10. + 01 MUL2 PIC S9(7)V99 COMP-3 VALUE 5. + 01 MUL3 PIC S9(7)V99 COMP-3 VALUE 2. + 01 RES PIC S9(7)V99 COMP-3. + PROCEDURE DIVISION. + COMPUTE RES = VAL / DIV1 / DIV2. + DISPLAY 'RES = ' RES. + COMPUTE RES ROUNDED = VAL / DIV1 / DIV2. + DISPLAY 'RES ROUNDED = ' RES. + COMPUTE RES = VAL * MUL1 / DIV3 / DIV2. + DISPLAY 'RES MULT1 = ' RES. + COMPUTE RES = VAL * MUL2 * MUL3 / DIV3 / DIV2. + DISPLAY 'RES MULT2 = ' RES. + COMPUTE RES = VAL / DIV1. + DISPLAY 'RES 1 = ' RES. + COMPUTE RES = RES / DIV2. + DISPLAY 'RES F = ' RES. + COMPUTE RES = + VAL / DIV1 / DIV2. + DISPLAY 'RES NOT ROUNDED = ' RES. + COMPUTE RES ROUNDED MODE NEAREST-AWAY-FROM-ZERO = + VAL / DIV1 / DIV2. + DISPLAY 'RES ROUNDED NEAREST-AWAY = ' RES. + COMPUTE RES ROUNDED MODE AWAY-FROM-ZERO = + VAL / DIV1 / DIV2. + DISPLAY 'RES ROUNDED AWAY = ' RES. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/OSVS_Arithmetic_Test__2_.out b/gcc/testsuite/cobol.dg/group2/OSVS_Arithmetic_Test__2_.out new file mode 100644 index 0000000..d0816cd --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/OSVS_Arithmetic_Test__2_.out @@ -0,0 +1,10 @@ +RES = +0000680.95 +RES ROUNDED = +0000680.95 +RES MULT1 = +0000680.95 +RES MULT2 = +0000680.95 +RES 1 = +0022777.77 +RES F = +0000680.94 +RES NOT ROUNDED = +0000680.95 +RES ROUNDED NEAREST-AWAY = +0000680.95 +RES ROUNDED AWAY = +0000680.96 + diff --git a/gcc/testsuite/cobol.dg/group2/PERFORM_..._CONTINUE.cob b/gcc/testsuite/cobol.dg/group2/PERFORM_..._CONTINUE.cob new file mode 100644 index 0000000..5f39fc5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/PERFORM_..._CONTINUE.cob @@ -0,0 +1,9 @@ + *> { dg-do compile } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + PROCEDURE DIVISION. + PERFORM 2 TIMES + CONTINUE + END-PERFORM. + diff --git a/gcc/testsuite/cobol.dg/group2/PERFORM_inline__1_.cob b/gcc/testsuite/cobol.dg/group2/PERFORM_inline__1_.cob new file mode 100644 index 0000000..7f6f3aa --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/PERFORM_inline__1_.cob @@ -0,0 +1,19 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 INDVAL PIC 9(4). + PROCEDURE DIVISION. + PERFORM VARYING INDVAL FROM 1 + BY 1 UNTIL INDVAL > 2 + CONTINUE + END-PERFORM + IF INDVAL NOT = 3 + DISPLAY INDVAL NO ADVANCING + END-DISPLAY + END-IF + STOP RUN + . + diff --git a/gcc/testsuite/cobol.dg/group2/PERFORM_inline__2_.cob b/gcc/testsuite/cobol.dg/group2/PERFORM_inline__2_.cob new file mode 100644 index 0000000..e3e0458 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/PERFORM_inline__2_.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 INDVAL PIC 9(4). + PROCEDURE DIVISION. + PERFORM VARYING INDVAL FROM 1 + BY 1 UNTIL INDVAL > 2 + CONTINUE + END-PERFORM + IF INDVAL NOT = 3 + DISPLAY INDVAL NO ADVANCING + END-DISPLAY + END-IF + . + diff --git a/gcc/testsuite/cobol.dg/group2/PERFORM_type_OSVS.cob b/gcc/testsuite/cobol.dg/group2/PERFORM_type_OSVS.cob new file mode 100644 index 0000000..e64d679 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/PERFORM_type_OSVS.cob @@ -0,0 +1,28 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 MYOCC PIC 9(8) COMP VALUE 0. + PROCEDURE DIVISION. + ASTART SECTION. + A01. + PERFORM BTEST. + IF MYOCC NOT = 2 + DISPLAY MYOCC + END-DISPLAY + END-IF. + STOP RUN. + BTEST SECTION. + B01. + PERFORM B02 VARYING MYOCC FROM 1 BY 1 + UNTIL MYOCC > 5. + GO TO B99. + B02. + IF MYOCC > 1 + GO TO B99 + END-IF. + B99. + EXIT. + diff --git a/gcc/testsuite/cobol.dg/group2/PIC_ZZZ-__ZZZ_.cob b/gcc/testsuite/cobol.dg/group2/PIC_ZZZ-__ZZZ_.cob new file mode 100644 index 0000000..a8ad589 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/PIC_ZZZ-__ZZZ_.cob @@ -0,0 +1,44 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 X-ZZZN PIC ZZZ-. + 01 XZN-RED REDEFINES X-ZZZN PIC X(4). + 01 X-ZZZP PIC ZZZ+. + 01 XZP-RED REDEFINES X-ZZZP PIC X(4). + PROCEDURE DIVISION. + MOVE -1 TO X-ZZZN. + IF XZN-RED NOT = " 1-" + DISPLAY "(" X-ZZZN ")" + END-DISPLAY + END-IF. + MOVE 0 TO X-ZZZN. + IF XZN-RED NOT = " " + DISPLAY "(" X-ZZZN ")" + END-DISPLAY + END-IF. + MOVE +1 TO X-ZZZN. + IF XZN-RED NOT = " 1 " + DISPLAY "(" X-ZZZN ")" + END-DISPLAY + END-IF. + + MOVE -1 TO X-ZZZP. + IF XZP-RED NOT = " 1-" + DISPLAY "(" X-ZZZP ")" + END-DISPLAY + END-IF. + MOVE 0 TO X-ZZZP. + IF XZP-RED NOT = " " + DISPLAY "(" X-ZZZP ")" + END-DISPLAY + END-IF. + MOVE +1 TO X-ZZZP. + IF XZP-RED NOT = " 1+" + DISPLAY "(" X-ZZZP ")" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Quick_check_of_PIC_XX_COMP-5.cob b/gcc/testsuite/cobol.dg/group2/Quick_check_of_PIC_XX_COMP-5.cob new file mode 100644 index 0000000..5e73de6 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Quick_check_of_PIC_XX_COMP-5.cob @@ -0,0 +1,17 @@ + *> { dg-do run } + *> { dg-options "-dialect mf" } + *> { dg-output-file "group2/Quick_check_of_PIC_XX_COMP-5.out" } + identification division. + program-id. wrapper. + data division. + working-storage section. + 01 memx pic x(2) comp-5. + 77 ptr pointer. + procedure division. + Initialize ptr.display "LENGTH OF X(2) is " length of memx + move 12345 to memx + display memx + IF ptr <> NULL then display 'bad pointer'. + goback. + end program wrapper. + diff --git a/gcc/testsuite/cobol.dg/group2/Quick_check_of_PIC_XX_COMP-5.out b/gcc/testsuite/cobol.dg/group2/Quick_check_of_PIC_XX_COMP-5.out new file mode 100644 index 0000000..a79f3be --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Quick_check_of_PIC_XX_COMP-5.out @@ -0,0 +1,3 @@ +LENGTH OF X(2) is 2 +12345 + diff --git a/gcc/testsuite/cobol.dg/group2/Quote_marks_in_comment_paragraphs.cob b/gcc/testsuite/cobol.dg/group2/Quote_marks_in_comment_paragraphs.cob new file mode 100644 index 0000000..70564e4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Quote_marks_in_comment_paragraphs.cob @@ -0,0 +1,11 @@ + *> { dg-do run } + *> { dg-output-file "group2/Quote_marks_in_comment_paragraphs.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATE-written. hello'". + *> Written is intentionally lowercase. + *> extra " to fix syntax highlighting + PROCEDURE DIVISION. + DISPLAY "Hello, world!". + diff --git a/gcc/testsuite/cobol.dg/group2/Quote_marks_in_comment_paragraphs.out b/gcc/testsuite/cobol.dg/group2/Quote_marks_in_comment_paragraphs.out new file mode 100644 index 0000000..297edb3 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Quote_marks_in_comment_paragraphs.out @@ -0,0 +1,2 @@ +Hello, world! + diff --git a/gcc/testsuite/cobol.dg/group2/REDEFINES_values_on_FILLER_and_INITIALIZE.cob b/gcc/testsuite/cobol.dg/group2/REDEFINES_values_on_FILLER_and_INITIALIZE.cob new file mode 100644 index 0000000..2367ad5 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/REDEFINES_values_on_FILLER_and_INITIALIZE.cob @@ -0,0 +1,38 @@ + *> { dg-do run } + *> { dg-output-file "group2/REDEFINES_values_on_FILLER_and_INITIALIZE.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 TSRDF. + 05 WS-ASK-ID-DATE PIC X(10). + 05 WS-ASK-ID-DATE-R REDEFINES WS-ASK-ID-DATE. + 10 WS-ASK-ID-DATE-YYYY PIC 9(4) VALUE 2017. + 10 FILLER PIC X VALUE '-'. + 10 WS-ASK-ID-DATE-MM PIC 9(2). + 10 FILLER PIC X VALUE '-'. + 10 WS-ASK-ID-DATE-DD PIC 9(2). + PROCEDURE DIVISION. + MOVE ALL '*' TO WS-ASK-ID-DATE + MOVE 2015 TO WS-ASK-ID-DATE-YYYY + MOVE 08 TO WS-ASK-ID-DATE-MM + MOVE 21 TO WS-ASK-ID-DATE-DD + DISPLAY "The date is " WS-ASK-ID-DATE " Compiled". + + INITIALIZE WS-ASK-ID-DATE-R. + MOVE 08 TO WS-ASK-ID-DATE-MM + MOVE 21 TO WS-ASK-ID-DATE-DD + DISPLAY "The date is " WS-ASK-ID-DATE " INITIALIZE". + + INITIALIZE WS-ASK-ID-DATE-R WITH FILLER. + MOVE 08 TO WS-ASK-ID-DATE-MM + MOVE 21 TO WS-ASK-ID-DATE-DD + DISPLAY "The date is " WS-ASK-ID-DATE " WITH FILLER". + + INITIALIZE WS-ASK-ID-DATE-R WITH FILLER ALL TO VALUE. + MOVE 08 TO WS-ASK-ID-DATE-MM + MOVE 21 TO WS-ASK-ID-DATE-DD + DISPLAY "The date is " WS-ASK-ID-DATE " ALL TO VALUE". + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/REDEFINES_values_on_FILLER_and_INITIALIZE.out b/gcc/testsuite/cobol.dg/group2/REDEFINES_values_on_FILLER_and_INITIALIZE.out new file mode 100644 index 0000000..6a24172 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/REDEFINES_values_on_FILLER_and_INITIALIZE.out @@ -0,0 +1,5 @@ +The date is 2015*08*21 Compiled +The date is 0000*08*21 INITIALIZE +The date is 0000 08 21 WITH FILLER +The date is 2017-08-21 ALL TO VALUE + diff --git a/gcc/testsuite/cobol.dg/group2/Recursive_PERFORM_paragraph.cob b/gcc/testsuite/cobol.dg/group2/Recursive_PERFORM_paragraph.cob new file mode 100644 index 0000000..3eb0685 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Recursive_PERFORM_paragraph.cob @@ -0,0 +1,22 @@ + *> { dg-do run } + *> { dg-output-file "group2/Recursive_PERFORM_paragraph.out" } + identification division. + program-id. prog. + data division. + working-storage section. + 77 n binary-double unsigned. + 77 f binary-double unsigned. + procedure division. + move 20 to n + move 1 to f + display "compute " n " factorial". + fact. + compute f = f * n + subtract 1 from n + if n not equal to zero then + perform fact + end-if. + end-fact. + display f. + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/Recursive_PERFORM_paragraph.out b/gcc/testsuite/cobol.dg/group2/Recursive_PERFORM_paragraph.out new file mode 100644 index 0000000..97f0737 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Recursive_PERFORM_paragraph.out @@ -0,0 +1,3 @@ +compute 0000000000000000020 factorial +2432902008176640000 + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__EBCDIC_table_sort__1_.cob b/gcc/testsuite/cobol.dg/group2/SORT__EBCDIC_table_sort__1_.cob new file mode 100644 index 0000000..9bf4892 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__EBCDIC_table_sort__1_.cob @@ -0,0 +1,29 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + SPECIAL-NAMES. + ALPHABET ALPHA IS EBCDIC. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC X(10) VALUE "d4b2e1a3c5". + 01 G. + 02 TBL OCCURS 10. + 03 X PIC X. + PROCEDURE DIVISION. + MOVE Z TO G. + SORT TBL ASCENDING KEY X SEQUENCE ALPHA. + IF G NOT = "abcde12345" + DISPLAY G + END-DISPLAY + END-IF. + MOVE Z TO G. + SORT TBL DESCENDING KEY X SEQUENCE ALPHA. + IF G NOT = "54321edcba" + DISPLAY G + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__EBCDIC_table_sort__2_.cob b/gcc/testsuite/cobol.dg/group2/SORT__EBCDIC_table_sort__2_.cob new file mode 100644 index 0000000..2a10d2d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__EBCDIC_table_sort__2_.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + CONFIGURATION SECTION. + OBJECT-COMPUTER. + x86 PROGRAM COLLATING SEQUENCE IS EBCDIC-CODE. + SPECIAL-NAMES. + ALPHABET EBCDIC-CODE IS EBCDIC. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 Z PIC X(10) VALUE "d4b2e1a3c5". + 01 G. + 02 TBL OCCURS 10. + 03 X PIC X. + PROCEDURE DIVISION. + MOVE Z TO G. + SORT TBL ASCENDING KEY X. + IF G NOT = "abcde12345" + DISPLAY G. + MOVE Z TO G. + SORT TBL DESCENDING KEY X. + IF G NOT = "54321edcba" + DISPLAY G. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__table_sort.cob b/gcc/testsuite/cobol.dg/group2/SORT__table_sort.cob new file mode 100644 index 0000000..52fc973 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__table_sort.cob @@ -0,0 +1,33 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 G VALUE "d4b2e1a3c5". + 02 TBL OCCURS 5. + 03 X PIC X. + 03 Y PIC 9. + PROCEDURE DIVISION. + SORT TBL ASCENDING KEY X. + IF G NOT = "a3b2c5d4e1" + DISPLAY G + END-DISPLAY + END-IF. + SORT TBL DESCENDING KEY Y. + IF G NOT = "c5d4a3b2e1" + DISPLAY G + END-DISPLAY + END-IF. + SORT TBL ASCENDING KEY TBL. + IF G NOT = "a3b2c5d4e1" + DISPLAY G + END-DISPLAY + END-IF. + SORT TBL DESCENDING KEY. + IF G NOT = "e1d4c5b2a3" + DISPLAY G + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__table_sort__2_.cob b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__2_.cob new file mode 100644 index 0000000..d30b4ea --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__2_.cob @@ -0,0 +1,96 @@ + *> { dg-do run } + *> { dg-output-file "group2/SORT__table_sort__2_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 K PIC 9(2). + + 01 CNT1 PIC 9(9) COMP-5 VALUE 4. + 01 TAB1. + 05 ROW1 OCCURS 1 TO 4 DEPENDING CNT1 + DESCENDING TAB1-NR. + 10 TAB1-NR PIC 99. + + 01 TAB2. + 05 CNT2 PIC 9(9) COMP-5 VALUE 4. + 05 ROW2 OCCURS 1 TO 4 DEPENDING CNT2 + DESCENDING TAB2-NR. + 10 TAB2-NR PIC 99. + + 01 TAB3. + 05 CNT3 PIC 9(9) COMP-5 VALUE 10. + 05 ROW3 OCCURS 1 TO 10 DEPENDING CNT3 + DESCENDING TAB3-NR + ASCENDING TAB3-DATA. + 10 TAB3-NR PIC 99. + 10 FILLER PIC X(2). + 10 TAB3-DATA PIC X(5). + 10 FILLER PIC X(2). + 10 TAB3-DATA2 PIC X(5). + + + PROCEDURE DIVISION. + A. + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + MOVE K TO TAB1-NR(K), TAB2-NR(K) + END-PERFORM + + MOVE 1 TO TAB3-NR(1). + MOVE 1 TO TAB3-NR(8). + MOVE 1 TO TAB3-NR(4). + MOVE 6 TO TAB3-NR(2). + MOVE 5 TO TAB3-NR(3). + MOVE 5 TO TAB3-NR(9). + MOVE 2 TO TAB3-NR(5). + MOVE 2 TO TAB3-NR(10). + MOVE 4 TO TAB3-NR(6). + MOVE 3 TO TAB3-NR(7). + + MOVE "abcde" TO TAB3-DATA(1). + MOVE "AbCde" TO TAB3-DATA(2). + MOVE "abcde" TO TAB3-DATA(3). + MOVE "zyx" TO TAB3-DATA(4). + MOVE "12345" TO TAB3-DATA(5). + MOVE "zyx" TO TAB3-DATA(6). + MOVE "abcde" TO TAB3-DATA(7). + MOVE "AbCde" TO TAB3-DATA(8). + MOVE "abc" TO TAB3-DATA(9). + MOVE "12346" TO TAB3-DATA(10). + + MOVE "day" TO TAB3-DATA2(1). + MOVE "The" TO TAB3-DATA2(2). + MOVE "eats" TO TAB3-DATA2(3). + MOVE "." TO TAB3-DATA2(4). + MOVE "mooos" TO TAB3-DATA2(5). + MOVE "grass" TO TAB3-DATA2(6). + MOVE "and" TO TAB3-DATA2(7). + MOVE "whole" TO TAB3-DATA2(8). + MOVE "cow" TO TAB3-DATA2(9). + MOVE "the" TO TAB3-DATA2(10). + + SORT ROW1 DESCENDING TAB1-NR + SORT ROW2 DESCENDING TAB2-NR + + DISPLAY "SINGLE TABLE" END-DISPLAY + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + DISPLAY TAB1-NR(K) END-DISPLAY + END-PERFORM + + DISPLAY "LOWER LEVEL TABLE" END-DISPLAY + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + DISPLAY TAB2-NR(K) END-DISPLAY + END-PERFORM + + SORT ROW3 DESCENDING TAB3-NR ASCENDING TAB3-DATA + + DISPLAY "MULTY KEY SORT" END-DISPLAY + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 10 + DISPLAY FUNCTION TRIM(ROW3(K)) + END-DISPLAY + END-PERFORM + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__table_sort__2_.out b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__2_.out new file mode 100644 index 0000000..5866ecf --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__2_.out @@ -0,0 +1,22 @@ +SINGLE TABLE +04 +03 +02 +01 +LOWER LEVEL TABLE +04 +03 +02 +01 +MULTY KEY SORT +06 AbCde The +05 abc cow +05 abcde eats +04 zyx grass +03 abcde and +02 12345 mooos +02 12346 the +01 AbCde whole +01 abcde day +01 zyx . + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3A_.cob b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3A_.cob new file mode 100644 index 0000000..660f93c --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3A_.cob @@ -0,0 +1,48 @@ + *> { dg-do run } + *> { dg-output-file "group2/SORT__table_sort__3A_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 K PIC 9(2). + + 01 CNT1 PIC 9(9) COMP-5 VALUE 4. + 01 TAB1. + 05 ROW1 OCCURS 1 TO 4 DEPENDING CNT1 + DESCENDING TAB1-NR. + 10 TAB1-NR PIC 99. + 10 TAB-DATA PIC X(5). + 01 TAB2. + 05 ROW2 OCCURS 1 TO 4 DEPENDING CNT1 + ASCENDING ROW2. + 10 TAB2-NR PIC 99. + 10 TAB2-DATA PIC X(5). + + PROCEDURE DIVISION. + A. + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + MOVE K TO TAB1-NR (K) + MOVE 'BLA' TO TAB-DATA(K) + END-PERFORM + + SORT ROW1 + + DISPLAY "After SORT [DESCENDING] ROW1" + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + DISPLAY TAB1-NR(K) NO ADVANCING END-DISPLAY + END-PERFORM + DISPLAY "" + + MOVE TAB1 TO TAB2 + SORT ROW2 + + DISPLAY "After SORT [ASCENDING] ROW2" + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + DISPLAY TAB2-NR(K) NO ADVANCING END-DISPLAY + END-PERFORM + DISPLAY "" + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3A_.out b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3A_.out new file mode 100644 index 0000000..29ea985 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3A_.out @@ -0,0 +1,5 @@ +After SORT [DESCENDING] ROW1 +04030201 +After SORT [ASCENDING] ROW2 +01020304 + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3B_.cob b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3B_.cob new file mode 100644 index 0000000..3afea83 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3B_.cob @@ -0,0 +1,44 @@ + *> { dg-do run } + *> { dg-output-file "group2/SORT__table_sort__3B_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog2. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 K PIC 9(2). + + 01 CNT1 PIC 9(9) COMP-5 VALUE 4. + 01 TAB1. + 05 ROW1 OCCURS 5 DESCENDING TAB1-NR. + 10 TAB1-NR PIC 99 VALUE ZERO. + 10 TAB-DATA PIC X(5). + 01 TAB2. + 05 ROW1 OCCURS 1 TO 4 DEPENDING CNT1 + DESCENDING TAB1-NR. + 10 TAB1-NR PIC 99. + 10 TAB-DATA PIC X(5). + + PROCEDURE DIVISION. + A. + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + MOVE K TO TAB1-NR OF TAB2(K) + MOVE 'BLA' TO TAB-DATA OF TAB2(K) + END-PERFORM + + DISPLAY "Before sort" + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + DISPLAY TAB1-NR OF TAB2(K) NO ADVANCING END-DISPLAY + END-PERFORM + DISPLAY "" + + SORT ROW1 OF TAB2. + + DISPLAY "After descending sort" + PERFORM VARYING K FROM 1 BY 1 UNTIL K > 4 + DISPLAY TAB1-NR OF TAB2(K) NO ADVANCING END-DISPLAY + END-PERFORM + DISPLAY "" + + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3B_.out b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3B_.out new file mode 100644 index 0000000..4721770 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SORT__table_sort__3B_.out @@ -0,0 +1,5 @@ +Before sort +01020304 +After descending sort +04030201 + diff --git a/gcc/testsuite/cobol.dg/group2/SOURCE_FIXED_FREE_directives.cob b/gcc/testsuite/cobol.dg/group2/SOURCE_FIXED_FREE_directives.cob new file mode 100644 index 0000000..29b266e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SOURCE_FIXED_FREE_directives.cob @@ -0,0 +1,27 @@ + *> { dg-do run } + *> { dg-output-file "group2/SOURCE_FIXED_FREE_directives.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + >>SOURCE FREE + DATA DIVISION. + WORKING-STORAGE SECTION. + >>SOURCE FIXED + PROCEDURE DIVISION. FIXED + DISPLAY "OK" NO ADVANCING + END-DISPLAY. + >>SOURCE FREE + DISPLAY + "OK" + NO ADVANCING + END-DISPLAY. + >>SOURCE FORMAT FIXED + DISPLAY "OK" NO ADVANCING FIXED + END-DISPLAY. + >>SOURCE FORMAT IS FREE + DISPLAY + "OK" + NO ADVANCING + END-DISPLAY. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/SOURCE_FIXED_FREE_directives.out b/gcc/testsuite/cobol.dg/group2/SOURCE_FIXED_FREE_directives.out new file mode 100644 index 0000000..ed898e2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/SOURCE_FIXED_FREE_directives.out @@ -0,0 +1 @@ +OKOKOKOK diff --git a/gcc/testsuite/cobol.dg/group2/STOP_RUN_WITH_ERROR_STATUS.cob b/gcc/testsuite/cobol.dg/group2/STOP_RUN_WITH_ERROR_STATUS.cob new file mode 100644 index 0000000..c5f8fe7 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/STOP_RUN_WITH_ERROR_STATUS.cob @@ -0,0 +1,10 @@ + *> { dg-do run } + *> { dg-xfail-run-if "" { *-*-* } } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + STOP RUN WITH ERROR STATUS. + diff --git a/gcc/testsuite/cobol.dg/group2/STOP_RUN_WITH_NORMAL_STATUS.cob b/gcc/testsuite/cobol.dg/group2/STOP_RUN_WITH_NORMAL_STATUS.cob new file mode 100644 index 0000000..9950a77 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/STOP_RUN_WITH_NORMAL_STATUS.cob @@ -0,0 +1,9 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + PROCEDURE DIVISION. + STOP RUN WITH NORMAL STATUS. + diff --git a/gcc/testsuite/cobol.dg/group2/STRING___UNSTRING__NOT__ON_OVERFLOW.cob b/gcc/testsuite/cobol.dg/group2/STRING___UNSTRING__NOT__ON_OVERFLOW.cob new file mode 100644 index 0000000..8397189 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/STRING___UNSTRING__NOT__ON_OVERFLOW.cob @@ -0,0 +1,104 @@ + *> { dg-do run } + *> { dg-output-file "group2/STRING___UNSTRING__NOT__ON_OVERFLOW.out" } + + identification division. + program-id. prog. + data division. + working-storage section. + 77 simple-str pic x(20). + 77 err-str pic x(50). + *----------------------------------------------------------------- + procedure division. + * STRING test + move spaces to simple-str + string 'data' + delimited by size + into simple-str + on overflow + move spaces to err-str + string 'STRING OVERFLOW' + delimited by size + into err-str + end-string + display err-str upon syserr + end-display + display '1 failed' + end-display + not on overflow + display '1 passed' + end-display + end-string + if simple-str not = 'data' + display 'STRING ERROR (1): "' simple-str '"' + end-display + end-if + * + move spaces to simple-str + string 'data is too big here...' + delimited by size + into simple-str + on overflow + display '2 passed' + end-display + not on overflow + display '2 failed' + end-display + move spaces to err-str + string 'missing OVERFLOW' + delimited by size + into err-str + end-string + display err-str upon syserr + end-display + end-string + if simple-str not = 'data is too big here' + display 'STRING ERROR (2): "' simple-str '"' + end-display + end-if + * + * UNSTRING test + move spaces to simple-str + unstring 'data' + into simple-str + on overflow + move spaces to err-str + unstring 'UNSTRING OVERFLOW' + into err-str + end-unstring + display err-str upon syserr + end-display + display '3 failed' + end-display + not on overflow + display '3 passed' + end-display + end-unstring + if simple-str not = 'data' + display 'UNSTRING ERROR (1): "' simple-str '"' + end-display + end-if + * + move spaces to simple-str + unstring 'data is too big here...' + into simple-str + on overflow + display '4 passed' + end-display + not on overflow + display '4 failed' + end-display + move spaces to err-str + string 'missing OVERFLOW' + delimited by size + into err-str + end-string + display err-str upon syserr + end-display + end-unstring + if simple-str not = 'data is too big here' + display 'UNSTRING ERROR (2): "' simple-str '"' + end-display + end-if + * + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/STRING___UNSTRING__NOT__ON_OVERFLOW.out b/gcc/testsuite/cobol.dg/group2/STRING___UNSTRING__NOT__ON_OVERFLOW.out new file mode 100644 index 0000000..f819dc4 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/STRING___UNSTRING__NOT__ON_OVERFLOW.out @@ -0,0 +1,5 @@ +1 passed +2 passed +3 passed +4 passed + diff --git a/gcc/testsuite/cobol.dg/group2/STRING_with_subscript_reference.cob b/gcc/testsuite/cobol.dg/group2/STRING_with_subscript_reference.cob new file mode 100644 index 0000000..66a5477 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/STRING_with_subscript_reference.cob @@ -0,0 +1,18 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 G. + 02 X PIC X(3) OCCURS 3. + PROCEDURE DIVISION. + MOVE SPACES TO G. + STRING "abc" INTO X(2) + END-STRING. + IF G NOT = " abc " + DISPLAY X(1) NO ADVANCING + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/Static_CALL_with_ON_EXCEPTION__with_-fno-static-call_.cob b/gcc/testsuite/cobol.dg/group2/Static_CALL_with_ON_EXCEPTION__with_-fno-static-call_.cob new file mode 100644 index 0000000..fa43889 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Static_CALL_with_ON_EXCEPTION__with_-fno-static-call_.cob @@ -0,0 +1,20 @@ + *> { dg-do run } + *> { dg-options "-fno-static-call -rdynamic" } + *> { dg-output-file "group2/Static_CALL_with_ON_EXCEPTION__with_-fno-static-call_.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. caller. + PROCEDURE DIVISION. + CALL "callee1" ON EXCEPTION + CALL "callee2" ON EXCEPTION + DISPLAY "neither callee1 nor callee2 found" + END-CALL + END-CALL + GOBACK. + END PROGRAM caller. + IDENTIFICATION DIVISION. + PROGRAM-ID. callee2. + PROCEDURE DIVISION. + DISPLAY "this is callee2" NO ADVANCING + GOBACK. + diff --git a/gcc/testsuite/cobol.dg/group2/Static_CALL_with_ON_EXCEPTION__with_-fno-static-call_.out b/gcc/testsuite/cobol.dg/group2/Static_CALL_with_ON_EXCEPTION__with_-fno-static-call_.out new file mode 100644 index 0000000..4f18f54 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/Static_CALL_with_ON_EXCEPTION__with_-fno-static-call_.out @@ -0,0 +1 @@ +this is callee2 diff --git a/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_ALL_LOW-VALUE.cob b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_ALL_LOW-VALUE.cob new file mode 100644 index 0000000..495feef --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_ALL_LOW-VALUE.cob @@ -0,0 +1,26 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 G. + 03 FILLER PIC XXX VALUE "ABC". + 03 FILLER PIC XX VALUE LOW-VALUE. + 03 FILLER PIC XXX VALUE "DEF". + 01 A PIC XXX. + 01 B PIC XXX. + PROCEDURE DIVISION. + UNSTRING G DELIMITED BY ALL LOW-VALUE + INTO A B + END-UNSTRING. + IF A NOT = "ABC" + DISPLAY "A is " """" A """" + END-DISPLAY + END-IF. + IF B NOT = "DEF" + DISPLAY "B is " """" B """" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_ALL_SPACE-2.cob b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_ALL_SPACE-2.cob new file mode 100644 index 0000000..9bbbd8e --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_ALL_SPACE-2.cob @@ -0,0 +1,56 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 WS-RECORD. + 02 VALUE SPACE PIC X(04). + 02 VALUE "ABC AND DE" PIC X(10). + 02 VALUE SPACE PIC X(07). + 02 VALUE "FG AND HIJ" PIC X(10). + 02 VALUE SPACE PIC X(08). + 01 SPACE-2 PIC X(02) VALUE SPACE. + 01 WS-DUMMY PIC X(15). + 01 WS-POINTER PIC 99. + PROCEDURE DIVISION. + MOVE 1 TO WS-POINTER. + * + PERFORM 0001-SUB. + IF WS-DUMMY NOT = SPACE + DISPLAY "Expected space - Got " WS-DUMMY + END-DISPLAY + END-IF. + IF WS-POINTER NOT = 5 + DISPLAY "Expected 5 - Got " WS-POINTER + END-DISPLAY + END-IF. + * + PERFORM 0001-SUB. + IF WS-DUMMY NOT = "ABC AND DE" + DISPLAY "Expected ABC AND DE - Got " WS-DUMMY + END-DISPLAY + END-IF. + IF WS-POINTER NOT = 21 + DISPLAY "Expected 21 - Got " WS-POINTER + END-DISPLAY + END-IF. + * + PERFORM 0001-SUB. + IF WS-DUMMY NOT = " FG AND HIJ" + DISPLAY "Expected FG AND HIJ - Got " WS-DUMMY + END-DISPLAY + END-IF. + IF WS-POINTER NOT = 40 + DISPLAY "Expected 40 - Got " WS-POINTER + END-DISPLAY + END-IF. + STOP RUN. + 0001-SUB. + UNSTRING WS-RECORD + DELIMITED BY ALL SPACE-2 + INTO WS-DUMMY + POINTER WS-POINTER + END-UNSTRING. + diff --git a/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_POINTER.cob b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_POINTER.cob new file mode 100644 index 0000000..5d3fdf2 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITED_POINTER.cob @@ -0,0 +1,45 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 WS-LAY-RECORD PIC X(66). + 01 WS-DUMMY PIC X(50). + 01 WS-KEYWORD PIC X(32). + 01 WS-POINTER PIC 99. + PROCEDURE DIVISION. + MOVE + ' 10 AF-RECORD-TYPE-SEQUENCE-04 PIC 9(05) COMP-3.' + TO WS-LAY-RECORD. + MOVE 1 TO WS-POINTER. + PERFORM 0001-SUB. + IF WS-POINTER NOT = 48 + DISPLAY "Expected 48 - Got " WS-POINTER + END-DISPLAY + END-IF. + ADD 7 TO WS-POINTER + END-ADD. + PERFORM 0001-SUB. + IF WS-POINTER NOT = 62 + DISPLAY "Expected 62 - Got " WS-POINTER + END-DISPLAY + END-IF. + PERFORM 0001-SUB. + IF WS-POINTER NOT = 63 + DISPLAY "Expected 63 - Got " WS-POINTER + END-DISPLAY + END-IF. + STOP RUN. + 0001-SUB. + UNSTRING WS-LAY-RECORD + DELIMITED + BY ' PIC ' + OR ' COMP-3' + OR '.' + INTO WS-DUMMY + DELIMITER WS-KEYWORD + POINTER WS-POINTER + END-UNSTRING. + diff --git a/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITER_IN.cob b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITER_IN.cob new file mode 100644 index 0000000..714dba1 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UNSTRING_DELIMITER_IN.cob @@ -0,0 +1,35 @@ + *> { dg-do run } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + ENVIRONMENT DIVISION. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 WK-CMD PIC X(8) VALUE "WWADDBCC". + 01 WK-SIGNS PIC XX VALUE "AB". + 01 WKS REDEFINES WK-SIGNS. + 03 WK-SIGN PIC X OCCURS 2. + 01 . + 02 WK-DELIM PIC X OCCURS 2. + 01 . + 02 WK-DATA PIC X(2) OCCURS 3. + PROCEDURE DIVISION. + UNSTRING WK-CMD DELIMITED BY WK-SIGN(1) OR WK-SIGN(2) + INTO WK-DATA(1) DELIMITER IN WK-DELIM(1) + WK-DATA(2) DELIMITER IN WK-DELIM(2) + WK-DATA(3) + END-UNSTRING + IF WK-DATA(1) NOT = "WW" + OR WK-DATA(2) NOT = "DD" + OR WK-DATA(3) NOT = "CC" + OR WK-DELIM(1) NOT = "A" + OR WK-DELIM(2) NOT = "B" + DISPLAY """" WK-DATA(1) + WK-DATA(2) + WK-DATA(3) + WK-DELIM(1) + WK-DELIM(2) """" + END-DISPLAY + END-IF. + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/UNSTRING_with_FUNCTION___literal.cob b/gcc/testsuite/cobol.dg/group2/UNSTRING_with_FUNCTION___literal.cob new file mode 100644 index 0000000..f4c8032 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UNSTRING_with_FUNCTION___literal.cob @@ -0,0 +1,42 @@ + *> { dg-do run } + *> { dg-output-file "group2/UNSTRING_with_FUNCTION___literal.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + DATA DIVISION. + WORKING-STORAGE SECTION. + 01 FILLER. + 05 TSTUNS PIC X(479). + 05 PRM PIC X(16) OCCURS 4 TIMES. + PROCEDURE DIVISION. + MOVE "The,Quick,Brown,Fox" TO TSTUNS. + UNSTRING TSTUNS DELIMITED BY ',' + INTO PRM(1), PRM(2), PRM(3), PRM(4). + DISPLAY "PRM(1) is " PRM(1) ":". + DISPLAY "PRM(2) is " PRM(2) ":". + DISPLAY "PRM(3) is " PRM(3) ":". + DISPLAY "PRM(4) is " PRM(4) ":". + UNSTRING FUNCTION UPPER-CASE(TSTUNS) DELIMITED BY ',' + INTO PRM(1), PRM(2), PRM(3), PRM(4). + DISPLAY "Now using UPPER-CASE" + DISPLAY "PRM(1) is " PRM(1) ":". + DISPLAY "PRM(2) is " PRM(2) ":". + DISPLAY "PRM(3) is " PRM(3) ":". + DISPLAY "PRM(4) is " PRM(4) ":". + UNSTRING "Daddy,was,a,Rolling stone" DELIMITED BY ',' + INTO PRM(1), PRM(2), PRM(3), PRM(4). + DISPLAY "Now using Literal" + DISPLAY "PRM(1) is " PRM(1) ":". + DISPLAY "PRM(2) is " PRM(2) ":". + DISPLAY "PRM(3) is " PRM(3) ":". + DISPLAY "PRM(4) is " PRM(4) ":". + UNSTRING FUNCTION LOWER-CASE("Daddy,was,a,Rolling stone") + DELIMITED BY ',' + INTO PRM(1), PRM(2), PRM(3), PRM(4). + DISPLAY "Now using Literal + LOWER-CASE" + DISPLAY "PRM(1) is " PRM(1) ":". + DISPLAY "PRM(2) is " PRM(2) ":". + DISPLAY "PRM(3) is " PRM(3) ":". + DISPLAY "PRM(4) is " PRM(4) ":". + STOP RUN. + diff --git a/gcc/testsuite/cobol.dg/group2/UNSTRING_with_FUNCTION___literal.out b/gcc/testsuite/cobol.dg/group2/UNSTRING_with_FUNCTION___literal.out new file mode 100644 index 0000000..297f254 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/UNSTRING_with_FUNCTION___literal.out @@ -0,0 +1,20 @@ +PRM(1) is The : +PRM(2) is Quick : +PRM(3) is Brown : +PRM(4) is Fox : +Now using UPPER-CASE +PRM(1) is THE : +PRM(2) is QUICK : +PRM(3) is BROWN : +PRM(4) is FOX : +Now using Literal +PRM(1) is Daddy : +PRM(2) is was : +PRM(3) is a : +PRM(4) is Rolling stone : +Now using Literal + LOWER-CASE +PRM(1) is daddy : +PRM(2) is was : +PRM(3) is a : +PRM(4) is rolling stone : + diff --git a/gcc/testsuite/cobol.dg/group2/_-static__compilation.cob b/gcc/testsuite/cobol.dg/group2/_-static__compilation.cob new file mode 100644 index 0000000..7843d3d --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/_-static__compilation.cob @@ -0,0 +1,10 @@ + *> { dg-do run } + *> { dg-options "-static" } + *> { dg-output-file "group2/_-static__compilation.out" } + + IDENTIFICATION DIVISION. + PROGRAM-ID. prog. + PROCEDURE DIVISION. + DISPLAY "hello, world". + end program prog. + diff --git a/gcc/testsuite/cobol.dg/group2/_-static__compilation.out b/gcc/testsuite/cobol.dg/group2/_-static__compilation.out new file mode 100644 index 0000000..ae0e511 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/_-static__compilation.out @@ -0,0 +1,2 @@ +hello, world + diff --git a/gcc/testsuite/cobol.dg/group2/access_to_OPTIONAL_LINKAGE_item_not_passed.cob b/gcc/testsuite/cobol.dg/group2/access_to_OPTIONAL_LINKAGE_item_not_passed.cob new file mode 100644 index 0000000..5cf0446 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/access_to_OPTIONAL_LINKAGE_item_not_passed.cob @@ -0,0 +1,34 @@ + *> { dg-do run } + *> { dg-output-file "group2/access_to_OPTIONAL_LINKAGE_item_not_passed.out" } + + identification division. + program-id. caller. + data division. + working-storage section. + 01 x pic x(4) value '9876'. + procedure division. + call 'callee' using x + end-call + call 'callee' using omitted + end-call + stop run. + end program caller. + + identification division. + program-id. callee. + data division. + working-storage section. + 01 py pointer. + linkage section. + 01 x. + 05 y pic x(4). + procedure division using optional x. + set py to address of x. + if py is not equal to zero + display y + else + display "parameter omitted" + end-if. + goback. + end program callee. + diff --git a/gcc/testsuite/cobol.dg/group2/access_to_OPTIONAL_LINKAGE_item_not_passed.out b/gcc/testsuite/cobol.dg/group2/access_to_OPTIONAL_LINKAGE_item_not_passed.out new file mode 100644 index 0000000..9e82a04 --- /dev/null +++ b/gcc/testsuite/cobol.dg/group2/access_to_OPTIONAL_LINKAGE_item_not_passed.out @@ -0,0 +1,3 @@ +9876 +parameter omitted + diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-recursion3.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-recursion3.C new file mode 100644 index 0000000..cadbdf0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-recursion3.C @@ -0,0 +1,15 @@ +// PR c++/120204 +// { dg-do compile { target c++14 } } + +template<class T, int t> +struct array{}; + +template <typename... TArgs> struct ILEArglist { + using Sizes = array<int, sizeof...(TArgs)>; + static constexpr int size() { // { dg-bogus "not usable" } + Sizes &offsets_c = offsets; // { dg-error "depends on itself" } + return 0; + } + array<char, size()> offsets(); // { dg-error "constant expression" } +}; +auto arglist = ILEArglist<>(); diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-nondep5.C b/gcc/testsuite/g++.dg/cpp2a/concepts-nondep5.C new file mode 100644 index 0000000..f08d4d4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-nondep5.C @@ -0,0 +1,34 @@ +// The from_range_t default ctor should not break the PR99599 workaround +// { dg-do compile { target c++20 } } + +template<typename T> +struct S { T t; }; + +template<typename T> +concept C = sizeof(S<T>) > 0; + +struct I; + +struct from_range_t { + explicit from_range_t() = default; +}; +inline constexpr from_range_t from_range; + +template<typename T> +concept FromRange = __is_same_as (T, from_range_t); + +//#define WORKAROUND +#ifdef WORKAROUND +template<FromRange U, C T> +void f(U, T*); +#else +template<C T> +void f(from_range_t, T*); +#endif + +void f(...); + +void g(I* p) +{ + ::f(0, p); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C b/gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C new file mode 100644 index 0000000..7adf6ec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-nondep6.C @@ -0,0 +1,12 @@ +// PR c++/120185 + +struct A { + A(...); +}; + +template <class T> void f(A, T) { } + +int main() +{ + f(42, 24); +} diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C b/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C index 08f206d..41364f7 100644 --- a/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-recursive-sat4.C @@ -7,7 +7,7 @@ template <class T, class U> concept C = requires(T t, U u) { t * u; }; // { dg-error "depends on itself" "" { target *-*-* } .-2 } template <class Rep> struct Int { - Int(); // make the class non-aggregate in light of PR99599 fix + Int(int = 0); // make the class ineligible for PR99599 workaround template <class T> requires C<T, Rep> friend void operator*(T, Int) { } template <class T> requires C<T, Rep> friend void operator*(Int, T) { } }; diff --git a/gcc/testsuite/g++.dg/cpp2a/constinit16.C b/gcc/testsuite/g++.dg/cpp2a/constinit16.C index dda81d5..046e9aa 100644 --- a/gcc/testsuite/g++.dg/cpp2a/constinit16.C +++ b/gcc/testsuite/g++.dg/cpp2a/constinit16.C @@ -2,7 +2,7 @@ // { dg-do compile { target c++20 } } // { dg-add-options tls } // { dg-require-alias "" } -// { dg-require-effective-target tls_runtime } +// { dg-require-effective-target tls } // { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar1" } } // { dg-final { scan-assembler "_ZTH17mythreadlocalvar2" } } // { dg-final { scan-assembler-not "_ZTH17mythreadlocalvar3" } } diff --git a/gcc/testsuite/g++.dg/cpp2a/decomp2.C b/gcc/testsuite/g++.dg/cpp2a/decomp2.C index c2bfe46..d13f424 100644 --- a/gcc/testsuite/g++.dg/cpp2a/decomp2.C +++ b/gcc/testsuite/g++.dg/cpp2a/decomp2.C @@ -1,7 +1,7 @@ // P1091R3 // { dg-do run { target c++11 } } // { dg-options "" } -// { dg-require-effective-target tls } +// { dg-require-effective-target tls_runtime } // { dg-add-options tls } namespace std { diff --git a/gcc/testsuite/g++.dg/ipa/pr120146.C b/gcc/testsuite/g++.dg/ipa/pr120146.C new file mode 100644 index 0000000..33644b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr120146.C @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-options "-O -fipa-pta" } + +struct basic_ios { + ~basic_ios(); +}; +struct basic_istream : virtual basic_ios {}; +template <typename> struct basic_ifstream : basic_istream { + template <typename _Path> basic_ifstream(_Path, int); +}; +extern template class basic_ifstream<char>; +void CompareFiles_path2() { basic_ifstream<char>(CompareFiles_path2, 0); } diff --git a/gcc/testsuite/gcc.dg/html-output/html-output.exp b/gcc/testsuite/gcc.dg/html-output/html-output.exp new file mode 100644 index 0000000..1f977ca --- /dev/null +++ b/gcc/testsuite/gcc.dg/html-output/html-output.exp @@ -0,0 +1,31 @@ +# Copyright (C) 2012-2024 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" "" + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.c b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.c new file mode 100644 index 0000000..c211f4f --- /dev/null +++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-fdiagnostics-add-output=experimental-html" } */ + +/* Verify that basics of HTML output work. */ + +int missing_semicolon (void) +{ + return 42 /* { dg-error "expected ';' before '.' token" } */ +} + +/* Use a Python script to verify various properties about the generated + .html file: + { dg-final { run-html-pytest missing-semicolon.c "missing-semicolon.py" } } */ diff --git a/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py new file mode 100644 index 0000000..8687168 --- /dev/null +++ b/gcc/testsuite/gcc.dg/html-output/missing-semicolon.py @@ -0,0 +1,84 @@ +# Verify that basics of HTML output work. +# +# For reference, we expect this textual output: +# +# PATH/missing-semicolon.c: In function ‘missing_semicolon’: +# PATH/missing-semicolon.c:8:12: error: expected ‘;’ before ‘}’ token +# 8 | return 42 /* { dg-error "expected ';' before '.' token" } */ +# | ^ +# | ; +# 9 | } +# | ~ + +from htmltest import * + +import pytest + +@pytest.fixture(scope='function', autouse=True) +def html_tree(): + return html_tree_from_env() + +XHTML = 'http://www.w3.org/1999/xhtml' +ns = {'xhtml': XHTML} + +def make_tag(local_name): + return f'{{{XHTML}}}' + local_name + +def test_basics(html_tree): + root = html_tree.getroot () + assert root.tag == make_tag('html') + + head = root.find('xhtml:head', ns) + assert head is not None + + title = head.find('xhtml:title', ns) + assert title.text == 'Title goes here' + + body = root.find('xhtml:body', ns) + assert body is not None + + diag_list = body.find('xhtml:div', ns) + assert diag_list is not None + assert diag_list.attrib['class'] == 'gcc-diagnostic-list' + + diag = diag_list.find('xhtml:div', ns) + assert diag is not None + assert diag.attrib['class'] == 'gcc-diagnostic' + + message = diag.find('xhtml:span', ns) + assert message is not None + assert message.attrib['class'] == 'gcc-message' + assert message.text == "expected '" + assert message[0].tag == make_tag('span') + assert message[0].attrib['class'] == 'gcc-quoted-text' + assert message[0].text == ';' + assert message[0].tail == "' before '" + assert message[1].tag == make_tag('span') + assert message[1].attrib['class'] == 'gcc-quoted-text' + assert message[1].text == '}' + assert message[1].tail == "' token" + + pre = diag.find('xhtml:pre', ns) + assert pre is not None + assert pre.attrib['class'] == 'gcc-annotated-source' + +# For reference, here's the generated HTML: +""" +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>Title goes here</title> + </head> + <body> + <div class="gcc-diagnostic-list"> + <div class="gcc-diagnostic"> + <span class="gcc-message">expected '<span class="gcc-quoted-text">;</span>' before '<span class="gcc-quoted-text">}</span>' token</span> + <pre class="gcc-annotated-source"></pre> + </div> + </div> + </body> +</html> +""" diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-xhtml-1.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-xhtml-1.c deleted file mode 100644 index da069ff..0000000 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-xhtml-1.c +++ /dev/null @@ -1,19 +0,0 @@ -/* { dg-do compile } */ - -int missing_semicolon (void) -{ - return 42 -} - -/* Verify some properties of the generated HTML. */ - -/* { dg-begin-multiline-output "" } -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - { dg-end-multiline-output "" } */ - -/* { dg-excess-errors "" } */ diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp index 96e76d2..a84fbae 100644 --- a/gcc/testsuite/gcc.dg/plugin/plugin.exp +++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp @@ -76,8 +76,6 @@ set plugin_test_list [list \ crash-test-ice-in-header-sarif-2.1.c \ crash-test-ice-in-header-sarif-2.2.c \ crash-test-write-though-null-sarif.c } \ - { diagnostic_plugin_xhtml_format.cc \ - diagnostic-test-xhtml-1.c } \ { diagnostic_group_plugin.cc \ diagnostic-group-test-1.c } \ { diagnostic_plugin_test_show_locus.cc \ diff --git a/gcc/testsuite/gcc.dg/pr119160.c b/gcc/testsuite/gcc.dg/pr119160.c index b4629a1..5743b3b 100644 --- a/gcc/testsuite/gcc.dg/pr119160.c +++ b/gcc/testsuite/gcc.dg/pr119160.c @@ -1,5 +1,6 @@ /* { dg-do run } */ -/* { dg-options "-O2 -finstrument-functions-once -favoid-store-forwarding -fnon-call-exceptions -fschedule-insns -mgeneral-regs-only -Wno-psabi" } */ +/* { dg-options "-O2 -finstrument-functions-once -favoid-store-forwarding -fnon-call-exceptions -fschedule-insns -Wno-psabi" } */ +/* { dg-additional-options "-mgeneral-regs-only" { target { x86_64-*-* i?86-*-* arm*-*-* aarch64*-*-* } } } */ typedef __attribute__((__vector_size__ (32))) int V; diff --git a/gcc/testsuite/gcc.dg/pr87600.h b/gcc/testsuite/gcc.dg/pr87600.h index af91f63..c89071eb 100644 --- a/gcc/testsuite/gcc.dg/pr87600.h +++ b/gcc/testsuite/gcc.dg/pr87600.h @@ -7,7 +7,7 @@ #elif defined (__i386__) # define REG1 "%eax" # define REG2 "%edx" -#elif defined (__powerpc__) || defined (__POWERPC__) +#elif defined (__powerpc__) || defined (__POWERPC__) || defined (__PPC__) # define REG1 "r3" # define REG2 "r4" #elif defined (__s390__) diff --git a/gcc/testsuite/gcc.dg/pr89313.c b/gcc/testsuite/gcc.dg/pr89313.c index 76cb091..7de64da 100644 --- a/gcc/testsuite/gcc.dg/pr89313.c +++ b/gcc/testsuite/gcc.dg/pr89313.c @@ -8,7 +8,7 @@ # define REG "r0" #elif defined (__i386__) # define REG "%eax" -#elif defined (__powerpc__) || defined (__POWERPC__) +#elif defined (__powerpc__) || defined (__POWERPC__) || defined (__PPC__) # define REG "r3" #elif defined (__s390__) # define REG "0" diff --git a/gcc/testsuite/gcc.dg/torture/pr119131-1.c b/gcc/testsuite/gcc.dg/torture/pr119131-1.c index c62f702..1780035 100644 --- a/gcc/testsuite/gcc.dg/torture/pr119131-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr119131-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target dfp } */ +/* { dg-additional-options "-Wno-psabi" } */ /* PR target/119131 */ typedef __attribute__((__vector_size__ (64))) char C; diff --git a/gcc/testsuite/gcc.dg/torture/pr120043.c b/gcc/testsuite/gcc.dg/torture/pr120043.c new file mode 100644 index 0000000..ae27468 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120043.c @@ -0,0 +1,10 @@ +/* { dg-do run } */ +/* { dg-additional-options "-fallow-store-data-races" } */ + +const int a; +int *b; +int main() +{ + &a != b || (*b = 1); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120122-1.c b/gcc/testsuite/gcc.dg/torture/pr120122-1.c new file mode 100644 index 0000000..dde41d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120122-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* PR tree-optimization/120122 */ + +#include <stdbool.h> + +struct Value { + int type; + union { + bool boolean; + long long t; + }; +}; + +static struct Value s_item_mem; + +/* truthy was being miscompiled for the value.type==2 case, + because we would have a VCE from unsigned char to bool + that went from being conditional in the value.type==1 case + to unconditional when `value.type!=0`. + The move of the VCE from conditional to unconditional, + needs to changed into a convert (NOP_EXPR). */ +static bool truthy(void) __attribute__((noipa)); +static bool +truthy(void) +{ + bool tt = false; + for(int i = 0; i < 10; i++) + { + struct Value value = s_item_mem; + if (value.type == 0) + tt = tt | 0; + else if (value.type == 1) + tt = tt | value.boolean; + else + tt = tt | 1; + } + return tt; +} + +int +main(void) +{ + s_item_mem.type = 2; + s_item_mem.t = -1; + bool b1 = !truthy(); + s_item_mem.type = 1; + s_item_mem.boolean = b1; + bool b = truthy(); + if (b1 != b) __builtin_abort(); + if (b) __builtin_abort(); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120182.c b/gcc/testsuite/gcc.dg/torture/pr120182.c new file mode 100644 index 0000000..5e2d171 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120182.c @@ -0,0 +1,42 @@ +/* { dg-do run { target { { *-*-linux* *-*-gnu* *-*-uclinux* } && mmap } } } */ + +#include <unistd.h> +#include <stdlib.h> +#include <sys/mman.h> + +struct S +{ + struct S *next; +}; + +static void __attribute__((noipa)) +allocate(void *addr, unsigned long long size) +{ + void *ptr = mmap((void *)addr, size, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, + -1, 0); + if(ptr != addr) + exit(0); +} + +int main (void) +{ + int size = 0x8000; + char *ptr = (char *)0x288000ull; + allocate((void *)ptr, size); + + struct S *s1 = (struct S *)ptr; + struct S *s2 = (struct S *)256; + for (int i = 0; i < 3; i++) + { + for(char *addr = (char *)s1; addr < (char *)s1 + sizeof(*s1); ++addr) + *addr = 0; + + if(s1->next) + s1->next = s1->next->next = s2; + else + s1->next = s2; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr120211-1.c b/gcc/testsuite/gcc.dg/torture/pr120211-1.c new file mode 100644 index 0000000..f9bc97c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr120211-1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int a, b, d; +void e() { + do { + int f = 0; + while (1) { + int c = a; + for (; (c & 1) == 0; c = 1) + for (; c & 1;) + ; + if (a) + break; + f++; + } + b = f & 5; + if (b) + break; + } while (d++); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c index a9011ce..7062916 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-40.c @@ -20,6 +20,7 @@ int f1(int x) /* { dg-final { scan-tree-dump-times "if " 1 "phiopt1" } } */ /* { dg-final { scan-tree-dump-not "if " "phiopt2" } } */ -/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 2 "phiopt1" } } */ -/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 1 "phiopt2" } } */ -/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 1 "phiopt2" } } */ +/* The ABS_EXPR in f gets rewritten to ABSU_EXPR as phiopt can't prove it was not undefined when moving it. */ +/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 1 "phiopt1" } } */ +/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 1 "phiopt1" } } */ +/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 2 "phiopt2" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c index 9774e28..817d4fe 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-41.c @@ -29,6 +29,6 @@ int fge(int a, unsigned char b) return a > 0 ? a : -a; } - +/* The ABS_EXPR gets rewritten to ABSU_EXPR as phiopt can't prove it was not undefined when moving it. */ /* { dg-final { scan-tree-dump-not "if " "phiopt1" } } */ -/* { dg-final { scan-tree-dump-times "ABS_EXPR <" 4 "phiopt1" } } */ +/* { dg-final { scan-tree-dump-times "ABSU_EXPR <" 4 "phiopt1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c b/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c new file mode 100644 index 0000000..d71ef5e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr120080.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-fgimple -O2" } */ + +void __GIMPLE (ssa,startwith("switchlower1")) +foo (int b) +{ + __BB(2): + switch (b) {default: L9; case 0: L5; case 5: L5; case 101: L5; } + + __BB(3): +L9: + switch (b) {default: L7; case 5: L6; case 101: L6; } + + __BB(4): +L6: + __builtin_unreachable (); + + __BB(5): +L7: + __builtin_trap (); + + __BB(6): +L5: + return; + +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c index 127300f..dafb4c4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c @@ -14,8 +14,8 @@ f2 (long int b) return (16 + (b & 7)) & 15; } -char -f3 (char c) +signed char +f3 (signed char c) { return -(c & 63) & 31; } @@ -34,7 +34,7 @@ f5 (int e) /* { dg-final { scan-tree-dump-times "return -a \& 7;" 1 "original" } } */ /* { dg-final { scan-tree-dump-times "return b \& 7;" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "return \\(char\\) -\\(unsigned char\\) c \& 31;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return \\(signed char\\) -\\(unsigned char\\) c \& 31;" 1 "original" } } */ /* { dg-final { scan-tree-dump-times "return \\(int\\) \\(12 - \\(unsigned int\\) d\\) \& 7;" 1 "original" { target { ! int16 } } } } */ /* { dg-final { scan-tree-dump-times "return \\(int\\) \\(12 - \\(unsigned short\\) d\\) \& 7;" 1 "original" { target { int16 } } } } */ /* { dg-final { scan-tree-dump-times "return 12 - \\(e \& 7\\) \& 15;" 1 "original" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c new file mode 100644 index 0000000..955fc7e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr119960-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_double } */ + +double foo (double *dst, double *src, int b) +{ + double y = src[1]; + if (b) + { + dst[0] = src[0]; + dst[1] = y; + } + return y; +} + +/* { dg-final { scan-tree-dump "optimized: basic block part vectorized" "slp2" { target vect_double } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_134-pr120089.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_134-pr120089.c new file mode 100644 index 0000000..4d8199c --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_134-pr120089.c @@ -0,0 +1,66 @@ +/* { dg-add-options vect_early_break } */ +/* { dg-additional-options "-funswitch-loops" } */ + +#include "tree-vect.h" + +typedef int type; +typedef type Vec2[2]; + +struct BytesVec { + type d[100]; +}; + +__attribute__((noipa)) struct BytesVec +buildVertexBufferData(const Vec2 *origVertices, bool needsZW, + unsigned paddingSize, unsigned long t) { + const unsigned vertexCount = t; + struct BytesVec data = (struct BytesVec){.d = {0}}; + type *nextVertexPtr = data.d; + + for (unsigned vertexIdx = 0u; vertexIdx < vertexCount; ++vertexIdx) { + + if (vertexIdx > t) + __builtin_trap(); + __builtin_memcpy(nextVertexPtr, &origVertices[vertexIdx], + 2 * sizeof(type)); + nextVertexPtr += 2; + + if (needsZW) { + nextVertexPtr += 2; + } + + nextVertexPtr += paddingSize; + } + + return data; +} +Vec2 origVertices[] = { + {0, 1}, {2, 3}, {4, 5}, {6, 7}, + {8, 9}, {10, 11}, {12, 13}, {14, 15}, + {16, 17}, {18, 19}, {20, 21}, {22, 23}, + {24, 25}, {26, 27}, {27, 28}, {29, 30}, +}; + +int main() +{ + check_vect (); + struct BytesVec vec + = buildVertexBufferData(origVertices, false, 0, + sizeof(origVertices) / sizeof(origVertices[0])); + + int errors = 0; + for (unsigned i = 0; i < 100; i++) { + if (i / 2 < sizeof(origVertices) / sizeof(origVertices[0])) { + int ii = i; + int e = origVertices[ii / 2][ii % 2]; + if (vec.d[i] != e) + errors++; + } else { + if (vec.d[i] != 0) + errors++; + } + } + if (errors) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c new file mode 100644 index 0000000..1ee30a8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120143.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-add-options vect_early_break } */ +/* { dg-additional-options "-O3 -fwhole-program" } */ + +short a; +extern _Bool b[][23]; +short g = 6; +int v[4]; +int x[3]; +void c(short g, int v[], int x[]) { + for (;;) + for (unsigned y = 0; y < 023; y++) { + b[y][y] = v[y]; + for (_Bool aa = 0; aa < (_Bool)g; aa = x[y]) + a = a > 0; + } +} +int main() { c(g, v, x); } diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120211.c b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120211.c new file mode 100644 index 0000000..664b60d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_135-pr120211.c @@ -0,0 +1,12 @@ +/* { dg-add-options vect_early_break } */ +/* { dg-additional-options "-O3 -fno-tree-copy-prop -fno-tree-dominator-opts -fno-tree-loop-ivcanon -fno-tree-pre -fno-code-hoisting" } */ + +int a, b[1]; +int main() { + int c = 0; + for (; c < 1; c++) { + while (a) + c++; + b[c] = 0; + } +} diff --git a/gcc/testsuite/gcc.target/aarch64/pr99988.c b/gcc/testsuite/gcc.target/aarch64/pr99988.c index 7cca496..c09ce67 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr99988.c +++ b/gcc/testsuite/gcc.target/aarch64/pr99988.c @@ -1,5 +1,5 @@ /* { dg-do compile { target lp64 } } */ -/* { dg-options "-O2 -mbranch-protection=standard" } */ +/* { dg-options "-O2 -mbranch-protection=standard -fno-bit-tests" } */ /* { dg-final { scan-assembler-times {bti j} 13 } } */ int a; int c(); diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_6.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_6.c index 907637f..eeba533 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/attributes_6.c @@ -29,7 +29,7 @@ test_add (fixed_int8_t x, fixed_int8_t y) } /* -** test_add_gnu: +** test_add_gnu: {target aarch64_big_endian } ** ( ** add (z[0-9]+\.b), (?:z0\.b, z1\.b|z1\.b, z0\.b) ** ptrue (p[0-7])\.b, vl32 @@ -41,6 +41,12 @@ test_add (fixed_int8_t x, fixed_int8_t y) ** ) ** ret */ +/* +** test_add_gnu: {target aarch64_little_endian } +** add (z[0-9]+)\.b, (?:z0\.b, z1\.b|z1\.b, z0\.b) +** str \1, \[x8\] +** ret +*/ gnu_int8_t test_add_gnu (fixed_int8_t x, fixed_int8_t y) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_14.c b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_14.c index b65826b..d423dcf 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_14.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_14.c @@ -9,5 +9,7 @@ uint64_t f2(uint64_t *ptr, int n) { return res; } -/* { dg-final { scan-assembler-times {\tld1d\tz[0-9]+\.d,} 5 } } */ +/* { dg-final { scan-assembler-times {\tld1d\tz[0-9]+\.d,} 5 {target aarch64_big_endian} } } */ +/* { dg-final { scan-assembler-times {\tld1d\tz[0-9]+\.d,} 1 {target aarch64_little_endian} } } */ +/* { dg-final { scan-assembler-times {\tldr\tz[0-9]+,} 4 {target aarch64_little_endian} } } */ /* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.d,} 8 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_4.c b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_4.c index a7ecfe3..93af4c1 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_4.c @@ -9,4 +9,5 @@ vset (int *restrict dst, int *restrict src, int count) *dst++ = 1; } -/* { dg-final { scan-assembler-times {\tst1w\tz} 1 } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz} 1 {target aarch64_big_endian} } } */ +/* { dg-final { scan-assembler-times {\tstr\tz} 1 {target aarch64_little_endian} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_5.c b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_5.c index f3a29fc..fab49ed 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_5.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_5.c @@ -9,5 +9,6 @@ vset (int *restrict dst, int *restrict src, int count) *dst++ = 1; } -/* { dg-final { scan-assembler-times {\tst1w\tz} 2 } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz} 2 {target aarch64_big_endian} } } */ +/* { dg-final { scan-assembler-times {\tstr\tz} 2 {target aarch64_little_endian} } } */ /* { dg-final { scan-assembler-not {\tstp\tq} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_6.c b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_6.c index 565e1e3..160667b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_6.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_6.c @@ -9,4 +9,5 @@ vset (int *restrict dst, int *restrict src, int count) *dst++ = 1; } -/* { dg-final { scan-assembler-times {\tst1w\tz} 1 } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz} 1 {target aarch64_big_endian} } } */ +/* { dg-final { scan-assembler-times {\tstr\tz} 1 {target aarch64_little_endian} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_7.c b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_7.c index 31057c0..b71c673 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/cost_model_7.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/cost_model_7.c @@ -9,4 +9,5 @@ vset (int *restrict dst, int *restrict src, int count) *dst++ = 1; } -/* { dg-final { scan-assembler-times {\tst1w\tz} 2 } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz} 2 {target aarch64_big_endian} } } */ +/* { dg-final { scan-assembler-times {\tstr\tz} 2 {target aarch64_little_endian} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f16.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f16.c index 50e77f9..8d480a8 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f16.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f16.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int16_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int16_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.h), #9\.0[^\n]* ** ... @@ -35,6 +44,15 @@ callee_0 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.h, #9\.0[^\n]* +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int16_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int16_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int16_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int16_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int16_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.h), #9\.0[^\n]* ** ... @@ -72,6 +99,15 @@ callee_1 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.h, #9\.0[^\n]* +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int16_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int16_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int16_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int16_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int16_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.h), #9\.0[^\n]* ** ... @@ -114,6 +159,15 @@ callee_7 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.h, #9\.0[^\n]* +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int16_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int16_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int16_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int16_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int16_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.h), #9\.0[^\n]* ** ... @@ -163,6 +229,17 @@ callee_8 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.h, #9\.0[^\n]* +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int16_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f32.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f32.c index e7b092a..b3c699d 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f32.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f32.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int32_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int32_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.s), #9\.0[^\n]* ** ... @@ -35,6 +44,15 @@ callee_0 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.s, #9\.0[^\n]* +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int32_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int32_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int32_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int32_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int32_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.s), #9\.0[^\n]* ** ... @@ -72,6 +99,15 @@ callee_1 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.s, #9\.0[^\n]* +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int32_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int32_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int32_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int32_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int32_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.s), #9\.0[^\n]* ** ... @@ -114,6 +159,15 @@ callee_7 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.s, #9\.0[^\n]* +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int32_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int32_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int32_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int32_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int32_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.s), #9\.0[^\n]* ** ... @@ -163,6 +229,17 @@ callee_8 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.s, #9\.0[^\n]* +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int32_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f64.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f64.c index c3389a8..7078afc 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f64.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_f64.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int64_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int64_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.d), #9\.0[^\n]* ** ... @@ -35,6 +44,15 @@ callee_0 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.d, #9\.0[^\n]* +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int64_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int64_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int64_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int64_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int64_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.d), #9\.0[^\n]* ** ... @@ -72,6 +99,15 @@ callee_1 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.d, #9\.0[^\n]* +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int64_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int64_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int64_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int64_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int64_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.d), #9\.0[^\n]* ** ... @@ -114,6 +159,15 @@ callee_7 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.d, #9\.0[^\n]* +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int64_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int64_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int64_t *ptr) ** ... ** ret */ +/* +** callee_8: +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int64_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int64_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** fmov (z[0-9]+\.d), #9\.0[^\n]* ** ... @@ -163,6 +229,17 @@ callee_8 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** fmov (z[0-9]+)\.d, #9\.0[^\n]* +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int64_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_mf8.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_mf8.c index 2877787..fcbac37 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_mf8.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_mf8.c @@ -8,9 +8,9 @@ /* ** callee_0: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x1\] +** ldr (z[0-9]+), \[x1\] ** ... -** st1b \1, \2, \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -32,9 +32,9 @@ callee_0 (mfloat8_t *ptr, ...) ** ... ** umov (w[0-9]+), v0.b\[0\] ** ... -** mov (z[0-9]+\.b), \1 +** mov (z[0-9]+)\.b, \1 ** ... -** st1b \2, p[0-7], \[x1\] +** str \2, \[x1\] ** ... ** ret */ @@ -47,9 +47,9 @@ caller_0 (mfloat8_t *ptr, mfloat8_t in) /* ** callee_1: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x2\] +** ldr (z[0-9]+), \[x2\] ** ... -** st1b \1, p[0-7], \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -72,9 +72,9 @@ callee_1 (mfloat8_t *ptr, ...) ** ... ** umov (w[0-9]+), v0.b\[0\] ** ... -** mov (z[0-9]+\.b), \1 +** mov (z[0-9]+)\.b, \1 ** ... -** st1b \2, p[0-7], \[x2\] +** str \2, \[x2\] ** ... ** ret */ @@ -87,9 +87,9 @@ caller_1 (mfloat8_t *ptr, mfloat8_t in) /* ** callee_7: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x7\] +** ldr (z[0-9]+), \[x7\] ** ... -** st1b \1, p[0-7], \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -117,9 +117,9 @@ callee_7 (mfloat8_t *ptr, ...) ** ... ** umov (w[0-9]+), v0.b\[0\] ** ... -** mov (z[0-9]+\.b), \1 +** mov (z[0-9]+)\.b, \1 ** ... -** st1b \2, p[0-7], \[x7\] +** str \2, \[x7\] ** ... ** ret */ @@ -136,9 +136,9 @@ caller_7 (mfloat8_t *ptr, mfloat8_t in) ** ... ** ldr (x[0-9]+), \[sp, \1\] ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[\2\] +** ldr (z[0-9]+), \[\2\] ** ... -** st1b \3, \4, \[x0\] +** str \3, \[x0\] ** ... ** ret */ @@ -167,9 +167,9 @@ callee_8 (mfloat8_t *ptr, ...) ** ... ** umov (w[0-9]+), v0.b\[0\] ** ... -** mov (z[0-9]+\.b), \1 +** mov (z[0-9]+)\.b, \1 ** ... -** st1b \2, p[0-7], \[(x[0-9]+)\] +** str \2, \[(x[0-9]+)\] ** ... ** str \3, \[sp\] ** ... diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s16.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s16.c index 3c644e1..e65e64f 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s16.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s16.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int16_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int16_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -35,6 +44,15 @@ callee_0 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int16_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int16_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int16_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int16_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int16_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -72,6 +99,15 @@ callee_1 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int16_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int16_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int16_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int16_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int16_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -114,6 +159,15 @@ callee_7 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int16_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int16_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int16_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int16_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int16_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -163,6 +229,17 @@ callee_8 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int16_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s32.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s32.c index 652d609..6488a5f 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s32.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s32.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int32_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int32_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -35,6 +44,15 @@ callee_0 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int32_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int32_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int32_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int32_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int32_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -72,6 +99,15 @@ callee_1 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int32_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int32_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int32_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int32_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int32_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -114,6 +159,15 @@ callee_7 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int32_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int32_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int32_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int32_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int32_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -163,6 +229,17 @@ callee_8 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int32_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s64.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s64.c index 72ea6a3..4b77b4f 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s64.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s64.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int64_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int64_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -35,6 +44,15 @@ callee_0 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int64_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int64_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int64_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int64_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int64_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -72,6 +99,15 @@ callee_1 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int64_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int64_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int64_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int64_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int64_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -114,6 +159,15 @@ callee_7 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int64_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int64_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int64_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int64_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int64_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -163,6 +229,17 @@ callee_8 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int64_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s8.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s8.c index 02f4bec..e686b3e 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s8.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_s8.c @@ -8,9 +8,9 @@ /* ** callee_0: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x1\] +** ldr (z[0-9]+), \[x1\] ** ... -** st1b \1, \2, \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -29,9 +29,9 @@ callee_0 (int8_t *ptr, ...) /* ** caller_0: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[x1\] +** str \1, \[x1\] ** ... ** ret */ @@ -44,9 +44,9 @@ caller_0 (int8_t *ptr) /* ** callee_1: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x2\] +** ldr (z[0-9]+), \[x2\] ** ... -** st1b \1, p[0-7], \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -66,9 +66,9 @@ callee_1 (int8_t *ptr, ...) /* ** caller_1: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[x2\] +** str \1, \[x2\] ** ... ** ret */ @@ -81,9 +81,9 @@ caller_1 (int8_t *ptr) /* ** callee_7: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x7\] +** ldr (z[0-9]+), \[x7\] ** ... -** st1b \1, p[0-7], \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -108,9 +108,9 @@ callee_7 (int8_t *ptr, ...) /* ** caller_7: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[x7\] +** str \1, \[x7\] ** ... ** ret */ @@ -127,9 +127,9 @@ caller_7 (int8_t *ptr) ** ... ** ldr (x[0-9]+), \[sp, \1\] ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[\2\] +** ldr (z[0-9]+), \[\2\] ** ... -** st1b \3, \4, \[x0\] +** str \3, \[x0\] ** ... ** ret */ @@ -155,9 +155,9 @@ callee_8 (int8_t *ptr, ...) /* ** caller_8: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[(x[0-9]+)\] +** str \1, \[(x[0-9]+)\] ** ... ** str \2, \[sp\] ** ... diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u16.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u16.c index b60d448..74ef4da 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u16.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u16.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int16_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int16_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -35,6 +44,15 @@ callee_0 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int16_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int16_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int16_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int16_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int16_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -72,6 +99,15 @@ callee_1 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int16_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int16_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1h (z[0-9]+\.h), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int16_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int16_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int16_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -114,6 +159,15 @@ callee_7 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int16_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int16_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int16_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int16_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int16_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.h), #42 ** ... @@ -163,6 +229,17 @@ callee_8 (int16_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.h, #42 +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int16_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u32.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u32.c index 5f01464..4f9ff78 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u32.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u32.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int32_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int32_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -35,6 +44,15 @@ callee_0 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int32_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int32_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int32_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int32_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int32_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -72,6 +99,15 @@ callee_1 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int32_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int32_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1w (z[0-9]+\.s), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int32_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int32_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int32_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -114,6 +159,15 @@ callee_7 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int32_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int32_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int32_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int32_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int32_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.s), #42 ** ... @@ -163,6 +229,17 @@ callee_8 (int32_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.s, #42 +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int32_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u64.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u64.c index 986739f..27e437b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u64.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u64.c @@ -6,7 +6,7 @@ #include <stdarg.h> /* -** callee_0: +** callee_0: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x1\] ** ... @@ -14,6 +14,15 @@ ** ... ** ret */ +/* +** callee_0: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x1\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_0 (int64_t *ptr, ...) { @@ -27,7 +36,7 @@ callee_0 (int64_t *ptr, ...) } /* -** caller_0: +** caller_0: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -35,6 +44,15 @@ callee_0 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_0: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[x1\] +** ... +** ret +*/ void __attribute__((noipa)) caller_0 (int64_t *ptr) { @@ -42,7 +60,7 @@ caller_0 (int64_t *ptr) } /* -** callee_1: +** callee_1: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x2\] ** ... @@ -50,6 +68,15 @@ caller_0 (int64_t *ptr) ** ... ** ret */ +/* +** callee_1: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x2\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_1 (int64_t *ptr, ...) { @@ -64,7 +91,7 @@ callee_1 (int64_t *ptr, ...) } /* -** caller_1: +** caller_1: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -72,6 +99,15 @@ callee_1 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_1: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[x2\] +** ... +** ret +*/ void __attribute__((noipa)) caller_1 (int64_t *ptr) { @@ -79,7 +115,7 @@ caller_1 (int64_t *ptr) } /* -** callee_7: +** callee_7: {target aarch64_big_endian} ** ... ** ld1d (z[0-9]+\.d), (p[0-7])/z, \[x7\] ** ... @@ -87,6 +123,15 @@ caller_1 (int64_t *ptr) ** ... ** ret */ +/* +** callee_7: {target aarch64_little_endian} +** ... +** ldr (z[0-9]+), \[x7\] +** ... +** str \1, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_7 (int64_t *ptr, ...) { @@ -106,7 +151,7 @@ callee_7 (int64_t *ptr, ...) } /* -** caller_7: +** caller_7: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -114,6 +159,15 @@ callee_7 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_7: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[x7\] +** ... +** ret +*/ void __attribute__((noipa)) caller_7 (int64_t *ptr) { @@ -122,7 +176,7 @@ caller_7 (int64_t *ptr) /* FIXME: We should be able to get rid of the va_list object. */ /* -** callee_8: +** callee_8: {target aarch64_big_endian} ** sub sp, sp, #([0-9]+) ** ... ** ldr (x[0-9]+), \[sp, \1\] @@ -133,6 +187,18 @@ caller_7 (int64_t *ptr) ** ... ** ret */ +/* +** callee_8: {target aarch64_little_endian} +** sub sp, sp, #([0-9]+) +** ... +** ldr (x[0-9]+), \[sp, \1\] +** ... +** ldr (z[0-9]+), \[\2\] +** ... +** str \3, \[x0\] +** ... +** ret +*/ void __attribute__((noipa)) callee_8 (int64_t *ptr, ...) { @@ -153,7 +219,7 @@ callee_8 (int64_t *ptr, ...) } /* -** caller_8: +** caller_8: {target aarch64_big_endian} ** ... ** mov (z[0-9]+\.d), #42 ** ... @@ -163,6 +229,17 @@ callee_8 (int64_t *ptr, ...) ** ... ** ret */ +/* +** caller_8: {target aarch64_little_endian} +** ... +** mov (z[0-9]+)\.d, #42 +** ... +** str \1, \[(x[0-9]+)\] +** ... +** str \2, \[sp\] +** ... +** ret +*/ void __attribute__((noipa)) caller_8 (int64_t *ptr) { diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u8.c b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u8.c index 533cba67..d43a6da 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u8.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/pcs/varargs_2_u8.c @@ -8,9 +8,9 @@ /* ** callee_0: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x1\] +** ldr (z[0-9]+), \[x1\] ** ... -** st1b \1, \2, \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -29,9 +29,9 @@ callee_0 (int8_t *ptr, ...) /* ** caller_0: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[x1\] +** str \1, \[x1\] ** ... ** ret */ @@ -44,9 +44,9 @@ caller_0 (int8_t *ptr) /* ** callee_1: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x2\] +** ldr (z[0-9]+), \[x2\] ** ... -** st1b \1, p[0-7], \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -66,9 +66,9 @@ callee_1 (int8_t *ptr, ...) /* ** caller_1: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[x2\] +** str \1, \[x2\] ** ... ** ret */ @@ -81,9 +81,9 @@ caller_1 (int8_t *ptr) /* ** callee_7: ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[x7\] +** ldr (z[0-9]+), \[x7\] ** ... -** st1b \1, p[0-7], \[x0\] +** str \1, \[x0\] ** ... ** ret */ @@ -108,9 +108,9 @@ callee_7 (int8_t *ptr, ...) /* ** caller_7: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[x7\] +** str \1, \[x7\] ** ... ** ret */ @@ -127,9 +127,9 @@ caller_7 (int8_t *ptr) ** ... ** ldr (x[0-9]+), \[sp, \1\] ** ... -** ld1b (z[0-9]+\.b), (p[0-7])/z, \[\2\] +** ldr (z[0-9]+), \[\2\] ** ... -** st1b \3, \4, \[x0\] +** str \3, \[x0\] ** ... ** ret */ @@ -155,9 +155,9 @@ callee_8 (int8_t *ptr, ...) /* ** caller_8: ** ... -** mov (z[0-9]+\.b), #42 +** mov (z[0-9]+)\.b, #42 ** ... -** st1b \1, p[0-7], \[(x[0-9]+)\] +** str \1, \[(x[0-9]+)\] ** ... ** str \2, \[sp\] ** ... diff --git a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_2.c b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_2.c index 985cd0c..f07900b 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/peel_ind_2.c @@ -19,5 +19,7 @@ foo (void) /* We should operate on aligned vectors. */ /* { dg-final { scan-assembler {\t(adrp|adr)\tx[0-9]+, (x|\.LANCHOR0)\n} } } */ /* We should unroll the loop three times. */ -/* { dg-final { scan-assembler-times "\tst1w\t" 3 } } */ +/* { dg-final { scan-assembler-times "\tst1w\t" 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times "\tst1w\t" 2 { target aarch64_little_endian } } } */ +/* { dg-final { scan-assembler-times "\tstr\t" 1 { target aarch64_little_endian } } } */ /* { dg-final { scan-assembler {\tptrue\t(p[0-9]+)\.s, vl7\n.*\teor\tp[0-9]+\.b, (p[0-9]+)/z, (\1\.b, \2\.b|\2\.b, \1\.b)\n} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/ptrue_ldr_str.c b/gcc/testsuite/gcc.target/aarch64/sve/ptrue_ldr_str.c new file mode 100644 index 0000000..c3bfa98 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/ptrue_ldr_str.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target aarch64_little_endian } */ + +#include <arm_sve.h> + +#define TEST(TYPE, TY, B) \ + sv##TYPE ld_##TY (TYPE *x) \ + { \ + return svld1_##TY(svptrue_b##B (), x); \ + } \ + void st_##TY (TYPE *x, sv##TYPE data) \ + { \ + svst1_##TY(svptrue_b##B (), x, data); \ + } + +TEST(bfloat16_t, bf16, 16) +TEST(float16_t, f16, 16) +TEST(float32_t, f32, 32) +TEST(float64_t, f64, 64) +TEST(uint8_t, u8, 8) +TEST(uint16_t, u16, 16) +TEST(uint32_t, u32, 32) +TEST(uint64_t, u64, 64) +TEST(int8_t, s8, 8) +TEST(int16_t, s16, 16) +TEST(int32_t, s32, 32) +TEST(int64_t, s64, 64) + +/* { dg-final { scan-assembler-times {\tldr\tz0, \[x0\]} 12 } } */ +/* { dg-final { scan-assembler-times {\tstr\tz0, \[x0\]} 12 } } */
\ No newline at end of file diff --git a/gcc/testsuite/gcc.target/aarch64/sve/single_1.c b/gcc/testsuite/gcc.target/aarch64/sve/single_1.c index d9bb97e..be71921 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/single_1.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/single_1.c @@ -40,12 +40,13 @@ TEST_LOOP (double, 3.0) /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #2\.0e\+0\n} 1 } } */ /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #3\.0e\+0\n} 1 } } */ -/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl32\n} 11 } } */ +/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl32\n} 9 { target aarch64_big_endian } } } */ -/* { dg-final { scan-assembler-times {\tst1b\tz[0-9]+\.b,} 2 } } */ -/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 } } */ +/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 2 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 11 { target aarch64_little_endian } } } */ /* { dg-final { scan-assembler-not {\twhile} } } */ /* { dg-final { scan-assembler-not {\tb} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/single_2.c b/gcc/testsuite/gcc.target/aarch64/sve/single_2.c index d27eead..8692984 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/single_2.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/single_2.c @@ -16,12 +16,13 @@ /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #2\.0e\+0\n} 1 } } */ /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #3\.0e\+0\n} 1 } } */ -/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl64\n} 11 } } */ +/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl64\n} 9 { target aarch64_big_endian } } } */ -/* { dg-final { scan-assembler-times {\tst1b\tz[0-9]+\.b,} 2 } } */ -/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 } } */ +/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 2 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 11 { target aarch64_little_endian } } } */ /* { dg-final { scan-assembler-not {\twhile} } } */ /* { dg-final { scan-assembler-not {\tb} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/single_3.c b/gcc/testsuite/gcc.target/aarch64/sve/single_3.c index 313a72d..10799fd 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/single_3.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/single_3.c @@ -16,12 +16,13 @@ /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #2\.0e\+0\n} 1 } } */ /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #3\.0e\+0\n} 1 } } */ -/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl128\n} 11 } } */ +/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl128\n} 9 { target aarch64_big_endian } } } */ -/* { dg-final { scan-assembler-times {\tst1b\tz[0-9]+\.b,} 2 } } */ -/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 } } */ +/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 2 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 11 { target aarch64_little_endian } } } */ /* { dg-final { scan-assembler-not {\twhile} } } */ /* { dg-final { scan-assembler-not {\tb} } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/sve/single_4.c b/gcc/testsuite/gcc.target/aarch64/sve/single_4.c index 4f46654..53658a8 100644 --- a/gcc/testsuite/gcc.target/aarch64/sve/single_4.c +++ b/gcc/testsuite/gcc.target/aarch64/sve/single_4.c @@ -16,12 +16,13 @@ /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #2\.0e\+0\n} 1 } } */ /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #3\.0e\+0\n} 1 } } */ -/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl256\n} 11 } } */ +/* { dg-final { scan-assembler-times {\tptrue\tp[0-7]\.b, vl256\n} 9 { target aarch64_big_endian } } } */ -/* { dg-final { scan-assembler-times {\tst1b\tz[0-9]+\.b,} 2 } } */ -/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 } } */ -/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 } } */ +/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.h,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d,} 3 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 2 { target aarch64_big_endian } } } */ +/* { dg-final { scan-assembler-times {\tstr\tz[0-9]+, \[x0\]} 11 { target aarch64_little_endian } } } */ /* { dg-final { scan-assembler-not {\twhile} } } */ /* { dg-final { scan-assembler-not {\tb} } } */ diff --git a/gcc/testsuite/gcc.target/i386/minmax-6.c b/gcc/testsuite/gcc.target/i386/minmax-6.c index 615f919..23f61c5 100644 --- a/gcc/testsuite/gcc.target/i386/minmax-6.c +++ b/gcc/testsuite/gcc.target/i386/minmax-6.c @@ -15,4 +15,4 @@ UMVLine16Y_11 (short unsigned int * Pic, int y, int width) /* We do not want the RA to spill %esi for it's dual-use but using pmaxsd is OK. */ /* { dg-final { scan-assembler-not "rsp" { target { ! { ia32 } } } } } */ -/* { dg-final { scan-assembler "pmaxsd" } } */ +/* { dg-final { scan-assembler "pmaxsd" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/i386/minmax-7.c b/gcc/testsuite/gcc.target/i386/minmax-7.c index 619a939..b2cb1c2 100644 --- a/gcc/testsuite/gcc.target/i386/minmax-7.c +++ b/gcc/testsuite/gcc.target/i386/minmax-7.c @@ -17,4 +17,4 @@ void bar (int aleft, int axcenter) /* We do not want the RA to spill %esi for it's dual-use but using pminsd is OK. */ /* { dg-final { scan-assembler-not "rsp" { target { ! { ia32 } } } } } */ -/* { dg-final { scan-assembler "pminsd" } } */ +/* { dg-final { scan-assembler "pminsd" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c b/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c index 22a48c8..0f35ddd 100644 --- a/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c +++ b/gcc/testsuite/gcc.target/powerpc/block-cmp-8.c @@ -1,6 +1,6 @@ /* { dg-do run { target ilp32 } } */ /* { dg-options "-O2 -mpowerpc64" } */ -/* { dg-require-effective-target has_arch_ppc64 } */ +/* { dg-require-effective-target powerpc64 } */ /* { dg-timeout-factor 2 } */ /* Verify memcmp on m32 mpowerpc64 */ diff --git a/gcc/testsuite/gcc.target/riscv/arch-48.c b/gcc/testsuite/gcc.target/riscv/arch-48.c new file mode 100644 index 0000000..58a558e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-48.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gc_zama16b -mabi=lp64" } */ +int foo() +{ +} diff --git a/gcc/testsuite/gcc.target/riscv/arch-49.c b/gcc/testsuite/gcc.target/riscv/arch-49.c new file mode 100644 index 0000000..6b86ae9 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-49.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rvi20u64 -mabi=lp64" } */ +int +foo () +{} diff --git a/gcc/testsuite/gcc.target/riscv/arch-50.c b/gcc/testsuite/gcc.target/riscv/arch-50.c new file mode 100644 index 0000000..072180d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-50.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rvi20u64_mafdc -mabi=lp64d" } */ +#if !(defined __riscv_mul) || \ + !(defined __riscv_atomic) || \ + !(defined __riscv_flen) || \ + !(defined __riscv_div) || \ + !(defined __riscv_compressed) +#error "Feature macros not defined" +#endif +int +foo () +{} diff --git a/gcc/testsuite/gcc.target/riscv/arch-51.c b/gcc/testsuite/gcc.target/riscv/arch-51.c new file mode 100644 index 0000000..5af983c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-51.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rva20u64 -mabi=lp64d" } */ +#if !(defined __riscv_mul) || \ + !(defined __riscv_atomic) || \ + !(defined __riscv_flen) || \ + !(defined __riscv_div) || \ + !(defined __riscv_compressed) +#error "Feature macros not defined" +#endif +int +foo () +{} diff --git a/gcc/testsuite/gcc.target/riscv/arch-52.c b/gcc/testsuite/gcc.target/riscv/arch-52.c new file mode 100644 index 0000000..da6aea8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-52.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rva22u64v -mabi=lp64" } */ +/* { dg-warning "*Should use \"_\" to contact Profiles with other extensions" } */ +int +foo () +{} diff --git a/gcc/testsuite/gcc.target/riscv/arch-53.c b/gcc/testsuite/gcc.target/riscv/arch-53.c new file mode 100644 index 0000000..8210978 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-53.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rva23u64 -mabi=lp64d" } */ + +void foo(){} + +/* { dg-final { scan-assembler ".attribute arch, \"rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0" +"_b1p0_v1p0_zic64b1p0_zicbom1p0_zicbop1p0_zicboz1p0_ziccamoa1p0_ziccif1p0_zicclsm1p0" +_ziccrse1p0_zicntr2p0_zicond1p0_zicsr2p0_zihintntl1p0_zihintpause2p0_zihpm2p0_zimop1p0" +_za64rs1p0_zaamo1p0_zalrsc1p0_zawrs1p0_zfa1p0_zfhmin1p0_zca1p0_zcb1p0_zcd1p0_zcmop1p0" +_zba1p0_zbb1p0_zbs1p0_zkt1p0_zvbb1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0" +_zvfhmin1p0_zvkb1p0_zvkt1p0_zvl128b1p0_zvl32b1p0_zvl64b1p0\"" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/arch-54.c b/gcc/testsuite/gcc.target/riscv/arch-54.c new file mode 100644 index 0000000..6d242df --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/arch-54.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rvb23u64 -mabi=lp64d" } */ + +void foo(){} + +/* { dg-final { scan-assembler ".attribute arch, \"rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0" +"_b1p0_zic64b1p0_zicbom1p0_zicbop1p0_zicboz1p0_ziccamoa1p0_ziccif1p0_zicclsm1p0_ziccrse1p0" +"_zicntr2p0_zicond1p0_zicsr2p0_zihintntl1p0_zihintpause2p0_zihpm2p0_zimop1p0_za64rs1p0" +"_zaamo1p0_zalrsc1p0_zawrs1p0_zfa1p0_zfhmin1p0_zca1p0_zcb1p0_zcd1p0_zcmop1p0_zba1p0" +"_zbb1p0_zbs1p0_zkt1p0\"" } } */ diff --git a/gcc/testsuite/gcc.target/riscv/ior-synthesis-1.c b/gcc/testsuite/gcc.target/riscv/ior-synthesis-1.c new file mode 100644 index 0000000..04644cd --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/ior-synthesis-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { rv64 } } } */ +/* { dg-options "-march=rv64gb -mabi=lp64d" } */ + +unsigned long foo(unsigned long src) { return src | 0x8c00000000000001; } + +/* { dg-final { scan-assembler-times "\\srori\t" 2 } } */ +/* { dg-final { scan-assembler-times "\\sori\t" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/ior-synthesis-2.c b/gcc/testsuite/gcc.target/riscv/ior-synthesis-2.c new file mode 100644 index 0000000..f28fe5e --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/ior-synthesis-2.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { rv64 } } } */ +/* { dg-options "-march=rv64gb -mabi=lp64d" } */ + +unsigned long foo(unsigned long src) { return src | 0x8800000000000007; } + +/* { dg-final { scan-assembler-times "\\sbseti\t" 2 } } */ +/* { dg-final { scan-assembler-times "\\sori\t" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/pr120137.c b/gcc/testsuite/gcc.target/riscv/pr120137.c new file mode 100644 index 0000000..c55a1c1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr120137.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl256b -mrvv-vector-bits=zvl -mabi=lp64" } */ + +char b[13][13]; +void c() { + for (int d = 0; d < 13; ++d) + for (int e = 0; e < 13; ++e) + b[d][e] = e == 0 ? -98 : 38; +} + + + diff --git a/gcc/testsuite/gcc.target/riscv/pr120154.c b/gcc/testsuite/gcc.target/riscv/pr120154.c new file mode 100644 index 0000000..fd849ca --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/pr120154.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gv -mabi=lp64" } */ + + + +typedef __attribute__((__vector_size__(4))) char V; + +V g; + +V +bar(V a, V b) +{ + V s = a + b + g; + return s; +} + +V +foo() +{ + return bar((V){20}, (V){23, 150}); +} + diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h index 66654eb..db802bd 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_binary.h @@ -3,15 +3,59 @@ #include <stdint.h> -#define DEF_VX_BINARY(T, OP) \ -void \ -test_vx_binary (T * restrict out, T * restrict in, T x, unsigned n) \ -{ \ - for (unsigned i = 0; i < n; i++) \ - out[i] = in[i] OP x; \ +#define DEF_VX_BINARY_CASE_0(T, OP) \ +void \ +test_vx_binary_case_0 (T * restrict out, T * restrict in, T x, unsigned n) \ +{ \ + for (unsigned i = 0; i < n; i++) \ + out[i] = in[i] OP x; \ } -#define DEF_VX_BINARY_WRAP(T, OP) DEF_VX_BINARY(T, OP) -#define RUN_VX_BINARY(out, in, x, n) test_vx_binary(out, in, x, n) -#define RUN_VX_BINARY_WRAP(out, in, x, n) RUN_VX_BINARY(out, in, x, n) +#define DEF_VX_BINARY_CASE_0_WRAP(T, OP) DEF_VX_BINARY_CASE_0(T, OP) +#define RUN_VX_BINARY_CASE_0(out, in, x, n) test_vx_binary_case_0(out, in, x, n) +#define RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) RUN_VX_BINARY_CASE_0(out, in, x, n) + +#define VX_BINARY_BODY(op) \ + out[k + 0] = in[k + 0] op tmp; \ + out[k + 1] = in[k + 1] op tmp; \ + k += 2; + +#define VX_BINARY_BODY_X4(op) \ + VX_BINARY_BODY(op) \ + VX_BINARY_BODY(op) + +#define VX_BINARY_BODY_X8(op) \ + VX_BINARY_BODY_X4(op) \ + VX_BINARY_BODY_X4(op) + +#define VX_BINARY_BODY_X16(op) \ + VX_BINARY_BODY_X8(op) \ + VX_BINARY_BODY_X8(op) + +#define VX_BINARY_BODY_X32(op) \ + VX_BINARY_BODY_X16(op) \ + VX_BINARY_BODY_X16(op) + +#define VX_BINARY_BODY_X64(op) \ + VX_BINARY_BODY_X32(op) \ + VX_BINARY_BODY_X32(op) + +#define VX_BINARY_BODY_X128(op) \ + VX_BINARY_BODY_X64(op) \ + VX_BINARY_BODY_X64(op) + +#define DEF_VX_BINARY_CASE_1(T, OP, BODY) \ +void \ +test_vx_binary_case_1 (T * restrict out, T * restrict in, T x, unsigned n) \ +{ \ + unsigned k = 0; \ + T tmp = x + 3; \ + \ + while (k < n) \ + { \ + tmp = tmp ^ 0x3f; \ + BODY(OP) \ + } \ +} +#define DEF_VX_BINARY_CASE_1_WRAP(T, OP, BODY) DEF_VX_BINARY_CASE_1(T, OP, BODY) #endif diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i16.c index 488bc75..6de21a8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i16.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int16_t, +) +DEF_VX_BINARY_CASE_0(int16_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i32.c index aeba835..f46be7a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i32.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int32_t, +) +DEF_VX_BINARY_CASE_0(int32_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i64.c index ed0b937..2b57b28 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i64.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int64_t, +) +DEF_VX_BINARY_CASE_0(int64_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i8.c index 781d3c0..e139284 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-i8.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int8_t, +) +DEF_VX_BINARY_CASE_0(int8_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u16.c index c01fc23..0266d44 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u16.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint16_t, +) +DEF_VX_BINARY_CASE_0(uint16_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u32.c index 63198492..c541733 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u32.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint32_t, +) +DEF_VX_BINARY_CASE_0(uint32_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u64.c index 36eec53..e9e2162 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u64.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint64_t, +) +DEF_VX_BINARY_CASE_0(uint64_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u8.c index 6bf4b61..da71fff 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-1-u8.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint8_t, +) +DEF_VX_BINARY_CASE_0(uint8_t, +) /* { dg-final { scan-assembler-times {vadd.vx} 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i16.c index eb19938..b40d0b8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i16.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int16_t, +) +DEF_VX_BINARY_CASE_0(int16_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i32.c index 24182c5..af3a40d 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i32.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int32_t, +) +DEF_VX_BINARY_CASE_0(int32_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i64.c index b3d3d4b..5f7c51c 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i64.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int64_t, +) +DEF_VX_BINARY_CASE_0(int64_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i8.c index fb35315..420cf0e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-i8.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int8_t, +) +DEF_VX_BINARY_CASE_0(int8_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u16.c index 6ba2658..7741d06 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u16.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint16_t, +) +DEF_VX_BINARY_CASE_0(uint16_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u32.c index b60412c..10ff20e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u32.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint32_t, +) +DEF_VX_BINARY_CASE_0(uint32_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u64.c index a273294..fa5ab40 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u64.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint64_t, +) +DEF_VX_BINARY_CASE_0(uint64_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u8.c index f3c41f9..0374e1f 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-2-u8.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint8_t, +) +DEF_VX_BINARY_CASE_0(uint8_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i16.c index f3a2627..f766907 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i16.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int16_t, +) +DEF_VX_BINARY_CASE_0(int16_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i32.c index 490854c..1b47a59 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i32.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int32_t, +) +DEF_VX_BINARY_CASE_0(int32_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i64.c index a7448df..92ab1e8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i64.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int64_t, +) +DEF_VX_BINARY_CASE_0(int64_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i8.c index 72c7cd8..444707e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-i8.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(int8_t, +) +DEF_VX_BINARY_CASE_0(int8_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u16.c index 552b4ed..e3fc112 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u16.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint16_t, +) +DEF_VX_BINARY_CASE_0(uint16_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u32.c index e319672..f76971b 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u32.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint32_t, +) +DEF_VX_BINARY_CASE_0(uint32_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u64.c index 6e2a89e..09a4b42 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u64.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint64_t, +) +DEF_VX_BINARY_CASE_0(uint64_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u8.c index d3383e2..5a0679f 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-3-u8.c @@ -3,6 +3,6 @@ #include "vx_binary.h" -DEF_VX_BINARY(uint8_t, +) +DEF_VX_BINARY_CASE_0(uint8_t, +) /* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i16.c new file mode 100644 index 0000000..9a26601 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i16.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int16_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i32.c new file mode 100644 index 0000000..55b51fc --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i32.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int32_t, +, VX_BINARY_BODY_X4) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i64.c new file mode 100644 index 0000000..8ad6098 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i64.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int64_t, +, VX_BINARY_BODY) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i8.c new file mode 100644 index 0000000..193e020 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-i8.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int8_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u16.c new file mode 100644 index 0000000..a093fca --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u16.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint16_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u32.c new file mode 100644 index 0000000..9f5843b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u32.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint32_t, +, VX_BINARY_BODY_X4) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u64.c new file mode 100644 index 0000000..0f00688 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u64.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint64_t, +, VX_BINARY_BODY) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u8.c new file mode 100644 index 0000000..47707e8 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-4-u8.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=0" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint8_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i16.c new file mode 100644 index 0000000..e5ec888 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i16.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int16_t, +, VX_BINARY_BODY_X8) + +/* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i32.c new file mode 100644 index 0000000..ed6c22d --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i32.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int32_t, +, VX_BINARY_BODY_X4) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i64.c new file mode 100644 index 0000000..ef44012 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i64.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int64_t, +, VX_BINARY_BODY) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i8.c new file mode 100644 index 0000000..d61f9df --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-i8.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int8_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u16.c new file mode 100644 index 0000000..3d1ba7f --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u16.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint16_t, +, VX_BINARY_BODY_X8) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u32.c new file mode 100644 index 0000000..2e9862b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u32.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint32_t, +, VX_BINARY_BODY_X4) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u64.c new file mode 100644 index 0000000..72e6786 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u64.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint64_t, +, VX_BINARY_BODY) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u8.c new file mode 100644 index 0000000..e935be1 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-5-u8.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=1" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint8_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i16.c new file mode 100644 index 0000000..d80f0c0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i16.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int16_t, +, VX_BINARY_BODY_X8) + +/* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i32.c new file mode 100644 index 0000000..99f6614 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i32.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int32_t, +, VX_BINARY_BODY_X4) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i64.c new file mode 100644 index 0000000..ab06c51 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i64.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int64_t, +, VX_BINARY_BODY) + +/* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i8.c new file mode 100644 index 0000000..7ead9d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-i8.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(int8_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u16.c new file mode 100644 index 0000000..79b754b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u16.c @@ -0,0 +1,9 @@ + +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint16_t, +, VX_BINARY_BODY_X8) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u32.c new file mode 100644 index 0000000..2f70dcd --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u32.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint32_t, +, VX_BINARY_BODY_X4) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u64.c new file mode 100644 index 0000000..8094a2c --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u64.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint64_t, +, VX_BINARY_BODY) + +/* { dg-final { scan-assembler-not {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u8.c new file mode 100644 index 0000000..56d040b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-6-u8.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvl128b -mabi=lp64d --param=gpr2vr-cost=2" } */ + +#include "vx_binary.h" + +DEF_VX_BINARY_CASE_1(uint8_t, +, VX_BINARY_BODY_X16) + +/* { dg-final { scan-assembler {vadd.vx} } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i16.c index fb5375d..306ad76 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i16.c @@ -6,9 +6,9 @@ #define T int16_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i32.c index c2c79f5..6ccdf7a 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i32.c @@ -6,9 +6,9 @@ #define T int32_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i64.c index 541ed21..9484aa8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i64.c @@ -6,9 +6,9 @@ #define T int64_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i8.c index d507bbb..aeb330e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-i8.c @@ -6,9 +6,9 @@ #define T int8_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u16.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u16.c index 52c0749..dafaa29 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u16.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u16.c @@ -6,9 +6,9 @@ #define T uint16_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u32.c index 70dc347..6b285c8 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u32.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u32.c @@ -6,9 +6,9 @@ #define T uint32_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u64.c index 6ce0060..eeee4e1 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u64.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u64.c @@ -6,9 +6,9 @@ #define T uint64_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u8.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u8.c index a0e80b7..22d7a0e 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u8.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vx_vf/vx_vadd-run-1-u8.c @@ -6,9 +6,9 @@ #define T uint8_t -DEF_VX_BINARY_WRAP(T, +) +DEF_VX_BINARY_CASE_0_WRAP(T, +) #define TEST_DATA TEST_BINARY_DATA_WRAP(T, vadd) -#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_WRAP(out, in, x, n) +#define TEST_RUN(out, in, x, n) RUN_VX_BINARY_CASE_0_WRAP(out, in, x, n) #include "vx_binary_run.h" diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/crc-builtin-zvbc.c b/gcc/testsuite/gcc.target/riscv/rvv/base/crc-builtin-zvbc.c new file mode 100644 index 0000000..2d5fa88 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/crc-builtin-zvbc.c @@ -0,0 +1,66 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv_zvbc -mabi=lp64d" } */ + +#include <stdint-gcc.h> + +int8_t crc8_data8 () +{ + return __builtin_crc8_data8 (0x34, 'a', 0x12); +} + +int16_t crc16_data8 () +{ + return __builtin_crc16_data8 (0x1234, 'a', 0x1021); +} + +int16_t crc16_data16 () +{ + return __builtin_crc16_data16 (0x1234, 0x3214, 0x1021); +} + +int32_t crc32_data8 () +{ + return __builtin_crc32_data8 (0xffffffff, 0x32, 0x4002123); +} + +int32_t crc32_data16 () +{ + return __builtin_crc32_data16 (0xffffffff, 0x3232, 0x4002123); +} + +int32_t crc32_data32 () +{ + return __builtin_crc32_data32 (0xffffffff, 0x123546ff, 0x4002123); +} + +int8_t rev_crc8_data8 () +{ + return __builtin_rev_crc8_data8 (0x34, 'a', 0x12); +} + +int16_t rev_crc16_data8 () +{ + return __builtin_rev_crc16_data8 (0x1234, 'a', 0x1021); +} + +int16_t rev_crc16_data16 () +{ + return __builtin_rev_crc16_data16 (0x1234, 0x3214, 0x1021); +} + +int32_t rev_crc32_data8 () +{ + return __builtin_rev_crc32_data8 (0xffffffff, 0x32, 0x4002123); +} + +int32_t rev_crc32_data16 () +{ + return __builtin_rev_crc32_data16 (0xffffffff, 0x3232, 0x4002123); +} + +int32_t rev_crc32_data32 () +{ + return __builtin_rev_crc32_data32 (0xffffffff, 0x123546ff, 0x4002123); +} +/* { dg-final { scan-assembler-times "vclmul.vx" 12 } } */ +/* { dg-final { scan-assembler-times "vclmulh.vx" 12 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp index 4283d12..d76a2d7 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp +++ b/gcc/testsuite/gcc.target/riscv/rvv/rvv.exp @@ -130,6 +130,21 @@ foreach op $AUTOVEC_TEST_OPTS { "$op" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/sat/*.\[cS\]]] \ "$op" "" +} + +# vx_vf tests +set AUTOVEC_TEST_OPTS [list \ + {-ftree-vectorize -O3 -mrvv-vector-bits=zvl -mrvv-max-lmul=m1 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=zvl -mrvv-max-lmul=m2 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=zvl -mrvv-max-lmul=m4 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=zvl -mrvv-max-lmul=m8 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=zvl -mrvv-max-lmul=dynamic -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=scalable -mrvv-max-lmul=m1 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=scalable -mrvv-max-lmul=m2 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=scalable -mrvv-max-lmul=m4 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=scalable -mrvv-max-lmul=m8 -ffast-math} \ + {-ftree-vectorize -O3 -mrvv-vector-bits=scalable -mrvv-max-lmul=dynamic -ffast-math} ] +foreach op $AUTOVEC_TEST_OPTS { dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/autovec/vx_vf/*.\[cS\]]] \ "$op" "" } diff --git a/gcc/testsuite/gcc.target/riscv/xor-synthesis-1.c b/gcc/testsuite/gcc.target/riscv/xor-synthesis-1.c new file mode 100644 index 0000000..c630a79 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/xor-synthesis-1.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { rv64 } } } */ +/* { dg-options "-march=rv64gb -mabi=lp64d" } */ + +unsigned long foo(unsigned long src) { return src ^ 0xffffffffefffffffUL; } + +/* { dg-final { scan-assembler-times "\\sbinvi\t" 1 } } */ +/* { dg-final { scan-assembler-times "\\snot\t" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/xor-synthesis-2.c b/gcc/testsuite/gcc.target/riscv/xor-synthesis-2.c new file mode 100644 index 0000000..25457d2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/xor-synthesis-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile { target { rv64 } } } */ +/* { dg-options "-march=rv64gb -mabi=lp64d" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" "-O1" "-Og" } } */ + +unsigned long foo(unsigned long src) { return src ^ 0x8800000000000007; } + +/* xfailed until we remove mvconst_internal. */ +/* { dg-final { scan-assembler-times "\\sbinvi\t" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "\\sxori\t" 1 { xfail *-*-* } } } */ + diff --git a/gcc/testsuite/gcc.target/riscv/xor-synthesis-3.c b/gcc/testsuite/gcc.target/riscv/xor-synthesis-3.c new file mode 100644 index 0000000..765904b --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/xor-synthesis-3.c @@ -0,0 +1,8 @@ +/* { dg-do compile { target { rv64 } } } */ +/* { dg-options "-march=rv64gb -mabi=lp64d" } */ + +unsigned long foo(unsigned long src) { return src ^ 0x8c00000000000001; } + +/* { dg-final { scan-assembler-times "\\srori\t" 2 } } */ +/* { dg-final { scan-assembler-times "\\sxori\t" 1 } } */ + diff --git a/gcc/testsuite/gfortran.dg/do_concurrent_basic.f90 b/gcc/testsuite/gfortran.dg/do_concurrent_basic.f90 index fe8723d..bdb6e0e 100644 --- a/gcc/testsuite/gfortran.dg/do_concurrent_basic.f90 +++ b/gcc/testsuite/gfortran.dg/do_concurrent_basic.f90 @@ -1,4 +1,4 @@ -! { dg-do run } +! { dg-do compile } program basic_do_concurrent implicit none integer :: i, arr(10) @@ -7,5 +7,8 @@ program basic_do_concurrent arr(i) = i end do + do concurrent (i=1:10);enddo + do,concurrent (i=1:10);arr(i)=i;enddo + print *, arr -end program basic_do_concurrent
\ No newline at end of file +end program basic_do_concurrent diff --git a/gcc/testsuite/gfortran.dg/guality/pr120193.f90 b/gcc/testsuite/gfortran.dg/guality/pr120193.f90 new file mode 100644 index 0000000..e65febf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/guality/pr120193.f90 @@ -0,0 +1,26 @@ +! PR fortran/120193 +! { dg-do run } +! { dg-options "-g -funsigned" } +! { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } + +program foo + unsigned(kind=1) :: a(2), e + unsigned(kind=2) :: b(2), f + unsigned(kind=4) :: c(2), g + unsigned(kind=8) :: d(2), h + character(kind=1, len=1) :: i(2), j + character(kind=4, len=1) :: k(2), l + a = 97u_1 ! { dg-final { gdb-test 24 "a" "d" } } + b = 97u_2 ! { dg-final { gdb-test 24 "b" "c" } } + c = 97u_4 ! { dg-final { gdb-test 24 "c" "b" } } + d = 97u_8 ! { dg-final { gdb-test 24 "d" "a" } } + e = 97u_1 ! { dg-final { gdb-test 24 "e" "97" } } + f = 97u_2 ! { dg-final { gdb-test 24 "f" "97" } } + g = 97u_4 ! { dg-final { gdb-test 24 "g" "97" } } + h = 97u_8 ! { dg-final { gdb-test 24 "h" "97" } } + i = 'a' ! { dg-final { gdb-test 24 "i" "('a', 'a')" } } + j = 'b' ! { dg-final { gdb-test 24 "j" "'b'" } } + k = 'c' + l = 'd' + print *, a +end program diff --git a/gcc/testsuite/gfortran.dg/interface_61.f90 b/gcc/testsuite/gfortran.dg/interface_61.f90 new file mode 100644 index 0000000..15db3b8a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/interface_61.f90 @@ -0,0 +1,27 @@ +! { dg-do compile } +! { dg-options -Wexternal-argument-mismatch } +! PR fortran/120163 - this used to cause an error. +! Original test case by Bálint Aradi +module mod1 + implicit none + + abstract interface + pure subroutine callback_interface(a) + real, intent(in) :: a + end subroutine callback_interface + end interface + +contains + + subroutine caller(callback) + procedure(callback_interface) :: callback + real :: a + call callback(a) + end subroutine caller + +end module mod1 + + +module mod2 + use mod1 +end module mod2 diff --git a/gcc/testsuite/gfortran.dg/pr120152_1.f90 b/gcc/testsuite/gfortran.dg/pr120152_1.f90 new file mode 100644 index 0000000..c49197d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr120152_1.f90 @@ -0,0 +1,52 @@ +! PR libfortran/120152 +! { dg-do run } + +subroutine f1 + integer(kind=8) :: a (10, 10, 10), b (10, 10) + logical :: c (10, 10, 10) + a = 0 + c = .true. + b = maxloc (a, 2, c, 8, .true.) +end +subroutine f2 + integer(kind=8) :: a (10, 10, 10) + integer(kind=4) :: b (10, 10) + logical :: c (10, 10, 10) + a = 0 + c = .true. + b = maxloc (a, 2, c, 4, .true.) +end +subroutine f3 + integer(kind=8) :: a (10, 10, 10), b (10, 10) + a = 0 + b = maxloc (a, 2, kind=8, back=.true.) +end +subroutine f4 + integer(kind=8) :: a (10, 10, 10) + integer(kind=4) :: b (10, 10) + a = 0 + b = maxloc (a, 2, kind=4, back=.true.) +end +subroutine f5 + integer(kind=8) :: a (10, 10, 10), b (10, 10) + logical :: c + a = 0 + c = .false. + b = maxloc (a, 2, c, 8, .true.) +end +subroutine f6 + integer(kind=8) :: a (10, 10, 10) + integer(kind=4) :: b (10, 10) + logical :: c + a = 0 + c = .false. + b = maxloc (a, 2, c, 4, .true.) +end +program pr120152 + call f1 + call f2 + call f3 + call f4 + call f5 + call f6 +end diff --git a/gcc/testsuite/gfortran.dg/pr120152_2.f90 b/gcc/testsuite/gfortran.dg/pr120152_2.f90 new file mode 100644 index 0000000..39cfb28 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr120152_2.f90 @@ -0,0 +1,80 @@ +! PR libfortran/120152 +! { dg-do run { target fortran_large_int } } + +subroutine f1 + integer(kind=16) :: a (10, 10, 10) + integer(kind=8) :: b (10, 10) + logical :: c (10, 10, 10) + a = 0 + c = .true. + b = maxloc (a, 2, c, 8, .true.) +end +subroutine f2 + integer(kind=16) :: a (10, 10, 10) + integer(kind=4) :: b (10, 10) + logical :: c (10, 10, 10) + a = 0 + c = .true. + b = maxloc (a, 2, c, 4, .true.) +end +subroutine f3 + integer(kind=16) :: a (10, 10, 10) + integer(kind=8) :: b (10, 10) + a = 0 + b = maxloc (a, 2, kind=8, back=.true.) +end +subroutine f4 + integer(kind=16) :: a (10, 10, 10) + integer(kind=4) :: b (10, 10) + a = 0 + b = maxloc (a, 2, kind=4, back=.true.) +end +subroutine f5 + integer(kind=16) :: a (10, 10, 10) + integer(kind=8) :: b (10, 10) + logical :: c + a = 0 + c = .false. + b = maxloc (a, 2, c, 8, .true.) +end +subroutine f6 + integer(kind=16) :: a (10, 10, 10) + integer(kind=4) :: b (10, 10) + logical :: c + a = 0 + c = .false. + b = maxloc (a, 2, c, 4, .true.) +end +subroutine f7 + integer(kind=8) :: a (10, 10, 10) + integer(kind=16) :: b (10, 10) + logical :: c (10, 10, 10) + a = 0 + c = .true. + b = maxloc (a, 2, c, 16, .true.) +end +subroutine f8 + integer(kind=8) :: a (10, 10, 10) + integer(kind=16) :: b (10, 10) + a = 0 + b = maxloc (a, 2, kind=16, back=.true.) +end +subroutine f9 + integer(kind=8) :: a (10, 10, 10) + integer(kind=16) :: b (10, 10) + logical :: c + a = 0 + c = .false. + b = maxloc (a, 2, c, 16, .true.) +end +program pr120152 + call f1 + call f2 + call f3 + call f4 + call f5 + call f6 + call f7 + call f8 + call f9 +end diff --git a/gcc/testsuite/gfortran.dg/pr120153.f90 b/gcc/testsuite/gfortran.dg/pr120153.f90 new file mode 100644 index 0000000..22a7849 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr120153.f90 @@ -0,0 +1,36 @@ +! PR libfortran/120153 +! { dg-do run { target fortran_large_int } } +! { dg-additional-options "-funsigned" } + +subroutine f1 + unsigned(kind=16) :: a (10, 10, 10) + integer(kind=16) :: b (10, 10) + logical :: c (10, 10, 10) + a = 0u_16 + c = .true. + b = maxloc (a, 2, c, 16, .true.) +end +subroutine f2 + unsigned(kind=16) :: a (10, 10, 10) + integer(kind=16) :: b (10, 10) + a = 0u_16 + b = maxloc (a, 2, kind=16, back=.true.) +end +subroutine f3 + unsigned(kind=16) :: a (10, 10, 10) + integer(kind=8) :: b (10, 10) + logical :: c + a = 0u_16 + c = .false. + b = maxloc (a, 2, c, 16, .true.) +end +subroutine f4 + unsigned(kind=16) :: a (5, 5, 5) + call random_number (a) +end +program pr120153 + call f1 + call f2 + call f3 + call f4 +end diff --git a/gcc/testsuite/gfortran.dg/pr120158.f90 b/gcc/testsuite/gfortran.dg/pr120158.f90 new file mode 100644 index 0000000..593f4bc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr120158.f90 @@ -0,0 +1,15 @@ +! PR libfortran/120158 +! { dg-do run { target fortran_large_int } } +! { dg-additional-options "-funsigned" } + + unsigned(kind=8) :: a(10, 10, 10), b(10, 10) + integer(kind=8) :: c(10, 10), d(10, 10) + a = 0u_8 + if (maxval (a) .ne. 0u_8) stop 1 + b = maxval (a, 1) + if (any (b .ne. 0u_8)) stop 2 + c = maxloc (a, 1) + d = maxloc (a, 2, back=.true.) + if (any (c .ne. 1)) stop 3 + if (any (d .ne. 10)) stop 4 +end diff --git a/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 new file mode 100644 index 0000000..b480dff --- /dev/null +++ b/gcc/testsuite/gfortran.dg/transfer_array_subref.f90 @@ -0,0 +1,48 @@ +! { dg-do run } +! { dg-additional-options "-O2 -fdump-tree-optimized" } +! +! PR fortran/102891 - passing of inquiry ref of complex array to TRANSFER + +program main + implicit none + integer, parameter :: dp = 8 + + type complex_wrap1 + complex(dp) :: z(2) + end type complex_wrap1 + + type complex_wrap2 + complex(dp), dimension(:), allocatable :: z + end type complex_wrap2 + + type(complex_wrap1) :: x = complex_wrap1([ (1, 2), (3, 4) ]) + type(complex_wrap2) :: w + + w%z = x%z + + ! The following statements should get optimized away... + if (size (transfer ( x%z%re ,[1.0_dp])) /= 2) error stop 1 + if (size (transfer ((x%z%re),[1.0_dp])) /= 2) error stop 2 + if (size (transfer ([x%z%re],[1.0_dp])) /= 2) error stop 3 + if (size (transfer ( x%z%im ,[1.0_dp])) /= 2) error stop 4 + if (size (transfer ((x%z%im),[1.0_dp])) /= 2) error stop 5 + if (size (transfer ([x%z%im],[1.0_dp])) /= 2) error stop 6 + + ! ... while the following may not: + if (any (transfer ( x%z%re ,[1.0_dp]) /= x%z%re)) stop 7 + if (any (transfer ( x%z%im ,[1.0_dp]) /= x%z%im)) stop 8 + + if (size (transfer ( w%z%re ,[1.0_dp])) /= 2) stop 11 + if (size (transfer ((w%z%re),[1.0_dp])) /= 2) stop 12 + if (size (transfer ([w%z%re],[1.0_dp])) /= 2) stop 13 + if (size (transfer ( w%z%im ,[1.0_dp])) /= 2) stop 14 + if (size (transfer ((w%z%im),[1.0_dp])) /= 2) stop 15 + if (size (transfer ([w%z%im],[1.0_dp])) /= 2) stop 16 + + if (any (transfer ( w%z%re ,[1.0_dp]) /= x%z%re)) stop 17 + if (any (transfer ( w%z%im ,[1.0_dp]) /= x%z%im)) stop 18 + + deallocate (w%z) +end program main + +! { dg-final { scan-tree-dump-not "_gfortran_error_stop_numeric" "optimized" } } diff --git a/gcc/testsuite/gnat.dg/opt106.adb b/gcc/testsuite/gnat.dg/opt106.adb new file mode 100644 index 0000000..525930b --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt106.adb @@ -0,0 +1,11 @@ +-- { dg-do run } +-- { dg-options "-O2" } + +with Opt106_Pkg1; use Opt106_Pkg1; + +procedure Opt106 is + Obj : T := (False, 0, 0, 0, True); + +begin + Proc (Obj, 0, False, True); +end; diff --git a/gcc/testsuite/gnat.dg/opt106_pkg1.adb b/gcc/testsuite/gnat.dg/opt106_pkg1.adb new file mode 100644 index 0000000..154b13f --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt106_pkg1.adb @@ -0,0 +1,39 @@ +with Opt106_Pkg2; use Opt106_Pkg2; + +package body Opt106_Pkg1 is + + procedure Proc (Obj : in out T; + Data : Integer; + Last : Boolean; + Stretch : Boolean) is + + begin + if Stretch and then (Obj.Delayed /= 0 or else not Obj.Attach_Last) then + raise Program_Error; + end if; + + if Obj.Delayed /= 0 then + Stop (Obj.Delayed, Obj.Before, Data, False); + end if; + + if Last or (Obj.Delayed = 0 and not Stretch) then + Stop (Data, Obj.Before, 0, Last); + + if Last then + Obj.Initialized := False; + else + Obj.Next := 0; + Obj.Before := Data; + end if; + + else + if Stretch then + Obj.Next := 1; + else + Obj.Before := Obj.Delayed; + end if; + Obj.Delayed := Data; + end if; + end; + +end Opt106_Pkg1; diff --git a/gcc/testsuite/gnat.dg/opt106_pkg1.ads b/gcc/testsuite/gnat.dg/opt106_pkg1.ads new file mode 100644 index 0000000..85ac24d --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt106_pkg1.ads @@ -0,0 +1,16 @@ +package Opt106_Pkg1 is + + type T is record + Initialized : Boolean; + Before : Integer; + Delayed : Integer; + Next : Integer; + Attach_Last : Boolean; + end record; + + procedure Proc (Obj : in out T; + Data : Integer; + Last : Boolean; + Stretch : Boolean); + +end Opt106_Pkg1; diff --git a/gcc/testsuite/gnat.dg/opt106_pkg2.adb b/gcc/testsuite/gnat.dg/opt106_pkg2.adb new file mode 100644 index 0000000..cf63956 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt106_pkg2.adb @@ -0,0 +1,11 @@ +package body Opt106_Pkg2 is + + procedure Stop (Delayed : Integer; + Before : Integer; + After : Integer; + Last : Boolean) is + begin + raise Program_Error; + end; + +end Opt106_Pkg2; diff --git a/gcc/testsuite/gnat.dg/opt106_pkg2.ads b/gcc/testsuite/gnat.dg/opt106_pkg2.ads new file mode 100644 index 0000000..77e5b40 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt106_pkg2.ads @@ -0,0 +1,8 @@ +package Opt106_Pkg2 is + + procedure Stop (Delayed : Integer; + Before : Integer; + After : Integer; + Last : Boolean); + +end Opt106_Pkg2; diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 6dd8fa3..312c4b8 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -26,6 +26,7 @@ load_lib scanipa.exp load_lib scanwpaipa.exp load_lib scanlang.exp load_lib scansarif.exp +load_lib scanhtml.exp load_lib timeout.exp load_lib timeout-dg.exp load_lib prune.exp diff --git a/gcc/testsuite/lib/htmltest.py b/gcc/testsuite/lib/htmltest.py new file mode 100644 index 0000000..b249ea6 --- /dev/null +++ b/gcc/testsuite/lib/htmltest.py @@ -0,0 +1,9 @@ +import os +import xml.etree.ElementTree as ET + +def html_tree_from_env(): + # return parsed HTML content as an ET from an HTML_PATH file + html_filename = os.environ['HTML_PATH'] + html_filename += '.html' + print('html_filename: %r' % html_filename) + return ET.parse(html_filename) diff --git a/gcc/testsuite/lib/scanhtml.exp b/gcc/testsuite/lib/scanhtml.exp new file mode 100644 index 0000000..6d8f398 --- /dev/null +++ b/gcc/testsuite/lib/scanhtml.exp @@ -0,0 +1,90 @@ +# Copyright (C) 2000-2025 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# Various utilities for scanning HTML output, used by gcc-dg.exp and +# g++-dg.exp. +# +# This is largely borrowed from scansarif.exp. + +proc html-pytest-format-line { args } { + global subdir + + set testcase [lindex $args 0] + set pytest_script [lindex $args 1] + set output_line [lindex $args 2] + + set index [string first "::" $output_line] + set test_output [string range $output_line [expr $index + 2] [string length $output_line]] + + return "$subdir/$testcase ${pytest_script}::${test_output}" +} + +# Call by dg-final to run a pytest Python script. +# We pass filename of a test via HTML_PATH environment variable. + +proc run-html-pytest { args } { + global srcdir subdir + # Extract the test file name from the arguments. + set testcase [lindex $args 0] + + verbose "Running HTML $testcase in $srcdir/$subdir" 2 + set testcase [remote_download host $testcase] + + set pytest_script [lindex $args 1] + if { ![check_effective_target_pytest3] } { + unsupported "$pytest_script pytest python3 is missing" + return + } + + setenv HTML_PATH $testcase + set libdir "${srcdir}/lib" + + # Set/prepend libdir to PYTHONPATH + if [info exists ::env(PYTHONPATH)] { + set old_PYTHONPATH $::env(PYTHONPATH) + setenv PYTHONPATH "${libdir}:${old_PYTHONPATH}" + } else { + setenv PYTHONPATH "${libdir}" + } + + verbose "PYTHONPATH=[getenv PYTHONPATH]" 2 + + spawn -noecho python3 -m pytest --color=no -rap -s --tb=no $srcdir/$subdir/$pytest_script + + if [info exists old_PYTHONPATH] { + setenv PYTHONPATH ${old_PYTHONPATH} + } + + set prefix "\[^\r\n\]*" + expect { + -re "FAILED($prefix)\[^\r\n\]+\r\n" { + set output [html-pytest-format-line $testcase $pytest_script $expect_out(1,string)] + fail $output + exp_continue + } + -re "ERROR($prefix)\[^\r\n\]+\r\n" { + set output [html-pytest-format-line $testcase $pytest_script $expect_out(1,string)] + fail $output + exp_continue + } + -re "PASSED($prefix)\[^\r\n\]+\r\n" { + set output [html-pytest-format-line $testcase $pytest_script $expect_out(1,string)] + pass $output + exp_continue + } + } +} + diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index fe8aee0..636361e 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -1066,7 +1066,7 @@ if_convertible_gimple_assign_stmt_p (gimple *stmt, fprintf (dump_file, "tree could trap...\n"); return false; } - else if (gimple_with_undefined_signed_overflow (stmt)) + else if (gimple_needing_rewrite_undefined (stmt)) /* We have to rewrite stmts with undefined overflow. */ need_to_rewrite_undefined = true; @@ -2881,8 +2881,8 @@ predicate_statements (loop_p loop) gsi_replace (&gsi, new_stmt, true); } - else if (gimple_with_undefined_signed_overflow (stmt)) - rewrite_to_defined_overflow (&gsi); + else if (gimple_needing_rewrite_undefined (stmt)) + rewrite_to_defined_unconditional (&gsi); else if (gimple_vdef (stmt)) { tree lhs = gimple_assign_lhs (stmt); diff --git a/gcc/tree-scalar-evolution.cc b/gcc/tree-scalar-evolution.cc index 9d64d3a..43311e5 100644 --- a/gcc/tree-scalar-evolution.cc +++ b/gcc/tree-scalar-evolution.cc @@ -3932,8 +3932,8 @@ final_value_replacement_loop (class loop *loop) gsi2 = gsi_start (stmts); while (!gsi_end_p (gsi2)) { - if (gimple_with_undefined_signed_overflow (gsi_stmt (gsi2))) - rewrite_to_defined_overflow (&gsi2); + if (gimple_needing_rewrite_undefined (gsi_stmt (gsi2))) + rewrite_to_defined_unconditional (&gsi2); gsi_next (&gsi2); } } diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc index 19990d6..1fff923 100644 --- a/gcc/tree-ssa-ifcombine.cc +++ b/gcc/tree-ssa-ifcombine.cc @@ -514,9 +514,9 @@ ifcombine_mark_ssa_name_walk (tree *t, int *, void *data_) static inline void ifcombine_rewrite_to_defined_overflow (gimple_stmt_iterator gsi) { - if (!gimple_with_undefined_signed_overflow (gsi_stmt (gsi))) + if (!gimple_needing_rewrite_undefined (gsi_stmt (gsi))) return; - rewrite_to_defined_overflow (&gsi); + rewrite_to_defined_unconditional (&gsi); } diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc index ae2fd87..50d2ee9 100644 --- a/gcc/tree-ssa-loop-im.cc +++ b/gcc/tree-ssa-loop-im.cc @@ -1419,11 +1419,11 @@ move_computations_worker (basic_block bb) when the target loop header is executed and the stmt may invoke undefined integer or pointer overflow rewrite it to unsigned arithmetic. */ - if (gimple_with_undefined_signed_overflow (stmt) + if (gimple_needing_rewrite_undefined (stmt) && (!ALWAYS_EXECUTED_IN (bb) || !(ALWAYS_EXECUTED_IN (bb) == level || flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level)))) - gsi_insert_seq_on_edge (e, rewrite_to_defined_overflow (stmt)); + gsi_insert_seq_on_edge (e, rewrite_to_defined_unconditional (stmt)); else gsi_insert_on_edge (e, stmt); } diff --git a/gcc/tree-ssa-loop-split.cc b/gcc/tree-ssa-loop-split.cc index 80f488a..492abf8 100644 --- a/gcc/tree-ssa-loop-split.cc +++ b/gcc/tree-ssa-loop-split.cc @@ -663,8 +663,8 @@ split_loop (class loop *loop1) gsi = gsi_start (stmts2); while (!gsi_end_p (gsi)) { - if (gimple_with_undefined_signed_overflow (gsi_stmt (gsi))) - rewrite_to_defined_overflow (&gsi); + if (gimple_needing_rewrite_undefined (gsi_stmt (gsi))) + rewrite_to_defined_unconditional (&gsi); gsi_next (&gsi); } } diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 54ecd93..9724040 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -838,33 +838,13 @@ move_stmt (gimple *stmt, gimple_stmt_iterator *gsi, auto_bitmap &inserted_exprs) // Mark the name to be renamed if there is one. bitmap_set_bit (inserted_exprs, SSA_NAME_VERSION (name)); gimple_stmt_iterator gsi1 = gsi_for_stmt (stmt); - gsi_move_before (&gsi1, gsi); + gsi_move_before (&gsi1, gsi, GSI_NEW_STMT); reset_flow_sensitive_info (name); /* Rewrite some code which might be undefined when unconditionalized. */ - if (gimple_assign_single_p (stmt)) - { - tree rhs = gimple_assign_rhs1 (stmt); - /* VCE from integral types to another integral types but with - different precisions need to be changed into casts - to be well defined when unconditional. */ - if (gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR - && INTEGRAL_TYPE_P (TREE_TYPE (name)) - && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0)))) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "rewriting stmt with maybe undefined VCE "); - print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); - } - tree new_rhs = TREE_OPERAND (rhs, 0); - gcc_assert (is_gimple_val (new_rhs)); - gimple_assign_set_rhs_code (stmt, NOP_EXPR); - gimple_assign_set_rhs1 (stmt, new_rhs); - update_stmt (stmt); - } - } + if (gimple_needing_rewrite_undefined (stmt)) + rewrite_to_defined_unconditional (gsi); } /* RAII style class to temporarily remove flow sensitive @@ -3546,8 +3526,14 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb, /* If LHS is an access to a local variable without address-taken (or when we allow data races) and known not to trap, we could always safely move down the store. */ + tree base; if (ref_can_have_store_data_races (lhs) - || tree_could_trap_p (lhs)) + || tree_could_trap_p (lhs) + /* tree_could_trap_p is a predicate for rvalues, so check + for readonly memory explicitly. */ + || ((base = get_base_address (lhs)) + && DECL_P (base) + && TREE_READONLY (base))) return false; } diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc index 13bb85c..3c38f3d 100644 --- a/gcc/tree-ssa-reassoc.cc +++ b/gcc/tree-ssa-reassoc.cc @@ -2925,13 +2925,13 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange, !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); - if (gimple_with_undefined_signed_overflow (stmt)) + if (gimple_needing_rewrite_undefined (stmt)) { gimple_stmt_iterator gsip = gsi; gimple_stmt_iterator gsin = gsi; gsi_prev (&gsip); gsi_next (&gsin); - rewrite_to_defined_overflow (&gsi); + rewrite_to_defined_unconditional (&gsi); unsigned uid = gimple_uid (stmt); if (gsi_end_p (gsip)) gsip = gsi_after_labels (bb); diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc index 3ad0c69..deca44a 100644 --- a/gcc/tree-ssa-structalias.cc +++ b/gcc/tree-ssa-structalias.cc @@ -6562,7 +6562,7 @@ create_variable_info_for (tree decl, const char *name, bool add_id) varpool_node *vnode = varpool_node::get (decl); /* For escaped variables initialize them from nonlocal. */ - if (!vnode->all_refs_explicit_p ()) + if (!vnode || !vnode->all_refs_explicit_p ()) make_copy_constraint (vi, nonlocal_id); /* While we can in theory walk references for the varpool @@ -6581,7 +6581,7 @@ create_variable_info_for (tree decl, const char *name, bool add_id) process_constraint (new_constraint (lhs, *rhsp)); /* If this is a variable that escapes from the unit the initializer escapes as well. */ - if (!vnode->all_refs_explicit_p ()) + if (!vnode || !vnode->all_refs_explicit_p ()) { lhs.var = escaped_id; lhs.offset = 0; diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc index dea217a..bd4de96 100644 --- a/gcc/tree-switch-conversion.cc +++ b/gcc/tree-switch-conversion.cc @@ -1793,12 +1793,14 @@ bit_test_cluster::find_bit_tests (vec<cluster *> &clusters, int max_c) end up with as few clusters as possible. */ unsigned l = clusters.length (); - auto_vec<min_cluster_item> min; - min.reserve (l + 1); - gcc_checking_assert (l > 0); + if (l == 0) + return clusters.copy (); gcc_checking_assert (l <= INT_MAX); + auto_vec<min_cluster_item> min; + min.reserve (l + 1); + int bits_in_word = GET_MODE_BITSIZE (word_mode); /* First phase: Compute the minimum number of clusters for each prefix of the diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 231a3ca..9fd1ef2 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -734,7 +734,6 @@ vect_analyze_early_break_dependences (loop_vec_info loop_vinfo) stmt_vec_info stmt_vinfo = vect_stmt_to_vectorize (loop_vinfo->lookup_stmt (stmt)); - stmt = STMT_VINFO_STMT (stmt_vinfo); auto dr_ref = STMT_VINFO_DATA_REF (stmt_vinfo); if (!dr_ref) continue; diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 3de1ea6..fe6f3cf 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5470,76 +5470,6 @@ vect_emit_reduction_init_stmts (loop_vec_info loop_vinfo, } } -/* Function get_initial_def_for_reduction - - Input: - REDUC_INFO - the info_for_reduction - INIT_VAL - the initial value of the reduction variable - NEUTRAL_OP - a value that has no effect on the reduction, as per - neutral_op_for_reduction - - Output: - Return a vector variable, initialized according to the operation that - STMT_VINFO performs. This vector will be used as the initial value - of the vector of partial results. - - The value we need is a vector in which element 0 has value INIT_VAL - and every other element has value NEUTRAL_OP. */ - -static tree -get_initial_def_for_reduction (loop_vec_info loop_vinfo, - stmt_vec_info reduc_info, - tree init_val, tree neutral_op) -{ - class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); - tree scalar_type = TREE_TYPE (init_val); - tree vectype = get_vectype_for_scalar_type (loop_vinfo, scalar_type); - tree init_def; - gimple_seq stmts = NULL; - - gcc_assert (vectype); - - gcc_assert (POINTER_TYPE_P (scalar_type) || INTEGRAL_TYPE_P (scalar_type) - || SCALAR_FLOAT_TYPE_P (scalar_type)); - - gcc_assert (nested_in_vect_loop_p (loop, reduc_info) - || loop == (gimple_bb (reduc_info->stmt))->loop_father); - - if (operand_equal_p (init_val, neutral_op)) - { - /* If both elements are equal then the vector described above is - just a splat. */ - neutral_op = gimple_convert (&stmts, TREE_TYPE (vectype), neutral_op); - init_def = gimple_build_vector_from_val (&stmts, vectype, neutral_op); - } - else - { - neutral_op = gimple_convert (&stmts, TREE_TYPE (vectype), neutral_op); - init_val = gimple_convert (&stmts, TREE_TYPE (vectype), init_val); - if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant ()) - { - /* Construct a splat of NEUTRAL_OP and insert INIT_VAL into - element 0. */ - init_def = gimple_build_vector_from_val (&stmts, vectype, - neutral_op); - init_def = gimple_build (&stmts, CFN_VEC_SHL_INSERT, - vectype, init_def, init_val); - } - else - { - /* Build {INIT_VAL, NEUTRAL_OP, NEUTRAL_OP, ...}. */ - tree_vector_builder elts (vectype, 1, 2); - elts.quick_push (init_val); - elts.quick_push (neutral_op); - init_def = gimple_build_vector (&stmts, &elts); - } - } - - if (stmts) - vect_emit_reduction_init_stmts (loop_vinfo, reduc_info, stmts); - return init_def; -} - /* Get at the initial defs for the reduction PHIs for REDUC_INFO, which performs a reduction involving GROUP_SIZE scalar statements. NUMBER_OF_VECTORS is the number of vector defs to create. If NEUTRAL_OP @@ -5951,7 +5881,6 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, loop-closed PHI of the inner loop which we remember as def for the reduction PHI generation. */ bool double_reduc = false; - stmt_vec_info rdef_info = stmt_info; if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_double_reduction_def) { double_reduc = true; @@ -5981,20 +5910,18 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, auto_vec<tree> reduc_inputs; int j, i; vec<tree> &scalar_results = reduc_info->reduc_scalar_results; - unsigned int group_size = 1, k; + unsigned int k; /* SLP reduction without reduction chain, e.g., # a1 = phi <a2, a0> # b1 = phi <b2, b0> a2 = operation (a1) b2 = operation (b1) */ bool slp_reduc - = (slp_node - && !REDUC_GROUP_FIRST_ELEMENT (STMT_VINFO_REDUC_DEF (reduc_info))); + = !REDUC_GROUP_FIRST_ELEMENT (STMT_VINFO_REDUC_DEF (reduc_info)); bool direct_slp_reduc; tree induction_index = NULL_TREE; - if (slp_node) - group_size = SLP_TREE_LANES (slp_node); + unsigned int group_size = SLP_TREE_LANES (slp_node); if (nested_in_vect_loop_p (loop, stmt_info)) { @@ -6024,18 +5951,8 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, /* All statements produce live-out values. */ live_out_stmts = SLP_TREE_SCALAR_STMTS (slp_node); - unsigned vec_num; - int ncopies; - if (slp_node) - { - vec_num = SLP_TREE_VEC_DEFS (slp_node_instance->reduc_phis).length (); - ncopies = 1; - } - else - { - vec_num = 1; - ncopies = STMT_VINFO_VEC_STMTS (reduc_info).length (); - } + unsigned vec_num + = SLP_TREE_VEC_DEFS (slp_node_instance->reduc_phis).length (); /* For cond reductions we want to create a new vector (INDEX_COND_EXPR) which is updated with the current index of the loop for every match of @@ -6050,53 +5967,29 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, if (STMT_VINFO_REDUC_TYPE (reduc_info) == COND_REDUCTION) { auto_vec<std::pair<tree, bool>, 2> ccompares; - if (slp_node) + slp_tree cond_node = slp_node_instance->root; + while (cond_node != slp_node_instance->reduc_phis) { - slp_tree cond_node = slp_node_instance->root; - while (cond_node != slp_node_instance->reduc_phis) + stmt_vec_info cond_info = SLP_TREE_REPRESENTATIVE (cond_node); + int slp_reduc_idx; + if (gimple_assign_rhs_code (cond_info->stmt) == COND_EXPR) { - stmt_vec_info cond_info = SLP_TREE_REPRESENTATIVE (cond_node); - int slp_reduc_idx; - if (gimple_assign_rhs_code (cond_info->stmt) == COND_EXPR) - { - gimple *vec_stmt - = SSA_NAME_DEF_STMT (SLP_TREE_VEC_DEFS (cond_node)[0]); - gcc_assert (gimple_assign_rhs_code (vec_stmt) == VEC_COND_EXPR); - ccompares.safe_push - (std::make_pair (gimple_assign_rhs1 (vec_stmt), - STMT_VINFO_REDUC_IDX (cond_info) == 2)); - /* ??? We probably want to have REDUC_IDX on the SLP node? - We have both three and four children COND_EXPR nodes - dependent on whether the comparison is still embedded - as GENERIC. So work backwards. */ - slp_reduc_idx = (SLP_TREE_CHILDREN (cond_node).length () - 3 - + STMT_VINFO_REDUC_IDX (cond_info)); - } - else - slp_reduc_idx = STMT_VINFO_REDUC_IDX (cond_info); - cond_node = SLP_TREE_CHILDREN (cond_node)[slp_reduc_idx]; - } - } - else - { - stmt_vec_info cond_info = STMT_VINFO_REDUC_DEF (reduc_info); - cond_info = vect_stmt_to_vectorize (cond_info); - while (cond_info != reduc_info) - { - if (gimple_assign_rhs_code (cond_info->stmt) == COND_EXPR) - { - gimple *vec_stmt = STMT_VINFO_VEC_STMTS (cond_info)[0]; - gcc_assert (gimple_assign_rhs_code (vec_stmt) == VEC_COND_EXPR); - ccompares.safe_push - (std::make_pair (gimple_assign_rhs1 (vec_stmt), - STMT_VINFO_REDUC_IDX (cond_info) == 2)); - } - cond_info - = loop_vinfo->lookup_def (gimple_op (cond_info->stmt, - 1 + STMT_VINFO_REDUC_IDX - (cond_info))); - cond_info = vect_stmt_to_vectorize (cond_info); + gimple *vec_stmt + = SSA_NAME_DEF_STMT (SLP_TREE_VEC_DEFS (cond_node)[0]); + gcc_assert (gimple_assign_rhs_code (vec_stmt) == VEC_COND_EXPR); + ccompares.safe_push + (std::make_pair (gimple_assign_rhs1 (vec_stmt), + STMT_VINFO_REDUC_IDX (cond_info) == 2)); + /* ??? We probably want to have REDUC_IDX on the SLP node? + We have both three and four children COND_EXPR nodes + dependent on whether the comparison is still embedded + as GENERIC. So work backwards. */ + slp_reduc_idx = (SLP_TREE_CHILDREN (cond_node).length () - 3 + + STMT_VINFO_REDUC_IDX (cond_info)); } + else + slp_reduc_idx = STMT_VINFO_REDUC_IDX (cond_info); + cond_node = SLP_TREE_CHILDREN (cond_node)[slp_reduc_idx]; } gcc_assert (ccompares.length () != 0); @@ -6205,30 +6098,22 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, /* We need to reduce values in all exits. */ exit_bb = loop_exit->dest; exit_gsi = gsi_after_labels (exit_bb); - reduc_inputs.create (slp_node ? vec_num : ncopies); + reduc_inputs.create (vec_num); for (unsigned i = 0; i < vec_num; i++) { gimple_seq stmts = NULL; - if (slp_node) - def = vect_get_slp_vect_def (slp_node, i); + def = vect_get_slp_vect_def (slp_node, i); + tree new_def = copy_ssa_name (def); + phi = create_phi_node (new_def, exit_bb); + if (LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit) + SET_PHI_ARG_DEF (phi, loop_exit->dest_idx, def); else - def = gimple_get_lhs (STMT_VINFO_VEC_STMTS (rdef_info)[0]); - for (j = 0; j < ncopies; j++) - { - tree new_def = copy_ssa_name (def); - phi = create_phi_node (new_def, exit_bb); - if (j) - def = gimple_get_lhs (STMT_VINFO_VEC_STMTS (rdef_info)[j]); - if (LOOP_VINFO_IV_EXIT (loop_vinfo) == loop_exit) - SET_PHI_ARG_DEF (phi, loop_exit->dest_idx, def); - else - { - for (unsigned k = 0; k < gimple_phi_num_args (phi); k++) - SET_PHI_ARG_DEF (phi, k, def); - } - new_def = gimple_convert (&stmts, vectype, new_def); - reduc_inputs.quick_push (new_def); + { + for (unsigned k = 0; k < gimple_phi_num_args (phi); k++) + SET_PHI_ARG_DEF (phi, k, def); } + new_def = gimple_convert (&stmts, vectype, new_def); + reduc_inputs.quick_push (new_def); gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT); } @@ -6284,8 +6169,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, if (REDUC_GROUP_FIRST_ELEMENT (STMT_VINFO_REDUC_DEF (reduc_info)) || direct_slp_reduc || (slp_reduc - && constant_multiple_p (TYPE_VECTOR_SUBPARTS (vectype), group_size)) - || ncopies > 1) + && constant_multiple_p (TYPE_VECTOR_SUBPARTS (vectype), group_size))) { gimple_seq stmts = NULL; tree single_input = reduc_inputs[0]; @@ -6579,7 +6463,7 @@ vect_create_epilog_for_reduction (loop_vec_info loop_vinfo, is itself a neutral value. */ tree vector_identity = NULL_TREE; tree neutral_op = NULL_TREE; - if (slp_node) + if (1) { tree initial_value = NULL_TREE; if (REDUC_GROUP_FIRST_ELEMENT (STMT_VINFO_REDUC_DEF (reduc_info))) @@ -7088,10 +6972,10 @@ static bool vectorize_fold_left_reduction (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, - gimple **vec_stmt, slp_tree slp_node, + slp_tree slp_node, gimple *reduc_def_stmt, code_helper code, internal_fn reduc_fn, - tree *ops, int num_ops, tree vectype_in, + int num_ops, tree vectype_in, int reduc_index, vec_loop_masks *masks, vec_loop_lens *lens) { @@ -7099,14 +6983,7 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo, tree vectype_out = STMT_VINFO_VECTYPE (stmt_info); internal_fn mask_reduc_fn = get_masked_reduction_fn (reduc_fn, vectype_in); - int ncopies; - if (slp_node) - ncopies = 1; - else - ncopies = vect_get_num_copies (loop_vinfo, vectype_in); - gcc_assert (!nested_in_vect_loop_p (loop, stmt_info)); - gcc_assert (ncopies == 1); bool is_cond_op = false; if (!code.is_tree_code ()) @@ -7118,9 +6995,8 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo, gcc_assert (TREE_CODE_LENGTH (tree_code (code)) == binary_op); - if (slp_node) - gcc_assert (known_eq (TYPE_VECTOR_SUBPARTS (vectype_out), - TYPE_VECTOR_SUBPARTS (vectype_in))); + gcc_assert (known_eq (TYPE_VECTOR_SUBPARTS (vectype_out), + TYPE_VECTOR_SUBPARTS (vectype_in))); /* The operands either come from a binary operation or an IFN_COND operation. The former is a gimple assign with binary rhs and the latter is a @@ -7130,36 +7006,14 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo, int group_size = 1; stmt_vec_info scalar_dest_def_info; auto_vec<tree> vec_oprnds0, vec_opmask; - if (slp_node) - { - vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[(is_cond_op ? 2 : 0) - + (1 - reduc_index)], - &vec_oprnds0); - group_size = SLP_TREE_SCALAR_STMTS (slp_node).length (); - scalar_dest_def_info = SLP_TREE_SCALAR_STMTS (slp_node)[group_size - 1]; - /* For an IFN_COND_OP we also need the vector mask operand. */ - if (is_cond_op) - vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[0], &vec_opmask); - } - else - { - tree op0, opmask; - if (!is_cond_op) - op0 = ops[1 - reduc_index]; - else - { - op0 = ops[2 + (1 - reduc_index)]; - opmask = ops[0]; - } - vect_get_vec_defs_for_operand (loop_vinfo, stmt_info, 1, - op0, &vec_oprnds0); - scalar_dest_def_info = stmt_info; - - /* For an IFN_COND_OP we also need the vector mask operand. */ - if (is_cond_op) - vect_get_vec_defs_for_operand (loop_vinfo, stmt_info, 1, - opmask, &vec_opmask); - } + vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[(is_cond_op ? 2 : 0) + + (1 - reduc_index)], + &vec_oprnds0); + group_size = SLP_TREE_SCALAR_STMTS (slp_node).length (); + scalar_dest_def_info = SLP_TREE_SCALAR_STMTS (slp_node)[group_size - 1]; + /* For an IFN_COND_OP we also need the vector mask operand. */ + if (is_cond_op) + vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[0], &vec_opmask); gimple *sdef = vect_orig_stmt (scalar_dest_def_info)->stmt; tree scalar_dest = gimple_get_lhs (sdef); @@ -7167,7 +7021,6 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo, tree reduc_var = gimple_phi_result (reduc_def_stmt); int vec_num = vec_oprnds0.length (); - gcc_assert (vec_num == 1 || slp_node); tree vec_elem_type = TREE_TYPE (vectype_out); gcc_checking_assert (useless_type_conversion_p (scalar_type, vec_elem_type)); @@ -7279,13 +7132,7 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo, scalar_dest_def_info, new_stmt, gsi); - if (slp_node) - slp_node->push_vec_def (new_stmt); - else - { - STMT_VINFO_VEC_STMTS (stmt_info).safe_push (new_stmt); - *vec_stmt = new_stmt; - } + slp_node->push_vec_def (new_stmt); } return true; @@ -7543,7 +7390,7 @@ vectorizable_lane_reducing (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, return false; } - if (slp_node && !vect_maybe_update_slp_op_vectype (slp_op, vectype)) + if (!vect_maybe_update_slp_op_vectype (slp_op, vectype)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -7682,23 +7529,20 @@ vectorizable_reduction (loop_vec_info loop_vinfo, { if (is_a <gphi *> (stmt_info->stmt)) { - if (slp_node) - { - /* We eventually need to set a vector type on invariant - arguments. */ - unsigned j; - slp_tree child; - FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child) - if (!vect_maybe_update_slp_op_vectype - (child, SLP_TREE_VECTYPE (slp_node))) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "incompatible vector types for " - "invariants\n"); - return false; - } - } + /* We eventually need to set a vector type on invariant + arguments. */ + unsigned j; + slp_tree child; + FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (slp_node), j, child) + if (!vect_maybe_update_slp_op_vectype + (child, SLP_TREE_VECTYPE (slp_node))) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "incompatible vector types for " + "invariants\n"); + return false; + } /* Analysis for double-reduction is done on the outer loop PHI, nested cycles have no further restrictions. */ STMT_VINFO_TYPE (stmt_info) = cycle_phi_info_type; @@ -7723,7 +7567,6 @@ vectorizable_reduction (loop_vec_info loop_vinfo, the outer loop PHI. The latter is what we want to analyze the reduction with. The LC PHI is handled by vectorizable_lc_phi. */ - gcc_assert (slp_node); return gimple_phi_num_args (as_a <gphi *> (stmt_info->stmt)) == 2; } use_operand_p use_p; @@ -7734,13 +7577,10 @@ vectorizable_reduction (loop_vec_info loop_vinfo, phi_info = loop_vinfo->lookup_stmt (use_stmt); } - if (slp_node) - { - slp_node_instance->reduc_phis = slp_node; - /* ??? We're leaving slp_node to point to the PHIs, we only - need it to get at the number of vector stmts which wasn't - yet initialized for the instance root. */ - } + slp_node_instance->reduc_phis = slp_node; + /* ??? We're leaving slp_node to point to the PHIs, we only + need it to get at the number of vector stmts which wasn't + yet initialized for the instance root. */ /* PHIs should not participate in patterns. */ gcc_assert (!STMT_VINFO_RELATED_STMT (phi_info)); @@ -7756,11 +7596,10 @@ vectorizable_reduction (loop_vec_info loop_vinfo, unsigned reduc_chain_length = 0; bool only_slp_reduc_chain = true; stmt_info = NULL; - slp_tree slp_for_stmt_info = slp_node ? slp_node_instance->root : NULL; + slp_tree slp_for_stmt_info = slp_node_instance->root; /* For double-reductions we start SLP analysis at the inner loop LC PHI which is the def of the outer loop live stmt. */ - if (STMT_VINFO_DEF_TYPE (reduc_info) == vect_double_reduction_def - && slp_node) + if (STMT_VINFO_DEF_TYPE (reduc_info) == vect_double_reduction_def) slp_for_stmt_info = SLP_TREE_CHILDREN (slp_for_stmt_info)[0]; while (reduc_def != PHI_RESULT (reduc_def_phi)) { @@ -7863,7 +7702,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, reduc_def = op.ops[reduc_idx]; reduc_chain_length++; - if (!stmt_info && slp_node) + if (!stmt_info) slp_for_stmt_info = SLP_TREE_CHILDREN (slp_for_stmt_info)[0]; } /* PHIs should not participate in patterns. */ @@ -7877,14 +7716,13 @@ vectorizable_reduction (loop_vec_info loop_vinfo, /* STMT_VINFO_REDUC_DEF doesn't point to the first but the last element. */ - if (slp_node && REDUC_GROUP_FIRST_ELEMENT (stmt_info)) + if (REDUC_GROUP_FIRST_ELEMENT (stmt_info)) { gcc_assert (!REDUC_GROUP_NEXT_ELEMENT (stmt_info)); stmt_info = REDUC_GROUP_FIRST_ELEMENT (stmt_info); } if (REDUC_GROUP_FIRST_ELEMENT (stmt_info)) - gcc_assert (slp_node - && REDUC_GROUP_FIRST_ELEMENT (stmt_info) == stmt_info); + gcc_assert (REDUC_GROUP_FIRST_ELEMENT (stmt_info) == stmt_info); /* 1. Is vectorizable reduction? */ /* Not supportable if the reduction variable is used in the loop, unless @@ -7939,7 +7777,6 @@ vectorizable_reduction (loop_vec_info loop_vinfo, OK to use them in a reduction chain or when the reduction group has just one element. */ if (lane_reducing - && slp_node && !REDUC_GROUP_FIRST_ELEMENT (stmt_info) && SLP_TREE_LANES (slp_node) > 1) { @@ -8017,7 +7854,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, /* If we have a condition reduction, see if we can simplify it further. */ if (reduction_type == COND_REDUCTION) { - if (slp_node && SLP_TREE_LANES (slp_node) != 1) + if (SLP_TREE_LANES (slp_node) != 1) return false; /* When the condition uses the reduction value in the condition, fail. */ @@ -8119,10 +7956,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, if (STMT_VINFO_LIVE_P (phi_info)) return false; - if (slp_node) - ncopies = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); - else - ncopies = vect_get_num_copies (loop_vinfo, vectype_in); + ncopies = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); gcc_assert (ncopies >= 1); @@ -8194,8 +8028,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, outer-loop vectorization is safe. Likewise when we are vectorizing a series of reductions using SLP and the VF is one the reductions are performed in scalar order. */ - if (slp_node - && !REDUC_GROUP_FIRST_ELEMENT (stmt_info) + if (!REDUC_GROUP_FIRST_ELEMENT (stmt_info) && known_eq (LOOP_VINFO_VECT_FACTOR (loop_vinfo), 1u)) ; else if (needs_fold_left_reduction_p (op.type, orig_code)) @@ -8227,7 +8060,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, || reduction_type == INTEGER_INDUC_COND_REDUCTION || reduction_type == CONST_COND_REDUCTION || reduction_type == EXTRACT_LAST_REDUCTION) - && slp_node + && 1 && ncopies > 1) { if (dump_enabled_p ()) @@ -8236,17 +8069,6 @@ vectorizable_reduction (loop_vec_info loop_vinfo, return false; } - if ((double_reduc || reduction_type != TREE_CODE_REDUCTION) - && !slp_node - && ncopies > 1) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "multiple types in double reduction or condition " - "reduction or fold-left reduction.\n"); - return false; - } - internal_fn reduc_fn = IFN_LAST; if (reduction_type == TREE_CODE_REDUCTION || reduction_type == FOLD_LEFT_REDUCTION @@ -8308,14 +8130,11 @@ vectorizable_reduction (loop_vec_info loop_vinfo, /* For SLP reductions, see if there is a neutral value we can use. */ tree neutral_op = NULL_TREE; - if (slp_node) - { - tree initial_value = NULL_TREE; - if (REDUC_GROUP_FIRST_ELEMENT (stmt_info) != NULL) - initial_value = vect_phi_initial_value (reduc_def_phi); - neutral_op = neutral_op_for_reduction (TREE_TYPE (vectype_out), - orig_code, initial_value); - } + tree initial_value = NULL_TREE; + if (REDUC_GROUP_FIRST_ELEMENT (stmt_info) != NULL) + initial_value = vect_phi_initial_value (reduc_def_phi); + neutral_op = neutral_op_for_reduction (TREE_TYPE (vectype_out), + orig_code, initial_value); if (double_reduc && reduction_type == FOLD_LEFT_REDUCTION) { @@ -8341,7 +8160,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, } if (reduction_type == FOLD_LEFT_REDUCTION - && (slp_node && SLP_TREE_LANES (slp_node) > 1) + && SLP_TREE_LANES (slp_node) > 1 && !REDUC_GROUP_FIRST_ELEMENT (stmt_info)) { /* We cannot use in-order reductions in this case because there is @@ -8370,8 +8189,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, } /* Check extra constraints for variable-length unchained SLP reductions. */ - if (slp_node - && !REDUC_GROUP_FIRST_ELEMENT (stmt_info) + if (!REDUC_GROUP_FIRST_ELEMENT (stmt_info) && !nunits_out.is_constant ()) { /* We checked above that we could build the initial vector when @@ -8465,9 +8283,8 @@ vectorizable_reduction (loop_vec_info loop_vinfo, own reduction accumulator since one of the main goals of unrolling a reduction is to reduce the aggregate loop-carried latency. */ if (ncopies > 1 - && (!slp_node - || (!REDUC_GROUP_FIRST_ELEMENT (stmt_info) - && SLP_TREE_LANES (slp_node) == 1)) + && !REDUC_GROUP_FIRST_ELEMENT (stmt_info) + && SLP_TREE_LANES (slp_node) == 1 && (STMT_VINFO_RELEVANT (stmt_info) <= vect_used_only_live) && reduc_chain_length == 1 && loop_vinfo->suggested_unroll_factor == 1) @@ -8518,8 +8335,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, reduction. */ single_defuse_cycle &= !lane_reducing; - if (slp_node - && (single_defuse_cycle || reduction_type == FOLD_LEFT_REDUCTION)) + if (single_defuse_cycle || reduction_type == FOLD_LEFT_REDUCTION) for (i = 0; i < (int) op.num_ops; i++) if (!vect_maybe_update_slp_op_vectype (slp_op[i], vectype_op[i])) { @@ -8549,7 +8365,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, { stmt_vec_info tem = vect_stmt_to_vectorize (STMT_VINFO_REDUC_DEF (phi_info)); - if (slp_node && REDUC_GROUP_FIRST_ELEMENT (tem)) + if (REDUC_GROUP_FIRST_ELEMENT (tem)) { gcc_assert (!REDUC_GROUP_NEXT_ELEMENT (tem)); tem = REDUC_GROUP_FIRST_ELEMENT (tem); @@ -8645,11 +8461,10 @@ vect_emulate_mixed_dot_prod (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, bool vect_transform_reduction (loop_vec_info loop_vinfo, stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, - gimple **vec_stmt, slp_tree slp_node) + slp_tree slp_node) { tree vectype_out = STMT_VINFO_VECTYPE (stmt_info); class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); - unsigned ncopies; unsigned vec_num; stmt_vec_info reduc_info = info_for_reduction (loop_vinfo, stmt_info); @@ -8677,16 +8492,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo, if (!vectype_in) vectype_in = STMT_VINFO_VECTYPE (stmt_info); - if (slp_node) - { - ncopies = 1; - vec_num = vect_get_num_copies (loop_vinfo, slp_node, vectype_in); - } - else - { - ncopies = vect_get_num_copies (loop_vinfo, vectype_in); - vec_num = 1; - } + vec_num = vect_get_num_copies (loop_vinfo, slp_node, vectype_in); code_helper code = canonicalize_code (op.code, op.type); internal_fn cond_fn = get_conditional_internal_fn (code, op.type); @@ -8702,10 +8508,6 @@ vect_transform_reduction (loop_vec_info loop_vinfo, if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "transform reduction.\n"); - /* FORNOW: Multiple types are not supported for condition. */ - if (code == COND_EXPR) - gcc_assert (ncopies == 1); - /* A binary COND_OP reduction must have the same definition and else value. */ bool cond_fn_p = code.is_internal_fn () @@ -8729,8 +8531,8 @@ vect_transform_reduction (loop_vec_info loop_vinfo, internal_fn reduc_fn = STMT_VINFO_REDUC_FN (reduc_info); gcc_assert (code.is_tree_code () || cond_fn_p); return vectorize_fold_left_reduction - (loop_vinfo, stmt_info, gsi, vec_stmt, slp_node, reduc_def_phi, - code, reduc_fn, op.ops, op.num_ops, vectype_in, + (loop_vinfo, stmt_info, gsi, slp_node, reduc_def_phi, + code, reduc_fn, op.num_ops, vectype_in, reduc_index, masks, lens); } @@ -8748,33 +8550,12 @@ vect_transform_reduction (loop_vec_info loop_vinfo, tree scalar_dest = gimple_get_lhs (stmt_info->stmt); tree vec_dest = vect_create_destination_var (scalar_dest, vectype_out); - if (lane_reducing && !slp_node && !single_defuse_cycle) - { - /* Note: there are still vectorizable cases that can not be handled by - single-lane slp. Probably it would take some time to evolve the - feature to a mature state. So we have to keep the below non-slp code - path as failsafe for lane-reducing support. */ - gcc_assert (op.num_ops <= 3); - for (unsigned i = 0; i < op.num_ops; i++) - { - unsigned oprnd_ncopies = ncopies; - - if ((int) i == reduc_index) - { - tree vectype = STMT_VINFO_VECTYPE (stmt_info); - oprnd_ncopies = vect_get_num_copies (loop_vinfo, vectype); - } - - vect_get_vec_defs_for_operand (loop_vinfo, stmt_info, oprnd_ncopies, - op.ops[i], &vec_oprnds[i]); - } - } /* Get NCOPIES vector definitions for all operands except the reduction definition. */ - else if (!cond_fn_p) + if (!cond_fn_p) { gcc_assert (reduc_index >= 0 && reduc_index <= 2); - vect_get_vec_defs (loop_vinfo, stmt_info, slp_node, ncopies, + vect_get_vec_defs (loop_vinfo, stmt_info, slp_node, 1, single_defuse_cycle && reduc_index == 0 ? NULL_TREE : op.ops[0], &vec_oprnds[0], single_defuse_cycle && reduc_index == 1 @@ -8789,7 +8570,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo, vectype. */ gcc_assert (single_defuse_cycle && (reduc_index == 1 || reduc_index == 2)); - vect_get_vec_defs (loop_vinfo, stmt_info, slp_node, ncopies, op.ops[0], + vect_get_vec_defs (loop_vinfo, stmt_info, slp_node, 1, op.ops[0], truth_type_for (vectype_in), &vec_oprnds[0], reduc_index == 1 ? NULL_TREE : op.ops[1], NULL_TREE, &vec_oprnds[1], @@ -8945,7 +8726,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo, handle over the operand to other dependent statements. */ gcc_assert (reduc_vop); - if (slp_node && TREE_CODE (reduc_vop) == SSA_NAME + if (TREE_CODE (reduc_vop) == SSA_NAME && !SSA_NAME_IS_DEFAULT_DEF (reduc_vop)) new_stmt = SSA_NAME_DEF_STMT (reduc_vop); else @@ -8969,7 +8750,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo, std::swap (vop[0], vop[1]); } tree mask = vect_get_loop_mask (loop_vinfo, gsi, masks, - vec_num * ncopies, vectype_in, + vec_num, vectype_in, mask_index++); gcall *call = gimple_build_call_internal (cond_fn, 4, mask, vop[0], vop[1], vop[0]); @@ -8987,7 +8768,7 @@ vect_transform_reduction (loop_vec_info loop_vinfo, if (masked_loop_p && mask_by_cond_expr) { tree mask = vect_get_loop_mask (loop_vinfo, gsi, masks, - vec_num * ncopies, vectype_in, + vec_num, vectype_in, mask_index++); build_vect_cond_expr (code, vop, mask, gsi); } @@ -9015,15 +8796,10 @@ vect_transform_reduction (loop_vec_info loop_vinfo, if (single_defuse_cycle && i < num - 1) vec_oprnds[reduc_index].safe_push (gimple_get_lhs (new_stmt)); - else if (slp_node) - slp_node->push_vec_def (new_stmt); else - STMT_VINFO_VEC_STMTS (stmt_info).safe_push (new_stmt); + slp_node->push_vec_def (new_stmt); } - if (!slp_node) - *vec_stmt = STMT_VINFO_VEC_STMTS (stmt_info)[0]; - return true; } @@ -9031,14 +8807,12 @@ vect_transform_reduction (loop_vec_info loop_vinfo, bool vect_transform_cycle_phi (loop_vec_info loop_vinfo, - stmt_vec_info stmt_info, gimple **vec_stmt, + stmt_vec_info stmt_info, slp_tree slp_node, slp_instance slp_node_instance) { tree vectype_out = STMT_VINFO_VECTYPE (stmt_info); class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); int i; - int ncopies; - int j; bool nested_cycle = false; int vec_num; @@ -9058,25 +8832,12 @@ vect_transform_cycle_phi (loop_vec_info loop_vinfo, /* Leave the scalar phi in place. */ return true; - if (slp_node) - { - vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); - ncopies = 1; - } - else - { - vec_num = 1; - ncopies = vect_get_num_copies (loop_vinfo, - STMT_VINFO_VECTYPE (stmt_info)); - } + vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); /* Check whether we should use a single PHI node and accumulate vectors to one before the backedge. */ if (STMT_VINFO_FORCE_SINGLE_CYCLE (reduc_info)) - { - ncopies = 1; - vec_num = 1; - } + vec_num = 1; /* Create the destination vector */ gphi *phi = as_a <gphi *> (stmt_info->stmt); @@ -9086,158 +8847,86 @@ vect_transform_cycle_phi (loop_vec_info loop_vinfo, /* Get the loop-entry arguments. */ tree vec_initial_def = NULL_TREE; auto_vec<tree> vec_initial_defs; - if (slp_node) + vec_initial_defs.reserve (vec_num); + /* Optimize: if initial_def is for REDUC_MAX smaller than the base + and we can't use zero for induc_val, use initial_def. Similarly + for REDUC_MIN and initial_def larger than the base. */ + if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION) { - vec_initial_defs.reserve (vec_num); - /* Optimize: if initial_def is for REDUC_MAX smaller than the base - and we can't use zero for induc_val, use initial_def. Similarly - for REDUC_MIN and initial_def larger than the base. */ - if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION) - { - gcc_assert (SLP_TREE_LANES (slp_node) == 1); - tree initial_def = vect_phi_initial_value (phi); - reduc_info->reduc_initial_values.safe_push (initial_def); - tree induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info); - if (TREE_CODE (initial_def) == INTEGER_CST - && !integer_zerop (induc_val) - && ((STMT_VINFO_REDUC_CODE (reduc_info) == MAX_EXPR - && tree_int_cst_lt (initial_def, induc_val)) - || (STMT_VINFO_REDUC_CODE (reduc_info) == MIN_EXPR - && tree_int_cst_lt (induc_val, initial_def)))) - { - induc_val = initial_def; - /* Communicate we used the initial_def to epilouge - generation. */ - STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info) = NULL_TREE; - } - vec_initial_defs.quick_push - (build_vector_from_val (vectype_out, induc_val)); - } - else if (nested_cycle) - { - unsigned phi_idx = loop_preheader_edge (loop)->dest_idx; - vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[phi_idx], - &vec_initial_defs); - } - else + gcc_assert (SLP_TREE_LANES (slp_node) == 1); + tree initial_def = vect_phi_initial_value (phi); + reduc_info->reduc_initial_values.safe_push (initial_def); + tree induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info); + if (TREE_CODE (initial_def) == INTEGER_CST + && !integer_zerop (induc_val) + && ((STMT_VINFO_REDUC_CODE (reduc_info) == MAX_EXPR + && tree_int_cst_lt (initial_def, induc_val)) + || (STMT_VINFO_REDUC_CODE (reduc_info) == MIN_EXPR + && tree_int_cst_lt (induc_val, initial_def)))) { - gcc_assert (slp_node == slp_node_instance->reduc_phis); - vec<tree> &initial_values = reduc_info->reduc_initial_values; - vec<stmt_vec_info> &stmts = SLP_TREE_SCALAR_STMTS (slp_node); - - unsigned int num_phis = stmts.length (); - if (REDUC_GROUP_FIRST_ELEMENT (reduc_stmt_info)) - num_phis = 1; - initial_values.reserve (num_phis); - for (unsigned int i = 0; i < num_phis; ++i) - { - gphi *this_phi = as_a<gphi *> (stmts[i]->stmt); - initial_values.quick_push (vect_phi_initial_value (this_phi)); - } - if (vec_num == 1) - vect_find_reusable_accumulator (loop_vinfo, reduc_info); - if (!initial_values.is_empty ()) - { - tree initial_value - = (num_phis == 1 ? initial_values[0] : NULL_TREE); - code_helper code = STMT_VINFO_REDUC_CODE (reduc_info); - tree neutral_op - = neutral_op_for_reduction (TREE_TYPE (vectype_out), - code, initial_value); - /* Try to simplify the vector initialization by applying an - adjustment after the reduction has been performed. This - can also break a critical path but on the other hand - requires to keep the initial value live across the loop. */ - if (neutral_op - && initial_values.length () == 1 - && !reduc_info->reused_accumulator - && STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def - && !operand_equal_p (neutral_op, initial_values[0])) - { - STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT (reduc_info) - = initial_values[0]; - initial_values[0] = neutral_op; - } - get_initial_defs_for_reduction (loop_vinfo, reduc_info, - &vec_initial_defs, vec_num, - stmts.length (), neutral_op); - } + induc_val = initial_def; + /* Communicate we used the initial_def to epilouge + generation. */ + STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info) = NULL_TREE; } + vec_initial_defs.quick_push + (build_vector_from_val (vectype_out, induc_val)); + } + else if (nested_cycle) + { + unsigned phi_idx = loop_preheader_edge (loop)->dest_idx; + vect_get_slp_defs (SLP_TREE_CHILDREN (slp_node)[phi_idx], + &vec_initial_defs); } else { - /* Get at the scalar def before the loop, that defines the initial - value of the reduction variable. */ - tree initial_def = vect_phi_initial_value (phi); - reduc_info->reduc_initial_values.safe_push (initial_def); - /* Optimize: if initial_def is for REDUC_MAX smaller than the base - and we can't use zero for induc_val, use initial_def. Similarly - for REDUC_MIN and initial_def larger than the base. */ - if (STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION) - { - tree induc_val = STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info); - if (TREE_CODE (initial_def) == INTEGER_CST - && !integer_zerop (induc_val) - && ((STMT_VINFO_REDUC_CODE (reduc_info) == MAX_EXPR - && tree_int_cst_lt (initial_def, induc_val)) - || (STMT_VINFO_REDUC_CODE (reduc_info) == MIN_EXPR - && tree_int_cst_lt (induc_val, initial_def)))) + gcc_assert (slp_node == slp_node_instance->reduc_phis); + vec<tree> &initial_values = reduc_info->reduc_initial_values; + vec<stmt_vec_info> &stmts = SLP_TREE_SCALAR_STMTS (slp_node); + + unsigned int num_phis = stmts.length (); + if (REDUC_GROUP_FIRST_ELEMENT (reduc_stmt_info)) + num_phis = 1; + initial_values.reserve (num_phis); + for (unsigned int i = 0; i < num_phis; ++i) + { + gphi *this_phi = as_a<gphi *> (stmts[i]->stmt); + initial_values.quick_push (vect_phi_initial_value (this_phi)); + } + if (vec_num == 1) + vect_find_reusable_accumulator (loop_vinfo, reduc_info); + if (!initial_values.is_empty ()) + { + tree initial_value + = (num_phis == 1 ? initial_values[0] : NULL_TREE); + code_helper code = STMT_VINFO_REDUC_CODE (reduc_info); + tree neutral_op + = neutral_op_for_reduction (TREE_TYPE (vectype_out), + code, initial_value); + /* Try to simplify the vector initialization by applying an + adjustment after the reduction has been performed. This + can also break a critical path but on the other hand + requires to keep the initial value live across the loop. */ + if (neutral_op + && initial_values.length () == 1 + && !reduc_info->reused_accumulator + && STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def + && !operand_equal_p (neutral_op, initial_values[0])) { - induc_val = initial_def; - /* Communicate we used the initial_def to epilouge - generation. */ - STMT_VINFO_VEC_INDUC_COND_INITIAL_VAL (reduc_info) = NULL_TREE; - } - vec_initial_def = build_vector_from_val (vectype_out, induc_val); - } - else if (nested_cycle) - { - /* Do not use an adjustment def as that case is not supported - correctly if ncopies is not one. */ - vect_get_vec_defs_for_operand (loop_vinfo, reduc_stmt_info, - ncopies, initial_def, - &vec_initial_defs); - } - else if (STMT_VINFO_REDUC_TYPE (reduc_info) == CONST_COND_REDUCTION - || STMT_VINFO_REDUC_TYPE (reduc_info) == COND_REDUCTION) - /* Fill the initial vector with the initial scalar value. */ - vec_initial_def - = get_initial_def_for_reduction (loop_vinfo, reduc_stmt_info, - initial_def, initial_def); - else - { - if (ncopies == 1) - vect_find_reusable_accumulator (loop_vinfo, reduc_info); - if (!reduc_info->reduc_initial_values.is_empty ()) - { - initial_def = reduc_info->reduc_initial_values[0]; - code_helper code = STMT_VINFO_REDUC_CODE (reduc_info); - tree neutral_op - = neutral_op_for_reduction (TREE_TYPE (initial_def), - code, initial_def); - gcc_assert (neutral_op); - /* Try to simplify the vector initialization by applying an - adjustment after the reduction has been performed. */ - if (!reduc_info->reused_accumulator - && STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def - && !operand_equal_p (neutral_op, initial_def)) - { - STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT (reduc_info) - = initial_def; - initial_def = neutral_op; - } - vec_initial_def - = get_initial_def_for_reduction (loop_vinfo, reduc_info, - initial_def, neutral_op); + STMT_VINFO_REDUC_EPILOGUE_ADJUSTMENT (reduc_info) + = initial_values[0]; + initial_values[0] = neutral_op; } + get_initial_defs_for_reduction (loop_vinfo, reduc_info, + &vec_initial_defs, vec_num, + stmts.length (), neutral_op); } } if (vec_initial_def) { - vec_initial_defs.create (ncopies); - for (i = 0; i < ncopies; ++i) - vec_initial_defs.quick_push (vec_initial_def); + vec_initial_defs.create (1); + vec_initial_defs.quick_push (vec_initial_def); } if (auto *accumulator = reduc_info->reused_accumulator) @@ -9312,29 +9001,15 @@ vect_transform_cycle_phi (loop_vec_info loop_vinfo, for (i = 0; i < vec_num; i++) { tree vec_init_def = vec_initial_defs[i]; - for (j = 0; j < ncopies; j++) - { - /* Create the reduction-phi that defines the reduction - operand. */ - gphi *new_phi = create_phi_node (vec_dest, loop->header); - - /* Set the loop-entry arg of the reduction-phi. */ - if (j != 0 && nested_cycle) - vec_init_def = vec_initial_defs[j]; - add_phi_arg (new_phi, vec_init_def, loop_preheader_edge (loop), - UNKNOWN_LOCATION); + /* Create the reduction-phi that defines the reduction + operand. */ + gphi *new_phi = create_phi_node (vec_dest, loop->header); + add_phi_arg (new_phi, vec_init_def, loop_preheader_edge (loop), + UNKNOWN_LOCATION); - /* The loop-latch arg is set in epilogue processing. */ + /* The loop-latch arg is set in epilogue processing. */ - if (slp_node) - slp_node->push_vec_def (new_phi); - else - { - if (j == 0) - *vec_stmt = new_phi; - STMT_VINFO_VEC_STMTS (stmt_info).safe_push (new_phi); - } - } + slp_node->push_vec_def (new_phi); } return true; @@ -9344,7 +9019,7 @@ vect_transform_cycle_phi (loop_vec_info loop_vinfo, bool vectorizable_lc_phi (loop_vec_info loop_vinfo, - stmt_vec_info stmt_info, gimple **vec_stmt, + stmt_vec_info stmt_info, slp_tree slp_node) { if (!loop_vinfo @@ -9356,22 +9031,25 @@ vectorizable_lc_phi (loop_vec_info loop_vinfo, && STMT_VINFO_DEF_TYPE (stmt_info) != vect_double_reduction_def) return false; - if (!vec_stmt) /* transformation not required. */ + /* Deal with copies from externs or constants that disguise as + loop-closed PHI nodes (PR97886). */ + if (!vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0], + SLP_TREE_VECTYPE (slp_node))) { - /* Deal with copies from externs or constants that disguise as - loop-closed PHI nodes (PR97886). */ - if (slp_node - && !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0], - SLP_TREE_VECTYPE (slp_node))) - { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "incompatible vector types for invariants\n"); - return false; - } - STMT_VINFO_TYPE (stmt_info) = lc_phi_info_type; - return true; + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "incompatible vector types for invariants\n"); + return false; } + STMT_VINFO_TYPE (stmt_info) = lc_phi_info_type; + return true; +} + +bool +vect_transform_lc_phi (loop_vec_info loop_vinfo, + stmt_vec_info stmt_info, + slp_tree slp_node) +{ tree vectype = STMT_VINFO_VECTYPE (stmt_info); tree scalar_dest = gimple_phi_result (stmt_info->stmt); @@ -9379,21 +9057,15 @@ vectorizable_lc_phi (loop_vec_info loop_vinfo, edge e = single_pred_edge (bb); tree vec_dest = vect_create_destination_var (scalar_dest, vectype); auto_vec<tree> vec_oprnds; - vect_get_vec_defs (loop_vinfo, stmt_info, slp_node, - !slp_node ? vect_get_num_copies (loop_vinfo, vectype) : 1, + vect_get_vec_defs (loop_vinfo, stmt_info, slp_node, 1, gimple_phi_arg_def (stmt_info->stmt, 0), &vec_oprnds); for (unsigned i = 0; i < vec_oprnds.length (); i++) { /* Create the vectorized LC PHI node. */ gphi *new_phi = create_phi_node (vec_dest, bb); add_phi_arg (new_phi, vec_oprnds[i], e, UNKNOWN_LOCATION); - if (slp_node) - slp_node->push_vec_def (new_phi); - else - STMT_VINFO_VEC_STMTS (stmt_info).safe_push (new_phi); + slp_node->push_vec_def (new_phi); } - if (!slp_node) - *vec_stmt = STMT_VINFO_VEC_STMTS (stmt_info)[0]; return true; } @@ -12203,7 +11875,7 @@ update_epilogue_loop_vinfo (class loop *epilogue, tree advance) gimple *stmt = STMT_VINFO_STMT (related_vinfo); stmt_worklist.safe_push (stmt); /* Set BB such that the assert in - 'get_initial_def_for_reduction' is able to determine that + 'get_initial_defs_for_reduction' is able to determine that the BB of the related stmt is inside this loop. */ gimple_set_bb (stmt, gimple_bb (new_stmt)); diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 562e222..857517f 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -2617,13 +2617,14 @@ out: if (oprnds_info[0]->def_stmts[0] && is_a<gassign *> (oprnds_info[0]->def_stmts[0]->stmt)) code = gimple_assign_rhs_code (oprnds_info[0]->def_stmts[0]->stmt); + basic_block bb = nullptr; for (unsigned j = 0; j < group_size; ++j) { FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info) { stmt_vec_info stmt_info = oprnd_info->def_stmts[j]; - if (!stmt_info || !stmt_info->stmt + if (!stmt_info || !is_a<gassign *> (stmt_info->stmt) || gimple_assign_rhs_code (stmt_info->stmt) != code || skip_args[i]) @@ -2631,6 +2632,14 @@ out: success = false; break; } + /* Avoid mixing lanes with defs in different basic-blocks. */ + if (!bb) + bb = gimple_bb (vect_orig_stmt (stmt_info)->stmt); + else if (gimple_bb (vect_orig_stmt (stmt_info)->stmt) != bb) + { + success = false; + break; + } bool exists; unsigned &stmt_idx @@ -5042,14 +5051,17 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size, vec<stmt_vec_info> roots = vNULL; vec<tree> remain = vNULL; gphi *phi = as_a<gphi *> (STMT_VINFO_STMT (stmt_info)); - stmts.create (1); tree def = gimple_phi_arg_def_from_edge (phi, latch_e); stmt_vec_info lc_info = loop_vinfo->lookup_def (def); - stmts.quick_push (vect_stmt_to_vectorize (lc_info)); - vect_build_slp_instance (vinfo, slp_inst_kind_reduc_group, - stmts, roots, remain, - max_tree_size, &limit, - bst_map, NULL, force_single_lane); + if (lc_info) + { + stmts.create (1); + stmts.quick_push (vect_stmt_to_vectorize (lc_info)); + vect_build_slp_instance (vinfo, slp_inst_kind_reduc_group, + stmts, roots, remain, + max_tree_size, &limit, + bst_map, NULL, force_single_lane); + } /* When the latch def is from a different cycle this can only be a induction. Build a simple instance for this. ??? We should be able to start discovery from the PHI @@ -5059,8 +5071,6 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size, tem.quick_push (stmt_info); if (!bst_map->get (tem)) { - gcc_assert (STMT_VINFO_DEF_TYPE (stmt_info) - == vect_induction_def); stmts.create (1); stmts.quick_push (stmt_info); vect_build_slp_instance (vinfo, slp_inst_kind_reduc_group, @@ -7834,21 +7844,70 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node, node, node_instance, cost_vec); } +static int +sort_ints (const void *a_, const void *b_) +{ + int a = *(const int *)a_; + int b = *(const int *)b_; + return a - b; +} + /* Verify if we can externalize a set of internal defs. */ static bool vect_slp_can_convert_to_external (const vec<stmt_vec_info> &stmts) { + /* Constant generation uses get_later_stmt which can only handle + defs from the same BB or a set of defs that can be ordered + with a dominance query. */ basic_block bb = NULL; + bool all_same = true; + auto_vec<int> bbs; + bbs.reserve_exact (stmts.length ()); for (stmt_vec_info stmt : stmts) - if (!stmt) - return false; - /* Constant generation uses get_later_stmt which can only handle - defs from the same BB. */ - else if (!bb) - bb = gimple_bb (stmt->stmt); - else if (gimple_bb (stmt->stmt) != bb) + { + if (!stmt) + return false; + else if (!bb) + bb = gimple_bb (stmt->stmt); + else if (gimple_bb (stmt->stmt) != bb) + all_same = false; + bbs.quick_push (gimple_bb (stmt->stmt)->index); + } + if (all_same) + return true; + + /* Produce a vector of unique BB indexes for the defs. */ + bbs.qsort (sort_ints); + unsigned i, j; + for (i = 1, j = 1; i < bbs.length (); ++i) + if (bbs[i] != bbs[j-1]) + bbs[j++] = bbs[i]; + gcc_assert (j >= 2); + bbs.truncate (j); + + if (bbs.length () == 2) + return (dominated_by_p (CDI_DOMINATORS, + BASIC_BLOCK_FOR_FN (cfun, bbs[0]), + BASIC_BLOCK_FOR_FN (cfun, bbs[1])) + || dominated_by_p (CDI_DOMINATORS, + BASIC_BLOCK_FOR_FN (cfun, bbs[1]), + BASIC_BLOCK_FOR_FN (cfun, bbs[0]))); + + /* ??? For more than two BBs we can sort the vector and verify the + result is a total order. But we can't use vec::qsort with a + compare function using a dominance query since there's no way to + signal failure and any fallback for an unordered pair would + fail qsort_chk later. + For now simply hope that ordering after BB index provides the + best candidate total order. If required we can implement our + own mergesort or export an entry without checking. */ + for (unsigned i = 1; i < bbs.length (); ++i) + if (!dominated_by_p (CDI_DOMINATORS, + BASIC_BLOCK_FOR_FN (cfun, bbs[i]), + BASIC_BLOCK_FOR_FN (cfun, bbs[i-1]))) return false; + return true; } diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index ea0b426..bd390b2 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -419,18 +419,22 @@ vect_stmt_relevant_p (stmt_vec_info stmt_info, loop_vec_info loop_vinfo, } } - /* Check if it's an induction and multiple exits. In this case there will be - a usage later on after peeling which is needed for the alternate exit. */ + /* Check if it's a not live PHI and multiple exits. In this case + there will be a usage later on after peeling which is needed for the + alternate exit. */ if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo) - && STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def) + && is_a <gphi *> (stmt) + && gimple_bb (stmt) == LOOP_VINFO_LOOP (loop_vinfo)->header + && ((! VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_info)) + && ! *live_p) + || STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def)) { if (dump_enabled_p ()) - dump_printf_loc (MSG_NOTE, vect_location, - "vec_stmt_relevant_p: induction forced for " - "early break.\n"); + dump_printf_loc (MSG_NOTE, vect_location, + "vec_stmt_relevant_p: PHI forced live for " + "early break.\n"); LOOP_VINFO_EARLY_BREAKS_LIVE_IVS (loop_vinfo).safe_push (stmt_info); *live_p = true; - } if (*live_p && *relevant == vect_unused_in_scope @@ -714,6 +718,8 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo, bool *fatal) bb = bbs[i]; for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) { + if (virtual_operand_p (gimple_phi_result (gsi_stmt (si)))) + continue; stmt_vec_info phi_info = loop_vinfo->lookup_stmt (gsi_stmt (si)); if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "init: phi relevant? %G", @@ -6806,7 +6812,6 @@ vectorizable_operation (vec_info *vinfo, poly_uint64 nunits_in; poly_uint64 nunits_out; tree vectype_out; - unsigned int ncopies; int vec_num; int i; vec<tree> vec_oprnds0 = vNULL; @@ -6867,7 +6872,7 @@ vectorizable_operation (vec_info *vinfo, } scalar_dest = gimple_assign_lhs (stmt); - vectype_out = STMT_VINFO_VECTYPE (stmt_info); + vectype_out = SLP_TREE_VECTYPE (slp_node); /* Most operations cannot handle bit-precision types without extra truncations. */ @@ -6978,20 +6983,8 @@ vectorizable_operation (vec_info *vinfo, } /* Multiple types in SLP are handled by creating the appropriate number of - vectorized stmts for each SLP node. Hence, NCOPIES is always 1 in - case of SLP. */ - if (slp_node) - { - ncopies = 1; - vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); - } - else - { - ncopies = vect_get_num_copies (loop_vinfo, vectype); - vec_num = 1; - } - - gcc_assert (ncopies >= 1); + vectorized stmts for each SLP node. */ + vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); /* Reject attempts to combine mask types with nonmask types, e.g. if we have an AND between a (nonmask) boolean loaded from memory and @@ -7033,9 +7026,10 @@ vectorizable_operation (vec_info *vinfo, ops we have to lower the lowering code assumes we are dealing with word_mode. */ if (!INTEGRAL_TYPE_P (TREE_TYPE (vectype)) + || !GET_MODE_SIZE (vec_mode).is_constant () || (((code == PLUS_EXPR || code == MINUS_EXPR || code == NEGATE_EXPR) - || !target_support_p) - && maybe_ne (GET_MODE_SIZE (vec_mode), UNITS_PER_WORD)) + || !target_support_p) + && maybe_ne (GET_MODE_SIZE (vec_mode), UNITS_PER_WORD)) /* Check only during analysis. */ || (!vec_stmt && !vect_can_vectorize_without_simd_p (code))) { @@ -7075,12 +7069,12 @@ vectorizable_operation (vec_info *vinfo, if (cond_len_fn != IFN_LAST && direct_internal_fn_supported_p (cond_len_fn, vectype, OPTIMIZE_FOR_SPEED)) - vect_record_loop_len (loop_vinfo, lens, ncopies * vec_num, vectype, + vect_record_loop_len (loop_vinfo, lens, vec_num, vectype, 1); else if (cond_fn != IFN_LAST && direct_internal_fn_supported_p (cond_fn, vectype, OPTIMIZE_FOR_SPEED)) - vect_record_loop_mask (loop_vinfo, masks, ncopies * vec_num, + vect_record_loop_mask (loop_vinfo, masks, vec_num, vectype, NULL); else { @@ -7093,10 +7087,9 @@ vectorizable_operation (vec_info *vinfo, } /* Put types on constant and invariant SLP children. */ - if (slp_node - && (!vect_maybe_update_slp_op_vectype (slp_op0, vectype) - || !vect_maybe_update_slp_op_vectype (slp_op1, vectype) - || !vect_maybe_update_slp_op_vectype (slp_op2, vectype))) + if (!vect_maybe_update_slp_op_vectype (slp_op0, vectype) + || !vect_maybe_update_slp_op_vectype (slp_op1, vectype) + || !vect_maybe_update_slp_op_vectype (slp_op2, vectype)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -7107,15 +7100,14 @@ vectorizable_operation (vec_info *vinfo, STMT_VINFO_TYPE (stmt_info) = op_vec_info_type; DUMP_VECT_SCOPE ("vectorizable_operation"); vect_model_simple_cost (vinfo, stmt_info, - ncopies, dt, ndts, slp_node, cost_vec); + 1, dt, ndts, slp_node, cost_vec); if (using_emulated_vectors_p) { /* The above vect_model_simple_cost call handles constants in the prologue and (mis-)costs one of the stmts as vector stmt. See below for the actual lowering that will be applied. */ - unsigned n - = slp_node ? SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node) : ncopies; + unsigned n = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); switch (code) { case PLUS_EXPR: @@ -7168,60 +7160,7 @@ vectorizable_operation (vec_info *vinfo, else vec_dest = vect_create_destination_var (scalar_dest, vectype_out); - /* In case the vectorization factor (VF) is bigger than the number - of elements that we can fit in a vectype (nunits), we have to generate - more than one vector stmt - i.e - we need to "unroll" the - vector stmt by a factor VF/nunits. In doing so, we record a pointer - from one copy of the vector stmt to the next, in the field - STMT_VINFO_RELATED_STMT. This is necessary in order to allow following - stages to find the correct vector defs to be used when vectorizing - stmts that use the defs of the current stmt. The example below - illustrates the vectorization process when VF=16 and nunits=4 (i.e., - we need to create 4 vectorized stmts): - - before vectorization: - RELATED_STMT VEC_STMT - S1: x = memref - - - S2: z = x + 1 - - - - step 1: vectorize stmt S1 (done in vectorizable_load. See more details - there): - RELATED_STMT VEC_STMT - VS1_0: vx0 = memref0 VS1_1 - - VS1_1: vx1 = memref1 VS1_2 - - VS1_2: vx2 = memref2 VS1_3 - - VS1_3: vx3 = memref3 - - - S1: x = load - VS1_0 - S2: z = x + 1 - - - - step2: vectorize stmt S2 (done here): - To vectorize stmt S2 we first need to find the relevant vector - def for the first operand 'x'. This is, as usual, obtained from - the vector stmt recorded in the STMT_VINFO_VEC_STMT of the stmt - that defines 'x' (S1). This way we find the stmt VS1_0, and the - relevant vector def 'vx0'. Having found 'vx0' we can generate - the vector stmt VS2_0, and as usual, record it in the - STMT_VINFO_VEC_STMT of stmt S2. - When creating the second copy (VS2_1), we obtain the relevant vector - def from the vector stmt recorded in the STMT_VINFO_RELATED_STMT of - stmt VS1_0. This way we find the stmt VS1_1 and the relevant - vector def 'vx1'. Using 'vx1' we create stmt VS2_1 and record a - pointer to it in the STMT_VINFO_RELATED_STMT of the vector stmt VS2_0. - Similarly when creating stmts VS2_2 and VS2_3. This is the resulting - chain of stmts and pointers: - RELATED_STMT VEC_STMT - VS1_0: vx0 = memref0 VS1_1 - - VS1_1: vx1 = memref1 VS1_2 - - VS1_2: vx2 = memref2 VS1_3 - - VS1_3: vx3 = memref3 - - - S1: x = load - VS1_0 - VS2_0: vz0 = vx0 + v1 VS2_1 - - VS2_1: vz1 = vx1 + v1 VS2_2 - - VS2_2: vz2 = vx2 + v1 VS2_3 - - VS2_3: vz3 = vx3 + v1 - - - S2: z = x + 1 - VS2_0 */ - - vect_get_vec_defs (vinfo, stmt_info, slp_node, ncopies, + vect_get_vec_defs (vinfo, stmt_info, slp_node, 1, op0, &vec_oprnds0, op1, &vec_oprnds1, op2, &vec_oprnds2); /* Arguments are ready. Create the new vector stmt. */ FOR_EACH_VEC_ELT (vec_oprnds0, i, vop0) @@ -7230,88 +7169,108 @@ vectorizable_operation (vec_info *vinfo, vop1 = ((op_type == binary_op || op_type == ternary_op) ? vec_oprnds1[i] : NULL_TREE); vop2 = ((op_type == ternary_op) ? vec_oprnds2[i] : NULL_TREE); - if (using_emulated_vectors_p - && (code == PLUS_EXPR || code == MINUS_EXPR || code == NEGATE_EXPR)) + if (using_emulated_vectors_p) { /* Lower the operation. This follows vector lowering. */ - unsigned int width = vector_element_bits (vectype); - tree inner_type = TREE_TYPE (vectype); - tree word_type - = build_nonstandard_integer_type (GET_MODE_BITSIZE (word_mode), 1); - HOST_WIDE_INT max = GET_MODE_MASK (TYPE_MODE (inner_type)); - tree low_bits = build_replicated_int_cst (word_type, width, max >> 1); - tree high_bits - = build_replicated_int_cst (word_type, width, max & ~(max >> 1)); + tree word_type = build_nonstandard_integer_type + (GET_MODE_BITSIZE (vec_mode).to_constant (), 1); tree wvop0 = make_ssa_name (word_type); new_stmt = gimple_build_assign (wvop0, VIEW_CONVERT_EXPR, build1 (VIEW_CONVERT_EXPR, word_type, vop0)); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); - tree result_low, signs; - if (code == PLUS_EXPR || code == MINUS_EXPR) + tree wvop1 = NULL_TREE; + if (vop1) { - tree wvop1 = make_ssa_name (word_type); + wvop1 = make_ssa_name (word_type); new_stmt = gimple_build_assign (wvop1, VIEW_CONVERT_EXPR, build1 (VIEW_CONVERT_EXPR, word_type, vop1)); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); - signs = make_ssa_name (word_type); - new_stmt = gimple_build_assign (signs, - BIT_XOR_EXPR, wvop0, wvop1); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); - tree b_low = make_ssa_name (word_type); - new_stmt = gimple_build_assign (b_low, - BIT_AND_EXPR, wvop1, low_bits); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); - tree a_low = make_ssa_name (word_type); - if (code == PLUS_EXPR) - new_stmt = gimple_build_assign (a_low, - BIT_AND_EXPR, wvop0, low_bits); - else - new_stmt = gimple_build_assign (a_low, - BIT_IOR_EXPR, wvop0, high_bits); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); - if (code == MINUS_EXPR) + } + + tree result_low; + if (code == PLUS_EXPR || code == MINUS_EXPR || code == NEGATE_EXPR) + { + unsigned int width = vector_element_bits (vectype); + tree inner_type = TREE_TYPE (vectype); + HOST_WIDE_INT max = GET_MODE_MASK (TYPE_MODE (inner_type)); + tree low_bits + = build_replicated_int_cst (word_type, width, max >> 1); + tree high_bits + = build_replicated_int_cst (word_type, + width, max & ~(max >> 1)); + tree signs; + if (code == PLUS_EXPR || code == MINUS_EXPR) { - new_stmt = gimple_build_assign (NULL_TREE, - BIT_NOT_EXPR, signs); + signs = make_ssa_name (word_type); + new_stmt = gimple_build_assign (signs, + BIT_XOR_EXPR, wvop0, wvop1); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + tree b_low = make_ssa_name (word_type); + new_stmt = gimple_build_assign (b_low, BIT_AND_EXPR, + wvop1, low_bits); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + tree a_low = make_ssa_name (word_type); + if (code == PLUS_EXPR) + new_stmt = gimple_build_assign (a_low, BIT_AND_EXPR, + wvop0, low_bits); + else + new_stmt = gimple_build_assign (a_low, BIT_IOR_EXPR, + wvop0, high_bits); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + if (code == MINUS_EXPR) + { + new_stmt = gimple_build_assign (NULL_TREE, + BIT_NOT_EXPR, signs); + signs = make_ssa_name (word_type); + gimple_assign_set_lhs (new_stmt, signs); + vect_finish_stmt_generation (vinfo, stmt_info, + new_stmt, gsi); + } + new_stmt = gimple_build_assign (NULL_TREE, BIT_AND_EXPR, + signs, high_bits); signs = make_ssa_name (word_type); gimple_assign_set_lhs (new_stmt, signs); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + result_low = make_ssa_name (word_type); + new_stmt = gimple_build_assign (result_low, code, + a_low, b_low); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); } - new_stmt = gimple_build_assign (NULL_TREE, - BIT_AND_EXPR, signs, high_bits); - signs = make_ssa_name (word_type); - gimple_assign_set_lhs (new_stmt, signs); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + else /* if (code == NEGATE_EXPR) */ + { + tree a_low = make_ssa_name (word_type); + new_stmt = gimple_build_assign (a_low, BIT_AND_EXPR, + wvop0, low_bits); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + signs = make_ssa_name (word_type); + new_stmt = gimple_build_assign (signs, BIT_NOT_EXPR, wvop0); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + new_stmt = gimple_build_assign (NULL_TREE, BIT_AND_EXPR, + signs, high_bits); + signs = make_ssa_name (word_type); + gimple_assign_set_lhs (new_stmt, signs); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + result_low = make_ssa_name (word_type); + new_stmt = gimple_build_assign (result_low, + MINUS_EXPR, high_bits, a_low); + vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + } + new_stmt = gimple_build_assign (NULL_TREE, BIT_XOR_EXPR, + result_low, signs); result_low = make_ssa_name (word_type); - new_stmt = gimple_build_assign (result_low, code, a_low, b_low); + gimple_assign_set_lhs (new_stmt, result_low); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); } else { - tree a_low = make_ssa_name (word_type); - new_stmt = gimple_build_assign (a_low, - BIT_AND_EXPR, wvop0, low_bits); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); - signs = make_ssa_name (word_type); - new_stmt = gimple_build_assign (signs, BIT_NOT_EXPR, wvop0); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); - new_stmt = gimple_build_assign (NULL_TREE, - BIT_AND_EXPR, signs, high_bits); - signs = make_ssa_name (word_type); - gimple_assign_set_lhs (new_stmt, signs); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + new_stmt = gimple_build_assign (NULL_TREE, code, wvop0, wvop1); result_low = make_ssa_name (word_type); - new_stmt = gimple_build_assign (result_low, - MINUS_EXPR, high_bits, a_low); + gimple_assign_set_lhs (new_stmt, result_low); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); + } - new_stmt = gimple_build_assign (NULL_TREE, BIT_XOR_EXPR, result_low, - signs); - result_low = make_ssa_name (word_type); - gimple_assign_set_lhs (new_stmt, result_low); - vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); new_stmt = gimple_build_assign (NULL_TREE, VIEW_CONVERT_EXPR, build1 (VIEW_CONVERT_EXPR, vectype, result_low)); @@ -7324,7 +7283,7 @@ vectorizable_operation (vec_info *vinfo, tree mask; if (masked_loop_p) mask = vect_get_loop_mask (loop_vinfo, gsi, masks, - vec_num * ncopies, vectype, i); + vec_num, vectype, i); else /* Dummy mask. */ mask = build_minus_one_cst (truth_type_for (vectype)); @@ -7351,7 +7310,7 @@ vectorizable_operation (vec_info *vinfo, if (len_loop_p) { tree len = vect_get_loop_len (loop_vinfo, gsi, lens, - vec_num * ncopies, vectype, i, 1); + vec_num, vectype, i, 1); signed char biasval = LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo); tree bias = build_int_cst (intQI_type_node, biasval); @@ -7378,21 +7337,19 @@ vectorizable_operation (vec_info *vinfo, && code == BIT_AND_EXPR && VECTOR_BOOLEAN_TYPE_P (vectype)) { - if (loop_vinfo->scalar_cond_masked_set.contains ({ op0, - ncopies})) + if (loop_vinfo->scalar_cond_masked_set.contains ({ op0, 1 })) { mask = vect_get_loop_mask (loop_vinfo, gsi, masks, - vec_num * ncopies, vectype, i); + vec_num, vectype, i); vop0 = prepare_vec_mask (loop_vinfo, TREE_TYPE (mask), mask, vop0, gsi); } - if (loop_vinfo->scalar_cond_masked_set.contains ({ op1, - ncopies })) + if (loop_vinfo->scalar_cond_masked_set.contains ({ op1, 1 })) { mask = vect_get_loop_mask (loop_vinfo, gsi, masks, - vec_num * ncopies, vectype, i); + vec_num, vectype, i); vop1 = prepare_vec_mask (loop_vinfo, TREE_TYPE (mask), mask, vop1, gsi); @@ -7423,15 +7380,9 @@ vectorizable_operation (vec_info *vinfo, new_stmt, gsi); } - if (slp_node) - slp_node->push_vec_def (new_stmt); - else - STMT_VINFO_VEC_STMTS (stmt_info).safe_push (new_stmt); + slp_node->push_vec_def (new_stmt); } - if (!slp_node) - *vec_stmt = STMT_VINFO_VEC_STMTS (stmt_info)[0]; - vec_oprnds0.release (); vec_oprnds1.release (); vec_oprnds2.release (); @@ -8786,6 +8737,15 @@ vectorizable_store (vec_info *vinfo, if (n == const_nunits) { int mis_align = dr_misalignment (first_dr_info, vectype); + /* With VF > 1 we advance the DR by step, if that is constant + and only aligned when performed VF times, DR alignment + analysis can analyze this as aligned since it assumes + contiguous accesses. But that is not how we code generate + here, so adjust for this. */ + if (maybe_gt (vf, 1u) + && !multiple_p (DR_STEP_ALIGNMENT (first_dr_info->dr), + DR_TARGET_ALIGNMENT (first_dr_info))) + mis_align = -1; dr_alignment_support dr_align = vect_supportable_dr_alignment (vinfo, dr_info, vectype, mis_align); @@ -8807,6 +8767,10 @@ vectorizable_store (vec_info *vinfo, ltype = build_vector_type (elem_type, n); lvectype = vectype; int mis_align = dr_misalignment (first_dr_info, ltype); + if (maybe_gt (vf, 1u) + && !multiple_p (DR_STEP_ALIGNMENT (first_dr_info->dr), + DR_TARGET_ALIGNMENT (first_dr_info))) + mis_align = -1; dr_alignment_support dr_align = vect_supportable_dr_alignment (vinfo, dr_info, ltype, mis_align); @@ -8867,17 +8831,10 @@ vectorizable_store (vec_info *vinfo, } } unsigned align; - /* ??? We'd want to use - if (alignment_support_scheme == dr_aligned) - align = known_alignment (DR_TARGET_ALIGNMENT (first_dr_info)); - since doing that is what we assume we can in the above checks. - But this interferes with groups with gaps where for example - VF == 2 makes the group in the unrolled loop aligned but the - fact that we advance with step between the two subgroups - makes the access to the second unaligned. See PR119586. - We have to anticipate that here or adjust code generation to - avoid the misaligned loads by means of permutations. */ - align = dr_alignment (vect_dr_behavior (vinfo, first_dr_info)); + if (alignment_support_scheme == dr_aligned) + align = known_alignment (DR_TARGET_ALIGNMENT (first_dr_info)); + else + align = dr_alignment (vect_dr_behavior (vinfo, first_dr_info)); /* Alignment is at most the access size if we do multiple stores. */ if (nstores > 1) align = MIN (tree_to_uhwi (TYPE_SIZE_UNIT (ltype)), align); @@ -10805,6 +10762,15 @@ vectorizable_load (vec_info *vinfo, if (n == const_nunits) { int mis_align = dr_misalignment (first_dr_info, vectype); + /* With VF > 1 we advance the DR by step, if that is constant + and only aligned when performed VF times, DR alignment + analysis can analyze this as aligned since it assumes + contiguous accesses. But that is not how we code generate + here, so adjust for this. */ + if (maybe_gt (vf, 1u) + && !multiple_p (DR_STEP_ALIGNMENT (first_dr_info->dr), + DR_TARGET_ALIGNMENT (first_dr_info))) + mis_align = -1; dr_alignment_support dr_align = vect_supportable_dr_alignment (vinfo, dr_info, vectype, mis_align); @@ -10833,6 +10799,10 @@ vectorizable_load (vec_info *vinfo, if (VECTOR_TYPE_P (ptype)) { mis_align = dr_misalignment (first_dr_info, ptype); + if (maybe_gt (vf, 1u) + && !multiple_p (DR_STEP_ALIGNMENT (first_dr_info->dr), + DR_TARGET_ALIGNMENT (first_dr_info))) + mis_align = -1; dr_align = vect_supportable_dr_alignment (vinfo, dr_info, ptype, mis_align); @@ -10852,8 +10822,10 @@ vectorizable_load (vec_info *vinfo, } } unsigned align; - /* ??? The above is still wrong, see vectorizable_store. */ - align = dr_alignment (vect_dr_behavior (vinfo, first_dr_info)); + if (alignment_support_scheme == dr_aligned) + align = known_alignment (DR_TARGET_ALIGNMENT (first_dr_info)); + else + align = dr_alignment (vect_dr_behavior (vinfo, first_dr_info)); /* Alignment is at most the access size if we do multiple loads. */ if (nloads > 1) align = MIN (tree_to_uhwi (TYPE_SIZE_UNIT (ltype)), align); @@ -14014,7 +13986,7 @@ vect_analyze_stmt (vec_info *vinfo, || vectorizable_comparison (vinfo, stmt_info, NULL, NULL, node, cost_vec) || vectorizable_lc_phi (as_a <loop_vec_info> (vinfo), - stmt_info, NULL, node) + stmt_info, node) || vectorizable_recurr (as_a <loop_vec_info> (vinfo), stmt_info, NULL, node, cost_vec) || vectorizable_early_exit (vinfo, stmt_info, NULL, NULL, node, @@ -14181,19 +14153,19 @@ vect_transform_stmt (vec_info *vinfo, case reduc_vec_info_type: done = vect_transform_reduction (as_a <loop_vec_info> (vinfo), stmt_info, - gsi, &vec_stmt, slp_node); + gsi, slp_node); gcc_assert (done); break; case cycle_phi_info_type: done = vect_transform_cycle_phi (as_a <loop_vec_info> (vinfo), stmt_info, - &vec_stmt, slp_node, slp_node_instance); + slp_node, slp_node_instance); gcc_assert (done); break; case lc_phi_info_type: - done = vectorizable_lc_phi (as_a <loop_vec_info> (vinfo), - stmt_info, &vec_stmt, slp_node); + done = vect_transform_lc_phi (as_a <loop_vec_info> (vinfo), + stmt_info, slp_node); gcc_assert (done); break; diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 3d11559..a2f33a5 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2625,12 +2625,11 @@ extern bool vectorizable_induction (loop_vec_info, stmt_vec_info, stmt_vector_for_cost *); extern bool vect_transform_reduction (loop_vec_info, stmt_vec_info, gimple_stmt_iterator *, - gimple **, slp_tree); + slp_tree); extern bool vect_transform_cycle_phi (loop_vec_info, stmt_vec_info, - gimple **, slp_tree, slp_instance); -extern bool vectorizable_lc_phi (loop_vec_info, stmt_vec_info, - gimple **, slp_tree); +extern bool vectorizable_lc_phi (loop_vec_info, stmt_vec_info, slp_tree); +extern bool vect_transform_lc_phi (loop_vec_info, stmt_vec_info, slp_tree); extern bool vectorizable_phi (vec_info *, stmt_vec_info, gimple **, slp_tree, stmt_vector_for_cost *); extern bool vectorizable_recurr (loop_vec_info, stmt_vec_info, diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc index 6603d90..4c78759 100644 --- a/gcc/vr-values.cc +++ b/gcc/vr-values.cc @@ -1996,10 +1996,13 @@ simplify_using_ranges::simplify (gimple_stmt_iterator *gsi) case BIT_AND_EXPR: case BIT_IOR_EXPR: - /* Optimize away BIT_AND_EXPR and BIT_IOR_EXPR - if all the bits being cleared are already cleared or - all the bits being set are already set. */ - if (INTEGRAL_TYPE_P (TREE_TYPE (rhs1))) + /* Optimize away BIT_AND_EXPR and BIT_IOR_EXPR if all the bits + being cleared are already cleared or all the bits being set + are already set. Beware that boolean types must be handled + logically (see range-op.cc) unless they have precision 1. */ + if (INTEGRAL_TYPE_P (TREE_TYPE (rhs1)) + && (TREE_CODE (TREE_TYPE (rhs1)) != BOOLEAN_TYPE + || TYPE_PRECISION (TREE_TYPE (rhs1)) == 1)) return simplify_bit_ops_using_ranges (gsi, stmt); break; |