File: func_template_array_6.ispc

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (33 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// This tests checks multidimensional arrays inside nested templates
// RUN: %{ispc} %s --emit-llvm-text --target=host --nostdlib -o - | FileCheck %s

// CHECK-LABEL: @test___
// CHECK: call {{.*}} @foo_level_1___vyiCuni64
// CHECK: @foo_level_1___vyiCuni64__
// CHECK: alloca [64 x [64 x [64 x i32]]]
// CHECK: call {{.*}} @foo_level_2___vyiCuni64
// CHECK: @foo_level_2___vyiCuni64
// CHECK: alloca [64 x [64 x [64 x i32]]]

template <typename T, int C>
noinline void foo_level_2(uniform float ret[], uniform int b[C][C][C]) {
    uniform int a[C][C][C];
    for (uniform int i = 0; i < C; ++i)
        for (uniform int j = 0; j < C; ++j)
            for (uniform int k = 0; k < C; ++k) {
                a[i][j][k] = 100*i+10*j+k;
                b[i][j][k] = 100*i+10*j-k;
            }

    ret[programIndex] = *(a[2][3] + 1);
}

template <typename T, int C>
noinline void foo_level_1(uniform float ret[]) {
    uniform int a[C][C][C];
    foo_level_2<T, C>(ret, a);
}

void test(uniform float ret[]) {
    foo_level_1<int, 64>(ret);
}