File: 08_masked_load_store.ispc

package info (click to toggle)
ispc 1.26.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 95,356 kB
  • sloc: cpp: 55,778; python: 6,681; yacc: 3,074; lex: 1,095; ansic: 714; sh: 283; makefile: 16
file content (22 lines) | stat: -rw-r--r-- 1,575 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) 2023-2024, Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause

#define MASKED_LOAD_STORE(T_ISPC)                                                                                      \
    export void masked_load_store_##T_ISPC(uniform T_ISPC aIN[], uniform T_ISPC bIN[], uniform T_ISPC cOUT[],          \
                                           uniform int n, uniform bool aMask[]) {                                      \
        bool mask = aMask[programIndex];                                                                               \
        for (int i = 0; i < n; i += programCount) {                                                                    \
            if (mask) {                                                                                                \
                T_ISPC a = aIN[i + programIndex];                                                                      \
                T_ISPC b = bIN[i + programIndex];                                                                      \
                cOUT[i + programIndex] = b - a;                                                                        \
            }                                                                                                          \
        }                                                                                                              \
    }

MASKED_LOAD_STORE(int8)
MASKED_LOAD_STORE(int16)
MASKED_LOAD_STORE(int32)
MASKED_LOAD_STORE(float)
MASKED_LOAD_STORE(double)
MASKED_LOAD_STORE(int64)