[llvm-bugs] [Bug 50794] New: [SIMD] avgr patterns not recognized
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Jun 21 20:12:53 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50794
Bug ID: 50794
Summary: [SIMD] avgr patterns not recognized
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: WebAssembly
Assignee: unassignedbugs at nondot.org
Reporter: clang at evan.coeusgroup.com
CC: llvm-bugs at lists.llvm.org
Instead of i8x16.avgr_u and i16x8.avgr_u, these examples result in two
additions and a shift (Compiler Explorer: https://godbolt.org/z/7bKq4hTqj):
#include <wasm_simd128.h>
#pragma clang diagnostic ignored "-Wmissing-prototypes"
typedef uint8_t u8x16 __attribute__((__vector_size__(16)));
typedef uint16_t u16x8 __attribute__((__vector_size__(16)));
#if 0 // Copied from proposal
Lane-wise integer rounding average
i8x16.avgr_u(a: v128, b: v128) -> v128
i16x8.avgr_u(a: v128, b: v128) -> v128
Lane-wise rounding average:
def S.RoundingAverage(x, y):
return (x + y + 1) // 2
def S.avgr_u(a, b):
return S.lanewise_binary(S.RoundingAverage, S.AsUnsigned(a),
S.AsUnsigned(b))
#endif
u8x16 avgr8(u8x16 a, u8x16 b) {
return (a + b + 1) >> 1;
}
u16x8 avgr16(u16x8 a, u16x8 b) {
return (a + b + 1) >> 1;
}
u8x16 avgr8_div(u8x16 a, u8x16 b) {
return (a + b + 1) / 2;
}
u16x8 avgr16_div(u16x8 a, u16x8 b) {
return (a + b + 1) / 2;
}
u8x16 avgr8_intrin(u8x16 a, u8x16 b) {
return __builtin_wasm_avgr_u_i8x16(a, b);
}
u16x8 avgr16_intrin(u16x8 a, u16x8 b) {
return __builtin_wasm_avgr_u_i16x8(a, b);
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210622/5e0fb6fb/attachment.html>
More information about the llvm-bugs
mailing list