diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-12-11 13:33:13 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-06-23 07:46:39 +0200 |
| commit | 86af2a17d26712bce69759120c290c5ede88f677 (patch) | |
| tree | c29b24b7dde23233b88a99fe3fc29538bd18bb5d /validation/linear/fp2i-cast.c | |
| parent | 3e7e84decfebec22936e288e66fd7a5a51f01fc7 (diff) | |
| download | sparse-dev-86af2a17d26712bce69759120c290c5ede88f677.tar.gz | |
cast: reorg testcases related to casts
* merge the tests about implicit & explicit casts in a
single file as there was a lot of redundancy.
* shuffle the tests to linear/ or optim/
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear/fp2i-cast.c')
| -rw-r--r-- | validation/linear/fp2i-cast.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/validation/linear/fp2i-cast.c b/validation/linear/fp2i-cast.c new file mode 100644 index 00000000..98d7453e --- /dev/null +++ b/validation/linear/fp2i-cast.c @@ -0,0 +1,30 @@ +#if __SIZEOF_INT__ == __SIZEOF_FLOAT__ +typedef signed int si; +typedef unsigned int ui; +#else +#error "no float-sized integer type" +#endif + +#if __SIZEOF_LONG_LONG__ == __SIZEOF_DOUBLE__ +typedef signed long long sl; +typedef unsigned long long ul; +#else +#error "no double-sized integer type" +#endif + +si f2si(float a) { return a; } +ui f2ui(float a) { return a; } +sl f2sl(float a) { return a; } +ul f2ul(float a) { return a; } +si d2si(double a) { return a; } +ui d2ui(double a) { return a; } +sl d2sl(double a) { return a; } +ul d2ul(double a) { return a; } + +/* + * check-name: fp2i cast + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-pattern(8): cast\\. + */ |
