rs6000: Inline lrint and lrintf

Message ID
State New
Series rs6000: Inline lrint and lrintf |

Commit Message

Ajit Agarwal Feb. 27, 2023, 11:20 a.m. UTC
  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  <>


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


diff --git a/gcc/config/rs6000/ b/gcc/config/rs6000/
index 81bffb04ceb..65c851e11fb 100644
--- a/gcc/config/rs6000/
+++ b/gcc/config/rs6000/
@@ -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>")]
   "fctid %0,%1"
   [(set_attr "type" "fp")])