[committed] i386: Fix atan2l argument order [PR93743]

Message ID CAFULd4Yyh5jacs0KYm69=dwPETdj3-N5f1tqn9COD7ZWJJbNWA@mail.gmail.com
State New
Headers show
Series
  • [committed] i386: Fix atan2l argument order [PR93743]
Related show

Commit Message

Uros Bizjak Feb. 16, 2020, 8:41 p.m.
i386: Fix atan2l argument order [PR93743]

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

2020-02-16  UroŇ° Bizjak  <ubizjak@gmail.com>

    PR target/93743
    * config/i386/i386.md (atan2xf3): Swap operands 1 and 2.
    (atan2<mode>3): Update operand order in the call to gen_atan2xf3.

testsuite/ChangeLog:

2020-02-16  UroŇ° Bizjak  <ubizjak@gmail.com>

    PR target/93743
    * gcc.target/i386/pr93743.c : New test.

Uros.

Patch

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index f14683cd14f..6c57500ae8e 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -15999,10 +15999,10 @@ 
 
 (define_insn "atan2xf3"
   [(set (match_operand:XF 0 "register_operand" "=f")
-        (unspec:XF [(match_operand:XF 1 "register_operand" "0")
-	            (match_operand:XF 2 "register_operand" "f")]
+        (unspec:XF [(match_operand:XF 2 "register_operand" "0")
+	            (match_operand:XF 1 "register_operand" "f")]
 	           UNSPEC_FPATAN))
-   (clobber (match_scratch:XF 3 "=2"))]
+   (clobber (match_scratch:XF 3 "=1"))]
   "TARGET_USE_FANCY_MATH_387
    && flag_unsafe_math_optimizations"
   "fpatan"
@@ -16026,7 +16026,7 @@ 
   emit_insn (gen_extend<mode>xf2 (op2, operands[2]));
   emit_insn (gen_extend<mode>xf2 (op1, operands[1]));
 
-  emit_insn (gen_atan2xf3 (op0, op2, op1));
+  emit_insn (gen_atan2xf3 (op0, op1, op2));
   emit_insn (gen_truncxf<mode>2 (operands[0], op0));
   DONE;
 })