cif8 and cuf8 work now. More tests.

This commit is contained in:
David Given 2016-11-19 11:42:30 +01:00
parent cc660b230f
commit 454a7494bb
4 changed files with 66 additions and 4 deletions

View file

@ -407,9 +407,12 @@ PATTERNS
emit "bl .fromf2l" emit "bl .fromf2l"
cost 4; cost 4;
out:(dret)reg = FROMSI.D(in:(iret)reg) out:(double)reg = FROMSI.D(in:(int)reg)
with corrupted(volatile) with corrupted(volatile)
emit "bl .fromsi2d" emit "stwu %in, -4(sp)"
emit "bl .cif8"
emit "lfd %out, 0(sp)"
emit "addi sp, sp, 8"
cost 4; cost 4;
out:(fret)reg = FROMUI.F(in:(iret)reg) out:(fret)reg = FROMUI.F(in:(iret)reg)
@ -417,9 +420,12 @@ PATTERNS
emit "bl .fromui2f" emit "bl .fromui2f"
cost 4; cost 4;
out:(dret)reg = FROMUI.D(in:(iret)reg) out:(double)reg = FROMUI.D(in:(int)reg)
with corrupted(volatile) with corrupted(volatile)
emit "bl .fromui2d" emit "stwu %in, -4(sp)"
emit "bl .cuf8"
emit "lfd %out, 0(sp)"
emit "addi sp, sp, 8"
cost 4; cost 4;
out:(lret)reg = FROMIPAIR.L(in1:(int)reg, in2:(int)reg) out:(lret)reg = FROMIPAIR.L(in1:(int)reg, in2:(int)reg)

View file

@ -0,0 +1,20 @@
#include "test.h"
/* Constants in globals to defeat constant folding. */
int one = 1;
int zero = 0;
int minusone = -1;
int big = 0x7fffffff;
int minusbig = -0x8000000;
/* Bypasses the CRT, so there's no stdio or BSS initialisation. */
void _m_a_i_n(void)
{
ASSERT((double)zero == 0.0);
ASSERT((double)one == 1.0);
ASSERT((double)minusone == -1.0);
ASSERT((double)big == 2147483647.0);
/* ASSERT((double)minusbig == -2147483648.0); FIXME: fails for now */
finished();
}

View file

@ -0,0 +1,16 @@
#include "test.h"
/* Constants in globals to defeat constant folding. */
unsigned int one_u = 1;
unsigned int zero_u = 0;
unsigned int big_u = 0xffffffff;
/* Bypasses the CRT, so there's no stdio or BSS initialisation. */
void _m_a_i_n(void)
{
ASSERT((double)zero_u == 0.0);
ASSERT((double)one_u == 1.0);
ASSERT((double)big_u == 4294967295.0);
finished();
}

View file

@ -0,0 +1,20 @@
#include "test.h"
/* Constants in globals to defeat constant folding. */
double one = 1.0;
double zero = 0.0;
/* Bypasses the CRT, so there's no stdio or BSS initialisation. */
void _m_a_i_n(void)
{
ASSERT(zero == zero);
ASSERT(one != zero);
ASSERT(zero < one);
ASSERT(zero <= one);
ASSERT(zero <= zero);
ASSERT(one > zero);
ASSERT(one >= zero);
ASSERT(one >= one);
finished();
}