]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix unrecognizable insn of cvtss2si.
authorliuhongt <hongtao.liu@intel.com>
Sun, 9 Oct 2022 07:30:10 +0000 (15:30 +0800)
committerliuhongt <hongtao.liu@intel.com>
Mon, 10 Oct 2022 07:58:04 +0000 (15:58 +0800)
Adjust lrintmn2 operand preidcates according to real instructions.

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
gcc/testsuite/gcc.target/i386/pr107185.c [new file with mode: 0644]

index 1be9b669909b33dda6eaf5279c9c4e519f84e769..947513701b91c6b63840870aa99d2d71b1735300 100644 (file)
    (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 (file)
index 0000000..333191a
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-ffast-math" } */
+
+void
+foo (float f)
+{
+  long p =  __builtin_lrintf (f);
+}