diff options
-rw-r--r-- | gcc/config/loongarch/loongarch.h | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/loongarch/flt-abi-isa-1.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/loongarch/flt-abi-isa-2.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/loongarch/flt-abi-isa-3.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/loongarch/flt-abi-isa-4.c | 10 |
5 files changed, 45 insertions, 2 deletions
diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h index f4e903d..f816787 100644 --- a/gcc/config/loongarch/loongarch.h +++ b/gcc/config/loongarch/loongarch.h @@ -676,7 +676,7 @@ enum reg_class point values. */ #define GP_RETURN (GP_REG_FIRST + 4) -#define FP_RETURN ((TARGET_SOFT_FLOAT) ? GP_RETURN : (FP_REG_FIRST + 0)) +#define FP_RETURN ((TARGET_SOFT_FLOAT_ABI) ? GP_RETURN : (FP_REG_FIRST + 0)) #define MAX_ARGS_IN_REGISTERS 8 @@ -1154,6 +1154,6 @@ struct GTY (()) machine_function /* The largest type that can be passed in floating-point registers. */ /* TODO: according to mabi. */ #define UNITS_PER_FP_ARG \ - (TARGET_HARD_FLOAT ? (TARGET_DOUBLE_FLOAT ? 8 : 4) : 0) + (TARGET_HARD_FLOAT_ABI ? (TARGET_DOUBLE_FLOAT_ABI ? 8 : 4) : 0) #define FUNCTION_VALUE_REGNO_P(N) ((N) == GP_RETURN || (N) == FP_RETURN) diff --git a/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-1.c b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-1.c new file mode 100644 index 0000000..1c9490f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=lp64d -mfpu=64 -march=loongarch64 -O2" } */ +/* { dg-final { scan-assembler "frecip\\.d" } } */ +/* { dg-final { scan-assembler-not "movgr2fr\\.d" } } */ +/* { dg-final { scan-assembler-not "movfr2gr\\.d" } } */ + +/* FPU is used for calculation and FPR is used for arguments and return + values. */ + +double +t (double x) +{ + return 1.0 / x; +} diff --git a/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-2.c b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-2.c new file mode 100644 index 0000000..0580fd6 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=lp64s -mfpu=64 -march=loongarch64 -O2" } */ +/* { dg-final { scan-assembler "frecip\\.d" } } */ +/* { dg-final { scan-assembler "movgr2fr\\.d" } } */ +/* { dg-final { scan-assembler "movfr2gr\\.d" } } */ + +/* FPU is used for calculation but FPR cannot be used for arguments and + return values. */ + +#include "flt-abi-isa-1.c" diff --git a/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-3.c b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-3.c new file mode 100644 index 0000000..16a926f --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=lp64s -mfpu=none -march=loongarch64 -O2" } */ +/* { dg-final { scan-assembler-not "frecip\\.d" } } */ +/* { dg-final { scan-assembler-not "movgr2fr\\.d" } } */ +/* { dg-final { scan-assembler-not "movfr2gr\\.d" } } */ + +/* FPU cannot be used at all. */ + +#include "flt-abi-isa-1.c" diff --git a/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-4.c b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-4.c new file mode 100644 index 0000000..43b579c --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/flt-abi-isa-4.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-msoft-float -march=loongarch64 -O2" } */ +/* { dg-final { scan-assembler-not "frecip\\.d" } } */ +/* { dg-final { scan-assembler-not "movgr2fr\\.d" } } */ +/* { dg-final { scan-assembler-not "movfr2gr\\.d" } } */ + +/* -msoft-float implies both -mabi=lp64s and -mfpu=none. + FPU cannot be used at all. */ + +#include "flt-abi-isa-1.c" |