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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |xry111 at gcc dot 
gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
                 CC|                            |chenglulu at loongson dot cn,
                   |                            |xen0n at gentoo dot org

--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Reduced test case:

typedef __INT32_TYPE__ int32_t;
typedef unsigned __INT32_TYPE__ uint32_t;

__attribute__((noipa))
static void long_filter_ehigh_3830_1(int32_t *buffer, int length)
{
    int i, j;
    int32_t dotprod = 0;
    int32_t delay[4] = { 0 };
    uint32_t coeffs[4] = { 0 };

    for (i = 0; i < length; i++) {
        dotprod = 0;
        for (j = 3; j >= 0; j--) {
            dotprod += delay[j] * coeffs[j];
            coeffs[j] += ((delay[j] >> 31) | 1);
        }
        for (j = 3; j > 0; j--)
            delay[j] = delay[j - 1];
        delay[0] = buffer[i];
    }

    __builtin_printf("%d\n", dotprod);
}

int main()
{
        int32_t buffer[] = {-1, 1};
        long_filter_ehigh_3830_1(buffer, 2);
}

The output should be -1, but with gcc-15 -mlsx it produces 8 instead.

I'm working on it.

Reply via email to