C-SKY: Add -mfloat-abi= option.

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=.
This commit is contained in:
Jojo R 2020-07-31 15:18:25 +08:00 committed by Xianmiao Qu
parent c713ad3fea
commit 197f1e8c14
4 changed files with 58 additions and 5 deletions

View File

@ -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)}" },
/******************************************************************

View File

@ -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

View File

@ -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 */

View File

@ -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
@ -20646,6 +20647,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