aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/riscv/zc.md
AgeCommit message (Collapse)AuthorFilesLines
2024-10-16Ternary operator formatting fixesJakub Jelinek1-2/+2
While working on PR117028 C2Y changes, I've noticed weird ternary operator formatting (operand1 ? operand2: operand3). The usual formatting is operand1 ? operand2 : operand3 where we have around 18000+ cases of that (counting only what fits on one line) and indent -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 -ndj \ -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob documented in https://www.gnu.org/prep/standards/html_node/Formatting.html#Formatting does the same. Some code was even trying to save space as much as possible and used operand1?operand2:operand3 or operand1 ? operand2:operand3 Today I've grepped for such cases (the grep was '?.*[^ ]:' and I had to skim through various false positives with that where the : matched e.g. stuff inside of strings, or *.md pattern macros or :: scope) and the following patch is a fix for what I found. 2024-10-16 Jakub Jelinek <jakub@redhat.com> gcc/ * attribs.cc (lookup_scoped_attribute_spec): ?: operator formatting fixes. * basic-block.h (FOR_BB_INSNS_SAFE): Likewise. * cfgcleanup.cc (outgoing_edges_match): Likewise. * cgraph.cc (cgraph_node::dump): Likewise. * config/arc/arc.cc (gen_acc1, gen_acc2): Likewise. * config/arc/arc.h (CLASS_MAX_NREGS, CONSTANT_ADDRESS_P): Likewise. * config/arm/arm.cc (arm_print_operand): Likewise. * config/cris/cris.md (*b<rnzcond:code><mode>): Likewise. * config/darwin.cc (darwin_asm_declare_object_name, darwin_emit_common): Likewise. * config/darwin-driver.cc (darwin_driver_init): Likewise. * config/epiphany/epiphany.md (call, sibcall, call_value, sibcall_value): Likewise. * config/i386/i386.cc (gen_push2): Likewise. * config/i386/i386.h (ix86_cur_cost): Likewise. * config/i386/openbsdelf.h (FUNCTION_PROFILER): Likewise. * config/loongarch/loongarch-c.cc (loongarch_cpu_cpp_builtins): Likewise. * config/loongarch/loongarch-cpu.cc (fill_native_cpu_config): Likewise. * config/riscv/riscv.cc (riscv_union_memmodels): Likewise. * config/riscv/zc.md (*mva01s<X:mode>, *mvsa01<X:mode>): Likewise. * config/rs6000/mmintrin.h (_mm_cmpeq_pi8, _mm_cmpgt_pi8, _mm_cmpeq_pi16, _mm_cmpgt_pi16, _mm_cmpeq_pi32, _mm_cmpgt_pi32): Likewise. * config/v850/predicates.md (pattern_is_ok_for_prologue): Likewise. * config/xtensa/constraints.md (d, C, W): Likewise. * coverage.cc (coverage_begin_function, build_init_ctor, build_gcov_exit_decl): Likewise. * df-problems.cc (df_create_unused_note): Likewise. * diagnostic.cc (diagnostic_set_caret_max_width): Likewise. * diagnostic-path.cc (path_summary::path_summary): Likewise. * expr.cc (expand_expr_divmod): Likewise. * gcov.cc (format_gcov): Likewise. * gcov-dump.cc (dump_gcov_file): Likewise. * genmatch.cc (main): Likewise. * incpath.cc (remove_duplicates, register_include_chains): Likewise. * ipa-devirt.cc (dump_odr_type): Likewise. * ipa-icf.cc (sem_item_optimizer::merge_classes): Likewise. * ipa-inline.cc (inline_small_functions): Likewise. * ipa-polymorphic-call.cc (ipa_polymorphic_call_context::dump): Likewise. * ipa-sra.cc (create_parameter_descriptors): Likewise. * ipa-utils.cc (find_always_executed_bbs): Likewise. * predict.cc (predict_loops): Likewise. * selftest.cc (read_file): Likewise. * sreal.h (SREAL_SIGN, SREAL_ABS): Likewise. * tree-dump.cc (dequeue_and_dump): Likewise. * tree-ssa-ccp.cc (bit_value_binop): Likewise. gcc/c-family/ * c-opts.cc (c_common_init_options, c_common_handle_option, c_common_finish, set_std_c89, set_std_c99, set_std_c11, set_std_c17, set_std_c23, set_std_cxx98, set_std_cxx11, set_std_cxx14, set_std_cxx17, set_std_cxx20, set_std_cxx23, set_std_cxx26): ?: operator formatting fixes. gcc/cp/ * search.cc (lookup_member): ?: operator formatting fixes. * typeck.cc (cp_build_modify_expr): Likewise. libcpp/ * expr.cc (interpret_float_suffix): ?: operator formatting fixes.
2024-08-06RISC-V: Fix comment typosPatrick O'Neill1-1/+1
This fixes most of the typos I found when reading various parts of the RISC-V backend. gcc/ChangeLog: * config/riscv/arch-canonicalize: Fix typos in comments. * config/riscv/autovec.md: Ditto. * config/riscv/riscv-avlprop.cc (avl_can_be_propagated_p): Ditto. (pass_avlprop::get_vlmax_ta_preferred_avl): Ditto. * config/riscv/riscv-modes.def (ADJUST_FLOAT_FORMAT): Ditto. (VLS_MODES): Ditto. * config/riscv/riscv-opts.h (TARGET_ZICOND_LIKE): Ditto. (enum rvv_vector_bits_enum): Ditto. * config/riscv/riscv-protos.h (enum insn_flags): Ditto. (enum insn_type): Ditto. * config/riscv/riscv-sr.cc (riscv_sr_match_epilogue): Ditto. * config/riscv/riscv-string.cc (expand_block_move): Ditto. * config/riscv/riscv-v.cc (rvv_builder::is_repeating_sequence): Ditto. (rvv_builder::single_step_npatterns_p): Ditto. (calculate_ratio): Ditto. (expand_const_vector): Ditto. (shuffle_merge_patterns): Ditto. (shuffle_compress_patterns): Ditto. (expand_select_vl): Ditto. * config/riscv/riscv-vector-builtins-functions.def (REQUIRED_EXTENSIONS): Ditto. * config/riscv/riscv-vector-builtins-shapes.h: Ditto. * config/riscv/riscv-vector-builtins.cc (function_builder::add_function): Ditto. (resolve_overloaded_builtin): Ditto. * config/riscv/riscv-vector-builtins.def (vbool1_t): Ditto. (vuint8m8_t): Ditto. (vuint16m8_t): Ditto. (vfloat16m8_t): Ditto. (unsigned_vector): Ditto. * config/riscv/riscv-vector-builtins.h (enum required_ext): Ditto. * config/riscv/riscv-vector-costs.cc (get_store_value): Ditto. (costs::analyze_loop_vinfo): Ditto. (costs::add_stmt_cost): Ditto. * config/riscv/riscv.cc (riscv_build_integer): Ditto. (riscv_vector_type_p): Ditto. * config/riscv/thead.cc (th_mempair_output_move): Ditto. * config/riscv/thead.md: Ditto. * config/riscv/vector-iterators.md: Ditto. * config/riscv/vector.md: Ditto. * config/riscv/zc.md: Ditto. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2024-02-21RISC-V: Add non-vector types to dfa pipelinesEdwin Lu1-48/+48
This patch adds non-vector related insn reservations and updates/creates new insn reservations so all non-vector typed instructions have a reservation. gcc/ChangeLog: * config/riscv/generic-ooo.md (generic_ooo_sfb_alu): Add reservation (generic_ooo_branch): Ditto * config/riscv/generic.md (generic_sfb_alu): Ditto (generic_fmul_half): Ditto * config/riscv/riscv.md: Remove cbo, pushpop, and rdfrm types * config/riscv/sifive-7.md (sifive_7_hfma): Add reservation (sifive_7_popcount): Ditto * config/riscv/sifive-p400.md (sifive_p400_clmul): Ditto * config/riscv/sifive-p600.md (sifive_p600_clmul): Ditto * config/riscv/vector.md: Change rdfrm to fmove * config/riscv/zc.md: Change pushpop to load/store Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
2024-01-31Revert "RISC-V: Add non-vector types to dfa pipelines"Edwin Lu1-48/+48
This reverts commit 26c34b809cd1a6249027730a8b52bbf6a1c0f4a8.
2024-01-31RISC-V: Add non-vector types to dfa pipelinesEdwin Lu1-48/+48
This patch adds non-vector related insn reservations and updates/creates new insn reservations so all non-vector typed instructions have a reservation. gcc/ChangeLog: * config/riscv/generic-ooo.md (generic_ooo_sfb_alu): Add reservation (generic_ooo_branch): ditto * config/riscv/generic.md (generic_sfb_alu): ditto (generic_fmul_half): ditto * config/riscv/riscv.md: Remove cbo, pushpop, and rdfrm types * config/riscv/sifive-7.md (sifive_7_hfma):Add reservation (sifive_7_popcount): ditto * config/riscv/vector.md: change rdfrm to fmove * config/riscv/zc.md: change pushpop to load/store Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
2024-01-03Update copyright years.Jakub Jelinek1-1/+1
2023-09-11RISC-V: Add Types for Un-Typed zc InstructionsEdwin Lu1-50/+52
Adds types to the untyped zc instructions. Creates a new types "pushpop" and "mvpair" for now gcc/ChangeLog: * config/riscv/riscv.md: Add "pushpop" and "mvpair" types * config/riscv/zc.md: Update types Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
2023-08-30RISC-V: support cm.mva01s cm.mvsa01 in zcmpDie Li1-0/+22
Signed-off-by: Die Li <lidie@eswincomputing.com> Co-Authored-By: Fei Gao <gaofei@eswincomputing.com> gcc/ChangeLog: * config/riscv/peephole.md: New pattern. * config/riscv/predicates.md (a0a1_reg_operand): New predicate. (zcmp_mv_sreg_operand): New predicate. * config/riscv/riscv.md: New predicate. * config/riscv/zc.md (*mva01s<X:mode>): New pattern. (*mvsa01<X:mode>): New pattern. gcc/testsuite/ChangeLog: * gcc.target/riscv/cm_mv_rv32.c: New test.
2023-08-30RISC-V: support cm.popretz in zcmpFei Gao1-0/+393
Generate cm.popretz instead of cm.popret if return value is 0. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_zcmp_can_use_popretz): true if popretz can be used (riscv_gen_multi_pop_insn): interface to generate cm.pop[ret][z] (riscv_expand_epilogue): expand cm.pop[ret][z] in epilogue * config/riscv/riscv.md: define A0_REGNUM * config/riscv/zc.md (@gpr_multi_popretz_up_to_ra_<mode>): md for popretz ra (@gpr_multi_popretz_up_to_s0_<mode>): md for popretz ra, s0 (@gpr_multi_popretz_up_to_s1_<mode>): likewise (@gpr_multi_popretz_up_to_s2_<mode>): likewise (@gpr_multi_popretz_up_to_s3_<mode>): likewise (@gpr_multi_popretz_up_to_s4_<mode>): likewise (@gpr_multi_popretz_up_to_s5_<mode>): likewise (@gpr_multi_popretz_up_to_s6_<mode>): likewise (@gpr_multi_popretz_up_to_s7_<mode>): likewise (@gpr_multi_popretz_up_to_s8_<mode>): likewise (@gpr_multi_popretz_up_to_s9_<mode>): likewise (@gpr_multi_popretz_up_to_s11_<mode>): likewise gcc/testsuite/ChangeLog: * gcc.target/riscv/rv32e_zcmp.c: add testcase for cm.popretz in rv32e * gcc.target/riscv/rv32i_zcmp.c: add testcase for cm.popretz in rv32i
2023-08-30RISC-V: support cm.push cm.pop cm.popret in zcmpFei Gao1-0/+1042
Zcmp can share the same logic as save-restore in stack allocation: pre-allocation by cm.push, step 1 and step 2. Pre-allocation not only saves callee saved GPRs, but also saves callee saved FPRs and local variables if any. Please be noted cm.push pushes ra, s0-s11 in reverse order than what save-restore does. So adaption has been done in .cfi directives in my patch. gcc/ChangeLog: * config/riscv/iterators.md (slot0_offset): slot 0 offset in stack GPRs area in bytes (slot1_offset): slot 1 offset in stack GPRs area in bytes (slot2_offset): likewise (slot3_offset): likewise (slot4_offset): likewise (slot5_offset): likewise (slot6_offset): likewise (slot7_offset): likewise (slot8_offset): likewise (slot9_offset): likewise (slot10_offset): likewise (slot11_offset): likewise (slot12_offset): likewise * config/riscv/predicates.md (stack_push_up_to_ra_operand): predicates of stack adjust pushing ra (stack_push_up_to_s0_operand): predicates of stack adjust pushing ra, s0 (stack_push_up_to_s1_operand): likewise (stack_push_up_to_s2_operand): likewise (stack_push_up_to_s3_operand): likewise (stack_push_up_to_s4_operand): likewise (stack_push_up_to_s5_operand): likewise (stack_push_up_to_s6_operand): likewise (stack_push_up_to_s7_operand): likewise (stack_push_up_to_s8_operand): likewise (stack_push_up_to_s9_operand): likewise (stack_push_up_to_s11_operand): likewise (stack_pop_up_to_ra_operand): predicates of stack adjust poping ra (stack_pop_up_to_s0_operand): predicates of stack adjust poping ra, s0 (stack_pop_up_to_s1_operand): likewise (stack_pop_up_to_s2_operand): likewise (stack_pop_up_to_s3_operand): likewise (stack_pop_up_to_s4_operand): likewise (stack_pop_up_to_s5_operand): likewise (stack_pop_up_to_s6_operand): likewise (stack_pop_up_to_s7_operand): likewise (stack_pop_up_to_s8_operand): likewise (stack_pop_up_to_s9_operand): likewise (stack_pop_up_to_s11_operand): likewise * config/riscv/riscv-protos.h (riscv_zcmp_valid_stack_adj_bytes_p):declaration * config/riscv/riscv.cc (struct riscv_frame_info): comment change (riscv_avoid_multi_push): helper function of riscv_use_multi_push (riscv_use_multi_push): true if multi push is used (riscv_multi_push_sregs_count): num of sregs in multi-push (riscv_multi_push_regs_count): num of regs in multi-push (riscv_16bytes_align): align to 16 bytes (riscv_stack_align): moved to a better place (riscv_save_libcall_count): no functional change (riscv_compute_frame_info): add zcmp frame info (riscv_for_each_saved_reg): save or restore fprs in specified slot for zcmp (riscv_adjust_multi_push_cfi_prologue): adjust cfi for cm.push (riscv_gen_multi_push_pop_insn): gen function for multi push and pop (get_multi_push_fpr_mask): get mask for the fprs pushed by cm.push (riscv_expand_prologue): allocate stack by cm.push (riscv_adjust_multi_pop_cfi_epilogue): adjust cfi for cm.pop[ret] (riscv_expand_epilogue): allocate stack by cm.pop[ret] (zcmp_base_adj): calculate stack adjustment base size (zcmp_additional_adj): calculate stack adjustment additional size (riscv_zcmp_valid_stack_adj_bytes_p): check if stack adjustment valid * config/riscv/riscv.h (RETURN_ADDR_MASK): mask of ra (S0_MASK): likewise (S1_MASK): likewise (S2_MASK): likewise (S3_MASK): likewise (S4_MASK): likewise (S5_MASK): likewise (S6_MASK): likewise (S7_MASK): likewise (S8_MASK): likewise (S9_MASK): likewise (S10_MASK): likewise (S11_MASK): likewise (MULTI_PUSH_GPR_MASK): GPR_MASK that cm.push can cover at most (ZCMP_MAX_SPIMM): max spimm value (ZCMP_SP_INC_STEP): zcmp sp increment step (ZCMP_INVALID_S0S10_SREGS_COUNTS): num of s0-s10 (ZCMP_S0S11_SREGS_COUNTS): num of s0-s11 (ZCMP_MAX_GRP_SLOTS): max slots of pushing and poping in zcmp (CALLEE_SAVED_FREG_NUMBER): get x of fsx(fs0 ~ fs11) * config/riscv/riscv.md: include zc.md * config/riscv/zc.md: New file. machine description for zcmp gcc/testsuite/ChangeLog: * gcc.target/riscv/rv32e_zcmp.c: New test. * gcc.target/riscv/rv32i_zcmp.c: New test. * gcc.target/riscv/zcmp_push_fpr.c: New test. * gcc.target/riscv/zcmp_stack_alignment.c: New test.