aboutsummaryrefslogtreecommitdiff
path: root/libgcc/config/riscv
AgeCommit message (Collapse)AuthorFilesLines
2024-05-06[RISC-V] Add support for _Bfloat16Xiao Zeng3-4/+12
1 At point <https://github.com/riscv/riscv-bfloat16>, BF16 has already been completed "post public review". 2 LLVM has also added support for RISCV BF16 in <https://reviews.llvm.org/D151313> and <https://reviews.llvm.org/D150929>. 3 According to the discussion <https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/367>, this use __bf16 and use DF16b in riscv_mangle_type like x86. Below test are passed for this patch * The riscv fully regression test. gcc/ChangeLog: * config/riscv/iterators.md: New mode iterator HFBF. * config/riscv/riscv-builtins.cc (riscv_init_builtin_types): Initialize data type _Bfloat16. * config/riscv/riscv-modes.def (FLOAT_MODE): New. (ADJUST_FLOAT_FORMAT): New. * config/riscv/riscv.cc (riscv_mangle_type): Support for BFmode. (riscv_scalar_mode_supported_p): Ditto. (riscv_libgcc_floating_mode_supported_p): Ditto. (riscv_init_libfuncs): Set the conversion method for BFmode and HFmode. (riscv_block_arith_comp_libfuncs_for_mode): Set the arithmetic and comparison libfuncs for the mode. * config/riscv/riscv.md (mode" ): Add BF. (movhf): Support for BFmode. (mov<mode>): Ditto. (*movhf_softfloat): Ditto. (*mov<mode>_softfloat): Ditto. libgcc/ChangeLog: * config/riscv/sfp-machine.h (_FP_NANFRAC_B): New. (_FP_NANSIGN_B): Ditto. * config/riscv/t-softfp32: Add support for BF16 libfuncs. * config/riscv/t-softfp64: Ditto. * soft-fp/floatsibf.c: For si -> bf16. * soft-fp/floatunsibf.c: For unsi -> bf16. gcc/testsuite/ChangeLog: * gcc.target/riscv/bf16_arithmetic.c: New test. * gcc.target/riscv/bf16_call.c: New test. * gcc.target/riscv/bf16_comparison.c: New test. * gcc.target/riscv/bf16_float_libcall_convert.c: New test. * gcc.target/riscv/bf16_integer_libcall_convert.c: New test. Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
2024-01-03Update copyright years.Jakub Jelinek9-9/+9
2023-10-13riscv: Fix -Wincompatible-pointer-types warning during libgcc buildFlorian Weimer1-1/+1
libgcc/ * config/riscv/linux-unwind.h (riscv_fallback_frame_state): Add missing cast.
2023-09-06libgcc _BitInt support [PR102989]Jakub Jelinek1-3/+3
This patch adds the library helpers for multiplication, division + modulo and casts from and to floating point (both binary and decimal). As described in the intro, the first step is try to reduce further the passed in precision by skipping over most significant limbs with just zeros or sign bit copies. For multiplication and division I've implemented a simple algorithm, using something smarter like Karatsuba or Toom N-Way might be faster for very large _BitInts (which we don't support right now anyway), but could mean more code in libgcc, which maybe isn't what people are willing to accept. For the to/from floating point conversions the patch uses soft-fp, because it already has tons of handy macros which can be used for that. In theory it could be implemented using {,unsigned} long long or {,unsigned} __int128 to/from floating point conversions with some frexp before/after, but at that point we already need to force it into integer registers and analyze it anyway. Plus, for 32-bit arches there is no __int128 that could be used for XF/TF mode stuff. I know that soft-fp is owned by glibc and I think the op-common.h change should be propagated there, but the bitint stuff is really GCC specific and IMHO doesn't belong into the glibc copy. 2023-09-06 Jakub Jelinek <jakub@redhat.com> PR c/102989 libgcc/ * config/aarch64/t-softfp (softfp_extras): Use += rather than :=. * config/i386/64/t-softfp (softfp_extras): Likewise. * config/i386/libgcc-glibc.ver (GCC_14.0.0): Export _BitInt support routines. * config/i386/t-softfp (softfp_extras): Add fixxfbitint and bf, hf and xf mode floatbitint. (CFLAGS-floatbitintbf.c, CFLAGS-floatbitinthf.c): Add -msse2. * config/riscv/t-softfp32 (softfp_extras): Use += rather than :=. * config/rs6000/t-e500v1-fp (softfp_extras): Likewise. * config/rs6000/t-e500v2-fp (softfp_extras): Likewise. * config/t-softfp (softfp_floatbitint_funcs): New. (softfp_bid_list): New. (softfp_func_list): Add sf and df mode from and to _BitInt libcalls. (softfp_bid_file_list): New. (LIB2ADD_ST): Add $(softfp_bid_file_list). * config/t-softfp-sfdftf (softfp_extras): Add fixtfbitint and floatbitinttf. * config/t-softfp-tf (softfp_extras): Likewise. * libgcc2.c (bitint_reduce_prec): New inline function. (BITINT_INC, BITINT_END): Define. (bitint_mul_1, bitint_addmul_1): New helper functions. (__mulbitint3): New function. (bitint_negate, bitint_submul_1): New helper functions. (__divmodbitint4): New function. * libgcc2.h (LIBGCC2_UNITS_PER_WORD): When building _BitInt support libcalls, redefine depending on __LIBGCC_BITINT_LIMB_WIDTH__. (__mulbitint3, __divmodbitint4): Declare. * libgcc-std.ver.in (GCC_14.0.0): Export _BitInt support routines. * Makefile.in (lib2funcs): Add _mulbitint3. (LIB2_DIVMOD_FUNCS): Add _divmodbitint4. * soft-fp/bitint.h: New file. * soft-fp/fixdfbitint.c: New file. * soft-fp/fixsfbitint.c: New file. * soft-fp/fixtfbitint.c: New file. * soft-fp/fixxfbitint.c: New file. * soft-fp/floatbitintbf.c: New file. * soft-fp/floatbitintdf.c: New file. * soft-fp/floatbitinthf.c: New file. * soft-fp/floatbitintsf.c: New file. * soft-fp/floatbitinttf.c: New file. * soft-fp/floatbitintxf.c: New file. * soft-fp/op-common.h (_FP_FROM_INT): Add support for rsize up to 4 * _FP_W_TYPE_SIZE rather than just 2 * _FP_W_TYPE_SIZE. * soft-fp/bitintpow10.c: New file. * soft-fp/fixsdbitint.c: New file. * soft-fp/fixddbitint.c: New file. * soft-fp/fixtdbitint.c: New file. * soft-fp/floatbitintsd.c: New file. * soft-fp/floatbitintdd.c: New file. * soft-fp/floatbitinttd.c: New file.
2023-07-22Fix PR 110066: crash with -pg -static on riscvAndrew Pinski1-0/+5
The problem -fasynchronous-unwind-tables is on by default for riscv linux We need turn it off for crt*.o because it would make __EH_FRAME_BEGIN__ point to .eh_frame data from crtbeginT.o instead of the user-defined object during static linking. This turns it off. OK? libgcc/ChangeLog: * config.host (riscv*-*-linux*): Add t-crtstuff to tmake_file. (riscv*-*-freebsd*): Likewise. * config/riscv/t-crtstuff: New file.
2023-07-06RISC-V: Handle rouding mode correctly on zfinxKito Cheng1-1/+1
Zfinx has provide fcsr like F, so rouding mode should use fcsr instead of `soft` fenv. libgcc/ChangeLog: * config/riscv/sfp-machine.h (FP_INIT_ROUNDMODE): Check zfinx. (FP_HANDLE_EXCEPTIONS): Ditto.
2023-05-02RISC-V: Enforce Libatomic LR/SC SEQ_CSTPatrick O'Neill1-2/+2
Replace LR.aq/SC.rl pairs with the SEQ_CST LR.aqrl/SC.rl pairs recommended by table A.6 of the ISA manual. 2023-04-27 Patrick O'Neill <patrick@rivosinc.com> libgcc/ChangeLog: * config/riscv/atomic.c: Change LR.aq/SC.rl pairs into sequentially consistent LR.aqrl/SC.rl pairs. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com>
2023-04-26RISCV: Inline subword atomic opsPatrick O'Neill1-0/+2
RISC-V has no support for subword atomic operations; code currently generates libatomic library calls. This patch changes the default behavior to inline subword atomic calls (using the same logic as the existing library call). Behavior can be specified using the -minline-atomics and -mno-inline-atomics command line flags. gcc/libgcc/config/riscv/atomic.c has the same logic implemented in asm. This will need to stay for backwards compatibility and the -mno-inline-atomics flag. 2023-04-18 Patrick O'Neill <patrick@rivosinc.com> gcc/ChangeLog: PR target/104338 * config/riscv/riscv-protos.h: Add helper function stubs. * config/riscv/riscv.cc: Add helper functions for subword masking. * config/riscv/riscv.opt: Add command-line flag. * config/riscv/sync.md: Add masking logic and inline asm for fetch_and_op, fetch_and_nand, CAS, and exchange ops. * doc/invoke.texi: Add blurb regarding command-line flag. libgcc/ChangeLog: PR target/104338 * config/riscv/atomic.c: Add reference to duplicate logic. gcc/testsuite/ChangeLog: PR target/104338 * gcc.target/riscv/inline-atomics-1.c: New test. * gcc.target/riscv/inline-atomics-2.c: New test. * gcc.target/riscv/inline-atomics-3.c: New test. * gcc.target/riscv/inline-atomics-4.c: New test. * gcc.target/riscv/inline-atomics-5.c: New test. * gcc.target/riscv/inline-atomics-6.c: New test. * gcc.target/riscv/inline-atomics-7.c: New test. * gcc.target/riscv/inline-atomics-8.c: New test. Signed-off-by: Patrick O'Neill <patrick@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2023-02-13RISC-V: Handle vlenb correctly in unwindingKito Cheng1-0/+39
gcc/ChangeLog: * config/riscv/riscv.h (RISCV_DWARF_VLENB): New. (DWARF_FRAME_REGISTERS): New. (DWARF_REG_TO_UNWIND_COLUMN): New. libgcc/ChangeLog: * config.host (riscv*-*-*): Add config/riscv/value-unwind.h. * config/riscv/value-unwind.h: New.
2023-01-16Update copyright years.Jakub Jelinek8-8/+8
2022-10-06libgcc: Decrease size of _Unwind_FrameState and even more size of cleared ↵Jakub Jelinek1-2/+2
area in uw_frame_state_for The following patch implements something that has Florian found as low hanging fruit in our unwinder and has been discussed in the https://gcc.gnu.org/wiki/cauldron2022#cauldron2022talks.inprocess_unwinding_bof talk. _Unwind_FrameState type seems to be (unlike the pre-GCC 3 frame_state which has been part of ABI) private to unwind-dw2.c + unwind.inc it includes, it is always defined on the stack of some entrypoints, initialized by static uw_frame_state_for and the address of it is also passed to other static functions or the static inlines handling machine dependent unwinding, but it isn't fortunately passed to any callbacks or public functions, so I think we can safely change it any time we want. Florian mentioned that the structure is large even on x86_64, 384 bytes there, starts with 328 bytes long element with frame_state_reg_info type which then starts with an array with __LIBGCC_DWARF_FRAME_REGISTERS__ + 1 elements, each of them is 16 bytes long, on x86_64 __LIBGCC_DWARF_FRAME_REGISTERS__ is just 17 but even that is big, on say riscv __LIBGCC_DWARF_FRAME_REGISTERS__ is I think 128, on powerpc 111, on sh 153 etc. And, we memset to zero the whole fs variable with the _Unwind_FrameState type at the start of the unwinding. The reason why each element is 16 byte (on 64-bit arches) is that it contains some pointer or pointer sized integer and then an enum (with just 7 different enumerators) + padding. The following patch decreases it by moving the enum into a separate array and using just one byte for each register in that second array. We could compress it even more, say 4 bits per register, but I don't want to uglify the code for it too much and make the accesses slower. Furthermore, the clearing of the object can clear only thos how array and members after it, because REG_UNSAVED enumerator (0) doesn't actually need any pointer or pointer sized integer, it is just the other kinds that need to have there something. By doing this, on x86_64 the above numbers change to _Unwind_FrameState type being now 264 bytes long, frame_state_reg_info 208 bytes and we don't clear the first 144 bytes of the object, so the memset is 120 bytes, so ~ 31% of the old clearing size. On riscv 64-bit assuming it has same structure layout rules for the few types used there that would be ~ 2160 bytes of _Unwind_FrameState type before and ~ 1264 bytes after, with the memset previously ~ 2160 bytes and after ~ 232 bytes after. We've also talked about possibly adding a number of initially initialized regs and initializing the rest lazily, but at least for x86_64 with 18 elements in the array that doesn't seem to be worth it anymore, especially because return address column is 16 there and that is usually the first thing to be touched. It might theory help with lots of registers if they are usually untouched, but would uglify and complicate any stores to how by having to check there for the not initialized yet cases and lazy initialization, and similarly for all reads of how to do there if below last initialized one, use how, otherwise imply REG_UNSAVED. The disadvantage of the patch is that touching reg[x].loc and how[x] now means 2 cachelines rather than one as before, and I admit beyond bootstrap/regtest I haven't benchmarked it in any way. 2022-10-06 Jakub Jelinek <jakub@redhat.com> * unwind-dw2.h (REG_UNSAVED, REG_SAVED_OFFSET, REG_SAVED_REG, REG_SAVED_EXP, REG_SAVED_VAL_OFFSET, REG_SAVED_VAL_EXP, REG_UNDEFINED): New anonymous enum, moved from inside of struct frame_state_reg_info. (struct frame_state_reg_info): Remove reg[].how element and the anonymous enum there. Add how element. * unwind-dw2.c: Include stddef.h. (uw_frame_state_for): Don't clear first offsetof (_Unwind_FrameState, regs.how[0]) bytes of *fs. (execute_cfa_program, __frame_state_for, uw_update_context_1, uw_update_context): Use fs->regs.how[X] instead of fs->regs.reg[X].how or fs.regs.how[X] instead of fs.regs.reg[X].how. * config/sh/linux-unwind.h (sh_fallback_frame_state): Likewise. * config/bfin/linux-unwind.h (bfin_fallback_frame_state): Likewise. * config/pa/linux-unwind.h (pa32_fallback_frame_state): Likewise. * config/pa/hpux-unwind.h (UPDATE_FS_FOR_SAR, UPDATE_FS_FOR_GR, UPDATE_FS_FOR_FR, UPDATE_FS_FOR_PC, pa_fallback_frame_state): Likewise. * config/alpha/vms-unwind.h (alpha_vms_fallback_frame_state): Likewise. * config/alpha/linux-unwind.h (alpha_fallback_frame_state): Likewise. * config/arc/linux-unwind.h (arc_fallback_frame_state, arc_frob_update_context): Likewise. * config/riscv/linux-unwind.h (riscv_fallback_frame_state): Likewise. * config/nios2/linux-unwind.h (NIOS2_REG): Likewise. * config/nds32/linux-unwind.h (NDS32_PUT_FS_REG): Likewise. * config/s390/tpf-unwind.h (s390_fallback_frame_state): Likewise. * config/s390/linux-unwind.h (s390_fallback_frame_state): Likewise. * config/sparc/sol2-unwind.h (sparc64_frob_update_context, MD_FALLBACK_FRAME_STATE_FOR): Likewise. * config/sparc/linux-unwind.h (sparc64_fallback_frame_state, sparc64_frob_update_context, sparc_fallback_frame_state): Likewise. * config/i386/sol2-unwind.h (x86_64_fallback_frame_state, x86_fallback_frame_state): Likewise. * config/i386/w32-unwind.h (i386_w32_fallback_frame_state): Likewise. * config/i386/linux-unwind.h (x86_64_fallback_frame_state, x86_fallback_frame_state): Likewise. * config/i386/freebsd-unwind.h (x86_64_freebsd_fallback_frame_state): Likewise. * config/i386/dragonfly-unwind.h (x86_64_dragonfly_fallback_frame_state): Likewise. * config/i386/gnu-unwind.h (x86_gnu_fallback_frame_state): Likewise. * config/csky/linux-unwind.h (csky_fallback_frame_state): Likewise. * config/aarch64/linux-unwind.h (aarch64_fallback_frame_state): Likewise. * config/aarch64/freebsd-unwind.h (aarch64_freebsd_fallback_frame_state): Likewise. * config/aarch64/aarch64-unwind.h (aarch64_frob_update_context): Likewise. * config/or1k/linux-unwind.h (or1k_fallback_frame_state): Likewise. * config/mips/linux-unwind.h (mips_fallback_frame_state): Likewise. * config/loongarch/linux-unwind.h (loongarch_fallback_frame_state): Likewise. * config/m68k/linux-unwind.h (m68k_fallback_frame_state): Likewise. * config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Likewise. * config/rs6000/darwin-fallback.c (set_offset): Likewise. * config/rs6000/aix-unwind.h (MD_FROB_UPDATE_CONTEXT): Likewise. * config/rs6000/linux-unwind.h (ppc_fallback_frame_state): Likewise. * config/rs6000/freebsd-unwind.h (frob_update_context): Likewise.
2022-08-16RISC-V: Support _Float16 type.Kito Cheng3-0/+9
RISC-V decide use _Float16 as primary IEEE half precision type, and this already become part of psABI, this patch has added folloing support for _Float16: - Soft-float support for _Float16. - Make sure _Float16 available on C++ mode. - Name mangling for _Float16 on C++ mode. gcc/ChangeLog * config/riscv/riscv-builtins.cc: include stringpool.h (riscv_float16_type_node): New. (riscv_init_builtin_types): Ditto. (riscv_init_builtins): Call riscv_init_builtin_types. * config/riscv/riscv-modes.def (HF): New. * config/riscv/riscv.cc (riscv_output_move): Handle HFmode. (riscv_mangle_type): New. (riscv_scalar_mode_supported_p): Ditto. (riscv_libgcc_floating_mode_supported_p): Ditto. (riscv_excess_precision): Ditto. (riscv_floatn_mode): Ditto. (riscv_init_libfuncs): Ditto. (TARGET_MANGLE_TYPE): Ditto. (TARGET_SCALAR_MODE_SUPPORTED_P): Ditto. (TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P): Ditto. (TARGET_INIT_LIBFUNCS): Ditto. (TARGET_C_EXCESS_PRECISION): Ditto. (TARGET_FLOATN_MODE): Ditto. * config/riscv/riscv.md (mode): Add HF. (softload): Add HF. (softstore): Ditto. (fmt): Ditto. (UNITMODE): Ditto. (movhf): New. (*movhf_softfloat): New. libgcc/ChangeLog: * config/riscv/sfp-machine.h (_FP_NANFRAC_H): New. (_FP_NANFRAC_H): Ditto. (_FP_NANSIGN_H): Ditto. * config/riscv/t-softfp32 (softfp_extensions): Add HF related routines. (softfp_truncations): Ditto. (softfp_extras): Ditto. * config/riscv/t-softfp64 (softfp_extras): Add HF related routines. gcc/testsuite/ChangeLog: * g++.target/riscv/_Float16.C: New. * gcc.target/riscv/_Float16-soft-1.c: Ditto. * gcc.target/riscv/_Float16-soft-2.c: Ditto. * gcc.target/riscv/_Float16-soft-3.c: Ditto. * gcc.target/riscv/_Float16-soft-4.c: Ditto. * gcc.target/riscv/_Float16.c: Ditto.
2022-01-03Update copyright years.Jakub Jelinek8-8/+8
2021-12-06RISC-V: jal cannot refer to a default visibility symbol for shared object.Nelson Chu2-7/+14
This is the original binutils bugzilla report, https://sourceware.org/bugzilla/show_bug.cgi?id=28509 And this is the first version of the proposed binutils patch, https://sourceware.org/pipermail/binutils/2021-November/118398.html After applying the binutils patch, I get the the unexpected error when building libgcc, /scratch/nelsonc/riscv-gnu-toolchain/riscv-gcc/libgcc/config/riscv/div.S:42: /scratch/nelsonc/build-upstream/rv64gc-linux/build-install/riscv64-unknown-linux-gnu/bin/ld: relocation R_RISCV_JAL against `__udivdi3' which may bind externally can not be used when making a shared object; recompile with -fPIC Therefore, this patch add an extra hidden alias symbol for __udivdi3, and then use HIDDEN_JUMPTARGET to target a non-preemptible symbol instead. The solution is similar to glibc as follows, https://sourceware.org/git/?p=glibc.git;a=commit;h=68389203832ab39dd0dbaabbc4059e7fff51c29b libgcc/ChangeLog: * config/riscv/div.S: Add the hidden alias symbol for __udivdi3, and then use HIDDEN_JUMPTARGET to target it since it is non-preemptible. * config/riscv/riscv-asm.h: Added new macros HIDDEN_JUMPTARGET and HIDDEN_DEF.
2021-03-23RISC-V: Update soft-fp config for big-endianMarcus Comstedt1-0/+4
libgcc/ * config/riscv/sfp-machine.h (__BYTE_ORDER): Set according to __BYTE_ORDER__.
2021-01-04Update copyright years.Jakub Jelinek8-8/+8
2020-09-29RISC-V/libgcc: Use `-fasynchronous-unwind-tables' for LIB2_DIVMOD_FUNCSMaciej W. Rozycki1-0/+2
Use `-fasynchronous-unwind-tables' rather than `-fexceptions -fnon-call-exceptions' in LIB2_DIVMOD_FUNCS compilation flags so as to provide unwind tables for the affected functions while not pulling the unwinder proper, which is not required here. Beyond saving program space it fixes a RISC-V glibc build error due to unsatisfied `malloc' and `free' references from the unwinder causing link errors with `ld.so' where libgcc has been built at -O0. libgcc/ * config/riscv/t-elf (LIB2_DIVMOD_EXCEPTION_FLAGS): New variable.
2020-07-31RISC-V/libgcc: Reduce the size of RV64 millicode by 6 bytesMaciej W. Rozycki1-6/+7
Rewrite code sequences throughout the 64-bit RISC-V `__riscv_save_*' routines replacing `li t1, -48', `li t1, -64', and `li t1, -80', instructions, which do not have a compressed encoding, respectively with `li t1, 3', `li t1, 4', and `li t1, 4', which do, and then adjusting the remaining code accordingly observing that `sub sp, sp, t1' takes the same amount of space as an `slli t1, t1, 4'/`add sp, sp, t1' instruction pair does, again due to the use of compressed encodings, saving 6 bytes total. This change does increase code size by 4 bytes for RISC-V processors lacking the compressed instruction set, however their users couldn't care about the code size or they would have chosen an implementation that does have the compressed instructions, wouldn't they? libgcc/ * config/riscv/save-restore.S [__riscv_xlen == 64] (__riscv_save_10, __riscv_save_8, __riscv_save_6, __riscv_save_4) (__riscv_save_2): Replace negative immediates used for the final stack pointer adjustment with positive ones, right-shifted by 4.
2020-06-02RISC-V: Make __divdi3 handle div by zero same as hardware.Jim Wilson1-3/+5
The ISA manual specifies that divide by zero always returns -1 as the result. We were failing to do that when the dividend was negative. Original patch from Virginie Moser. libgcc/ * config/riscv/div.S (__divdi3): For negative arguments, change bgez to bgtz.
2020-01-01Update copyright years.Jakub Jelinek8-8/+8
From-SVN: r279813
2019-11-01RISC-V: Build soft-float divide routines for -mno-fdiv.Jim Wilson1-0/+17
Using -mno-fdiv gives linker errors unless we build the missing divide routines in libgcc always. There is at least one university project designing RISC-V parts without FP divide that wants to use the option. libgcc/ * config/riscv/t-softfp32 (softfp_extra): Add FP divide routines From-SVN: r277723
2019-01-01Update copyright years.Jakub Jelinek8-8/+8
From-SVN: r267494
2018-05-18RISC-V: Add RV32E support.Kito Cheng1-1/+45
Kito Cheng <kito.cheng@gmail.com> Monk Chiang <sh.chiang04@gmail.com> gcc/ * common/config/riscv/riscv-common.c (riscv_parse_arch_string): Add support to parse rv32e*. Clear MASK_RVE for rv32i and rv64i. * config.gcc (riscv*-*-*): Add support for rv32e* and ilp32e. * config/riscv/riscv-c.c (riscv_cpu_cpp_builtins): Define __riscv_32e when TARGET_RVE. Handle ABI_ILP32E as soft-float ABI. * config/riscv/riscv-opts.h (riscv_abi_type): Add ABI_ILP32E. * config/riscv/riscv.c (riscv_compute_frame_info): When TARGET_RVE, compute save_libcall_adjustment properly. (riscv_option_override): Call error if TARGET_RVE and not ABI_ILP32E. (riscv_conditional_register_usage): Handle TARGET_RVE and ABI_ILP32E. * config/riscv/riscv.h (UNITS_PER_FP_ARG): Handle ABI_ILP32E. (STACK_BOUNDARY, ABI_STACK_BOUNDARY): Handle TARGET_RVE. (GP_REG_LAST, MAX_ARGS_IN_REGISTERS): Likewise. (ABI_SPEC): Handle mabi=ilp32e. * config/riscv/riscv.opt (abi_type): Add ABI_ILP32E. (RVE): Add RVE mask. * doc/invoke.texi (RISC-V options) <-mabi>: Add ilp32e info. <-march>: Add rv32e as an example. gcc/testsuite/ * gcc.dg/stack-usage-1.c: Add support for rv32e. libgcc/ * config/riscv/save-restore.S: Add support for rv32e. Co-Authored-By: Jim Wilson <jimw@sifive.com> Co-Authored-By: Monk Chiang <sh.chiang04@gmail.com> From-SVN: r260384
2018-01-03Update copyright years.Jakub Jelinek8-8/+8
From-SVN: r256169
2017-12-12Use C version of multi3 for RVE support.Kito Cheng3-91/+87
libgcc/ * config/riscv/t-elf: Use multi3.c instead of multi3.S. * config/riscv/multi3.c: New file. * config/riscv/multi3.S: Remove. From-SVN: r255598
2017-12-08Add .type and .size directives to riscv libgcc functions.Jim Wilson5-102/+175
libgcc/ * config/riscv/div.S: Use FUNC_* macros. * config/riscv/muldi3.S, config/riscv/multi3.S: Likewise * config/riscv/save-restore.S: Likewise. * config/riscv/riscv-asm.h: New. From-SVN: r255521
2017-06-28Use ucontext_t not struct ucontext in linux-unwind.h files.Joseph Myers1-1/+1
Current glibc no longer gives the ucontext_t type the tag struct ucontext, to conform with POSIX namespace rules. This requires various linux-unwind.h files in libgcc, that were previously using struct ucontext, to be fixed to use ucontext_t instead. This is similar to the removal of the struct siginfo tag from siginfo_t some years ago. This patch changes those files to use ucontext_t instead. As the standard name that should be unconditionally safe, so this is not restricted to architectures supported by glibc, or conditioned on the glibc version. Tested compilation together with current glibc with glibc's build-many-glibcs.py. * config/aarch64/linux-unwind.h (aarch64_fallback_frame_state), config/alpha/linux-unwind.h (alpha_fallback_frame_state), config/bfin/linux-unwind.h (bfin_fallback_frame_state), config/i386/linux-unwind.h (x86_64_fallback_frame_state, x86_fallback_frame_state), config/m68k/linux-unwind.h (struct uw_ucontext), config/nios2/linux-unwind.h (struct nios2_ucontext), config/pa/linux-unwind.h (pa32_fallback_frame_state), config/riscv/linux-unwind.h (riscv_fallback_frame_state), config/sh/linux-unwind.h (sh_fallback_frame_state), config/tilepro/linux-unwind.h (tile_fallback_frame_state), config/xtensa/linux-unwind.h (xtensa_fallback_frame_state): Use ucontext_t instead of struct ucontext. From-SVN: r249731
2017-02-06RISC-V Port: libgccPalmer Dabbelt14-0/+1112
libgcc/ChangeLog: 2017-02-06 Palmer Dabbelt <palmer@dabbelt.com> * config.host: Add RISC-V tuples. * config/riscv/atomic.c: New file. * config/riscv/crti.S: Likewise. * config/riscv/crtn.S: Likewise. * config/riscv/div.S: Likewise. * config/riscv/linux-unwind.h: Likewise. * config/riscv/muldi3.S: Likewise. * config/riscv/multi3.S: Likewise. * config/riscv/save-restore.S: Likewise. * config/riscv/sfp-machine.h: Likewise. * config/riscv/t-elf: Likewise. * config/riscv/t-elf32: Likewise. * config/riscv/t-elf64: Likewise. * config/riscv/t-softfp32: Likewise. * config/riscv/t-softfp64: Likewise. From-SVN: r245226