summaryrefslogtreecommitdiffstats
path: root/clang/test/Frontend/fixed_point_bit_widths.c
diff options
context:
space:
mode:
authorLeonard Chan <leonardchan@google.com>2018-06-02 02:58:51 +0000
committerLeonard Chan <leonardchan@google.com>2018-06-02 02:58:51 +0000
commitdb55d8331e631e84b07e6fbad923085b4baa9597 (patch)
treecab6ad2f57e7522caaa1ded6b6d211583ae6f0b7 /clang/test/Frontend/fixed_point_bit_widths.c
parent9c2d52014c95cef4aa0cf7e39ed47a42643c9568 (diff)
downloadbcm5719-llvm-db55d8331e631e84b07e6fbad923085b4baa9597.tar.gz
bcm5719-llvm-db55d8331e631e84b07e6fbad923085b4baa9597.zip
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. Differential Revision: https://reviews.llvm.org/D46084 llvm-svn: 333814
Diffstat (limited to 'clang/test/Frontend/fixed_point_bit_widths.c')
-rw-r--r--clang/test/Frontend/fixed_point_bit_widths.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c b/clang/test/Frontend/fixed_point_bit_widths.c
new file mode 100644
index 00000000000..8ad9ffbd6d4
--- /dev/null
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -0,0 +1,43 @@
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
+
+int size_SsA = sizeof(signed short _Accum);
+int size_SA = sizeof(signed _Accum);
+int size_SlA = sizeof(signed long _Accum);
+int align_SsA = __alignof(signed short _Accum);
+int align_SA = __alignof(signed _Accum);
+int align_SlA = __alignof(signed long _Accum);
+
+int size_UsA = sizeof(unsigned short _Accum);
+int size_UA = sizeof(unsigned _Accum);
+int size_UlA = sizeof(unsigned long _Accum);
+int align_UsA = __alignof(unsigned short _Accum);
+int align_UA = __alignof(unsigned _Accum);
+int align_UlA = __alignof(unsigned long _Accum);
+
+int size_sA = sizeof(short _Accum);
+int size_A = sizeof(_Accum);
+int size_lA = sizeof(long _Accum);
+int align_sA = __alignof(short _Accum);
+int align_A = __alignof(_Accum);
+int align_lA = __alignof(long _Accum);
+
+// CHECK: @size_SsA = dso_local global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_SA = dso_local global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_SlA = dso_local global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_SsA = dso_local global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_SA = dso_local global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_SlA = dso_local global i{{[0-9]+}} 8
+
+// CHECK-NEXT: @size_UsA = dso_local global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_UA = dso_local global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_UlA = dso_local global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_UsA = dso_local global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_UA = dso_local global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_UlA = dso_local global i{{[0-9]+}} 8
+
+// CHECK-NEXT: @size_sA = dso_local global i{{[0-9]+}} 2
+// CHECK-NEXT: @size_A = dso_local global i{{[0-9]+}} 4
+// CHECK-NEXT: @size_lA = dso_local global i{{[0-9]+}} 8
+// CHECK-NEXT: @align_sA = dso_local global i{{[0-9]+}} 2
+// CHECK-NEXT: @align_A = dso_local global i{{[0-9]+}} 4
+// CHECK-NEXT: @align_lA = dso_local global i{{[0-9]+}} 8
OpenPOWER on IntegriCloud