cif8 and cuf8 work now. More tests.
authorDavid Given <dg@cowlark.com>
Sat, 19 Nov 2016 10:42:30 +0000 (11:42 +0100)
committerDavid Given <dg@cowlark.com>
Sat, 19 Nov 2016 10:42:30 +0000 (11:42 +0100)
mach/powerpc/mcg/table
plat/qemuppc/tests/cif8_e.c [new file with mode: 0644]
plat/qemuppc/tests/cuf8_e.c [new file with mode: 0644]
plat/qemuppc/tests/doublecmp_e.c [new file with mode: 0644]

index 79ac7c5..b6bc0ac 100644 (file)
@@ -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 (file)
index 0000000..e81c2f7
--- /dev/null
@@ -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 (file)
index 0000000..a3517b2
--- /dev/null
@@ -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 (file)
index 0000000..f6c1582
--- /dev/null
@@ -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