diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c b/gcc-4.9/gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c new file mode 100644 index 000000000..20b215996 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/nios2/custom-fp-conversion.c @@ -0,0 +1,66 @@ +/* Test generation of conversion custom instructions. */ + +/* { dg-do compile } */ +/* { dg-options "-O1 -ffinite-math-only -funsafe-math-optimizations" } */ + +/* -O1 in the options is significant. Without it FP operations may not be + optimized to custom instructions. */ + +#include <stdio.h> +#include <math.h> + +#pragma GCC target ("custom-frdxhi=40") +#pragma GCC target ("custom-frdxlo=41") +#pragma GCC target ("custom-frdy=42") +#pragma GCC target ("custom-fwrx=43") +#pragma GCC target ("custom-fwry=44") + +#pragma GCC target ("custom-fextsd=100") +#pragma GCC target ("custom-fixdi=101") +#pragma GCC target ("custom-fixdu=102") +#pragma GCC target ("custom-fixsi=103") +#pragma GCC target ("custom-fixsu=104") +#pragma GCC target ("custom-floatid=105") +#pragma GCC target ("custom-floatis=106") +#pragma GCC target ("custom-floatud=107") +#pragma GCC target ("custom-floatus=108") +#pragma GCC target ("custom-ftruncds=109") + +typedef struct data { + double fextsd; + int fixdi; + unsigned fixdu; + int fixsi; + unsigned fixsu; + double floatid; + float floatis; + double floatud; + float floatus; + float ftruncds; +} data_t; + +void +custom_fp (int i, unsigned u, float f, double d, data_t *out) +{ + out->fextsd = (double) f; + out->fixdi = (int) d; + out->fixdu = (unsigned) d; + out->fixsi = (int) f; + out->fixsu = (unsigned) f; + out->floatid = (double) i; + out->floatis = (float) i; + out->floatud = (double) u; + out->floatus = (float) u; + out->ftruncds = (float) d; +} + +/* { dg-final { scan-assembler "custom\\t100, .* # fextsd .*" } } */ +/* { dg-final { scan-assembler "custom\\t101, .* # fixdi .*" } } */ +/* { dg-final { scan-assembler "custom\\t102, .* # fixdu .*" } } */ +/* { dg-final { scan-assembler "custom\\t103, .* # fixsi .*" } } */ +/* { dg-final { scan-assembler "custom\\t104, .* # fixsu .*" } } */ +/* { dg-final { scan-assembler "custom\\t105, .* # floatid .*" } } */ +/* { dg-final { scan-assembler "custom\\t106, .* # floatis .*" } } */ +/* { dg-final { scan-assembler "custom\\t107, .* # floatud .*" } } */ +/* { dg-final { scan-assembler "custom\\t108, .* # floatus .*" } } */ +/* { dg-final { scan-assembler "custom\\t109, .* # ftruncds .*" } } */ |