File: 1886.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 (41 lines) | stat: -rw-r--r-- 1,129 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
34
35
36
37
38
39
40
41
//; RUN: %{ispc} %s -o %t.o --nowrap --target=host 2>&1 | FileCheck %s -check-prefix=CHECK_WARNING

//; CHECK_WARNING: 21:19: Warning: Typecasting to type "/*unbound*/ float"
//; CHECK_WARNING: 25:19: Warning: Typecasting to type "/*unbound*/ float"
//; CHECK_WARNING: 29:26: Warning: Typecasting to type "/*unbound*/ float"
//; CHECK_WARNING: 33:23: Warning: Typecasting to type "/*unbound*/ float"

//; CHECK_WARNING-NOT: 38:
//; CHECK_WARNING-NOT: 39:
//; CHECK_WARNING-NOT: 40:

noinline float foo(float A, float B) {
    return A * B;
}

noinline float foo(float A, uniform float B) {
    return A * B;
}

noinline float bar(float A, uniform int B) {
    return foo(A, (float)B);
}

noinline float bar1(float A, uniform int B) {
    return foo(A, (float)B + (float)0);
}

noinline float bar2(float A, uniform int B, uniform bool cond) {
    return foo(A, cond ? (float)B : (float)0);
}

noinline float bar3(float A, uniform int B) {
    return foo(A, B + (float)0);
}

// Negative test
noinline float bar4(float A, uniform int B) {
    A = A + (float)B;
    B = B + (int)1;
    return foo(A, (varying float)B + (float)0);
}