gcc/ChangeLog:
* config/csky/csky_opts.h (float_abi_type): New.
* config/csky/csky.h (TARGET_SOFT_FLOAT): New.
(TARGET_HARD_FLOAT): New.
(TARGET_HARD_FLOAT_ABI): New.
(OPTION_DEFAULT_SPECS): Use mfloat-abi.
* config/csky/csky.opt (mfloat-abi): New.
* doc/invoke.texi (C-SKY Options): Document -mfloat-abi=.
---
gcc/config/csky/csky.h | 9 ++++++++-
gcc/config/csky/csky.opt | 29 +++++++++++++++++++++++++----
gcc/config/csky/csky_opts.h | 7 +++++++
gcc/doc/invoke.texi | 18 ++++++++++++++++++
4 files changed, 58 insertions(+), 5 deletions(-)
diff --git a/gcc/config/csky/csky.h b/gcc/config/csky/csky.h
index 2d5a66ca187..8f4090b4b38 100644
--- a/gcc/config/csky/csky.h
+++ b/gcc/config/csky/csky.h
@@ -126,6 +126,13 @@
#define TARGET_TLS \
(CSKY_TARGET_ARCH (CK807) || CSKY_TARGET_ARCH (CK810))
+/* Run-time Target Specification. */
+#define TARGET_SOFT_FLOAT (csky_float_abi == CSKY_FLOAT_ABI_SOFT)
+/* Use hardware floating point instructions. */
+#define TARGET_HARD_FLOAT (csky_float_abi != CSKY_FLOAT_ABI_SOFT)
+/* Use hardware floating point calling convention. */
+#define TARGET_HARD_FLOAT_ABI (csky_float_abi == CSKY_FLOAT_ABI_HARD)
+
/* Number of loads/stores handled by ldm/stm. */
#define CSKY_MIN_MULTIPLE_STLD 3
#define CSKY_MAX_MULTIPLE_STLD 12
@@ -818,7 +825,7 @@ while (0)
{"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \
{"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
{"endian", "%{!mbig-endian:%{!mlittle-endian:-m%(VALUE)-endian}}" }, \
- {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" },
+ {"float", "%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}" },
/******************************************************************
diff --git a/gcc/config/csky/csky.opt b/gcc/config/csky/csky.opt
index 5846e50344f..60b51e5798f 100644
--- a/gcc/config/csky/csky.opt
+++ b/gcc/config/csky/csky.opt
@@ -57,12 +57,33 @@ Target RejectNegative Report Alias(mlittle-endian)
Undocumented
;; assembly.
mhard-float
-Target Report RejectNegative Mask(HARD_FLOAT)
-Enable hardware floating-point instructions.
+Target RejectNegative Alias(mfloat-abi=, hard) Undocumented
msoft-float
-Target Report RejectNegative InverseMask(HARD_FLOAT)
-Use library calls to perform floating-point operations (default).
+Target RejectNegative Alias(mfloat-abi=, soft) Undocumented
+
+mfloat-abi=v2
+Target RejectNegative Alias(mfloat-abi=, hard) Undocumented
+
+mfloat-abi=v1
+Target RejectNegative Alias(mfloat-abi=, softfp) Undocumented
+
+mfloat-abi=
+Target RejectNegative Joined Enum(float_abi_type) Var(csky_float_abi)
Init(CSKY_FLOAT_ABI_SOFT)
+Specify if floating point hardware should be used.
+
+Enum
+Name(float_abi_type) Type(enum float_abi_type)
+Known floating-point ABIs (for use with the -mfloat-abi= option):
+
+EnumValue
+Enum(float_abi_type) String(soft) Value(CSKY_FLOAT_ABI_SOFT)
+
+EnumValue
+Enum(float_abi_type) String(softfp) Value(CSKY_FLOAT_ABI_SOFTFP)
+
+EnumValue
+Enum(float_abi_type) String(hard) Value(CSKY_FLOAT_ABI_HARD)
mfpu=
Target RejectNegative Joined Enum(csky_fpu) Var(csky_fpu_index)
Init(TARGET_FPU_auto) Save
diff --git a/gcc/config/csky/csky_opts.h b/gcc/config/csky/csky_opts.h
index a6dbf5ab6dd..7ee56be3e81 100644
--- a/gcc/config/csky/csky_opts.h
+++ b/gcc/config/csky/csky_opts.h
@@ -59,5 +59,12 @@ enum csky_fpu_type
};
#define CSKY_TARGET_FPU_GET(name) TARGET_FPU_ ## name
+enum float_abi_type
+{
+ CSKY_FLOAT_ABI_SOFT,
+ CSKY_FLOAT_ABI_SOFTFP,
+ CSKY_FLOAT_ABI_HARD
+};
+
#endif /* CSKY_OPTS_H */
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index eaaf6d06b65..a132e09c674 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -820,6 +820,7 @@ Objective-C and Objective-C++ Dialects}.
@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
-mbig-endian -EB -mlittle-endian -EL @gol
-mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
+-mfloat-abi=@var{name} @gol
-melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
-mdsp -medsp -mvdsp @gol
-mdiv -msmart -mhigh-registers -manchor @gol
@@ -20644,6 +20645,23 @@ Specify the C-SKY target processor. Valid values for
@var{cpu} are:
Select big- or little-endian code. The default is little-endian.
+@item -mfloat-abi=@var{name}
+@opindex mfloat-abi
+Specifies which floating-point ABI to use. Permissible values
+are: @samp{soft}, @samp{softfp} and @samp{hard}.
+
+Specifying @samp{soft} causes GCC to generate output containing
+library calls for floating-point operations.
+@samp{softfp} allows the generation of code using hardware floating-point
+instructions, but still uses the soft-float calling conventions.
+@samp{hard} allows generation of floating-point instructions
+and uses FPU-specific calling conventions.
+
+The default depends on the specific target configuration. Note that
+the hard-float and soft-float ABIs are not link-compatible; you must
+compile your entire program with the same ABI, and link with a
+compatible set of libraries.
+
@item -mhard-float
@opindex mhard-float
@itemx -msoft-float