Merge change 6741
* changes: Implement floating point for ARM.
This commit is contained in:
commit
2974d1fb8b
1010
libacc/acc.cpp
1010
libacc/acc.cpp
File diff suppressed because it is too large
Load Diff
|
@ -38,13 +38,12 @@ void testVars(float arg0, float arg1, double arg2, double arg3) {
|
|||
* (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);
|
||||
|
|
|
@ -4,7 +4,7 @@ void unaryOps() {
|
|||
// 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 @@ void comparisonOpsff() {
|
|||
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 comparisonTestid(int a, double b) {
|
|||
|
||||
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 @@ void testBranching() {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class TestACC(unittest.TestCase):
|
|||
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 @@ class TestACC(unittest.TestCase):
|
|||
"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"],
|
||||
|
|
Loading…
Reference in New Issue