]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: TFmode is not allowed to be stored in the float register.
authorLulu Cheng <chenglulu@loongson.cn>
Thu, 4 Jul 2024 02:37:26 +0000 (10:37 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Fri, 12 Jul 2024 02:23:01 +0000 (10:23 +0800)
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.

gcc/config/loongarch/loongarch.cc
gcc/config/loongarch/loongarch.h
gcc/testsuite/gcc.target/loongarch/pr115752.c [new file with mode: 0644]

index 27f3dbdfb1a007db24cfb953d5c41968bf98ffcb..5d894a36b4d469444e7d2cd676134374add9e58f 100644 (file)
@@ -6763,7 +6763,7 @@ loongarch_hard_regno_mode_ok_uncached (unsigned int regno, machine_mode mode)
       if (mclass == MODE_FLOAT
          || mclass == MODE_COMPLEX_FLOAT
          || mclass == MODE_VECTOR_FLOAT)
-       return size <= UNITS_PER_FPVALUE;
+       return size <= UNITS_PER_HWFPVALUE;
 
       /* Allow integer modes that fit into a single register.  We need
         to put integers into FPRs when using instructions like CVT
index b9323aba394817e123c217b73c40fdaead41c56d..5efeae53be6b6ecba605ff7adfd0bcb148dca8d0 100644 (file)
@@ -146,13 +146,6 @@ along with GCC; see the file COPYING3.  If not see
 #define UNITS_PER_HWFPVALUE \
   (TARGET_SOFT_FLOAT ? 0 : UNITS_PER_FP_REG)
 
-/* The largest size of value that can be held in floating-point
-   registers.  */
-#define UNITS_PER_FPVALUE \
-  (TARGET_SOFT_FLOAT ? 0 \
-   : TARGET_SINGLE_FLOAT ? UNITS_PER_FP_REG \
-                        : LA_LONG_DOUBLE_TYPE_SIZE / BITS_PER_UNIT)
-
 /* The number of bytes in a double.  */
 #define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT)
 
diff --git a/gcc/testsuite/gcc.target/loongarch/pr115752.c b/gcc/testsuite/gcc.target/loongarch/pr115752.c
new file mode 100644 (file)
index 0000000..df4bae5
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+
+long double
+test (long double xx)
+{
+   __asm ("" :: "f"(xx)); /* { dg-error "inconsistent operand constraints in an 'asm'" } */
+   return xx + 1;
+}