From f921d854228a023a4e8247f4dab7de1869db442b Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Mon, 4 Jun 2018 16:07:52 +0000 Subject: This diff includes changes for supporting the following types. // Primary fixed point types signed short _Accum s_short_accum; signed _Accum s_accum; signed long _Accum s_long_accum; unsigned short _Accum u_short_accum; unsigned _Accum u_accum; unsigned long _Accum u_long_accum; // Aliased fixed point types short _Accum short_accum; _Accum accum; long _Accum long_accum; This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent _Fract types will also be added in future patches. The tests included are for asserting that we can declare these types. Fixed the test that was failing by not checking for dso_local on some targets. Differential Revision: https://reviews.llvm.org/D46084 llvm-svn: 333923 --- clang/test/Frontend/fixed_point_errors.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 clang/test/Frontend/fixed_point_errors.c (limited to 'clang/test/Frontend/fixed_point_errors.c') diff --git a/clang/test/Frontend/fixed_point_errors.c b/clang/test/Frontend/fixed_point_errors.c new file mode 100644 index 00000000000..0158dc68c42 --- /dev/null +++ b/clang/test/Frontend/fixed_point_errors.c @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -verify -ffixed-point %s + +/* We do not yet support long long. No recommended bit widths are given for this + * size. */ + +long long _Accum longlong_accum; // expected-error{{'long long _Accum' is invalid}} +unsigned long long _Accum u_longlong_accum; // expected-error{{'long long _Accum' is invalid}} + +/* Although _Complex types work with floating point numbers, the extension + * provides no info for complex fixed point types. */ + +_Complex signed short _Accum cmplx_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex signed _Accum cmplx_s_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex signed long _Accum cmplx_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex unsigned short _Accum cmplx_u_short_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex unsigned _Accum cmplx_u_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex unsigned long _Accum cmplx_u_long_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex short _Accum cmplx_s_short_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex _Accum cmplx_s_accum; // expected-error{{'_Complex _Accum' is invalid}} +_Complex long _Accum cmplx_s_long_accum; // expected-error{{'_Complex _Accum' is invalid}} + +/* Bad combinations */ +float _Accum f_accum; // expected-error{{cannot combine with previous 'float' declaration specifier}} +double _Accum d_accum; // expected-error{{cannot combine with previous 'double' declaration specifier}} +_Bool _Accum b_accum; // expected-error{{cannot combine with previous '_Bool' declaration specifier}} +char _Accum c_accum; // expected-error{{cannot combine with previous 'char' declaration specifier}} +int _Accum i_accum; // expected-error{{cannot combine with previous 'int' declaration specifier}} -- cgit v1.2.3