Try harder to get the compiler to use float registers in different
places to increase the chance of messing up any preserved registers. llvm-svn: 207938
This commit is contained in:
parent
e73333a50f
commit
c72473d87b
|
|
@ -14,30 +14,38 @@
|
||||||
|
|
||||||
// Compile with -Os to get compiler uses float registers to hold float variables
|
// Compile with -Os to get compiler uses float registers to hold float variables
|
||||||
|
|
||||||
__attribute__((noinline))
|
double get_(int x) { return (double)x; }
|
||||||
double get(int x) { return (double)x; }
|
|
||||||
|
|
||||||
|
double (* volatile get)(int) = get_;
|
||||||
|
|
||||||
|
volatile int counter;
|
||||||
|
|
||||||
double try1(bool v) {
|
double try1(bool v) {
|
||||||
double a = get(0);
|
double a = get(0);
|
||||||
double b = get(0);
|
double b = get(1);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b;
|
return get(0)+a+b;
|
||||||
}
|
}
|
||||||
|
|
||||||
double try2(bool v) {
|
double try2(bool v) {
|
||||||
double a = get(0);
|
double a = get(0);
|
||||||
double b = get(0);
|
double b = get(1);
|
||||||
double c = get(0);
|
double c = get(2);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b + c;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b+c;
|
return get(0)+a+b+c;
|
||||||
}
|
}
|
||||||
|
|
||||||
double try3(bool v) {
|
double try3(bool v) {
|
||||||
double a = get(0);
|
double a = get(0);
|
||||||
double b = get(0);
|
double b = get(1);
|
||||||
double c = get(0);
|
double c = get(2);
|
||||||
double d = get(0);
|
double d = get(3);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b + c + d;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b+c+d;
|
return get(0)+a+b+c+d;
|
||||||
}
|
}
|
||||||
|
|
@ -48,6 +56,8 @@ double try4(bool v) {
|
||||||
double c = get(0);
|
double c = get(0);
|
||||||
double d = get(0);
|
double d = get(0);
|
||||||
double e = get(0);
|
double e = get(0);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b+c+d+e;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b+c+d+e;
|
return get(0)+a+b+c+d+e;
|
||||||
}
|
}
|
||||||
|
|
@ -59,6 +69,8 @@ double try5(bool v) {
|
||||||
double d = get(0);
|
double d = get(0);
|
||||||
double e = get(0);
|
double e = get(0);
|
||||||
double f = get(0);
|
double f = get(0);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b+c+d+e+f;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b+c+d+e+f;
|
return get(0)+a+b+c+d+e+f;
|
||||||
}
|
}
|
||||||
|
|
@ -71,6 +83,8 @@ double try6(bool v) {
|
||||||
double e = get(0);
|
double e = get(0);
|
||||||
double f = get(0);
|
double f = get(0);
|
||||||
double g = get(0);
|
double g = get(0);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b+c+d+e+f+g;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b+c+d+e+f+g;
|
return get(0)+a+b+c+d+e+f+g;
|
||||||
}
|
}
|
||||||
|
|
@ -84,6 +98,8 @@ double try7(bool v) {
|
||||||
double f = get(0);
|
double f = get(0);
|
||||||
double g = get(0);
|
double g = get(0);
|
||||||
double h = get(0);
|
double h = get(0);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b+c+d+e+f+g;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b+c+d+e+f+g;
|
return get(0)+a+b+c+d+e+f+g;
|
||||||
}
|
}
|
||||||
|
|
@ -98,6 +114,8 @@ double try8(bool v) {
|
||||||
double g = get(0);
|
double g = get(0);
|
||||||
double h = get(0);
|
double h = get(0);
|
||||||
double i = get(0);
|
double i = get(0);
|
||||||
|
for (counter = 100; counter; --counter)
|
||||||
|
a += get(1) + b+c+d+e+f+g+i;
|
||||||
if (v) throw 10;
|
if (v) throw 10;
|
||||||
return get(0)+a+b+c+d+e+f+g+i;
|
return get(0)+a+b+c+d+e+f+g+i;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue