These compute the average of two given values, rounding up and down, respectively, if the result isn't exact. When possible, these are mapped to target-specific intrinsics (PADD[BW] on IA and VH[R]ADD[US] on NEON.) A subsequent commit will add pattern-matching to generate calls to these intrinsincs when the corresponding patterns are detected in the IR.)
14 lines
329 B
Plaintext
14 lines
329 B
Plaintext
|
|
export uniform int width() { return programCount; }
|
|
|
|
|
|
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float bf) {
|
|
int8 a = aFOO[programIndex];
|
|
int8 b = bf;
|
|
RET[programIndex] = avg_down(a, b);
|
|
}
|
|
|
|
export void result(uniform float RET[]) {
|
|
RET[programIndex] = ((int)programIndex + 1 + 5) / 2;
|
|
}
|