> gcc/ChangeLog

> 
> * config.gcc (riscv): Accept rv64e and lp64e.
> * config/riscv/arch-canonicalize: Likewise.
> * config/riscv/riscv-c.cc (riscv_cpu_cpp_builtins): Likewise.
> * config/riscv/riscv-opts.h (riscv_abi_type): Likewise.
> * config/riscv/riscv.cc (riscv_option_override): Likewise
> * config/riscv/riscv.h (UNITS_PER_FP_ARG): Likewise.
> (STACK_BOUNDARY): Likewise.
> (ABI_STACK_BOUNDARY): Likewise.
> (MAX_ARGS_IN_REGISTERS): Likewise.
> (ABI_SPEC): Likewise.
> * config/riscv/riscv.opt (abi_type): Likewise.
&gt; * doc/invoke.texi (RISC-V) <-mabi>: Likewise.
&gt; ---
&gt; This is all still in flight, but evidently RV64E exists.  I haven't
&gt; tested this at all, but given that we don't even have the ABI docs lined
&gt; up yet it's likely a bit away from being mergable.
&gt; ---
&gt;  gcc/config.gcc                     |  8 +++++---
&gt;  gcc/config/riscv/arch-canonicalize |  2 +-
&gt;  gcc/config/riscv/riscv-c.cc        |  1 +
&gt;  gcc/config/riscv/riscv-opts.h      |  1 +
&gt;  gcc/config/riscv/riscv.cc          |  6 ++++--
&gt;  gcc/config/riscv/riscv.h           | 11 +++++++----
&gt;  gcc/config/riscv/riscv.opt         |  3 +++
&gt;  gcc/doc/invoke.texi                |  5 +++--
&gt;  8 files changed, 25 insertions(+), 12 deletions(-)
&gt; 
&gt; diff --git a/gcc/config.gcc b/gcc/config.gcc
&gt; index 4e3b15bb5e9..4617ecb8d9b 100644
&gt; --- a/gcc/config.gcc
&gt; +++ b/gcc/config.gcc
&gt; @@ -4637,7 +4637,7 @@ case "${target}" in
&gt;  
&gt;  # Infer arch from --with-arch, --target, and --with-abi.
&gt;  case "${with_arch}" in
&gt; -rv32e* | rv32i* | rv32g* | rv64i* | rv64g*)
&gt; +rv32e* | rv32i* | rv32g* | rv64e* | rv64i* | rv64g*)
&gt;  # OK.
&gt;  ;;
&gt;  "")
&gt; @@ -4645,12 +4645,13 @@ case "${target}" in
&gt;  case "${with_abi}" in
&gt;  ilp32e) with_arch="rv32e" ;;
&gt;  ilp32 | ilp32f | ilp32d) with_arch="rv32gc" ;;
&gt; +lp64e) with_arch="rv64e" ;;
&gt;  lp64 | lp64f | lp64d) with_arch="rv64gc" ;;
&gt;  *) with_arch="rv${xlen}gc" ;;
&gt;  esac
&gt;  ;;
&gt;  *)
&gt; -echo "--with-arch=${with_arch} is not supported.  The argument must begin 
with rv32e, rv32i, rv32g, rv64i, or rv64g." 1>&2
&gt; +echo "--with-arch=${with_arch} is not supported.  The argument must begin 
with rv32e, rv32i, rv32g, rv64e, rv64i, or rv64g." 1>&2
&gt;  exit 1
&gt;  ;;
&gt;  esac
&gt; @@ -4672,6 +4673,7 @@ case "${target}" in
&gt;  rv32e*) with_abi=ilp32e ;;
&gt;  rv32*) with_abi=ilp32 ;;
&gt;  rv64*d* | rv64g*) with_abi=lp64d ;;
&gt; +rv64e*) with_abi=lp64e ;;
&gt;  rv64*) with_abi=lp64 ;;
&gt;  esac
&gt;  ;;
&gt; @@ -4687,7 +4689,7 @@ case "${target}" in
&gt;  ilp32,rv32* | ilp32e,rv32e* \
&gt;  | ilp32f,rv32*f* | ilp32f,rv32g* \
&gt;  | ilp32d,rv32*d* | ilp32d,rv32g* \
&gt; -| lp64,rv64* \
&gt; +| lp64,rv64* | lp64e,rv64e* \
&gt;  | lp64f,rv64*f* | lp64f,rv64g* \
&gt;  | lp64d,rv64*d* | lp64d,rv64g*)
&gt;  ;;
&gt; diff --git a/gcc/config/riscv/arch-canonicalize 
b/gcc/config/riscv/arch-canonicalize
&gt; index fd7651ac491..8db3e88ddd7 100755
&gt; --- a/gcc/config/riscv/arch-canonicalize
&gt; +++ b/gcc/config/riscv/arch-canonicalize
&gt; @@ -71,7 +71,7 @@ def arch_canonicalize(arch, isa_spec):
&gt;    new_arch = ""
&gt;    extra_long_ext = []
&gt;    std_exts = []
&gt; -  if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64i', 'rv64g']:
&gt; +  if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64e', 'rv64i', 'rv64g']:
&gt;      new_arch = arch[:5].replace("g", "i")
&gt;      if arch[:5] in ['rv32g', 'rv64g']:
&gt;        std_exts = ['m', 'a', 'f', 'd']
&gt; diff --git a/gcc/config/riscv/riscv-c.cc b/gcc/config/riscv/riscv-c.cc
&gt; index eb7ef09297e..4614dc6b6d9 100644
&gt; --- a/gcc/config/riscv/riscv-c.cc
&gt; +++ b/gcc/config/riscv/riscv-c.cc
&gt; @@ -67,6 +67,7 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
&gt;    switch (riscv_abi)
&gt;      {
&gt;      case ABI_ILP32E:
&gt; +    case ABI_LP64E:
&gt;        builtin_define ("__riscv_abi_rve");
&gt;        gcc_fallthrough ();
&gt;  
&gt; diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h
&gt; index 1e153b3a6e7..70fe708cbae 100644
&gt; --- a/gcc/config/riscv/riscv-opts.h
&gt; +++ b/gcc/config/riscv/riscv-opts.h
&gt; @@ -27,6 +27,7 @@ enum riscv_abi_type {
&gt;    ABI_ILP32F,
&gt;    ABI_ILP32D,
&gt;    ABI_LP64,
&gt; +  ABI_LP64E,
&gt;    ABI_LP64F,
&gt;    ABI_LP64D
&gt;  };
&gt; diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
&gt; index 2e83ca07394..51b7195c17b 100644
&gt; --- a/gcc/config/riscv/riscv.cc
&gt; +++ b/gcc/config/riscv/riscv.cc
&gt; @@ -5047,8 +5047,10 @@ riscv_option_override (void)
&gt;      error ("requested ABI requires %<-march%> to subsume the %qc 
extension",
&gt;     UNITS_PER_FP_ARG > 8 ? 'Q' : (UNITS_PER_FP_ARG > 4 ? 'D' : 'F'));
&gt;  
&gt; -  if (TARGET_RVE && riscv_abi != ABI_ILP32E)
&gt; +  if (riscv_xlen == 32 && TARGET_RVE && riscv_abi != ABI_ILP32E)
&gt;      error ("rv32e requires ilp32e ABI");
&gt; +  if (riscv_xlen == 64 && TARGET_RVE && riscv_abi != ABI_LP64E)
&gt; +    error ("rv64e requires lp64e ABI");
&gt;  


Hi Palmer, I just run this patch and report unresolve the symbol "riscv_xlen" 
here,


maybe we can use "!TARGET_64BIT" and "TARGET_64BIT" to instead of them, thanks.



&gt;    /* We do not yet support ILP32 on RV64.  */
&gt;    if (BITS_PER_WORD != POINTER_SIZE)
&gt; @@ -5140,7 +5142,7 @@ riscv_conditional_register_usage (void)
&gt;  fixed_regs[r] = 1;
&gt;      }
&gt;  
&gt; -  if (riscv_abi == ABI_ILP32E)
&gt; +  if (riscv_abi == ABI_ILP32E || riscv_abi == ABI_LP64E)
&gt;      {
&gt;        for (int r = 16; r <= 31; r++)
&gt;  call_used_regs[r] = 1;
&gt; diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
&gt; index 6f7f4d3fbdc..40d23208975 100644
&gt; --- a/gcc/config/riscv/riscv.h
&gt; +++ b/gcc/config/riscv/riscv.h
&gt; @@ -159,7 +159,7 @@ ASM_MISA_SPEC
&gt;  /* The largest type that can be passed in floating-point registers.  */
&gt;  #define UNITS_PER_FP_ARG\
&gt;    ((riscv_abi == ABI_ILP32 || riscv_abi == ABI_ILP32E\
&gt; -    || riscv_abi == ABI_LP64)\
&gt; +    || riscv_abi == ABI_LP64 || riscv_abi == ABI_LP64E)\
&gt;     ? 0 \
&gt;     : ((riscv_abi == ABI_ILP32F || riscv_abi == ABI_LP64F) ? 4 : 8))
&gt;  
&gt; @@ -182,10 +182,11 @@ ASM_MISA_SPEC
&gt;  
&gt;  /* The smallest supported stack boundary the calling convention supports. 
 */
&gt;  #define STACK_BOUNDARY \
&gt; -  (riscv_abi == ABI_ILP32E ? BITS_PER_WORD : 2 * BITS_PER_WORD)
&gt; +  ((riscv_abi == ABI_ILP32E || riscv_abi == ABI_LP64E ? 1 : 2) * 
BITS_PER_WORD)
&gt;  
&gt;  /* The ABI stack alignment.  */
&gt; -#define ABI_STACK_BOUNDARY (riscv_abi == ABI_ILP32E ? BITS_PER_WORD : 128)
&gt; +#define ABI_STACK_BOUNDARY \
&gt; +  (riscv_abi == ABI_ILP32E || riscv_abi == ABI_LP64E ? BITS_PER_WORD : 
128)
&gt;  
&gt;  /* There is no point aligning anything to a rounder boundary than this.  
*/
&gt;  #define BIGGEST_ALIGNMENT 128
&gt; @@ -573,7 +574,8 @@ enum reg_class
&gt;  #define GP_RETURN GP_ARG_FIRST
&gt;  #define FP_RETURN (UNITS_PER_FP_ARG == 0 ? GP_RETURN : FP_ARG_FIRST)
&gt;  
&gt; -#define MAX_ARGS_IN_REGISTERS (riscv_abi == ABI_ILP32E ? 6 : 8)
&gt; +#define MAX_ARGS_IN_REGISTERS \
&gt; +  (riscv_abi == ABI_ILP32E || riscv_abi == ABI_LP64E ? 6 : 8)
&gt;  
&gt;  /* Symbolic macros for the first/last argument registers.  */
&gt;  
&gt; @@ -966,6 +968,7 @@ extern unsigned riscv_stack_boundary;
&gt;    "%{mabi=ilp32e:ilp32e}" \
&gt;    "%{mabi=ilp32f:ilp32f}" \
&gt;    "%{mabi=ilp32d:ilp32d}" \
&gt; +  "%{mabi=lp64e:lp64e}" \
&gt;    "%{mabi=lp64:lp64}" \
&gt;    "%{mabi=lp64f:lp64f}" \
&gt;    "%{mabi=lp64d:lp64d}" \
&gt; diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
&gt; index 9e9fe6d8ccd..94061ec9664 100644
&gt; --- a/gcc/config/riscv/riscv.opt
&gt; +++ b/gcc/config/riscv/riscv.opt
&gt; @@ -64,6 +64,9 @@ Enum(abi_type) String(ilp32d) Value(ABI_ILP32D)
&gt;  EnumValue
&gt;  Enum(abi_type) String(lp64) Value(ABI_LP64)
&gt;  
&gt; +EnumValue
&gt; +Enum(abi_type) String(lp64e) Value(ABI_LP64E)
&gt; +
&gt;  EnumValue
&gt;  Enum(abi_type) String(lp64f) Value(ABI_LP64F)
&gt;  
&gt; diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
&gt; index d5ff1018372..a43e3ec50de 100644
&gt; --- a/gcc/doc/invoke.texi
&gt; +++ b/gcc/doc/invoke.texi
&gt; @@ -28215,8 +28215,9 @@ conventions are: @samp{ilp32}, @samp{ilp32f}, 
@samp{ilp32d}, @samp{lp64},
&gt;  implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
&gt;  invalid because the ABI requires 64-bit values be passed in F registers, 
but F
&gt;  registers are only 32 bits wide.  There is also the @samp{ilp32e} ABI 
that can
&gt; -only be used with the @samp{rv32e} architecture.  This ABI is not well
&gt; -specified at present, and is subject to change.
&gt; +only be used with the @samp{rv32e} architecture and the @samp{lp64e} ABI 
that
&gt; +can only be used with the @samp{rv64e} architecture.  These two ABIs are 
not
&gt; +well specified at present, and are subject to change.
&gt;  
&gt;  @item -mfdiv
&gt;  @itemx -mno-fdiv
&gt; -- 
&gt; 2.34.1

Reply via email to