diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/regression/tests/gcc-torture-execute-loop-13.c | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/regression/tests/gcc-torture-execute-loop-13.c')
| -rw-r--r-- | support/regression/tests/gcc-torture-execute-loop-13.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/support/regression/tests/gcc-torture-execute-loop-13.c b/support/regression/tests/gcc-torture-execute-loop-13.c new file mode 100644 index 0000000..d43f011 --- /dev/null +++ b/support/regression/tests/gcc-torture-execute-loop-13.c @@ -0,0 +1,50 @@ +/* + loop-13.c from the execute part of the gcc torture tests. + */ + +#include <testfwk.h> + +#ifdef __SDCC +#pragma std_c99 +#endif + +/* PR opt/7130 */ +#define TYPE long + +#if !defined(__SDCC_pdk14) // Lack of memory +void +scale (TYPE *alpha, TYPE *x, int n) +{ + int i, ix; + + if (*alpha != 1) + for (i = 0, ix = 0; i < n; i++, ix += 2) + { + TYPE tmpr, tmpi; + tmpr = *alpha * x[ix]; + tmpi = *alpha * x[ix + 1]; + x[ix] = tmpr; + x[ix + 1] = tmpi; + } +} +#endif + +void +testTortureExecute (void) +{ +#if !defined(__SDCC_pdk14) // Lack of memory + int i; + TYPE x[10]; + TYPE alpha = 2; + + for (i = 0; i < 10; i++) + x[i] = i; + + scale (&alpha, x, 5); + + if (x[9] != 18) + ASSERT (0); + + return; +#endif +} |
