aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLulu Cheng <chenglulu@loongson.cn>2025-03-22 14:37:01 +0800
committerLulu Cheng <chenglulu@loongson.cn>2025-03-27 14:59:02 +0800
commit7c8da04c412ed4f54596f10434aa46592d000fbf (patch)
treeabbddbc69caf5963c50f624125a07104699b3c53
parent876a521a198130bac638d682444e908b331c1185 (diff)
downloadgcc-7c8da04c412ed4f54596f10434aa46592d000fbf.zip
gcc-7c8da04c412ed4f54596f10434aa46592d000fbf.tar.gz
gcc-7c8da04c412ed4f54596f10434aa46592d000fbf.tar.bz2
LoongArch: Support Q suffix for __float128.
In r14-3635 supports `__float128`, but does not support the 'q/Q' suffix. PR target/119408 gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_c_mode_for_suffix): New. (TARGET_C_MODE_FOR_SUFFIX): Define. gcc/testsuite/ChangeLog: * gcc.target/loongarch/pr119408.c: New test.
-rw-r--r--gcc/config/loongarch/loongarch.cc13
-rw-r--r--gcc/testsuite/gcc.target/loongarch/pr119408.c12
2 files changed, 25 insertions, 0 deletions
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index 01f0486..7533e53 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -11206,6 +11206,16 @@ loongarch_asm_code_end (void)
#undef DUMP_FEATURE
}
+/* Target hook for c_mode_for_suffix. */
+static machine_mode
+loongarch_c_mode_for_suffix (char suffix)
+{
+ if (suffix == 'q')
+ return TFmode;
+
+ return VOIDmode;
+}
+
/* Initialize the GCC target structure. */
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.half\t"
@@ -11477,6 +11487,9 @@ loongarch_asm_code_end (void)
#undef TARGET_OPTION_VALID_ATTRIBUTE_P
#define TARGET_OPTION_VALID_ATTRIBUTE_P loongarch_option_valid_attribute_p
+#undef TARGET_C_MODE_FOR_SUFFIX
+#define TARGET_C_MODE_FOR_SUFFIX loongarch_c_mode_for_suffix
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-loongarch.h"
diff --git a/gcc/testsuite/gcc.target/loongarch/pr119408.c b/gcc/testsuite/gcc.target/loongarch/pr119408.c
new file mode 100644
index 0000000..f46399a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/loongarch/pr119408.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wno-pedantic" } */
+
+__float128 a;
+__float128 b;
+void
+test (void)
+{
+ a = 1.11111111Q;
+ b = 1.434345q;
+}
+