-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for fp16/fp16alt to double and double to fp16/fp16alt. Fl…
…oatlib.c + t-elf to have it compile. This is a bit of a hack and could be done in a more generic manner
- Loading branch information
Eric Flamand
committed
Nov 15, 2019
1 parent
05da5fb
commit 035a62a
Showing
2 changed files
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifdef __gap9__ | ||
|
||
/* Convert half to double */ | ||
double __extendhfdf2 (float16 a1) | ||
|
||
{ | ||
register float F; | ||
__asm ("fcvt.s.h %0, %1" : "=r" (F) : "r" (a1) ); | ||
return F; | ||
} | ||
|
||
/* */ | ||
|
||
/* Convert alternative half to double */ | ||
double __extendohfdf2 (float16alt a1) | ||
|
||
{ | ||
float F; | ||
__asm ("fcvt.s.ah %0, %1" : "=r" (F) : "r" (a1) ); | ||
return F; | ||
} | ||
|
||
|
||
/* Truncate double to half*/ | ||
float16 __truncdfhf2 (double a1) | ||
|
||
{ | ||
register float F = a1; | ||
float16 R; | ||
__asm ("fcvt.h.s %0, %1" : "=r" (R) : "r" (F) ); | ||
return R; | ||
|
||
} | ||
|
||
/* Truncate double to alternative half*/ | ||
float16alt __truncdfohf2 (double a1) | ||
|
||
{ | ||
register float F = a1; | ||
float16alt R; | ||
__asm ("fcvt.ah.s %0, %1" : "=r" (R) : "r" (F) ); | ||
return R; | ||
|
||
} | ||
|
||
#endif |
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