From: Xi Ruoyao Date: Sun, 6 Nov 2022 12:41:38 +0000 (+0800) Subject: LoongArch: Rename frint_ to rint2 X-Git-Tag: basepoints/gcc-14~3288 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e468dd40150ad20fe87d315c2638c572ca44dc3b;p=thirdparty%2Fgcc.git LoongArch: Rename frint_ to rint2 Use standard name so __builtin_rint{,f} can be expanded to one instruction. gcc/ChangeLog: * config/loongarch/loongarch.md (frint_): Rename to .. (rint2): .. this. gcc/testsuite/ChangeLog: * gcc.target/loongarch/frint.c: New test. --- diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index bda34d0f3db3..a14ab14ac24f 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -2012,8 +2012,8 @@ [(set_attr "type" "move")] ) -;; Convert floating-point numbers to integers -(define_insn "frint_" +;; Round floating-point numbers to integers +(define_insn "rint2" [(set (match_operand:ANYF 0 "register_operand" "=f") (unspec:ANYF [(match_operand:ANYF 1 "register_operand" "f")] UNSPEC_FRINT))] diff --git a/gcc/testsuite/gcc.target/loongarch/frint.c b/gcc/testsuite/gcc.target/loongarch/frint.c new file mode 100644 index 000000000000..3ee6a8f973a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/loongarch/frint.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-mdouble-float" } */ +/* { dg-final { scan-assembler "frint\\.s" } } */ +/* { dg-final { scan-assembler "frint\\.d" } } */ + +double +my_rint (double a) +{ + return __builtin_rint (a); +} + +float +my_rintf (float a) +{ + return __builtin_rintf (a); +}