public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce
@ 2024-06-05 16:42 jondaniel879 at gmail dot com
  2024-06-05 16:56 ` [Bug c++/115362] " jondaniel879 at gmail dot com
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115362
           Summary: fixed_size_simd dot product recognition not working
                    for stdx::reduce
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jondaniel879 at gmail dot com
  Target Milestone: ---

namespace stdx = std::experimental;
using namespace stdx::parallelism_v2;

template<typename FIRST, typename... OTHER,
typename = std::enable_if_t<(std::is_convertible_v<std::decay_t<OTHER>, const
stdx::fixed_size_simd<T,N>> && ...)>>
static inline constexpr T dot(FIRST first, OTHER&&... other)
{
   return stdx::reduce(first * (... * std::forward<OTHER>(other)));
}

doesn't generate vdpp(s/d) on AVX machines.

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

* [Bug c++/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
@ 2024-06-05 16:56 ` jondaniel879 at gmail dot com
  2024-06-05 17:00 ` [Bug tree-optimization/115362] " pinskia at gcc dot gnu.org
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jon Daniel <jondaniel879 at gmail dot com> ---
the generated code should be similar to the following using __m128 as
FIRST/OTHER type for floating point.

inline constexpr uint8_t mask4dp(size_t n)
{
        switch(n)
        {
                case 1: return 0xff >> 3;
                case 2: return 0xff >> 2;
                case 3: return 0xff >> 1;
                case 4: return 0xff >> 0;
        }
}

template<size_t N, typename FIRST, typename... OTHER>
static inline constexpr FIRST dot(FIRST first, OTHER&&... other)
{
   return _mm_dp_ps(first, (... * std::forward<OTHER>(other)), mask4dp(N));
}

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

* [Bug tree-optimization/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
  2024-06-05 16:56 ` [Bug c++/115362] " jondaniel879 at gmail dot com
@ 2024-06-05 17:00 ` pinskia at gcc dot gnu.org
  2024-06-05 17:54 ` jondaniel879 at gmail dot com
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-05 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
          Component|c++                         |tree-optimization

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide a full compilable testcase?

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

* [Bug tree-optimization/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
  2024-06-05 16:56 ` [Bug c++/115362] " jondaniel879 at gmail dot com
  2024-06-05 17:00 ` [Bug tree-optimization/115362] " pinskia at gcc dot gnu.org
@ 2024-06-05 17:54 ` jondaniel879 at gmail dot com
  2024-06-05 18:32 ` jondaniel879 at gmail dot com
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 17:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58358
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58358&action=edit
compilable testcase

Compile:

g++ -march=native -mfpmath=sse -mveclibabi=svml -O3 -std=gnu++26 dotsimd.cpp -o
dotsimd

Run:

./dotsimd

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

* [Bug tree-optimization/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (2 preceding siblings ...)
  2024-06-05 17:54 ` jondaniel879 at gmail dot com
@ 2024-06-05 18:32 ` jondaniel879 at gmail dot com
  2024-06-05 18:33 ` jondaniel879 at gmail dot com
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58359
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58359&action=edit
dotsimd assembly output with dot_sse only

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

* [Bug tree-optimization/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (3 preceding siblings ...)
  2024-06-05 18:32 ` jondaniel879 at gmail dot com
@ 2024-06-05 18:33 ` jondaniel879 at gmail dot com
  2024-06-05 21:10 ` [Bug target/115362] " jondaniel879 at gmail dot com
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 18:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58360
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58360&action=edit
dotsimd assembly output with dot only

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

* [Bug target/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (4 preceding siblings ...)
  2024-06-05 18:33 ` jondaniel879 at gmail dot com
@ 2024-06-05 21:10 ` jondaniel879 at gmail dot com
  2024-06-05 21:26 ` jondaniel879 at gmail dot com
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jon Daniel <jondaniel879 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58358|0                           |1
        is obsolete|                            |

--- Comment #6 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58362
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58362&action=edit
dot product and determinant testcase

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

* [Bug target/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (5 preceding siblings ...)
  2024-06-05 21:10 ` [Bug target/115362] " jondaniel879 at gmail dot com
@ 2024-06-05 21:26 ` jondaniel879 at gmail dot com
  2024-06-05 21:29 ` jondaniel879 at gmail dot com
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jon Daniel <jondaniel879 at gmail dot com> ---
sign of determinant result using the dot product differs from clang++ generated
binary

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

* [Bug target/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (6 preceding siblings ...)
  2024-06-05 21:26 ` jondaniel879 at gmail dot com
@ 2024-06-05 21:29 ` jondaniel879 at gmail dot com
  2024-06-05 23:11 ` jondaniel879 at gmail dot com
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jon Daniel <jondaniel879 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58362|0                           |1
        is obsolete|                            |

--- Comment #8 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58363
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58363&action=edit
dot product and determinant testcase

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

* [Bug target/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (7 preceding siblings ...)
  2024-06-05 21:29 ` jondaniel879 at gmail dot com
@ 2024-06-05 23:11 ` jondaniel879 at gmail dot com
  2024-06-05 23:12 ` jondaniel879 at gmail dot com
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 23:11 UTC (permalink / raw)
  To: gcc-bugs

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

Jon Daniel <jondaniel879 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58363|0                           |1
        is obsolete|                            |

--- Comment #9 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58364
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58364&action=edit
dot product and determinant testcase

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

* [Bug target/115362] fixed_size_simd dot product recognition not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (8 preceding siblings ...)
  2024-06-05 23:11 ` jondaniel879 at gmail dot com
@ 2024-06-05 23:12 ` jondaniel879 at gmail dot com
  2024-06-05 23:17 ` [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant " jondaniel879 at gmail dot com
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 23:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jon Daniel <jondaniel879 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58364|0                           |1
        is obsolete|                            |

--- Comment #10 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58365
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58365&action=edit
dot product and determinant testcase

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (9 preceding siblings ...)
  2024-06-05 23:12 ` jondaniel879 at gmail dot com
@ 2024-06-05 23:17 ` jondaniel879 at gmail dot com
  2024-06-06  6:40 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-05 23:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jon Daniel <jondaniel879 at gmail dot com> ---
g++ output:

dot_product stdx::reduce: -16.000000
dot_product    _mm_dp_ps: -16.000000
determinant: dot_product: 717.000000
determinant: submatrices: -717.000000

clang++ output:

dot_product stdx::reduce: -16.000000
dot_product    _mm_dp_ps: -16.000000
determinant: dot_product: -717.000000
determinant: submatrices: -717.000000

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (10 preceding siblings ...)
  2024-06-05 23:17 ` [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant " jondaniel879 at gmail dot com
@ 2024-06-06  6:40 ` rguenth at gcc dot gnu.org
  2024-06-06  6:57 ` jondaniel879 at gmail dot com
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-06  6:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-06-06
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
How should I compile this?

> /space/rguenther/install/gcc-14.1/bin/g++ t.C -std=gnu++2b -mavx2
t.C: In function ‘int main(int, char**)’:
t.C:105:29: warning: ignoring attributes on template argument ‘__m128’
[-Wignored-attributes]
  105 |         std::array<__m128, 3> sse =
      |                             ^
In file included from
/spc/space/rguenther/install/gcc-14.1/lib64/gcc/x86_64-pc-linux-gnu/14.1.0/include/immintrin.h:39,
                 from
/spc/space/rguenther/install/gcc-14.1/lib64/gcc/x86_64-pc-linux-gnu/14.1.0/include/x86intrin.h:32,
                 from
/spc/space/rguenther/install/gcc-14.1/include/c++/14.1.0/experimental/bits/simd.h:45,
                 from
/spc/space/rguenther/install/gcc-14.1/include/c++/14.1.0/experimental/simd:74,
                 from t.C:4:
t.C: In static member function ‘static constexpr T math::vec::storage<T,
N>::dot_sse(FIRST, OTHER&& ...) [with FIRST = __vector(4) float; OTHER =
{__vector(4) float&, __vector(4) float&}; T = float; long unsigned int N = 3]’:
t.C:46:91: error: the last argument must be an 8-bit immediate
   46 | constexpr T dot_sse(FIRST first, OTHER&&... other) { return
_mm_dp_ps(first, (... * std::forward<OTHER>(other)), mask4dp(N))[0]; }
      |                                                             ^~~~~~~~~

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (11 preceding siblings ...)
  2024-06-06  6:40 ` rguenth at gcc dot gnu.org
@ 2024-06-06  6:57 ` jondaniel879 at gmail dot com
  2024-06-06  7:49 ` jondaniel879 at gmail dot com
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-06  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jon Daniel <jondaniel879 at gmail dot com> ---
This bug is triggered by -O0 optimization level flag.

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (12 preceding siblings ...)
  2024-06-06  6:57 ` jondaniel879 at gmail dot com
@ 2024-06-06  7:49 ` jondaniel879 at gmail dot com
  2024-06-06  7:53 ` jondaniel879 at gmail dot com
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-06  7:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jon Daniel <jondaniel879 at gmail dot com> ---
clang++ compiles with -O0 but generated executable segfaults

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (13 preceding siblings ...)
  2024-06-06  7:49 ` jondaniel879 at gmail dot com
@ 2024-06-06  7:53 ` jondaniel879 at gmail dot com
  2024-06-06  9:21 ` jondaniel879 at gmail dot com
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-06  7:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jon Daniel <jondaniel879 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58365|0                           |1
        is obsolete|                            |

--- Comment #15 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58367
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58367&action=edit
dot product and determinant testcase

g++ -march=native -mfpmath=sse -O3 -std=gnu++26 dotsimd.cpp

-O0 doesn't work with _mm_dp_ps

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (14 preceding siblings ...)
  2024-06-06  7:53 ` jondaniel879 at gmail dot com
@ 2024-06-06  9:21 ` jondaniel879 at gmail dot com
  2024-06-10 21:40 ` jondaniel879 at gmail dot com
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-06  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jon Daniel <jondaniel879 at gmail dot com> ---
See https://github.com/Const-me/SimdIntroArticle/ for different AVX2 DotProduct
examples and check if they have different signs with g++/clang++.

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (15 preceding siblings ...)
  2024-06-06  9:21 ` jondaniel879 at gmail dot com
@ 2024-06-10 21:40 ` jondaniel879 at gmail dot com
  2024-06-10 21:44 ` jondaniel879 at gmail dot com
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-10 21:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jon Daniel <jondaniel879 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58367|0                           |1
        is obsolete|                            |

--- Comment #17 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58399
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58399&action=edit
dot product and determinant testcase

g++ -march=native -mfpmath=sse -mavx2 -O3 -std=gnu++26 dotsimd.cpp

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (16 preceding siblings ...)
  2024-06-10 21:40 ` jondaniel879 at gmail dot com
@ 2024-06-10 21:44 ` jondaniel879 at gmail dot com
  2024-06-10 21:45 ` jondaniel879 at gmail dot com
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-10 21:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jon Daniel <jondaniel879 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #58359|0                           |1
        is obsolete|                            |
  Attachment #58360|0                           |1
        is obsolete|                            |

--- Comment #18 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58400
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58400&action=edit
dotsimd gcc asssemly output

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (17 preceding siblings ...)
  2024-06-10 21:44 ` jondaniel879 at gmail dot com
@ 2024-06-10 21:45 ` jondaniel879 at gmail dot com
  2024-06-14  2:07 ` jondaniel879 at gmail dot com
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-10 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Jon Daniel <jondaniel879 at gmail dot com> ---
Created attachment 58401
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58401&action=edit
dotsimd clang asssemly output

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (18 preceding siblings ...)
  2024-06-10 21:45 ` jondaniel879 at gmail dot com
@ 2024-06-14  2:07 ` jondaniel879 at gmail dot com
  2024-06-17 12:31 ` jondaniel879 at gmail dot com
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-14  2:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jon Daniel <jondaniel879 at gmail dot com> ---
float s = storage<float, 3>::dot(a.pinr(i), b.pinr(i), c.pinr(i));
float t = storage<float, 3>::dot(a.pinr(j), b.pinr(j), c.pinr(j));
return s-t;

g++ interchanges the operands s-t with t-s: -575-142=-717 != 142-(-575)=717 
causing the wrong sub/add.

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (19 preceding siblings ...)
  2024-06-14  2:07 ` jondaniel879 at gmail dot com
@ 2024-06-17 12:31 ` jondaniel879 at gmail dot com
  2024-06-17 13:06 ` jondaniel879 at gmail dot com
  2024-06-17 13:10 ` jondaniel879 at gmail dot com
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-17 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from Jon Daniel <jondaniel879 at gmail dot com> ---
The generated assembler output of

g++:
        vmaskmovps      40(%rsp), %xmm1, %xmm0
        vmaskmovps      56(%rsp), %xmm1, %xmm2
        vmulps  %xmm2, %xmm0, %xmm0

Notice the lower memory address register is taken as the second source operand

clang++:
        vmaskmovps      48(%rsp), %xmm0, %xmm2
        vmaskmovps      32(%rsp), %xmm0, %xmm3
        vmulps  %xmm3, %xmm2, %xmm2

Notice the lower memory address register is taken as the first source operand

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (20 preceding siblings ...)
  2024-06-17 12:31 ` jondaniel879 at gmail dot com
@ 2024-06-17 13:06 ` jondaniel879 at gmail dot com
  2024-06-17 13:10 ` jondaniel879 at gmail dot com
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-17 13:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from Jon Daniel <jondaniel879 at gmail dot com> ---
The generated assembler output snippet:

g++:
        vdpps   $113, 72(%rsp), 24(%rsp), %xmm3
        vdpps   $113, 72(%rsp), 24(%rsp), %xmm2
        vsubss  %xmm2, %xmm3, %xmm0

Notice the second dot product result as the first source operand


clang++:
        vdpps   $113, %xmm2, %xmm1, %xmm4
        vdpps   $113, %xmm0, %xmm1, %xmm1
        vsubss %xmm4, %xmm0, %xmm0

Notice the first dot product result as the first source operand

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

* [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant not working for stdx::reduce
  2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
                   ` (21 preceding siblings ...)
  2024-06-17 13:06 ` jondaniel879 at gmail dot com
@ 2024-06-17 13:10 ` jondaniel879 at gmail dot com
  22 siblings, 0 replies; 24+ messages in thread
From: jondaniel879 at gmail dot com @ 2024-06-17 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from Jon Daniel <jondaniel879 at gmail dot com> ---
(In reply to Jon Daniel from comment #21)
> The generated assembler output of
> 
> g++:
>         vmaskmovps      40(%rsp), %xmm1, %xmm0
>         vmaskmovps      56(%rsp), %xmm1, %xmm2
>         vmulps  %xmm2, %xmm0, %xmm0
> 
> Notice the lower memory address register is taken as the second source
> operand
> 
> clang++:
>         vmaskmovps      48(%rsp), %xmm0, %xmm2
>         vmaskmovps      32(%rsp), %xmm0, %xmm3
>         vmulps  %xmm3, %xmm2, %xmm2
> 
> Notice the lower memory address register is taken as the first source operand

Please delete "Comment 21" it is accidently posted wrong code and has nothing
to do with the bug.

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

end of thread, other threads:[~2024-06-17 13:10 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05 16:42 [Bug c++/115362] New: fixed_size_simd dot product recognition not working for stdx::reduce jondaniel879 at gmail dot com
2024-06-05 16:56 ` [Bug c++/115362] " jondaniel879 at gmail dot com
2024-06-05 17:00 ` [Bug tree-optimization/115362] " pinskia at gcc dot gnu.org
2024-06-05 17:54 ` jondaniel879 at gmail dot com
2024-06-05 18:32 ` jondaniel879 at gmail dot com
2024-06-05 18:33 ` jondaniel879 at gmail dot com
2024-06-05 21:10 ` [Bug target/115362] " jondaniel879 at gmail dot com
2024-06-05 21:26 ` jondaniel879 at gmail dot com
2024-06-05 21:29 ` jondaniel879 at gmail dot com
2024-06-05 23:11 ` jondaniel879 at gmail dot com
2024-06-05 23:12 ` jondaniel879 at gmail dot com
2024-06-05 23:17 ` [Bug target/115362] fixed_size_simd dot product recognition and sign of determinant " jondaniel879 at gmail dot com
2024-06-06  6:40 ` rguenth at gcc dot gnu.org
2024-06-06  6:57 ` jondaniel879 at gmail dot com
2024-06-06  7:49 ` jondaniel879 at gmail dot com
2024-06-06  7:53 ` jondaniel879 at gmail dot com
2024-06-06  9:21 ` jondaniel879 at gmail dot com
2024-06-10 21:40 ` jondaniel879 at gmail dot com
2024-06-10 21:44 ` jondaniel879 at gmail dot com
2024-06-10 21:45 ` jondaniel879 at gmail dot com
2024-06-14  2:07 ` jondaniel879 at gmail dot com
2024-06-17 12:31 ` jondaniel879 at gmail dot com
2024-06-17 13:06 ` jondaniel879 at gmail dot com
2024-06-17 13:10 ` jondaniel879 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).