Skip to content

[X86][SSE2] Failure to vectorize int16_t[8] to pminsw pattern #48223

Open
@RKSimon

Description

@RKSimon
Bugzilla Link 48879
Version trunk
OS Windows NT
CC @alexey-bataev,@anton-afanasyev,@weiguozhi,@topperc,@davidbolvansky,@dtemirbulatov,@LebedevRI,@RKSimon,@phoebewang,@rotateright

Extended Description

https://gcc.godbolt.org/z/57nGK3

typedef int16_t T;
constexpr int N = 8;

std::array<T,N> compute_min(std::array<T,N>& x, std::array<T,N>& y) {
    std::array<T,N> result;
    for (int i = 0; i != N; ++i) {
      result[i] = std::min(x[i], y[i]);
    }
    return result;
}

This ends up as a horrid mix of scalar and <2 x i16> smin patterns.

Much of the problem seems to be that we end up trying to store the final array as { i64, i64 } aggregate, resulting in a load of zext+shift+or to pack the i16's.

Even more impressive with -march=atom we end up with masked gather calls....

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions