From 454a7494bbd0c943dcc3d0c61cd7ccc79f94db13 Mon Sep 17 00:00:00 2001 From: David Given Date: Sat, 19 Nov 2016 11:42:30 +0100 Subject: [PATCH] cif8 and cuf8 work now. More tests. --- mach/powerpc/mcg/table | 14 ++++++++++---- plat/qemuppc/tests/cif8_e.c | 20 ++++++++++++++++++++ plat/qemuppc/tests/cuf8_e.c | 16 ++++++++++++++++ plat/qemuppc/tests/doublecmp_e.c | 20 ++++++++++++++++++++ 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 plat/qemuppc/tests/cif8_e.c create mode 100644 plat/qemuppc/tests/cuf8_e.c create mode 100644 plat/qemuppc/tests/doublecmp_e.c diff --git a/mach/powerpc/mcg/table b/mach/powerpc/mcg/table index 79ac7c577..b6bc0ac48 100644 --- a/mach/powerpc/mcg/table +++ b/mach/powerpc/mcg/table @@ -407,9 +407,12 @@ PATTERNS emit "bl .fromf2l" cost 4; - out:(dret)reg = FROMSI.D(in:(iret)reg) + out:(double)reg = FROMSI.D(in:(int)reg) 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; out:(fret)reg = FROMUI.F(in:(iret)reg) @@ -417,9 +420,12 @@ PATTERNS emit "bl .fromui2f" cost 4; - out:(dret)reg = FROMUI.D(in:(iret)reg) + out:(double)reg = FROMUI.D(in:(int)reg) 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; out:(lret)reg = FROMIPAIR.L(in1:(int)reg, in2:(int)reg) diff --git a/plat/qemuppc/tests/cif8_e.c b/plat/qemuppc/tests/cif8_e.c new file mode 100644 index 000000000..e81c2f7c2 --- /dev/null +++ b/plat/qemuppc/tests/cif8_e.c @@ -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(); +} \ No newline at end of file diff --git a/plat/qemuppc/tests/cuf8_e.c b/plat/qemuppc/tests/cuf8_e.c new file mode 100644 index 000000000..a3517b24c --- /dev/null +++ b/plat/qemuppc/tests/cuf8_e.c @@ -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(); +} \ No newline at end of file diff --git a/plat/qemuppc/tests/doublecmp_e.c b/plat/qemuppc/tests/doublecmp_e.c new file mode 100644 index 000000000..f6c1582dc --- /dev/null +++ b/plat/qemuppc/tests/doublecmp_e.c @@ -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(); +} \ No newline at end of file -- 2.34.1