summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLulu Cheng <chenglulu@loongson.cn>2024-07-04 10:37:26 +0800
committerLulu Cheng <chenglulu@loongson.cn>2024-07-13 14:07:50 +0800
commit616c3290785c204b3019e7aaff8a7d9bb425d336 (patch)
tree469bcfdd4536f2a6102a87fa65bbaddd03d52112
parentDaily bump. (diff)
LoongArch: TFmode is not allowed to be stored in the float register.
PR target/115752 gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_hard_regno_mode_ok_uncached): Replace UNITS_PER_FPVALUE with UNITS_PER_HWFPVALUE. * config/loongarch/loongarch.h (UNITS_PER_FPVALUE): Delete. gcc/testsuite/ChangeLog: * gcc.target/loongarch/pr115752.c: New test. (cherry picked from commit abeb6c8a62758faa0719e818e6e8a7db15a6793b)
-rw-r--r--gcc/config/loongarch/loongarch.cc2
-rw-r--r--gcc/config/loongarch/loongarch.h7
-rw-r--r--gcc/testsuite/gcc.target/loongarch/pr115752.c8
3 files changed, 9 insertions, 8 deletions
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index 2238858cd6ab..be26e156beb8 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -5491,7 +5491,7 @@ loongarch_hard_regno_mode_ok_uncached (unsigned int regno, machine_mode mode)
5491 if (mclass == MODE_FLOAT 5491 if (mclass == MODE_FLOAT
5492 || mclass == MODE_COMPLEX_FLOAT 5492 || mclass == MODE_COMPLEX_FLOAT
5493 || mclass == MODE_VECTOR_FLOAT) 5493 || mclass == MODE_VECTOR_FLOAT)
5494 return size <= UNITS_PER_FPVALUE; 5494 return size <= UNITS_PER_HWFPVALUE;
5495 5495
5496 /* Allow integer modes that fit into a single register. We need 5496 /* Allow integer modes that fit into a single register. We need
5497 to put integers into FPRs when using instructions like CVT 5497 to put integers into FPRs when using instructions like CVT
diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index d072522e3cfe..b1149a12aba4 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -202,13 +202,6 @@ along with GCC; see the file COPYING3. If not see
202#define UNITS_PER_HWFPVALUE \ 202#define UNITS_PER_HWFPVALUE \
203 (TARGET_SOFT_FLOAT ? 0 : UNITS_PER_FPREG) 203 (TARGET_SOFT_FLOAT ? 0 : UNITS_PER_FPREG)
204 204
205/* The largest size of value that can be held in floating-point
206 registers. */
207#define UNITS_PER_FPVALUE \
208 (TARGET_SOFT_FLOAT ? 0 \
209 : TARGET_SINGLE_FLOAT ? UNITS_PER_FPREG \
210 : LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)
211
212/* The number of bytes in a double. */ 205/* The number of bytes in a double. */
213#define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT) 206#define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT)
214 207
diff --git a/gcc/testsuite/gcc.target/loongarch/pr115752.c b/gcc/testsuite/gcc.target/loongarch/pr115752.c
new file mode 100644
index 000000000000..df4bae524f75
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/pr115752.c
@@ -0,0 +1,8 @@
1/* { dg-do compile } */
2
3long double
4test (long double xx)
5{
6 __asm ("" :: "f"(xx)); /* { dg-error "inconsistent operand constraints in an 'asm'" } */
7 return xx + 1;
8}