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  <aagar...@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


Reply via email to