diff options
Diffstat (limited to 'test/regression')
-rw-r--r-- | test/regression/Makefile | 16 | ||||
-rw-r--r-- | test/regression/Results/builtins-common-kvx | 391 | ||||
-rw-r--r-- | test/regression/Results/many_parameters | 1 | ||||
-rw-r--r-- | test/regression/Results/varargs2-kvx | 12 | ||||
-rw-r--r-- | test/regression/builtins-common.c | 2 | ||||
-rw-r--r-- | test/regression/builtins-kvx.c | 72 | ||||
-rw-r--r-- | test/regression/extasm.c | 1 | ||||
-rw-r--r-- | test/regression/many_parameters.c | 313 | ||||
-rw-r--r-- | test/regression/packedstruct1.c | 16 | ||||
-rw-r--r-- | test/regression/ran000373_reduced.c | 36 | ||||
-rw-r--r-- | test/regression/varargs2.c | 16 |
11 files changed, 864 insertions, 12 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile index 33a9f993..db0b381e 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -1,6 +1,8 @@ include ../../Makefile.config CCOMP=../../ccomp +# TODO - temporary +# CCOMPOPTS:=$(CCOMPOPTS) -fall-loads-nontrap -fduplicate 2 -fprepass CCOMPFLAGS=$(CCOMPOPTS) -stdlib ../../runtime \ -dparse -dc -dclight -dasm -fall \ -DARCH_$(ARCH) -DMODEL_$(MODEL) @@ -10,25 +12,33 @@ LIBS=$(LIBMATH) # Can run, both in compiled mode and in interpreter mode, # and have reference output in Results -TESTS=int32 int64 floats floats-basics floats-lit \ +TESTS?=int32 int64 floats floats-basics floats-lit \ expr1 expr6 funptr2 initializers initializers2 initializers3 \ volatile1 volatile2 volatile3 volatile4 \ funct3 expr5 struct7 struct8 struct11 struct12 casts1 casts2 char1 \ sizeof1 sizeof2 binops bool for1 for2 switch switch2 compound \ decl1 bitfields9 ptrs3 \ - parsing krfun ifconv + parsing krfun ifconv many_parameters # Can run, but only in compiled mode, and have reference output in Results -TESTS_COMP=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \ +TESTS_COMP?=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \ bitfields5 bitfields6 bitfields7 bitfields8 bitfields_uint_t bitfields10 \ builtins-common builtins-$(ARCH) packedstruct1 packedstruct2 alignas \ varargs1 varargs2 varargs3 sections alias aligned +ifeq ($(ARCH),kvx) + TESTS_COMP:=$(filter-out packedstruct1,$(TESTS_COMP)) + TESTS_COMP:=$(filter-out packedstruct2,$(TESTS_COMP)) +endif + # Can run, both in compiled mode and in interpreter mode, # but produce processor-dependent results, so no reference output in Results TESTS_DIFF=NaNs +# FIXME ifeq ($(ARCH),kvx) + TESTS_DIFF:=$(filter-out NaNs,$(TESTS_DIFF)) +# endif # Other tests: should compile to .s without errors (but expect warnings) diff --git a/test/regression/Results/builtins-common-kvx b/test/regression/Results/builtins-common-kvx new file mode 100644 index 00000000..fad75e7c --- /dev/null +++ b/test/regression/Results/builtins-common-kvx @@ -0,0 +1,391 @@ +bswap(12345678) = 78563412 +bswap16(1234) = 3412 +bswap64(123456789abcdef0) = f0debc9a78563412 +clz(ffffffff) = 0 +clz(80000000) = 0 +clz(7fffffff) = 1 +clz(40000000) = 1 +clz(3fffffff) = 2 +clz(20000000) = 2 +clz(1fffffff) = 3 +clz(10000000) = 3 +clz(0fffffff) = 4 +clz(08000000) = 4 +clz(07ffffff) = 5 +clz(04000000) = 5 +clz(03ffffff) = 6 +clz(02000000) = 6 +clz(01ffffff) = 7 +clz(01000000) = 7 +clz(00ffffff) = 8 +clz(00800000) = 8 +clz(007fffff) = 9 +clz(00400000) = 9 +clz(003fffff) = 10 +clz(00200000) = 10 +clz(001fffff) = 11 +clz(00100000) = 11 +clz(000fffff) = 12 +clz(00080000) = 12 +clz(0007ffff) = 13 +clz(00040000) = 13 +clz(0003ffff) = 14 +clz(00020000) = 14 +clz(0001ffff) = 15 +clz(00010000) = 15 +clz(0000ffff) = 16 +clz(00008000) = 16 +clz(00007fff) = 17 +clz(00004000) = 17 +clz(00003fff) = 18 +clz(00002000) = 18 +clz(00001fff) = 19 +clz(00001000) = 19 +clz(00000fff) = 20 +clz(00000800) = 20 +clz(000007ff) = 21 +clz(00000400) = 21 +clz(000003ff) = 22 +clz(00000200) = 22 +clz(000001ff) = 23 +clz(00000100) = 23 +clz(000000ff) = 24 +clz(00000080) = 24 +clz(0000007f) = 25 +clz(00000040) = 25 +clz(0000003f) = 26 +clz(00000020) = 26 +clz(0000001f) = 27 +clz(00000010) = 27 +clz(0000000f) = 28 +clz(00000008) = 28 +clz(00000007) = 29 +clz(00000004) = 29 +clz(00000003) = 30 +clz(00000002) = 30 +clz(00000001) = 31 +clz(00000001) = 31 +clzll(ffffffffffffffff) = 0 +clzll(8000000000000000) = 0 +clzll(7fffffffffffffff) = 1 +clzll(4000000000000000) = 1 +clzll(3fffffffffffffff) = 2 +clzll(2000000000000000) = 2 +clzll(1fffffffffffffff) = 3 +clzll(1000000000000000) = 3 +clzll(0fffffffffffffff) = 4 +clzll(0800000000000000) = 4 +clzll(07ffffffffffffff) = 5 +clzll(0400000000000000) = 5 +clzll(03ffffffffffffff) = 6 +clzll(0200000000000000) = 6 +clzll(01ffffffffffffff) = 7 +clzll(0100000000000000) = 7 +clzll(00ffffffffffffff) = 8 +clzll(0080000000000000) = 8 +clzll(007fffffffffffff) = 9 +clzll(0040000000000000) = 9 +clzll(003fffffffffffff) = 10 +clzll(0020000000000000) = 10 +clzll(001fffffffffffff) = 11 +clzll(0010000000000000) = 11 +clzll(000fffffffffffff) = 12 +clzll(0008000000000000) = 12 +clzll(0007ffffffffffff) = 13 +clzll(0004000000000000) = 13 +clzll(0003ffffffffffff) = 14 +clzll(0002000000000000) = 14 +clzll(0001ffffffffffff) = 15 +clzll(0001000000000000) = 15 +clzll(0000ffffffffffff) = 16 +clzll(0000800000000000) = 16 +clzll(00007fffffffffff) = 17 +clzll(0000400000000000) = 17 +clzll(00003fffffffffff) = 18 +clzll(0000200000000000) = 18 +clzll(00001fffffffffff) = 19 +clzll(0000100000000000) = 19 +clzll(00000fffffffffff) = 20 +clzll(0000080000000000) = 20 +clzll(000007ffffffffff) = 21 +clzll(0000040000000000) = 21 +clzll(000003ffffffffff) = 22 +clzll(0000020000000000) = 22 +clzll(000001ffffffffff) = 23 +clzll(0000010000000000) = 23 +clzll(000000ffffffffff) = 24 +clzll(0000008000000000) = 24 +clzll(0000007fffffffff) = 25 +clzll(0000004000000000) = 25 +clzll(0000003fffffffff) = 26 +clzll(0000002000000000) = 26 +clzll(0000001fffffffff) = 27 +clzll(0000001000000000) = 27 +clzll(0000000fffffffff) = 28 +clzll(0000000800000000) = 28 +clzll(00000007ffffffff) = 29 +clzll(0000000400000000) = 29 +clzll(00000003ffffffff) = 30 +clzll(0000000200000000) = 30 +clzll(00000001ffffffff) = 31 +clzll(0000000100000000) = 31 +clzll(00000000ffffffff) = 32 +clzll(0000000080000000) = 32 +clzll(000000007fffffff) = 33 +clzll(0000000040000000) = 33 +clzll(000000003fffffff) = 34 +clzll(0000000020000000) = 34 +clzll(000000001fffffff) = 35 +clzll(0000000010000000) = 35 +clzll(000000000fffffff) = 36 +clzll(0000000008000000) = 36 +clzll(0000000007ffffff) = 37 +clzll(0000000004000000) = 37 +clzll(0000000003ffffff) = 38 +clzll(0000000002000000) = 38 +clzll(0000000001ffffff) = 39 +clzll(0000000001000000) = 39 +clzll(0000000000ffffff) = 40 +clzll(0000000000800000) = 40 +clzll(00000000007fffff) = 41 +clzll(0000000000400000) = 41 +clzll(00000000003fffff) = 42 +clzll(0000000000200000) = 42 +clzll(00000000001fffff) = 43 +clzll(0000000000100000) = 43 +clzll(00000000000fffff) = 44 +clzll(0000000000080000) = 44 +clzll(000000000007ffff) = 45 +clzll(0000000000040000) = 45 +clzll(000000000003ffff) = 46 +clzll(0000000000020000) = 46 +clzll(000000000001ffff) = 47 +clzll(0000000000010000) = 47 +clzll(000000000000ffff) = 48 +clzll(0000000000008000) = 48 +clzll(0000000000007fff) = 49 +clzll(0000000000004000) = 49 +clzll(0000000000003fff) = 50 +clzll(0000000000002000) = 50 +clzll(0000000000001fff) = 51 +clzll(0000000000001000) = 51 +clzll(0000000000000fff) = 52 +clzll(0000000000000800) = 52 +clzll(00000000000007ff) = 53 +clzll(0000000000000400) = 53 +clzll(00000000000003ff) = 54 +clzll(0000000000000200) = 54 +clzll(00000000000001ff) = 55 +clzll(0000000000000100) = 55 +clzll(00000000000000ff) = 56 +clzll(0000000000000080) = 56 +clzll(000000000000007f) = 57 +clzll(0000000000000040) = 57 +clzll(000000000000003f) = 58 +clzll(0000000000000020) = 58 +clzll(000000000000001f) = 59 +clzll(0000000000000010) = 59 +clzll(000000000000000f) = 60 +clzll(0000000000000008) = 60 +clzll(0000000000000007) = 61 +clzll(0000000000000004) = 61 +clzll(0000000000000003) = 62 +clzll(0000000000000002) = 62 +clzll(0000000000000001) = 63 +clzll(0000000000000001) = 63 +ctz(00000001) = 0 +ctz(ffffffff) = 0 +ctz(00000002) = 1 +ctz(fffffffe) = 1 +ctz(00000004) = 2 +ctz(fffffffc) = 2 +ctz(00000008) = 3 +ctz(fffffff8) = 3 +ctz(00000010) = 4 +ctz(fffffff0) = 4 +ctz(00000020) = 5 +ctz(ffffffe0) = 5 +ctz(00000040) = 6 +ctz(ffffffc0) = 6 +ctz(00000080) = 7 +ctz(ffffff80) = 7 +ctz(00000100) = 8 +ctz(ffffff00) = 8 +ctz(00000200) = 9 +ctz(fffffe00) = 9 +ctz(00000400) = 10 +ctz(fffffc00) = 10 +ctz(00000800) = 11 +ctz(fffff800) = 11 +ctz(00001000) = 12 +ctz(fffff000) = 12 +ctz(00002000) = 13 +ctz(ffffe000) = 13 +ctz(00004000) = 14 +ctz(ffffc000) = 14 +ctz(00008000) = 15 +ctz(ffff8000) = 15 +ctz(00010000) = 16 +ctz(ffff0000) = 16 +ctz(00020000) = 17 +ctz(fffe0000) = 17 +ctz(00040000) = 18 +ctz(fffc0000) = 18 +ctz(00080000) = 19 +ctz(fff80000) = 19 +ctz(00100000) = 20 +ctz(fff00000) = 20 +ctz(00200000) = 21 +ctz(ffe00000) = 21 +ctz(00400000) = 22 +ctz(ffc00000) = 22 +ctz(00800000) = 23 +ctz(ff800000) = 23 +ctz(01000000) = 24 +ctz(ff000000) = 24 +ctz(02000000) = 25 +ctz(fe000000) = 25 +ctz(04000000) = 26 +ctz(fc000000) = 26 +ctz(08000000) = 27 +ctz(f8000000) = 27 +ctz(10000000) = 28 +ctz(f0000000) = 28 +ctz(20000000) = 29 +ctz(e0000000) = 29 +ctz(40000000) = 30 +ctz(c0000000) = 30 +ctz(80000000) = 31 +ctz(80000000) = 31 +ctzll(0000000000000001) = 0 +ctzll(ffffffffffffffff) = 0 +ctzll(0000000000000002) = 1 +ctzll(fffffffffffffffe) = 1 +ctzll(0000000000000004) = 2 +ctzll(fffffffffffffffc) = 2 +ctzll(0000000000000008) = 3 +ctzll(fffffffffffffff8) = 3 +ctzll(0000000000000010) = 4 +ctzll(fffffffffffffff0) = 4 +ctzll(0000000000000020) = 5 +ctzll(ffffffffffffffe0) = 5 +ctzll(0000000000000040) = 6 +ctzll(ffffffffffffffc0) = 6 +ctzll(0000000000000080) = 7 +ctzll(ffffffffffffff80) = 7 +ctzll(0000000000000100) = 8 +ctzll(ffffffffffffff00) = 8 +ctzll(0000000000000200) = 9 +ctzll(fffffffffffffe00) = 9 +ctzll(0000000000000400) = 10 +ctzll(fffffffffffffc00) = 10 +ctzll(0000000000000800) = 11 +ctzll(fffffffffffff800) = 11 +ctzll(0000000000001000) = 12 +ctzll(fffffffffffff000) = 12 +ctzll(0000000000002000) = 13 +ctzll(ffffffffffffe000) = 13 +ctzll(0000000000004000) = 14 +ctzll(ffffffffffffc000) = 14 +ctzll(0000000000008000) = 15 +ctzll(ffffffffffff8000) = 15 +ctzll(0000000000010000) = 16 +ctzll(ffffffffffff0000) = 16 +ctzll(0000000000020000) = 17 +ctzll(fffffffffffe0000) = 17 +ctzll(0000000000040000) = 18 +ctzll(fffffffffffc0000) = 18 +ctzll(0000000000080000) = 19 +ctzll(fffffffffff80000) = 19 +ctzll(0000000000100000) = 20 +ctzll(fffffffffff00000) = 20 +ctzll(0000000000200000) = 21 +ctzll(ffffffffffe00000) = 21 +ctzll(0000000000400000) = 22 +ctzll(ffffffffffc00000) = 22 +ctzll(0000000000800000) = 23 +ctzll(ffffffffff800000) = 23 +ctzll(0000000001000000) = 24 +ctzll(ffffffffff000000) = 24 +ctzll(0000000002000000) = 25 +ctzll(fffffffffe000000) = 25 +ctzll(0000000004000000) = 26 +ctzll(fffffffffc000000) = 26 +ctzll(0000000008000000) = 27 +ctzll(fffffffff8000000) = 27 +ctzll(0000000010000000) = 28 +ctzll(fffffffff0000000) = 28 +ctzll(0000000020000000) = 29 +ctzll(ffffffffe0000000) = 29 +ctzll(0000000040000000) = 30 +ctzll(ffffffffc0000000) = 30 +ctzll(0000000080000000) = 31 +ctzll(ffffffff80000000) = 31 +ctzll(0000000100000000) = 32 +ctzll(ffffffff00000000) = 32 +ctzll(0000000200000000) = 33 +ctzll(fffffffe00000000) = 33 +ctzll(0000000400000000) = 34 +ctzll(fffffffc00000000) = 34 +ctzll(0000000800000000) = 35 +ctzll(fffffff800000000) = 35 +ctzll(0000001000000000) = 36 +ctzll(fffffff000000000) = 36 +ctzll(0000002000000000) = 37 +ctzll(ffffffe000000000) = 37 +ctzll(0000004000000000) = 38 +ctzll(ffffffc000000000) = 38 +ctzll(0000008000000000) = 39 +ctzll(ffffff8000000000) = 39 +ctzll(0000010000000000) = 40 +ctzll(ffffff0000000000) = 40 +ctzll(0000020000000000) = 41 +ctzll(fffffe0000000000) = 41 +ctzll(0000040000000000) = 42 +ctzll(fffffc0000000000) = 42 +ctzll(0000080000000000) = 43 +ctzll(fffff80000000000) = 43 +ctzll(0000100000000000) = 44 +ctzll(fffff00000000000) = 44 +ctzll(0000200000000000) = 45 +ctzll(ffffe00000000000) = 45 +ctzll(0000400000000000) = 46 +ctzll(ffffc00000000000) = 46 +ctzll(0000800000000000) = 47 +ctzll(ffff800000000000) = 47 +ctzll(0001000000000000) = 48 +ctzll(ffff000000000000) = 48 +ctzll(0002000000000000) = 49 +ctzll(fffe000000000000) = 49 +ctzll(0004000000000000) = 50 +ctzll(fffc000000000000) = 50 +ctzll(0008000000000000) = 51 +ctzll(fff8000000000000) = 51 +ctzll(0010000000000000) = 52 +ctzll(fff0000000000000) = 52 +ctzll(0020000000000000) = 53 +ctzll(ffe0000000000000) = 53 +ctzll(0040000000000000) = 54 +ctzll(ffc0000000000000) = 54 +ctzll(0080000000000000) = 55 +ctzll(ff80000000000000) = 55 +ctzll(0100000000000000) = 56 +ctzll(ff00000000000000) = 56 +ctzll(0200000000000000) = 57 +ctzll(fe00000000000000) = 57 +ctzll(0400000000000000) = 58 +ctzll(fc00000000000000) = 58 +ctzll(0800000000000000) = 59 +ctzll(f800000000000000) = 59 +ctzll(1000000000000000) = 60 +ctzll(f000000000000000) = 60 +ctzll(2000000000000000) = 61 +ctzll(e000000000000000) = 61 +ctzll(4000000000000000) = 62 +ctzll(c000000000000000) = 62 +ctzll(8000000000000000) = 63 +ctzll(8000000000000000) = 63 +fabs(3.141590) = 3.141590 +fabs(-3.141590) = 3.141590 +fabsf(7.250000) = 7.250000 +fabsf(-7.250000) = 7.250000 diff --git a/test/regression/Results/many_parameters b/test/regression/Results/many_parameters new file mode 100644 index 00000000..838cfd7e --- /dev/null +++ b/test/regression/Results/many_parameters @@ -0,0 +1 @@ +1780 diff --git a/test/regression/Results/varargs2-kvx b/test/regression/Results/varargs2-kvx new file mode 100644 index 00000000..0576ca01 --- /dev/null +++ b/test/regression/Results/varargs2-kvx @@ -0,0 +1,12 @@ +An int: 42 +A long long: 123456789012345 +A string: Hello world +A double: 3.141592654 +A mixture: x & Hello, world! & 42 & 123456789012345 & 3.141592654 & 2.718281746 +Twice: -1 1.23 +Twice: -1 1.23 +With va_copy: -1 1.23 +With va_copy: -1 1.23 +With extra args: x & Hello, world! & 42 & 123456789012345 & 3.141592654 & 2.718281746 +With extra FP args: 3.141592654 & 2.718281746 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 42 +va_list compatibility: x & Hello, world! & 42 & 123456789012345 & 3.141592654 & 2.718281746 diff --git a/test/regression/builtins-common.c b/test/regression/builtins-common.c index 51d0584e..72839a61 100644 --- a/test/regression/builtins-common.c +++ b/test/regression/builtins-common.c @@ -44,8 +44,10 @@ int main(int argc, char ** argv) printf("fabs(%f) = %f\n", -a, __builtin_fabs(-a)); printf("fabsf(%f) = %f\n", f, __builtin_fabsf(f)); printf("fabsf(%f) = %f\n", -f, __builtin_fabsf(-f)); +#ifndef __KVX__ // no builtin FSQRT or SQRT on KVX printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); printf("sqrt(%f) = %f\n", a, __builtin_sqrt(a)); +#endif /* Make sure that ignoring the result of a builtin doesn't cause an internal error */ diff --git a/test/regression/builtins-kvx.c b/test/regression/builtins-kvx.c new file mode 100644 index 00000000..cbf51387 --- /dev/null +++ b/test/regression/builtins-kvx.c @@ -0,0 +1,72 @@ +/* Fun with builtins */ + +#include <stdio.h> +#include <math.h> + +char * check_relative_error(double exact, double actual, double precision) +{ + double relative_error = (actual - exact) / exact; + 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 z; + + //printf("mulhw(%x, %x) = %x\n", x, y, __builtin_mulhw(x, y)); + //printf("mulhwu(%x, %x) = %x\n", x, y, __builtin_mulhwu(x, y)); + //printf("clz(%x) = %d\n", x, __builtin_clz(x)); + //printf("clzll(%llx) = %d\n", (unsigned long long) x, __builtin_clzll(x)); + //printf("clzll(%llx) = %d\n", xx, __builtin_clzll(xx)); + //z = __builtin_bswap(x); + //printf("clzll(%lx) = %d\n", z, __builtin_clzll(z)); + //printf("bswap(%x) = %x\n", x, __builtin_bswap(x)); + //printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s)); + + //printf("fmadd(%f, %f, %f) = %f\n", a, b, c, __builtin_fmadd(a, b, c)); + //printf("fmsub(%f, %f, %f) = %f\n", a, b, c, __builtin_fmsub(a, b, c)); + //printf("fabs(%f) = %f\n", a, __builtin_fabs(a)); + //printf("fabs(%f) = %f\n", -a, __builtin_fabs(-a)); + //printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a)); + //printf("frsqrte(%f) = %s\n", + // a, check_relative_error(1.0 / sqrt(a), __builtin_frsqrte(a), 1./32.)); + //printf("fres(%f) = %s\n", + // a, check_relative_error(1.0 / a, __builtin_fres(a), 1./256.)); + //printf("fsel(%f, %f, %f) = %f\n", a, b, c, __builtin_fsel(a, b, c)); + //printf("fsel(%f, %f, %f) = %f\n", -a, b, c, __builtin_fsel(-a, b, c)); + //printf("fcti(%f) = %d\n", a, __builtin_fcti(a)); + //printf("fcti(%f) = %d\n", b, __builtin_fcti(b)); + //printf("fcti(%f) = %d\n", c, __builtin_fcti(c)); + //__builtin_eieio(); + //__builtin_sync(); + //__builtin_isync(); + //printf("isel(%d, %d, %d) = %d\n", 0, x, y, __builtin_isel(0, x, y)); + //printf("isel(%d, %d, %d) = %d\n", 42, x, y, __builtin_isel(42, x, y)); + //printf ("read_16_rev = %x\n", __builtin_read16_reversed(&s)); + //printf ("read_32_rev = %x\n", __builtin_read32_reversed(&y)); + //__builtin_write16_reversed(&s, 0x789A); + //printf ("after write_16_rev: %x\n", s); + //__builtin_write32_reversed(&y, 0x12345678); + //printf ("after write_32_rev: %x\n", y); + //y = 0; + //__builtin_write32_reversed(&y, 0x12345678); + //printf ("CSE write_32_rev: %s\n", y == 0x78563412 ? "ok" : "ERROR"); + ///* Make sure that ignoring the result of a builtin + // doesn't cause an internal error */ + //(void) __builtin_bswap(x); + //(void) __builtin_fsqrt(a); + return 0; +} + + + + + diff --git a/test/regression/extasm.c b/test/regression/extasm.c index 297178d1..e78fb741 100644 --- a/test/regression/extasm.c +++ b/test/regression/extasm.c @@ -24,6 +24,7 @@ int clobbers(int x, int z) || (defined(ARCH_riscV) && defined(MODEL_64)) \ || (defined(ARCH_powerpc) && defined(MODEL_ppc64)) \ || (defined(ARCH_powerpc) && defined(MODEL_e5500)) \ + || (defined(ARCH_kvx) && defined(MODEL_64)) \ || defined(ARCH_aarch64) #define SIXTYFOUR #else diff --git a/test/regression/many_parameters.c b/test/regression/many_parameters.c new file mode 100644 index 00000000..4d2529c0 --- /dev/null +++ b/test/regression/many_parameters.c @@ -0,0 +1,313 @@ +#include <stdio.h> + +int call1( + int call00, + int call01, + int call02, + int call03, + int call04, + int call05, + int call06, + int call07, + int call08, + int call09, + int call10, + int call11, + int call12, + int call13, + int call14, + int call15, + int call16, + int call17, + int call18, + int call19, + int call20, + int call21, + int call22, + int call23, + int call24, + int call25, + int call26, + int call27, + int call28, + int call29, + int call30, + int call31, + int call32, + int call33, + int call34, + int call35, + int call36, + int call37, + int call38, + int call39, + int call40, + int call41, + int call42, + int call43, + int call44, + int call45, + int call46, + int call47, + int call48, + int call49, + int call50, + int call51, + int call52, + int call53, + int call54, + int call55, + int call56, + int call57, + int call58, + int call59) { + return ( call00 + + call01 + + call02 + + call03 + + call04 + + call05 + + call06 + + call07 + + call08 + + call09 + + call10 + + call11 + + call12 + + call13 + + call14 + + call15 + + call16 + + call17 + + call18 + + call19 + + call20 + + call21 + + call22 + + call23 + + call24 + + call25 + + call26 + + call27 + + call28 + + call29 + + call30 + + call31 + + call32 + + call33 + + call34 + + call35 + + call36 + + call37 + + call38 + + call39 + + call40 + + call41 + + call42 + + call43 + + call44 + + call45 + + call46 + + call47 + + call48 + + call49 + + call50 + + call51 + + call52 + + call53 + + call54 + + call55 + + call56 + + call57 + + call58 + + call59); +} + +int call2( + int call00, + int call01, + int call02, + int call03, + int call04, + int call05, + int call06, + int call07, + int call08, + int call09, + int call10, + int call11, + int call12, + int call13, + int call14, + int call15, + int call16, + int call17, + int call18, + int call19, + int call20, + int call21, + int call22, + int call23, + int call24, + int call25, + int call26, + int call27, + int call28, + int call29, + int call30, + int call31, + int call32, + int call33, + int call34, + int call35, + int call36, + int call37, + int call38, + int call39, + int call40, + int call41, + int call42, + int call43, + int call44, + int call45, + int call46, + int call47, + int call48, + int call49, + int call50, + int call51, + int call52, + int call53, + int call54, + int call55, + int call56, + int call57, + int call58, + int call59) { + return 10 + call1( + call00, + call01, + call02, + call03, + call04, + call05, + call06, + call07, + call08, + call09, + call10, + call11, + call12, + call13, + call14, + call15, + call16, + call17, + call18, + call19, + call20, + call21, + call22, + call23, + call24, + call25, + call26, + call27, + call28, + call29, + call30, + call31, + call32, + call33, + call34, + call35, + call36, + call37, + call38, + call39, + call40, + call41, + call42, + call43, + call44, + call45, + call46, + call47, + call48, + call49, + call50, + call51, + call52, + call53, + call54, + call55, + call56, + call57, + call58, + call59); +} + +int main() { + int x = + call2( 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59); + printf("%d\n", x); +} diff --git a/test/regression/packedstruct1.c b/test/regression/packedstruct1.c index 5d3e7124..b805c92a 100644 --- a/test/regression/packedstruct1.c +++ b/test/regression/packedstruct1.c @@ -2,8 +2,8 @@ #include <stdio.h> -/* offsetof is the offset computed by the verified front-end (cfrontend/) */ -#define offsetof(s,f) (int)&(((struct s *)0)->f) +/* offsetOf is the offset computed by the verified front-end (cfrontend/) */ +#define offsetOf(s,f) (int)&(((struct s *)0)->f) /* boffsetof is the offset computed by the elaborator (cparser/) */ #define boffsetof(s,f) (int)__builtin_offsetof(struct s, f) @@ -24,7 +24,7 @@ void test1(void) printf("sizeof(struct s1) = %d\n", szof(s1)); printf("precomputed sizeof(struct s1) = %d\n", bszof(s1)); printf("offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", - offsetof(s1,x), offsetof(s1,y), offsetof(s1,z)); + offsetOf(s1,x), offsetOf(s1,y), offsetOf(s1,z)); printf("precomputed offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", boffsetof(s1,x), boffsetof(s1,y), boffsetof(s1,z)); s1.x = 123; s1.y = -456; s1.z = 3.14159; @@ -45,7 +45,7 @@ void test2(void) printf("precomputed sizeof(struct s2) = %d\n", bszof(s2)); printf("&s2 mod 16 = %d\n", ((int) &s2) & 0xF); printf("offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", - offsetof(s2,x), offsetof(s2,y), offsetof(s2,z)); + offsetOf(s2,x), offsetOf(s2,y), offsetOf(s2,z)); printf("precomputed offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", boffsetof(s2,x), boffsetof(s2,y), boffsetof(s2,z)); s2.x = 12345; s2.y = -456; s2.z = 3.14159; @@ -73,7 +73,7 @@ void test3(void) printf("sizeof(struct s3) = %d\n", szof(s3)); printf("precomputed sizeof(struct s3) = %d\n", bszof(s3)); - printf("offsetof(s) = %d\n", offsetof(s3,s)); + printf("offsetof(s) = %d\n", offsetOf(s3,s)); printf("precomputed offsetof(s) = %d\n", boffsetof(s3,s)); s3.x = 123; s3.y = 45678; @@ -104,7 +104,7 @@ void test4(void) printf("sizeof(struct s4) = %d\n", szof(s4)); printf("precomputed sizeof(struct s4) = %d\n", bszof(s4)); printf("offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", - offsetof(s4,x), offsetof(s4,y), offsetof(s4,z)); + offsetOf(s4,x), offsetOf(s4,y), offsetOf(s4,z)); printf("precomputed offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", boffsetof(s4,x), boffsetof(s4,y), boffsetof(s4,z)); s4.x = 123; s4.y = -456; s4.z = 3.14159; @@ -122,7 +122,7 @@ void test5(void) printf("sizeof(struct s5) = %d\n", szof(s5)); printf("precomputed sizeof(struct s5) = %d\n", bszof(s5)); printf("offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", - offsetof(s5,x), offsetof(s5,y), offsetof(s5,z)); + offsetOf(s5,x), offsetOf(s5,y), offsetOf(s5,z)); printf("precomputed offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", boffsetof(s5,x), boffsetof(s5,y), boffsetof(s5,z)); s5.x = 123; s5.y = -456; s5.z = 3.14159; @@ -140,7 +140,7 @@ void test6(void) printf("sizeof(struct s6) = %d\n", szof(s6)); printf("precomputed sizeof(struct s6) = %d\n", bszof(s6)); printf("offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", - offsetof(s6,x), offsetof(s6,y), offsetof(s6,z)); + offsetOf(s6,x), offsetOf(s6,y), offsetOf(s6,z)); printf("precomputed offsetof(x) = %d, offsetof(y) = %d, offsetof(z) = %d\n", boffsetof(s6,x), boffsetof(s6,y), boffsetof(s6,z)); s62.x = 123; s62.y = -456; s62.z = 3.14159; diff --git a/test/regression/ran000373_reduced.c b/test/regression/ran000373_reduced.c new file mode 100644 index 00000000..3f26e88a --- /dev/null +++ b/test/regression/ran000373_reduced.c @@ -0,0 +1,36 @@ +#include <stdint.h> +#include <stdio.h> +uint32_t au, cc, bk; +union ba { + int64_t bb; +}; +int32_t *ck; +int32_t **cr = &ck; +void a(uint32_t c, int d) { printf("checksum = %X\n", c); } +void av(uint8_t b) { au = b; } +void aw(uint64_t ax) { av(ax); } +void ay(uint64_t ax, char *az, int d) { aw(ax); } +static const int32_t df(int64_t, union ba, uint16_t, uint8_t); +const int32_t dh(int32_t, int32_t, uint32_t); +int16_t e(void) { + union ba f = {5}; + int32_t g = 5; + int32_t i[90269]; + uint32_t s = df(dh(0, 0, cc), f, g, 7); + return s; +} +const int32_t df(int64_t j, union ba k, uint16_t l, uint8_t m) { + *ck = k.bb; + return l; +} +const int32_t dh(int32_t n, int32_t o, uint32_t p) { + int32_t *t = &bk; + uint64_t q = 3; + *cr = t; + return q; +} +int main(void) { + int r = e(); + ay(bk, "", r); + a(au, r); +} diff --git a/test/regression/varargs2.c b/test/regression/varargs2.c index d64509e5..e3492ead 100644 --- a/test/regression/varargs2.c +++ b/test/regression/varargs2.c @@ -126,15 +126,27 @@ void printf_compat(const char * fmt, ...) } /* The test harness */ - int main() { miniprintf("An int: %d\n", 42); miniprintf("A long long: %l\n", 123456789012345LL); miniprintf("A string: %s\n", "Hello world"); miniprintf("A double: %e\n", 3.141592654); + +#ifndef __KVX__ miniprintf("A small struct: %y\n", (struct Y) { 'x', 12 }); miniprintf("A bigger struct: %z\n", (struct Z) { 123, 456, 789 }); +#endif + +#ifdef __KVX__ + miniprintf("A mixture: %c & %s & %d & %l & %e & %f\n", + 'x', + "Hello, world!", + 42, + 123456789012345LL, + 3.141592654, + 2.71828182); +#else miniprintf("A mixture: %c & %s & %y & %d & %l & %e & %f\n", 'x', "Hello, world!", @@ -143,6 +155,8 @@ int main() 123456789012345LL, 3.141592654, 2.71828182); +#endif + miniprintf2("Twice: %d %e\n", -1, 1.23); miniprintf3("With va_copy: %d %e\n", -1, 1.23); miniprintf_extra(0, 1, 2, 3, 4, 5, 6, 7, |