public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] [x86] Fix unrecognizable insn of cvtss2si.
@ 2022-10-10  1:26 liuhongt
  2022-10-10  7:27 ` Uros Bizjak
  0 siblings, 1 reply; 2+ messages in thread
From: liuhongt @ 2022-10-10  1:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: crazylht, hjl.tools

Adjust lrintmn2 operand preidcates according to real instructions.

Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
Ok as an obvious fix?

gcc/ChangeLog:

	PR target/107185
	* config/i386/i386.md (lrint<MODEF:mode><SWI48:mode>2): Swap
	predicate of operands[0] and operands[1].

gcc/testsuite/ChangeLog:

	* gcc.target/i386/pr107185.c: New test.
---
 gcc/config/i386/i386.md                  | 4 ++--
 gcc/testsuite/gcc.target/i386/pr107185.c | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr107185.c

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 1be9b669909..947513701b9 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -20145,8 +20145,8 @@ (define_insn "lrintxf<mode>2"
    (set_attr "mode" "<MODE>")])
 
 (define_expand "lrint<MODEF:mode><SWI48:mode>2"
-  [(set (match_operand:SWI48 0 "nonimmediate_operand")
-     (unspec:SWI48 [(match_operand:MODEF 1 "register_operand")]
+  [(set (match_operand:SWI48 0 "register_operand")
+     (unspec:SWI48 [(match_operand:MODEF 1 "nonimmediate_operand")]
 		   UNSPEC_FIX_NOTRUNC))]
   "SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH")
 
diff --git a/gcc/testsuite/gcc.target/i386/pr107185.c b/gcc/testsuite/gcc.target/i386/pr107185.c
new file mode 100644
index 00000000000..333191a9a89
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr107185.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-ffast-math" } */
+
+void
+foo (float f)
+{
+  long p =  __builtin_lrintf (f);
+}
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [x86] Fix unrecognizable insn of cvtss2si.
  2022-10-10  1:26 [PATCH] [x86] Fix unrecognizable insn of cvtss2si liuhongt
@ 2022-10-10  7:27 ` Uros Bizjak
  0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2022-10-10  7:27 UTC (permalink / raw)
  To: liuhongt; +Cc: gcc-patches

On Mon, Oct 10, 2022 at 3:26 AM liuhongt via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Adjust lrintmn2 operand preidcates according to real instructions.
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> Ok as an obvious fix?
>
> gcc/ChangeLog:
>
>         PR target/107185
>         * config/i386/i386.md (lrint<MODEF:mode><SWI48:mode>2): Swap
>         predicate of operands[0] and operands[1].
>
> gcc/testsuite/ChangeLog:
>
>         * gcc.target/i386/pr107185.c: New test.

OK.

Thanks,
Uros.

> ---
>  gcc/config/i386/i386.md                  | 4 ++--
>  gcc/testsuite/gcc.target/i386/pr107185.c | 8 ++++++++
>  2 files changed, 10 insertions(+), 2 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/i386/pr107185.c
>
> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
> index 1be9b669909..947513701b9 100644
> --- a/gcc/config/i386/i386.md
> +++ b/gcc/config/i386/i386.md
> @@ -20145,8 +20145,8 @@ (define_insn "lrintxf<mode>2"
>     (set_attr "mode" "<MODE>")])
>
>  (define_expand "lrint<MODEF:mode><SWI48:mode>2"
> -  [(set (match_operand:SWI48 0 "nonimmediate_operand")
> -     (unspec:SWI48 [(match_operand:MODEF 1 "register_operand")]
> +  [(set (match_operand:SWI48 0 "register_operand")
> +     (unspec:SWI48 [(match_operand:MODEF 1 "nonimmediate_operand")]
>                    UNSPEC_FIX_NOTRUNC))]
>    "SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH")
>
> diff --git a/gcc/testsuite/gcc.target/i386/pr107185.c b/gcc/testsuite/gcc.target/i386/pr107185.c
> new file mode 100644
> index 00000000000..333191a9a89
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr107185.c
> @@ -0,0 +1,8 @@
> +/* { dg-do compile } */
> +/* { dg-options "-ffast-math" } */
> +
> +void
> +foo (float f)
> +{
> +  long p =  __builtin_lrintf (f);
> +}
> --
> 2.27.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-10  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10  1:26 [PATCH] [x86] Fix unrecognizable insn of cvtss2si liuhongt
2022-10-10  7:27 ` Uros Bizjak

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