[PATCH] Gather and Scatter intrinsics.
Elena Demikhovsky
elena.demikhovsky at intel.com
Thu Feb 5 05:43:19 PST 2015
Hi hfinkel, anemet, nadav, reames,
Gather and Scatter are new introduced intrinsics, comming after recently implemented masked load and store.
This is the first patch for Gather and Scatter intrinsics. A'm asking to review the syntax (we discussed in mails), parsing and verification.
Gather and Scatter intrinsics allow to perform multiple memory accesses (read/write) in one vector instruction.
The intrinsics are not target specific and will have the following syntax:
Gather:
declare <16 x i32> @llvm.masked.gather.v16i32(<16 x i32*> <vector of ptrs>, i32 <alignment>, <16 x i1> <mask>, <16 x i32> <passthru>)
declare <8 x float> @llvm.masked.gather.v8f32(<8 x float*><vector of ptrs>, i32 <alignment>, <8 x i1> <mask>, <8 x float><passthru>)
Scatter:
declare void @llvm.masked.scatter.v8i32(<8 x i32><vector value to be stored> , <8 x i32*><vector of ptrs> , i32 <alignment>, <8 x i1> <mask>)
declare void @llvm.masked.scatter.v16i32(<16 x i32> <vector value to be stored> , <16 x i32*> <vector of ptrs>, i32 <alignment>, <16 x i1><mask> )
Vector of ptrs - a set of source/destination addresses, to load/store the value.
Mask - switches on/off vector lanes to prevent memory access for switched-off lanes
vector of ptrs, value and mask should have the same vector width.
These are code examples where gather / scatter should be used and will allow function vectorization
;void foo1(int * __restrict__ A, int * __restrict__ B, int * __restrict__ C) {
; for (int i=0; i<SIZE; i++) {
; A[i] = B[C[i]];
; }
;}
;void foo3(int * __restrict__ A, int * __restrict__ B) {
; for (int i=0; i<SIZE; i++) {
; A[B[i]] = i+5;
; }
;}
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7433
Files:
include/llvm/IR/Intrinsics.h
include/llvm/IR/Intrinsics.td
lib/IR/Function.cpp
lib/IR/Verifier.cpp
utils/TableGen/IntrinsicEmitter.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7433.19399.patch
Type: text/x-patch
Size: 5957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150205/c6b168cb/attachment.bin>
More information about the llvm-commits
mailing list