diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-02-06 19:19:56 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-02-06 19:19:56 +0100 |
commit | 1ac763ea169bc7821190954396a723fec04b14d9 (patch) | |
tree | f7d38def81e483ddae53ff3935386d82dfec56ca /test/monniaux/send_through | |
parent | a7ea84945b85403dda46498415d27e51ba33d309 (diff) | |
download | compcert-kvx-1ac763ea169bc7821190954396a723fec04b14d9.tar.gz compcert-kvx-1ac763ea169bc7821190954396a723fec04b14d9.zip |
float aussi
Diffstat (limited to 'test/monniaux/send_through')
-rw-r--r-- | test/monniaux/send_through/send_through.h | 4 | ||||
-rw-r--r-- | test/monniaux/send_through/send_through_ccomp.c | 8 | ||||
-rw-r--r-- | test/monniaux/send_through/send_through_gcc.c | 8 |
3 files changed, 17 insertions, 3 deletions
diff --git a/test/monniaux/send_through/send_through.h b/test/monniaux/send_through/send_through.h index 54b6c052..03714fec 100644 --- a/test/monniaux/send_through/send_through.h +++ b/test/monniaux/send_through/send_through.h @@ -1,4 +1,6 @@ typedef double op_int_double(int, double); +typedef float op_int_float(int, float); -double send_through(op_int_double f, int x, int y, double z); +double send_through_double(op_int_double f, int x, int y, double z); +float send_through_float(op_int_float f, int x, int y, float z); void print_from_ccomp(double x); diff --git a/test/monniaux/send_through/send_through_ccomp.c b/test/monniaux/send_through/send_through_ccomp.c index b005d94a..a683dd82 100644 --- a/test/monniaux/send_through/send_through_ccomp.c +++ b/test/monniaux/send_through/send_through_ccomp.c @@ -2,12 +2,18 @@ #include <math.h> #include "send_through.h" -double send_through(op_int_double f, int x, int y, double z) { +double send_through_double(op_int_double f, int x, int y, double z) { double w= f(x, f(y, z)); int mu = 1; return w; } +float send_through_float(op_int_float f, int x, int y, float z) { + float w= f(x, f(y, z)); + int mu = 1; + return w; +} + void print_from_ccomp(double x) { printf("x=%e x=%f x=%g x=%.03e x=%.03f x=%.03g x[rounded]=%ld\n", x, x, x, x, x, x, lrint(x)); diff --git a/test/monniaux/send_through/send_through_gcc.c b/test/monniaux/send_through/send_through_gcc.c index be70a566..83541cee 100644 --- a/test/monniaux/send_through/send_through_gcc.c +++ b/test/monniaux/send_through/send_through_gcc.c @@ -5,8 +5,14 @@ double sum_int_double(int x, double y) { return x + y; } +float sum_int_float(int x, float y) { + return x + y; +} + int main() { - double x = send_through(sum_int_double, 2, 3, 4.5); + double x = send_through_double(sum_int_double, 2, 3, 4.5); + float y = send_through_float(sum_int_float, 2, 3, 4.5f); printf("x[gcc] = %f\n", x); + printf("y[gcc] = %f\n", y); print_from_ccomp(x); } |