-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for full reciprocal calculation
- Loading branch information
Showing
3 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <spu_intrinsics.h> | ||
#include <cell/spurs.h> | ||
|
||
CELL_SPU_LS_PARAM(16 * 1024, 16 * 1024); | ||
|
||
#define NUM_REACC 800000000ull | ||
|
||
int cellSpursTaskMain(qword argTask, uint64_t argTaskset) | ||
{ | ||
(void)argTaskset; | ||
|
||
vec_float4 values = (vec_float4)argTask; | ||
vec_float4 the_ones = {1.0f, 1.0f, 1.0f, 1.0f}; | ||
|
||
for (uint64_t counter = 0; counter < NUM_REACC; counter++) | ||
{ | ||
vec_float4 frest_result = __builtin_spu_frest((vec_float4)values); | ||
qword fi_result = __builtin_si_fi((qword)values, (qword)frest_result); | ||
qword fnms_result = __builtin_si_fnms((qword)values, (qword)fi_result, (qword)the_ones); | ||
qword fma_result = __builtin_si_fma((qword)fnms_result, (qword)fi_result, (qword)fi_result); | ||
values = (vec_float4)fma_result; | ||
} | ||
|
||
return si_to_int((qword)values); | ||
} |