[llvm-bugs] [Bug 50800] New: [SIMD] *dest = vec[lane] should generate store*_lane instruction

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 22 08:24:39 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50800

            Bug ID: 50800
           Summary: [SIMD] *dest = vec[lane] should generate store*_lane
                    instruction
           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

This is very similar to #50792 (which is the load*_lane version, this is for
store*_lane).  Both are blocking the implementation of overloaded functions for
these operations in WAV.

Assigning an element from a vector to a pointer should use one of the
v128.store*_lane instructions, but right now uses an extract_lane and a scalar
store.

Example (Compiler Explorer: https://godbolt.org/z/a1cz8hexW):


#include <stdint.h>

typedef int8_t i8x16 __attribute__((__vector_size__(16)));
typedef int16_t i16x8 __attribute__((__vector_size__(16)));
typedef int32_t i32x4 __attribute__((__vector_size__(16)));
typedef int64_t i64x2 __attribute__((__vector_size__(16)));

void
i8x16_store_lane(int8_t * dest, i8x16 src) {
    *dest = src[1];
}

void
i16x8_store_lane(int16_t * dest, i16x8 src) {
    *dest = src[1];
}

void
i32x4_store_lane(int32_t * dest, i32x4 src) {
    *dest = src[1];
}

void
i64x2_store_lane(int64_t * dest, i64x2 src) {
    *dest = src[1];
}

void
i8x16_load_lane_intrin(int8_t * dest, i8x16 src) {
    __builtin_wasm_store8_lane(dest, src, 1);
}

void
i16x8_load_lane_intrin(int16_t * dest, i16x8 src) {
    __builtin_wasm_store16_lane(dest, src, 1);
}

void
i32x4_load_lane_intrin(int32_t * dest, i32x4 src) {
    __builtin_wasm_store32_lane(dest, src, 1);
}

void
i64x2_load_lane_intrin(int64_t * dest, i64x2 src) {
    __builtin_wasm_store64_lane(dest, src, 1);
}

-- 
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/2c21048e/attachment.html>


More information about the llvm-bugs mailing list