Issue 58139
Summary `addsubpd` not generated in complex multiplication since LLVM 13
Labels new issue
Assignees
Reporter p0nce
    Consider the following program that multiplies double complex numbers.

```
__m128d _mm_complexmult_pd(__m128d a, __m128d b)
{
    __m128d A;
    A[0] = a[0]*b[0];
    A[1] = a[0]*b[1];

    __m128d B;
    B[0] = a[1]*b[1];
    B[1] = a[1]*b[0];

    return _mm_addsub_pd(A, B);
}

__m128d _mm_complexmult_pd_naive(__m128d a, __m128d b)
{
    __m128d A;
    A[0] = a[0]*b[0] - a[1] * b[1];
    A[1] = a[0]*b[1] + a[1] * b[0];
    return A;
}
```

The first one use explicit addsubpd, the second one not.
In LLVM 12, `_mm_complexmult_pd_naive` is faster.
In LLVM 13, `_mm_complexmult_pd` is faster because addsubpd is not generated anymore unless in simpler cases.

Godbolt: https://cpp.godbolt.org/z/sMdh7eG4s
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to