Implement floating point for ARM.
diff --git a/libacc/tests/data/float.c b/libacc/tests/data/float.c
index df0de93..8625cf1 100644
--- a/libacc/tests/data/float.c
+++ b/libacc/tests/data/float.c
@@ -38,13 +38,12 @@
* (float*) & f0 = 1.1f;
* (double*) & d0 = 3.3;
printf("cast lval: %g %g %g %g\n", f0, f1, d0, d1);
-
}
int main() {
printf("int: %d float: %g double: %g\n", 1, 2.2f, 3.3);
printf(" ftoi(1.4f)=%d\n", ftoi(1.4f));
- printf(" dtoi(2.4f)=%d\n", dtoi(2.4f));
+ printf(" dtoi(2.4)=%d\n", dtoi(2.4));
printf(" itof(3)=%g\n", itof(3));
printf(" itod(4)=%g\n", itod(4));
testVars(1.0f, 2.0f, 3.0, 4.0);
diff --git a/libacc/tests/data/flops.c b/libacc/tests/data/flops.c
index dc36e93..7374056 100644
--- a/libacc/tests/data/flops.c
+++ b/libacc/tests/data/flops.c
@@ -4,7 +4,7 @@
// Unary ops
printf("-%g = %g\n", 1.1, -1.1);
printf("!%g = %d\n", 1.2, !1.2);
- printf("!%g = %d\n", 0.0, !0,0);
+ printf("!%g = %d\n", 0.0, !0.0);
}
void binaryOps() {
@@ -75,6 +75,7 @@
comparisonTestff(1.0f, 1.0f);
comparisonTestff(2.0f, 1.0f);
}
+
void comparisonTestid(int a, double b) {
printf("%d op %g: < %d <= %d == %d >= %d > %d != %d\n",
a, b, a < b, a <= b, a == b, a >= b, a > b, a != b);
@@ -82,9 +83,9 @@
void comparisonOpsid() {
printf("int op double:\n");
- comparisonTestid(1, 2.0f);
- comparisonTestid(1, 1.0f);
- comparisonTestid(2, 1.0f);
+ comparisonTestid(1, 2.0);
+ comparisonTestid(1, 1.0);
+ comparisonTestid(2, 1.0);
}
void comparisonTestdi(double a, int b) {
printf("%g op %d: < %d <= %d == %d >= %d > %d != %d\n",
@@ -117,10 +118,34 @@
printf("branching: %d %d %d\n", branch(-1.0), branch(0.0), branch(1.0));
}
+void testpassi(int a, int b, int c, int d, int e, int f, int g, int h) {
+ printf("testpassi: %d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h);
+}
+
+void testpassf(float a, float b, float c, float d, float e, float f, float g, float h) {
+ printf("testpassf: %g %g %g %g %g %g %g %g\n", a, b, c, d, e, f, g, h);
+}
+
+void testpassd(double a, double b, double c, double d, double e, double f, double g, double h) {
+ printf("testpassd: %g %g %g %g %g %g %g %g\n", a, b, c, d, e, f, g, h);
+}
+
+void testpassidf(int i, double d, float f) {
+ printf("testpassidf: %d %g %g\n", i, d, f);
+}
+
+void testParameterPassing() {
+ testpassi(1, 2, 3, 4, 5, 6, 7, 8);
+ testpassf(1, 2, 3, 4, 5, 6, 7, 8);
+ testpassd(1, 2, 3, 4, 5, 6, 7, 8);
+ testpassidf(1, 2.0, 3.0f);
+}
+
int main() {
unaryOps();
binaryOps();
comparisonOps();
testBranching();
+ testParameterPassing();
return 0;
}
diff --git a/libacc/tests/test.py b/libacc/tests/test.py
index 77c6609..ff9af9b 100644
--- a/libacc/tests/test.py
+++ b/libacc/tests/test.py
@@ -118,7 +118,7 @@
def testRunFloat(self):
self.compileCheck(["-R", "data/float.c"],
"Executing compiled code:\nresult: 0\n",
- "int: 1 float: 2.2 double: 3.3\n ftoi(1.4f)=1\n dtoi(2.4f)=2\n itof(3)=3\n itod(4)=4\nglobals: 1 2 3 4\nargs: 1 2 3 4\nlocals: 1 2 3 4\ncast rval: 2 4\ncast lval: 1.1 2 3.3 4\n")
+ "int: 1 float: 2.2 double: 3.3\n ftoi(1.4f)=1\n dtoi(2.4)=2\n itof(3)=3\n itod(4)=4\nglobals: 1 2 3 4\nargs: 1 2 3 4\nlocals: 1 2 3 4\ncast rval: 2 4\ncast lval: 1.1 2 3.3 4\n")
def testRunFlops(self):
self.compileCheck(["-R", "data/flops.c"],
@@ -171,7 +171,12 @@
"1 op 2: < 1 <= 1 == 0 >= 0 > 0 != 1\n" +
"1 op 1: < 0 <= 1 == 1 >= 1 > 0 != 0\n" +
"2 op 1: < 0 <= 0 == 0 >= 1 > 1 != 1\n" +
- "branching: 1 0 1\n")
+ "branching: 1 0 1\n" +
+ "testpassi: 1 2 3 4 5 6 7 8\n" +
+ "testpassf: 1 2 3 4 5 6 7 8\n" +
+ "testpassd: 1 2 3 4 5 6 7 8\n" +
+ "testpassidf: 1 2 3\n"
+ )
def testArmRunReturnVal(self):
self.compileCheckArm(["-R", "/system/bin/accdata/data/returnval-ansi.c"],