mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 13:27:29 -04:00
Was never specified, but itof/ftoi should be signed. (issue #4)
This commit is contained in:
parent
65c9aeadc5
commit
54adca00e3
3 changed files with 7 additions and 3 deletions
|
@ -314,8 +314,8 @@ format, which can be fixed point or floating point.
|
|||
\begin{tabular}{cl}
|
||||
\textbf{Instruction}&\textbf{Description}\\
|
||||
\hline
|
||||
\texttt{itof} \%dest, \%src&Integer to floating point.\\
|
||||
\texttt{ftoi} \%dest, \%src&Floating point to integer.\\
|
||||
\texttt{itof} \%dest, \%src&Signed integer to floating point.\\
|
||||
\texttt{ftoi} \%dest, \%src&Floating point to signed integer.\\
|
||||
\texttt{fneg} \%dest, \%src&Negate (complement sign bit).\\
|
||||
\texttt{fadd} \%dest, \%src1, \%src2&Floating point add.\\
|
||||
\texttt{fsub} \%dest, \%src1, \%src2&Floating point subtract.\\
|
||||
|
|
|
@ -291,7 +291,7 @@ void Instruction::executeOn(Core &c) {
|
|||
c.pc = c.shadowPc;
|
||||
}
|
||||
break;
|
||||
case ITOF: reg[rdest] = Float(double(reg[rsrc[0]]), wordSz);
|
||||
case ITOF: reg[rdest] = Float(double(Word_s(reg[rsrc[0]])), wordSz);
|
||||
break;
|
||||
case FTOI: reg[rdest] = Word_s(double(Float(reg[rsrc[0]], wordSz)));
|
||||
reg[rdest].trunc(wordSz);
|
||||
|
|
|
@ -24,6 +24,10 @@ int main() {
|
|||
for (unsigned i = 0; i < 2; i++) {
|
||||
int n = rand() - RAND_MAX/2;
|
||||
double d = n * 0.0000001;
|
||||
|
||||
// Sometimes do negative numbers.
|
||||
if (rand() & 1) d = -d;
|
||||
|
||||
try_val(d, sz);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue