diff options
| author | Leonard Chan <leonardchan@google.com> | 2018-08-06 16:05:08 +0000 |
|---|---|---|
| committer | Leonard Chan <leonardchan@google.com> | 2018-08-06 16:05:08 +0000 |
| commit | c03642e9a86d9ed128676d5405a1906282d727ad (patch) | |
| tree | c221a392e0bf810a25b78cc0f46c89c8525c0c48 /clang/test/Frontend | |
| parent | 0d1b3934e27f72f706345678204a87f72007ed64 (diff) | |
| download | bcm5719-llvm-c03642e9a86d9ed128676d5405a1906282d727ad.tar.gz bcm5719-llvm-c03642e9a86d9ed128676d5405a1906282d727ad.zip | |
[Fixed Point Arithmetic] Fix for FixedPointValueToString
- Print negative numbers correctly
- Handle APInts of different sizes
- Add formal unit tests for FixedPointValueToString
- Add tests for checking correct printing when padding is set
- Restrict to printing in radix 10 since that's all we need for now
Differential Revision: https://reviews.llvm.org/D49945
llvm-svn: 339026
Diffstat (limited to 'clang/test/Frontend')
| -rw-r--r-- | clang/test/Frontend/fixed_point_to_string.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/Frontend/fixed_point_to_string.c b/clang/test/Frontend/fixed_point_to_string.c new file mode 100644 index 00000000000..ad71d1024f5 --- /dev/null +++ b/clang/test/Frontend/fixed_point_to_string.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -ast-dump -ffixed-point %s | FileCheck %s +// RUN: %clang_cc1 -ast-dump -ffixed-point -fpadding-on-unsigned-fixed-point %s | FileCheck %s + +/** + * Check the same values are printed in the AST regardless of if unsigned types + * have the same number of fractional bits as signed types. + */ + +unsigned short _Accum u_short_accum = 0.5uhk; +unsigned _Accum u_accum = 0.5uk; +unsigned long _Accum u_long_accum = 0.5ulk; +unsigned short _Fract u_short_fract = 0.5uhr; +unsigned _Fract u_fract = 0.5ur; +unsigned long _Fract u_long_fract = 0.5ulr; + +//CHECK: FixedPointLiteral {{.*}} 'unsigned short _Accum' 0.5 +//CHECK: FixedPointLiteral {{.*}} 'unsigned _Accum' 0.5 +//CHECK: FixedPointLiteral {{.*}} 'unsigned long _Accum' 0.5 +//CHECK: FixedPointLiteral {{.*}} 'unsigned short _Fract' 0.5 +//CHECK: FixedPointLiteral {{.*}} 'unsigned _Fract' 0.5 +//CHECK: FixedPointLiteral {{.*}} 'unsigned long _Fract' 0.5 |

