public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] C-SKY: Add conditions for ceil etc patterns.
@ 2023-01-13 12:38 Xianmiao Qu
  0 siblings, 0 replies; only message in thread
From: Xianmiao Qu @ 2023-01-13 12:38 UTC (permalink / raw)
  To: gcc-patches

The ceil etc functions can be only inlined as instruction when
they can raise the "inexact" exception. Without the adding
conditions, it will cause the "gcc.dg/torture/builtin-fp-int-inexact-c2x.c"
etc cases fails.

gcc/
	* config/csky/csky_insn_fpuv3.md (l<frm_pattern><fixsuop><mode>si2): Test
	flag_fp_int_builtin_inexact || !flag_trapping_math.
	(<frm_pattern><mode>2): Likewise.
---
 gcc/config/csky/csky_insn_fpuv3.md | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/config/csky/csky_insn_fpuv3.md b/gcc/config/csky/csky_insn_fpuv3.md
index 628bae597ba..7f8f459621e 100644
--- a/gcc/config/csky/csky_insn_fpuv3.md
+++ b/gcc/config/csky/csky_insn_fpuv3.md
@@ -476,14 +476,16 @@
   [(set (match_operand:SI 0 "register_operand" "=v")
 	(FIX_SU:SI (unspec:F3ANY [(match_operand:F3ANY 1 "register_operand" "0")]
 				   FRM)))]
-  "CSKY_ISA_FEATURE(fpv3_<mode>)"
+  "CSKY_ISA_FEATURE(fpv3_<mode>)
+   && (flag_fp_int_builtin_inexact || !flag_trapping_math)"
   "fftoi.f<f3t>.<fixsu>32<rm>\t%0, %1"
 )
 
 (define_insn "<frm_pattern><mode>2"
   [(set (match_operand:F3ANY 0 "register_operand" "=v")
 	(unspec:F3ANY [(match_operand:F3ANY 1 "register_operand" "0")] FRMF))]
-  "CSKY_ISA_FEATURE(fpv3_<mode>)"
+  "CSKY_ISA_FEATURE(fpv3_<mode>)
+   && (flag_fp_int_builtin_inexact || !flag_trapping_math)"
   "fftofi.f<f3t><rm>\t%0, %1"
 )
 
-- 
2.32.1 (Apple Git-133)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-13 12:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 12:38 [committed] C-SKY: Add conditions for ceil etc patterns Xianmiao Qu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).