File: func_template_4.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 (19 lines) | stat: -rw-r--r-- 785 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
// Tests nested templates.

// RUN: %{ispc}  %s --emit-llvm-text --target=host -O0 -o - | FileCheck %s

template <typename T> noinline T add(T A, T B) { return A + B; }
template <typename T> noinline T mul(T A, T B) { return A * B; }
template <typename T> noinline T fma(T A, T B, T C) { return add<T>(mul<T>(A, B), C); }

// CHECK: define <{{[0-9]*}} x float> @foo___vyfvyfvyf
// CHECK: call {{.*}} @fma___vyf___vyfvyfvyf(<{{[0-9]*}} x float>

// CHECK: define {{.*}} @fma___vyf___vyfvyfvyf
// CHECK: call {{.*}} @mul___vyf___vyfvyf(<{{[0-9]*}} x float>
// CHECK: call {{.*}} @add___vyf___vyfvyf(<{{[0-9]*}} x float>

// CHECK: define {{.*}} @mul___vyf___vyfvyf

// CHECK: define {{.*}} @add___vyf___vyfvyf
float foo(float A, float B, float C) { return fma<varying float>(A, B, C); }