public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Inline lrint and lrintf
@ 2023-02-27 11:20 Ajit Agarwal
  0 siblings, 0 replies; only message in thread
From: Ajit Agarwal @ 2023-02-27 11:20 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool, bergner

Hello All:

Here is the patch for Inline lrint and lrintf. Currently glibc don't
use __builtin_lrint as they inline lrint with fctid/fctiw instruction.
With the below changes such inlines are not required and lrint builtin
can be used.

Bootstrapped and regtested on powerpc64-linux-gnu.

	rs6000: Inline lrint,lrintf

	For hard-float powerpc, GCC should support inline code generation
	for the lrint or lrintf built-in functions, subject only to
	-fno-math-errno (the condition -fno-math-errno is already checked
	in builtins.c:expand_builtin_int_roundingfn_2, so the back end's
	lrint insn patterns do not need to check that condition).

	TARGET_FPRND has nothing to do with fctid and fctiw.
	Remove the TARGET_FPRND from lrint<mode>di2 pattern.

	2023-02-27  Ajit Kumar Agarwal  <aagarwa1@linux.ibm.com>

gcc/ChangeLog:

	* config/rs6000/rs6000.md (lrint<mode>di2): Remove TARGET_FPRND
	condition from pattern.
---
 gcc/config/rs6000/rs6000.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 81bffb04ceb..65c851e11fb 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -6654,7 +6654,7 @@ (define_insn "lrint<mode>di2"
   [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
 	(unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "<rreg2>")]
 		   UNSPEC_FCTID))]
-  "TARGET_HARD_FLOAT && TARGET_FPRND"
+  "TARGET_HARD_FLOAT"
   "fctid %0,%1"
   [(set_attr "type" "fp")])
 
-- 
2.31.1



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

only message in thread, other threads:[~2023-02-27 11:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-27 11:20 [PATCH] rs6000: Inline lrint and lrintf Ajit Agarwal

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).