File: func_template_shortvec_10.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 (24 lines) | stat: -rw-r--r-- 1,160 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
// The test checks that we can do casts to pointers to short vectors inside templates (#3073).
// RUN: %{ispc} %s --ast-dump --target=host --nostdlib | FileCheck %s
// CHECK: unmasked void(uniform int8 * uniform a)] "foo1"
// CHECK: TypeCastExpr {{.*}} [/*unbound*/ T<4> * /*unbound*/]
// CHECK: (instantiation <varying int32>) {{.*}}  [ unmasked void(uniform int8 * uniform a)] "foo1"
// CHECK: TypeCastExpr {{.*}} [varying int32<4> * varying]

// CHECK: unmasked void(uniform int8 * uniform a)] "foo2"
// CHECK: TypeCastExpr {{.*}} [/*unbound*/ T<N> * /*unbound*/]
// CHECK: (instantiation <varying int32, 4>) {{.*}}  [ unmasked void(uniform int8 * uniform a)] "foo2"
// CHECK: TypeCastExpr {{.*}} [varying int32<4> * varying]
template <typename T> noinline unmasked void foo1(uniform int8 *uniform a) {
    uniform T<4> *uniform ptr1 = (uniform int<4> *uniform)a;
    T<4> *ptr2 = (T<4> *)a;
}
template <typename T, int N> noinline unmasked void foo2(uniform int8 *uniform a) {
    uniform T<N> *uniform ptr1 = (uniform T<N> * uniform) a;
    T<N> *ptr2 = (T<N> *)a;
}

unmasked int<4> bar(uniform int8 *uniform a) {
    foo1<int>(a);
    foo2<int, 4>(a);
}