public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111335] New: fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss
@ 2023-09-08  5:31 crazylht at gmail dot com
  2023-09-11  1:17 ` [Bug target/111335] " cvs-commit at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2023-09-08  5:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111335

            Bug ID: 111335
           Summary: fmaddpch seems not commutative for operands[1] and
                    operands[2] due to precision loss
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

fmaddcph is complex _Float16 fma.

cat test.c

#include <immintrin.h>
#include <cstdio>

void func(_Float16 a[], _Float16 b[], _Float16 c[])

{
   const __m128h r0 = _mm_loadu_ph(a);
   const __m128h r1 = _mm_loadu_ph(b);
   const __m128h r2 = _mm_loadu_ph(c);
   const __m128h mul = _mm_fmadd_pch(r0, r1, r2);
   printf("%f %f\n", (float)mul[0], (float)mul[1]);
}

int main()

{
  _Float16 a[8] = {-0.7949218f16, +0.2739257f16};
  _Float16 b[8] = {+0.0010070f16, +0.0015659f16};
  _Float16 c[8] = {-0.0010366f16, -0.0018014f16};
  func(a, b, c);
  return 0;
}


g++ -O0 -march=sapphirerapids test.c, we get fmaddpch a, b, c, and the result
is 
-0.002266 -0.002769

g++ -O0 -march=sapphirerapids test.c, we get fmaddpch b, a, c, and the result
is 
-0.002266 -0.002771

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

* [Bug target/111335] fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss
  2023-09-08  5:31 [Bug target/111335] New: fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss crazylht at gmail dot com
@ 2023-09-11  1:17 ` cvs-commit at gcc dot gnu.org
  2023-09-11  1:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-11  1:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111335

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:f197392a16ffb1327f1d12ff8ff05f9295e015cb

commit r14-3831-gf197392a16ffb1327f1d12ff8ff05f9295e015cb
Author: liuhongt <hongtao.liu@intel.com>
Date:   Fri Sep 8 09:22:43 2023 +0800

    Remove constraint modifier % for fcmaddcph/fmaddcph/fcmulcph since there're
not commutative.

    gcc/ChangeLog:

            PR target/111306
            PR target/111335
            * config/i386/sse.md (int_comm): New int_attr.
            (fma_<complexopname>_<mode><sdc_maskz_name><round_name>):
            Remove % for Complex conjugate operations since they're not
            commutative.
            (fma_<complexpairopname>_<mode>_pair): Ditto.
            (<avx512>_<complexopname>_<mode>_mask<round_name>): Ditto.
            (cmul<conj_op><mode>3): Ditto.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr111306.c: New test.

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

* [Bug target/111335] fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss
  2023-09-08  5:31 [Bug target/111335] New: fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss crazylht at gmail dot com
  2023-09-11  1:17 ` [Bug target/111335] " cvs-commit at gcc dot gnu.org
@ 2023-09-11  1:20 ` cvs-commit at gcc dot gnu.org
  2023-09-11  1:22 ` cvs-commit at gcc dot gnu.org
  2023-09-11  1:22 ` crazylht at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-11  1:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111335

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by hongtao Liu
<liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:162731529e4dd10970880c369471229735dc3e9b

commit r13-7789-g162731529e4dd10970880c369471229735dc3e9b
Author: liuhongt <hongtao.liu@intel.com>
Date:   Fri Sep 8 09:22:43 2023 +0800

    Remove constraint modifier % for fcmaddcph/fmaddcph/fcmulcph since there're
not commutative.

    gcc/ChangeLog:

            PR target/111306
            PR target/111335
            * config/i386/sse.md (int_comm): New int_attr.
            (fma_<complexopname>_<mode><sdc_maskz_name><round_name>):
            Remove % for Complex conjugate operations since they're not
            commutative.
            (fma_<complexpairopname>_<mode>_pair): Ditto.
            (<avx512>_<complexopname>_<mode>_mask<round_name>): Ditto.
            (cmul<conj_op><mode>3): Ditto.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr111306.c: New test.

    (cherry picked from commit f197392a16ffb1327f1d12ff8ff05f9295e015cb)

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

* [Bug target/111335] fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss
  2023-09-08  5:31 [Bug target/111335] New: fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss crazylht at gmail dot com
  2023-09-11  1:17 ` [Bug target/111335] " cvs-commit at gcc dot gnu.org
  2023-09-11  1:20 ` cvs-commit at gcc dot gnu.org
@ 2023-09-11  1:22 ` cvs-commit at gcc dot gnu.org
  2023-09-11  1:22 ` crazylht at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-11  1:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111335

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by hongtao Liu
<liuhongt@gcc.gnu.org>:

https://gcc.gnu.org/g:82c1ff396e49b706d5baa11f4c884810f6350e95

commit r12-9852-g82c1ff396e49b706d5baa11f4c884810f6350e95
Author: liuhongt <hongtao.liu@intel.com>
Date:   Fri Sep 8 09:22:43 2023 +0800

    Remove constraint modifier % for fcmaddcph/fmaddcph/fcmulcph since there're
not commutative.

    gcc/ChangeLog:

            PR target/111306
            PR target/111335
            * config/i386/sse.md (int_comm): New int_attr.
            (fma_<complexopname>_<mode><sdc_maskz_name><round_name>):
            Remove % for Complex conjugate operations since they're not
            commutative.
            (fma_<complexpairopname>_<mode>_pair): Ditto.
            (<avx512>_<complexopname>_<mode>_mask<round_name>): Ditto.
            (cmul<conj_op><mode>3): Ditto.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr111306.c: New test.

    (cherry picked from commit f197392a16ffb1327f1d12ff8ff05f9295e015cb)

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

* [Bug target/111335] fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss
  2023-09-08  5:31 [Bug target/111335] New: fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss crazylht at gmail dot com
                   ` (2 preceding siblings ...)
  2023-09-11  1:22 ` cvs-commit at gcc dot gnu.org
@ 2023-09-11  1:22 ` crazylht at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: crazylht at gmail dot com @ 2023-09-11  1:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111335

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC14.1 GCC13.3 GCC12.4

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

end of thread, other threads:[~2023-09-11  1:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08  5:31 [Bug target/111335] New: fmaddpch seems not commutative for operands[1] and operands[2] due to precision loss crazylht at gmail dot com
2023-09-11  1:17 ` [Bug target/111335] " cvs-commit at gcc dot gnu.org
2023-09-11  1:20 ` cvs-commit at gcc dot gnu.org
2023-09-11  1:22 ` cvs-commit at gcc dot gnu.org
2023-09-11  1:22 ` crazylht at gmail dot com

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