diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/monniaux/BearSSL/mk/mkT0.cmd | 32 | ||||
-rw-r--r-- | test/monniaux/builtins/fma.c | 14 | ||||
-rw-r--r-- | test/monniaux/latency/latency.s | 27 | ||||
-rw-r--r-- | test/monniaux/predicated/predicated.s | 13 | ||||
-rw-r--r-- | test/regression/builtins-arm.c | 11 | ||||
-rw-r--r-- | test/regression/builtins-powerpc.c | 15 | ||||
-rw-r--r-- | test/regression/builtins-riscV.c | 14 | ||||
-rw-r--r-- | test/regression/builtins-x86.c | 19 | ||||
-rw-r--r-- | test/regression/extasm.c | 10 | ||||
-rw-r--r-- | test/regression/ifconv.c | 20 |
10 files changed, 75 insertions, 100 deletions
diff --git a/test/monniaux/BearSSL/mk/mkT0.cmd b/test/monniaux/BearSSL/mk/mkT0.cmd deleted file mode 100644 index 98955625..00000000 --- a/test/monniaux/BearSSL/mk/mkT0.cmd +++ /dev/null @@ -1,32 +0,0 @@ -@echo off
-
-rem =====================================================================
-rem This script uses the command-line C# compiler csc.exe, which is
-rem provided with the .NET framework. We need framework 3.5 or later
-rem (some of the code uses features not available in the language version
-rem implemented in the compiler provided with framework 2.0.50727).
-rem =====================================================================
-
-if exist "%SystemRoot%\Microsoft.NET\Framework\v3.5\csc.exe" (
- set CSC="%SystemRoot%\Microsoft.NET\Framework\v3.5\csc.exe"
- goto do_compile
-)
-if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc.exe" (
- set CSC="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\csc.exe"
- goto do_compile
-)
-if exist "%SystemRoot%\Microsoft.NET\Framework64\v3.5\csc.exe" (
- set CSC="%SystemRoot%\Microsoft.NET\Framework64\v3.5\csc.exe"
- goto do_compile
-)
-if exist "%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\csc.exe" (
- set CSC="%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\csc.exe"
- goto do_compile
-)
-
-echo C# compiler not found
-exit 1
-
-:do_compile
-%CSC% /nologo /out:T0Comp.exe /main:T0Comp /res:T0\kern.t0,t0-kernel T0\*.cs
-if %errorlevel% neq 0 exit /b %errorlevel%
diff --git a/test/monniaux/builtins/fma.c b/test/monniaux/builtins/fma.c new file mode 100644 index 00000000..4083e781 --- /dev/null +++ b/test/monniaux/builtins/fma.c @@ -0,0 +1,14 @@ +#define COMPCERT_NO_FP_MACROS +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char **argv) { + if (argc < 4) return 1; + double x = strtod(argv[1], NULL); + double y = strtod(argv[2], NULL); + double z = strtod(argv[3], NULL); + printf("%g %g %g\n", __builtin_fma(x, y, z), fma(x, y, z), x*y + z); + printf("%g %g %g\n", __builtin_fma(-x, y, z), fma(-x, y, z), (-x)*y + z); + return 0; +} diff --git a/test/monniaux/latency/latency.s b/test/monniaux/latency/latency.s deleted file mode 100644 index 494f9f77..00000000 --- a/test/monniaux/latency/latency.s +++ /dev/null @@ -1,27 +0,0 @@ -# File generated by CompCert 3.4 -# Command line: -S latency.c - .text - .balign 2 - .globl latency -latency: - make $r2 = 100 -;; - loopdo $r2, .exitloop -;; - lws $r1 = 0[$r0] -;; - addw $r0 = $r0, 0 -;; - addw $r0 = $r0, 0 -;; - addw $r0 = $r0, 0 -;; - addw $r1 = $r1, 1 -;; - sw 0[$r0] = $r1 -;; -.exitloop: - ret -;; - .type latency, @function - .size latency, . - latency diff --git a/test/monniaux/predicated/predicated.s b/test/monniaux/predicated/predicated.s deleted file mode 100644 index f11606c2..00000000 --- a/test/monniaux/predicated/predicated.s +++ /dev/null @@ -1,13 +0,0 @@ - .text - - .globl predicated_write -predicated_write: - sd.wnez $r0? 8[$r1] = $r2 - ret - ;; - - .globl predicated_read -predicated_read: - ld.wnez $r1? $r0 = 8[$r2] - ret - ;; diff --git a/test/regression/builtins-arm.c b/test/regression/builtins-arm.c index 709343ce..d06e8e5e 100644 --- a/test/regression/builtins-arm.c +++ b/test/regression/builtins-arm.c @@ -2,14 +2,15 @@ #include <stdio.h> +unsigned int x = 0x12345678; +unsigned int y = 0xDEADBEEF; +unsigned long long xx = 0x1234567812345678ULL; +double a = 3.14159; +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; - unsigned short s = 0x1234; printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); 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)); diff --git a/test/regression/builtins-riscV.c b/test/regression/builtins-riscV.c index a302a6c4..c34fdf2c 100644 --- a/test/regression/builtins-riscV.c +++ b/test/regression/builtins-riscV.c @@ -2,15 +2,15 @@ #include <stdio.h> +unsigned int x = 0x12345678; +unsigned short s = 0x1234; +unsigned long long zz = 0x123456789ABCDEF0ULL; +double a = 3.14159; +double b = 2.718; +double c = 1.414; + int main(int argc, char ** argv) { - unsigned int x = 0x12345678; - unsigned short s = 0x1234; - unsigned long long zz = 0x123456789ABCDEF0ULL; - double a = 3.14159; - double b = 2.718; - double c = 1.414; - printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); printf("bswap32(%x) = %x\n", x, __builtin_bswap32(x)); printf("bswap64(%llx) = %llx\n", zz, __builtin_bswap64(zz)); diff --git a/test/regression/builtins-x86.c b/test/regression/builtins-x86.c index 1ba213e7..6233f9fd 100644 --- a/test/regression/builtins-x86.c +++ b/test/regression/builtins-x86.c @@ -2,18 +2,19 @@ #include <stdio.h> +unsigned int x = 0x12345678; +unsigned int y = 0xDEADBEEF; +unsigned long long xx = 0x1234567812345678ULL; +unsigned long long yy = 0x1234567800000000ULL; +unsigned long long zz = 0x123456789ABCDEF0ULL; +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 long long yy = 0x1234567800000000ULL; - unsigned long long zz = 0x123456789ABCDEF0ULL; unsigned z; - double a = 3.14159; - double b = 2.718; - double c = 1.414; - unsigned short s = 0x1234; printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); diff --git a/test/regression/extasm.c b/test/regression/extasm.c index babc57f1..83a07a05 100644 --- a/test/regression/extasm.c +++ b/test/regression/extasm.c @@ -33,6 +33,7 @@ int main() void * y; long long z; double f; + float sf; char c[16]; /* No inputs, no outputs */ @@ -72,6 +73,15 @@ int main() #ifdef FAILURES asm("FAIL4 a:%[a]" : "=r"(x) : [z]"i"(0)); #endif + /* One argument of each type */ + asm("TEST15 int32 %0" : : "r" (x)); +#ifdef SIXTYFOUR + asm("TEST15 int64 %0" : : "r" (z)); +#else + asm("TEST15 int64 %Q0 / %R0" : : "r" (z)); +#endif + asm("TEST15 float64 %0" : : "r" (f)); + asm("TEST15 float32 %0" : : "r" (sf)); /* Various failures */ #ifdef FAILURES asm("FAIL5 out:%0,%1" : "=r"(x), "=r"(y)); diff --git a/test/regression/ifconv.c b/test/regression/ifconv.c index dcbf43e5..e12a394c 100644 --- a/test/regression/ifconv.c +++ b/test/regression/ifconv.c @@ -83,6 +83,26 @@ float sdoz(float x, float y) return x >= y ? x - y : 0.0f; } +/* Examples where constant propagation should take place */ + +int constprop1(int x) +{ + int n = 0; + return n ? x : 42; +} + +int constprop2(int x) +{ + int n = 1; + return n ? x : 42; +} + +int constprop3(int x, int y) +{ + int n = 0; + return x < n ? y - 1 : y + 1; +} + /* Test harness */ #define TESTI(call) printf(#call " = %d\n", call) |