Skip to content

[WebAssembly] Compiler can't recognize avgr_u pattern in C #150550

@badumbatish

Description

@badumbatish

From @lukel97, currently the avgr_u is not recognized by the compiler in this godbolt https://godbolt.org/z/r6P1T6x9f

void f(unsigned char *x, unsigned char *y, int n) {
  // should have been vectorized into avgr_u instead of seperated vectorized add and logical right shift
  for (int i = 0; i < n; i++)
    x[i] = (x[i] + y[i] + 1) / 2;
}

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