diff options
author | Xavier Leroy <xavier.leroy@college-de-france.fr> | 2019-07-07 17:39:54 +0200 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2019-07-17 09:17:28 +0200 |
commit | 7cd0af8ba5d737fa9c45bb9fa454b38e9704097a (patch) | |
tree | cd348fa06266cfffeeadc5d5c61f4cd7fe80a7f8 /test/regression/builtins-powerpc.c | |
parent | 633e60ed36c07c4b6cb4b1dc93b9eea312882ceb (diff) | |
download | compcert-7cd0af8ba5d737fa9c45bb9fa454b38e9704097a.tar.gz compcert-7cd0af8ba5d737fa9c45bb9fa454b38e9704097a.zip |
When testing builtin functions, prevent constant propagation
Now that some builtin functions have known semantics, constant
propagation can happen in this test. This defeats the purpose,
which is to check that the correct processor instructions are generated.
To prevent this constant propagation, we move the initialized
variables to global scope. Since they are not "const", their
values are not known to the optimizer.
Diffstat (limited to 'test/regression/builtins-powerpc.c')
-rw-r--r-- | test/regression/builtins-powerpc.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/regression/builtins-powerpc.c b/test/regression/builtins-powerpc.c index 23e9d191..8fd5818b 100644 --- a/test/regression/builtins-powerpc.c +++ b/test/regression/builtins-powerpc.c @@ -9,16 +9,17 @@ char * check_relative_error(double exact, double actual, double precision) return fabs(relative_error) <= precision ? "OK" : "ERROR"; } +unsigned int x = 0x12345678; +unsigned int y = 0xDEADBEEF; +unsigned long long xx = 0x1234567812345678ULL; +double a = 3.14159; +double b = 2.718; +double c = 1.414; +unsigned short s = 0x1234; + int main(int argc, char ** argv) { - unsigned int x = 0x12345678; - unsigned int y = 0xDEADBEEF; - unsigned long long xx = 0x1234567812345678ULL; unsigned z; - double a = 3.14159; - double b = 2.718; - double c = 1.414; - unsigned short s = 0x1234; printf("mulhw(%x, %x) = %x\n", x, y, __builtin_mulhw(x, y)); printf("mulhwu(%x, %x) = %x\n", x, y, __builtin_mulhwu(x, y)); |