diff options
author | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2025-09-02 15:58:26 -0700 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2025-09-02 15:58:26 -0700 |
commit | 071b4126c613881f4cb25b4e5c39032964827f88 (patch) | |
tree | 7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/config/pru | |
parent | 845d23f3ea08ba873197c275a8857eee7edad996 (diff) | |
parent | caa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff) | |
download | gcc-devel/gfortran-test.zip gcc-devel/gfortran-test.tar.gz gcc-devel/gfortran-test.tar.bz2 |
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/config/pru')
-rw-r--r-- | gcc/config/pru/pru.cc | 11 | ||||
-rw-r--r-- | gcc/config/pru/pru.h | 3 | ||||
-rw-r--r-- | gcc/config/pru/pru.md | 28 | ||||
-rw-r--r-- | gcc/config/pru/pru.opt | 8 | ||||
-rw-r--r-- | gcc/config/pru/pru.opt.urls | 6 | ||||
-rw-r--r-- | gcc/config/pru/t-multilib | 29 |
6 files changed, 72 insertions, 13 deletions
diff --git a/gcc/config/pru/pru.cc b/gcc/config/pru/pru.cc index 322e319..3fdc56e 100644 --- a/gcc/config/pru/pru.cc +++ b/gcc/config/pru/pru.cc @@ -941,10 +941,19 @@ pru_init_libfuncs (void) /* Long long. */ set_optab_libfunc (ashr_optab, DImode, "__pruabi_asrll"); - set_optab_libfunc (smul_optab, DImode, "__pruabi_mpyll"); set_optab_libfunc (ashl_optab, DImode, "__pruabi_lslll"); set_optab_libfunc (lshr_optab, DImode, "__pruabi_lsrll"); + if (TARGET_OPT_MUL) + { + set_optab_libfunc (smul_optab, DImode, "__pruabi_mpyll"); + } + else + { + set_optab_libfunc (smul_optab, DImode, "__pruabi_softmpyll"); + set_optab_libfunc (smul_optab, SImode, "__pruabi_softmpyi"); + } + set_optab_libfunc (sdiv_optab, SImode, "__pruabi_divi"); set_optab_libfunc (udiv_optab, SImode, "__pruabi_divu"); set_optab_libfunc (smod_optab, SImode, "__pruabi_remi"); diff --git a/gcc/config/pru/pru.h b/gcc/config/pru/pru.h index 6c0719b..9d547ed 100644 --- a/gcc/config/pru/pru.h +++ b/gcc/config/pru/pru.h @@ -65,6 +65,9 @@ #undef ENDFILE_SPEC #define ENDFILE_SPEC "%{!mabi=ti:-lgloss} " +#undef MULTILIB_DEFAULTS +#define MULTILIB_DEFAULTS { "mloop", "mmul", "mfillzero" } + /* TI ABI mandates that ELF symbols do not start with any prefix. */ #undef USER_LABEL_PREFIX #define USER_LABEL_PREFIX "" diff --git a/gcc/config/pru/pru.md b/gcc/config/pru/pru.md index 3504e42..b8ef55b 100644 --- a/gcc/config/pru/pru.md +++ b/gcc/config/pru/pru.md @@ -215,7 +215,7 @@ mov\\t%0, %1 ldi\\t%0, %%pmem(%1) ldi\\t%0, %1 - fill\\t%0, 4 + * return TARGET_OPT_FILLZERO ? \"fill\\t%0, 4\" : \"ldi32\\t%0, 0xffffffff\"; ldi32\\t%0, %1" [(set_attr "type" "st,ld,alu,alu,alu,alu,alu") (set_attr "length" "4,4,4,4,4,4,8")]) @@ -259,9 +259,11 @@ case 1: return "lb%B1o\\t%b0, %1, %S1"; case 2: - return "zero\\t%F0, 8"; + return TARGET_OPT_FILLZERO ? "zero\\t%F0, 8" + : "ldi\\t%F0, 0\;ldi\\t%N0, 0"; case 3: - return "fill\\t%F0, 8"; + return TARGET_OPT_FILLZERO ? "fill\\t%F0, 8" + : "ldi32\\t%F0, 0xffffffff\;mov\\t%N0, %F0"; case 4: /* careful with overlapping source and destination regs. */ gcc_assert (GP_REG_P (REGNO (operands[0]))); @@ -502,7 +504,7 @@ (define_insn "zero_extendqidi2" [(set (match_operand:DI 0 "register_operand" "=r,r") (zero_extend:DI (match_operand:QI 1 "register_operand" "0,r")))] - "" + "TARGET_OPT_FILLZERO" "@ zero\\t%F0.b1, 7 mov\\t%F0.b0, %1\;zero\\t%F0.b1, 7" @@ -512,7 +514,7 @@ (define_insn "zero_extendhidi2" [(set (match_operand:DI 0 "register_operand" "=r,r") (zero_extend:DI (match_operand:HI 1 "register_operand" "0,r")))] - "" + "TARGET_OPT_FILLZERO" "@ zero\\t%F0.b2, 6 mov\\t%F0.w0, %1\;zero\\t%F0.b2, 6" @@ -522,7 +524,7 @@ (define_insn "zero_extendsidi2" [(set (match_operand:DI 0 "register_operand" "=r,r") (zero_extend:DI (match_operand:SI 1 "register_operand" "0,r")))] - "" + "TARGET_OPT_FILLZERO" "@ zero\\t%N0, 4 mov\\t%F0, %1\;zero\\t%N0, 4" @@ -535,7 +537,7 @@ (define_expand "extend<EQS0:mode><EQDHIDI:mode>2" [(set (match_operand:EQDHIDI 0 "register_operand" "=r") (sign_extend:EQDHIDI (match_operand:EQS0 1 "register_operand" "r")))] - "" + "TARGET_OPT_FILLZERO" { rtx_code_label *skip_hiset_label; @@ -744,7 +746,7 @@ (ior:HIDI (match_operand:HIDI 1 "register_operand" "0") (match_operand:HIDI 2 "const_fillbytes_operand" "Uf")))] - "" + "TARGET_OPT_FILLZERO" { static char line[64]; pru_byterange r; @@ -767,7 +769,7 @@ (and:HIDI (match_operand:HIDI 1 "register_operand" "0") (match_operand:HIDI 2 "const_zerobytes_operand" "Uz")))] - "" + "TARGET_OPT_FILLZERO" { static char line[64]; pru_byterange r; @@ -1114,7 +1116,8 @@ /* Try with the more efficient zero/fill patterns first. */ if (<LOGICAL_BITOP:CODE> == IOR && CONST_INT_P (operands[2]) - && const_fillbytes_operand (operands[2], DImode)) + && const_fillbytes_operand (operands[2], DImode) + && TARGET_OPT_FILLZERO) { rtx insn = maybe_gen_pru_ior_fillbytes (DImode, operands[0], @@ -1130,7 +1133,8 @@ } if (<LOGICAL_BITOP:CODE> == AND && CONST_INT_P (operands[2]) - && const_zerobytes_operand (operands[2], DImode)) + && const_zerobytes_operand (operands[2], DImode) + && TARGET_OPT_FILLZERO) { rtx insn = maybe_gen_pru_and_zerobytes (DImode, operands[0], @@ -1212,7 +1216,7 @@ [(set (match_operand:SI 0 "pru_muldst_operand" "=Rmd0") (mult:SI (match_operand:SI 1 "pru_mulsrc0_operand" "%Rms0") (match_operand:SI 2 "pru_mulsrc1_operand" "Rms1")))] - "" + "TARGET_OPT_MUL" "nop\;xin\\t0, %0, 4" [(set_attr "type" "alu") (set_attr "length" "8")]) diff --git a/gcc/config/pru/pru.opt b/gcc/config/pru/pru.opt index 8385beb..5206b2a 100644 --- a/gcc/config/pru/pru.opt +++ b/gcc/config/pru/pru.opt @@ -39,6 +39,14 @@ mloop Target Mask(OPT_LOOP) Allow (or do not allow) gcc to use the LOOP instruction. +mmul +Target Mask(OPT_MUL) +Allow (or do not allow) gcc to use the PRU multiplier unit. + +mfillzero +Target Mask(OPT_FILLZERO) +Allow (or do not allow) gcc to use the FILL and ZERO instructions. + mabi= Target RejectNegative Joined Enum(pru_abi_t) Var(pru_current_abi) Init(PRU_ABI_GNU) Save Select target ABI variant. diff --git a/gcc/config/pru/pru.opt.urls b/gcc/config/pru/pru.opt.urls index c87affb..5c57892 100644 --- a/gcc/config/pru/pru.opt.urls +++ b/gcc/config/pru/pru.opt.urls @@ -12,6 +12,12 @@ UrlSuffix(gcc/PRU-Options.html#index-mno-relax-1) mloop UrlSuffix(gcc/PRU-Options.html#index-mloop) +mmul +UrlSuffix(gcc/PRU-Options.html#index-mmul) + +mfillzero +UrlSuffix(gcc/PRU-Options.html#index-mfillzero) + mabi= UrlSuffix(gcc/PRU-Options.html#index-mabi-4) diff --git a/gcc/config/pru/t-multilib b/gcc/config/pru/t-multilib new file mode 100644 index 0000000..1e3c2b8 --- /dev/null +++ b/gcc/config/pru/t-multilib @@ -0,0 +1,29 @@ +# Copyright (C) 2025 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/>. + +MULTILIB_OPTIONS = +MULTILIB_OPTIONS += mloop/mno-loop +MULTILIB_OPTIONS += mmul/mno-mul +MULTILIB_OPTIONS += mfillzero/mno-fillzero + +# Build two variants: +# - Newer PRU core versions, present in AM335x and later. +# - Older PRU core versions, present in AM18xx. +MULTILIB_REQUIRED = +MULTILIB_REQUIRED += mloop/mmul/mfillzero +MULTILIB_REQUIRED += mno-loop/mno-mul/mno-fillzero |