From: Geng Qi Date: Fri, 30 Apr 2021 13:01:31 +0000 (+0800) Subject: C-SKY: Add cases for csky fpuv3 instructions. X-Git-Tag: upstream/12.2.0~7668 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1185ea88a0051b3ce9f44cde900bfef6526b568;p=platform%2Fupstream%2Fgcc.git C-SKY: Add cases for csky fpuv3 instructions. gcc/testsuite/ChangeLog: * gcc.target/csky/fpuv3/fpuv3.exp: New. * gcc.target/csky/fpuv3/fpv3_div.c: New. * gcc.target/csky/fpuv3/fpv3_fadd.c: New. * gcc.target/csky/fpuv3/fpv3_fdtos.c: New. * gcc.target/csky/fpuv3/fpv3_fftoi_rm.c: New. * gcc.target/csky/fpuv3/fpv3_fftoi_rz.c: New. * gcc.target/csky/fpuv3/fpv3_fhtos.c: New. * gcc.target/csky/fpuv3/fpv3_fitof.c: New. * gcc.target/csky/fpuv3/fpv3_fmov.c: New. * gcc.target/csky/fpuv3/fpv3_fmovi.c: New. * gcc.target/csky/fpuv3/fpv3_fmula.c: New. * gcc.target/csky/fpuv3/fpv3_fmuls.c: New. * gcc.target/csky/fpuv3/fpv3_fneg.c: New. * gcc.target/csky/fpuv3/fpv3_fnmula.c: New. * gcc.target/csky/fpuv3/fpv3_fnmuls.c: New. * gcc.target/csky/fpuv3/fpv3_fstod.c: New. * gcc.target/csky/fpuv3/fpv3_fstoh.c: New. * gcc.target/csky/fpuv3/fpv3_fsub.c: New. * gcc.target/csky/fpuv3/fpv3_fxtof.c: New. * gcc.target/csky/fpuv3/fpv3_h.c: New. * gcc.target/csky/fpuv3/fpv3_hs.c: New. * gcc.target/csky/fpuv3/fpv3_hsz.c: New. * gcc.target/csky/fpuv3/fpv3_hz.c: New. * gcc.target/csky/fpuv3/fpv3_ls.c: New. * gcc.target/csky/fpuv3/fpv3_lsz.c: New. * gcc.target/csky/fpuv3/fpv3_lt.c: New. * gcc.target/csky/fpuv3/fpv3_ltz.c: New. * gcc.target/csky/fpuv3/fpv3_max.c: New. * gcc.target/csky/fpuv3/fpv3_min.c: New. * gcc.target/csky/fpuv3/fpv3_mul.c: New. * gcc.target/csky/fpuv3/fpv3_mula.c: New. * gcc.target/csky/fpuv3/fpv3_muls.c: New. * gcc.target/csky/fpuv3/fpv3_ne.c: New. * gcc.target/csky/fpuv3/fpv3_nez.c: New. * gcc.target/csky/fpuv3/fpv3_recip.c: New. * gcc.target/csky/fpuv3/fpv3_sqrt.c: New. * gcc.target/csky/fpuv3/fpv3_unordered.c: New. --- diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp b/gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp new file mode 100644 index 0000000..1170e12 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp @@ -0,0 +1,50 @@ +# Copyright (C) 1997, 2004, 2006, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't a csky target. +if { ![istarget csky*-*-*]} then { + return +} + +set cflags [board_info target cflags] +if { [string first "ck6" "${cflags}"] >= 0 } { + verbose "the test is not support " + return +} +if { [string first "ck5" "${cflags}"] >= 0 } { + verbose "the test is not support " + return +} + +# Load support procs. +load_lib gcc-dg.exp + +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS "" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c new file mode 100644 index 0000000..32a1551 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float div32(float a, float b){ + return a/b; +} + + +float div64(double a, double b){ + return a/b; +} + +/* { dg-final { scan-assembler "fdiv\.32" } }*/ +/* { dg-final { scan-assembler "fdiv\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c new file mode 100644 index 0000000..d54b529 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-mfpu=fpv3" } */ + +__fp16 funch(__fp16 a, __fp16 b) +{ + return a + b; +} + +float funcs(float a, float b) +{ + return a + b; +} + +double funcd(double a, double b) +{ + return a + b; +} + +/* { dg-final { scan-assembler "fadd\.16" } }*/ +/* { dg-final { scan-assembler "fadd\.32" } }*/ +/* { dg-final { scan-assembler "fadd\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c new file mode 100644 index 0000000..034b15e --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float func(double a) +{ + return (float)a; +} + +/* { dg-final { scan-assembler "fdtos" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c new file mode 100644 index 0000000..11c4f9d --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c @@ -0,0 +1,55 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-ffast-math" } */ + +int lfloor_float32 (float x) +{ + return __builtin_lfloorf (x); +} + +int lfloor_float64 (double x) +{ + return __builtin_lfloor (x); +} + + +float floor_float32 (float x) +{ + return __builtin_floorf (x); +} + +double floor_float64 (double x) +{ + return __builtin_floor (x); +} + +/* { dg-final { scan-assembler "fftoi\.f32\.s32\.rni" } }*/ +/* { dg-final { scan-assembler "fftoi\.f64\.s32\.rni" } }*/ +/* { dg-final { scan-assembler "fftofi\.f32\.rni" } }*/ +/* { dg-final { scan-assembler "fftofi\.f64\.rni" } }*/ + +int lceil_float32 (float x) +{ + return __builtin_lceilf (x); +} + +int lceil_float64 (double x) +{ + return __builtin_lceil (x); +} + + +float ceil_float32 (float x) +{ + return __builtin_ceilf (x); +} + +double ceil_float64 (double x) +{ + return __builtin_ceil (x); +} + +/* { dg-final { scan-assembler "fftoi\.f32\.s32\.rpi" } }*/ +/* { dg-final { scan-assembler "fftoi\.f64\.s32\.rpi" } }*/ +/* { dg-final { scan-assembler "fftofi\.f32\.rpi" } }*/ +/* { dg-final { scan-assembler "fftofi\.f64\.rpi" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c new file mode 100644 index 0000000..4b2990b --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options " -mfpu=fpv3" } */ + +int funce(__fp16 a) +{ + return (int)a; +} + +unsigned int funcf(__fp16 a) +{ + return (unsigned int)a; +} + +int funca(float a) +{ + return (int)a; +} + +unsigned int funcb(float a) +{ + return (unsigned int)a; +} + +int funcc(double a) +{ + return (int)a; +} + +unsigned int funcd(double a) +{ + return (unsigned int)a; +} + +/* { dg-final { scan-assembler "fftoi\.f16\.s32\.rz" } }*/ +/* { dg-final { scan-assembler "fftoi\.f16\.u32\.rz" } }*/ +/* { dg-final { scan-assembler "fftoi\.f32\.s32\.rz" } }*/ +/* { dg-final { scan-assembler "fftoi\.f32\.u32\.rz" } }*/ +/* { dg-final { scan-assembler "fftoi\.f64\.s32\.rz" } }*/ +/* { dg-final { scan-assembler "fftoi\.f64\.u32\.rz" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c new file mode 100644 index 0000000..25fc542 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-mfpu=fpv3" } */ + +float func(__fp16 a) +{ + return (float)a; +} + +/* { dg-final { scan-assembler "fhtos" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c new file mode 100644 index 0000000..6a513dc --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c @@ -0,0 +1,72 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-mfpu=fpv3" } */ + +__fp16 funce(int a) +{ + return (__fp16)a; +} + +__fp16 funcf(unsigned int a) +{ + return (__fp16)a; +} + +float funca(int a) +{ + return (float)a; +} + +float funcb(unsigned int a) +{ + return (float)a; +} + +double funcc(int a) +{ + return (double)a; +} + +double funcd(unsigned int a) +{ + return (double)a; +} + +//double funch(short a) +//{ +// return (double)a; +//} +// +//double funci(unsigned short a) +//{ +// return (double)a; +//} +// +//float funcj(short a) +//{ +// return (float)a; +//} +// +//float funck(unsigned short a) +//{ +// return (float)a; +//} + +__fp16 funcm(short a) +{ + return (__fp16)a; +} + +__fp16 funcn(unsigned short a) +{ + return (__fp16)a; +} + +/* { dg-final { scan-assembler "fitof\.s32\.f16" } }*/ +/* { dg-final { scan-assembler "fitof\.u32\.f16" } }*/ +/* { dg-final { scan-assembler "fitof\.s32\.f32" } }*/ +/* { dg-final { scan-assembler "fitof\.u32\.f32" } }*/ +/* { dg-final { scan-assembler "fitof\.s32\.f64" } }*/ +/* { dg-final { scan-assembler "fitof\.u32\.f64" } }*/ +/* { dg-final { scan-assembler "fitof\.s16\.f16" } }*/ +/* { dg-final { scan-assembler "fitof\.u16\.f16" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c new file mode 100644 index 0000000..1aa87b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c @@ -0,0 +1,96 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2 -mfpu=fpv3" } */ + +#define FUNC(i) func_ ## i + +#define FTYPE __fp16 +FTYPE FUNC(ld16) (FTYPE *a, FTYPE *b) +{ + return *a = *b; +} + +/* { dg-final { scan-assembler "fld\.16" } }*/ +/* { dg-final { scan-assembler "fst\.16" } }*/ + +#undef FTYPE +#define FTYPE float +FTYPE FUNC(ld32) (FTYPE *a, FTYPE *b) +{ + return *a = *b; +} + +/* { dg-final { scan-assembler "fld\.32" } }*/ +/* { dg-final { scan-assembler "fld\.32" } }*/ + +#undef FTYPE +#define FTYPE double +FTYPE FUNC(ld64) (FTYPE *a, FTYPE *b) +{ + return *a = *b; +} + +/* { dg-final { scan-assembler "fld\.64" } }*/ +/* { dg-final { scan-assembler "fst\.64" } }*/ + + +#undef FTYPE +#define FTYPE __fp16 +FTYPE FUNC(ldr16) (FTYPE *a, int i, FTYPE *b) +{ + return a[i] = b[i]; +} + +/* { dg-final { scan-assembler "fldr\.16" } }*/ +/* { dg-final { scan-assembler "fstr\.16" } }*/ + +#undef FTYPE +#define FTYPE float +FTYPE FUNC(ldr32) (FTYPE *a, int i, FTYPE *b) +{ + return a[i] = b[i]; +} + +/* { dg-final { scan-assembler "fldr\.32" } }*/ +/* { dg-final { scan-assembler "fstr\.32" } }*/ + +#undef FTYPE +#define FTYPE double +FTYPE FUNC(ldr64) (FTYPE *a, int i, FTYPE *b) +{ + return a[i] = b[i]; +} + +/* { dg-final { scan-assembler "fldr\.64" } }*/ +/* { dg-final { scan-assembler "fstr\.64" } }*/ + + +#undef FTYPE +#define FTYPE __fp16 +FTYPE FUNC(mov16) (FTYPE a, FTYPE b) +{ + a = b; + return a; +} + +/* { dg-final { scan-assembler "fmov\.16" } }*/ + +#undef FTYPE +#define FTYPE float +FTYPE FUNC(mov32) (FTYPE a, FTYPE b) +{ + a = b; + return a; +} + +/* { dg-final { scan-assembler "fmov\.32" } }*/ + +#undef FTYPE +#define FTYPE double +FTYPE FUNC(mov64) (FTYPE a, FTYPE b) +{ + a = b; + return a; +} + +/* { dg-final { scan-assembler "fmov\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c new file mode 100644 index 0000000..5fbc011 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2 -mfpu=fpv3" } */ + +#define FUNC(i) func_ ## i + +#define FTYPE __fp16 +FTYPE FUNC(movi16) (void) +{ + return 1.0; +} + +/* { dg-final { scan-assembler "fmovi\.16" } }*/ + +#undef FTYPE +#define FTYPE float +FTYPE FUNC(movi32) (void) +{ + return 1.0; +} + +/* { dg-final { scan-assembler "fmovi\.32" } }*/ + +#undef FTYPE +#define FTYPE double +FTYPE FUNC(movi64) (void) +{ + return 1.0; +} + +/* { dg-final { scan-assembler "fmovi\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c new file mode 100644 index 0000000..078ebc7 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2 -mfpu=fpv3" } */ + +__fp16 func16(__fp16 a, __fp16 b, __fp16 c){ + a += b * c; + return a; +} + +float func32(float a, float b, float c){ + a += b * c; + return a; +} + + +double func64(double a, double b, double c){ + a += b * c; + return a; +} + +/* { dg-final { scan-assembler "ffmula\.16" } }*/ +/* { dg-final { scan-assembler "ffmula\.32" } }*/ +/* { dg-final { scan-assembler "ffmula\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c new file mode 100644 index 0000000..efc80bc --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2 -mfpu=fpv3" } */ + +__fp16 func16(__fp16 a, __fp16 b, __fp16 c){ + a -= b * c; + return a; +} + +float func32(float a, float b, float c){ + a -= b * c; + return a; +} + + +double func64(double a, double b, double c){ + a -= b * c; + return a; +} + +/* { dg-final { scan-assembler "ffmuls\.16" } }*/ +/* { dg-final { scan-assembler "ffmuls\.32" } }*/ +/* { dg-final { scan-assembler "ffmuls\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c new file mode 100644 index 0000000..9941cf8 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-mfpu=fpv3" } */ + +__fp16 func16(__fp16 a) +{ + return -a; +} + +float func32(float a) +{ + return -a; +} + +double func64(double a) +{ + return -a; +} + +/* { dg-final { scan-assembler "fneg\.32" } }*/ +/* { dg-final { scan-assembler "fneg\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c new file mode 100644 index 0000000..6770d29 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float fnmula32(float a, float b, float c){ + return -(a + b * c); +} + +double fnmula64(double a, double b, double c){ + return -(a + b * c); +} + +/* { dg-final { scan-assembler "ffnmula\.32" } }*/ +/* { dg-final { scan-assembler "ffnmula\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c new file mode 100644 index 0000000..86ba96b --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float fnmula32(float a, float b, float c){ + return -a + b * c; +} + +double fnmula64(double a, double b, double c){ + return -a + b * c; +} + +/* { dg-final { scan-assembler "ffnmuls\.32" } }*/ +/* { dg-final { scan-assembler "ffnmuls\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c new file mode 100644 index 0000000..d4a615c --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +double func(float a) +{ + return (double)a; +} + +/* { dg-final { scan-assembler "fstod" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c new file mode 100644 index 0000000..1333c41 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-mfpu=fpv3" } */ + +__fp16 func(float a) +{ + return (__fp16)a; +} + +/* { dg-final { scan-assembler "fstoh" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c new file mode 100644 index 0000000..914b2e6 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-mfpu=fpv3" } */ + +__fp16 funch(__fp16 a, __fp16 b) +{ + return a - b; +} + +float funcs(float a, float b) +{ + return a - b; +} + +double funcd(double a, double b) +{ + return a - b; +} + +/* { dg-final { scan-assembler "fsub\.16" } }*/ +/* { dg-final { scan-assembler "fsub\.32" } }*/ +/* { dg-final { scan-assembler "fsub\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c new file mode 100644 index 0000000..d5182a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O1" } */ + +//__fp16 +//fixed32_to_float16 (int i) +//{ +// return ((__fp16) i / (1 << 15)); +//} +// +//__fp16 +//fixedu32_to_float16 (unsigned int i) +//{ +// return ((__fp16) i / (1 << 15)); +//} +// +//float +//fixed32_to_float32 (int i) +//{ +// return ((float) i / (1 << 30)); +//} +// +// +//float +//fixedu32_to_float32 (unsigned int i) +//{ +// return ((float) i / (1 << 30)); +//} +// +//double +//fixed32_to_float64 (int i) +//{ +// return ((double) i / (1 << 30)); +//} +// +//double +//fixedu32_to_float64 (unsigned int i) +//{ +// return ((double) i / (1 << 30)); +//} +// +//__fp16 +//fixed16_to_float16 (short i) +//{ +// return ((__fp16) i / (1 << 15)); +//} +// +//__fp16 +//fixedu16_to_float16 (unsigned short i) +//{ +// return ((__fp16) i / (1 << 15)); +//} +// +//float +//fixed16_to_float32 (short i) +//{ +// return ((float) i / (1 << 16)); +//} +// +//float +//fixedu16_to_float32 (unsigned short i) +//{ +// return ((float) i / (1 << 16)); +//} +// +//double +//fixed16_to_float64 (short i) +//{ +// return ((double) i / (1 << 16)); +//} +// +//double +//fixedu16_to_float64 (unsigned short i) +//{ +// return ((double) i / (1 << 16)); +//} diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c new file mode 100644 index 0000000..c2e76d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float fh32(float a, float b, float c, float d){ + if(a > b) + return c; + + return d; +} + +double fh64(double a, double b, double c, double d){ + if( a > b) + return c; + return d; +} + +/* { dg-final { scan-assembler "fcmplt\.32" } }*/ +/* { dg-final { scan-assembler "fcmplt\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c new file mode 100644 index 0000000..ecfaa63 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float fhs32(float a, float b, float c, float d){ + if(a >= b) + return c; + return d; +} + +double fhs64(double a, double b, double c, double d){ + if( a >= b) + return c; + return d; +} + +/* { dg-final { scan-assembler "fcmphs\.32" } }*/ +/* { dg-final { scan-assembler "fcmphs\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c new file mode 100644 index 0000000..530a4be --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float fhsz32(float a, float b, float c){ + if(a >= 0.0f) + return b; + else + return c; +} + +double fhsz64(double a, double b, double c){ + if( a >= 0.0) + return b; + else + return c; +} + +/* { dg-final { scan-assembler "fcmphsz\.32" } }*/ +/* { dg-final { scan-assembler "fcmphsz\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c new file mode 100644 index 0000000..a2a8d8f --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float fhz32(float a, float b, float c){ + if(a > 0.0f) + return b; + else + return c; +} + +double fhz64(double a, double b, double c){ + if( a > 0.0) + return b; + else + return c; +} + +/* { dg-final { scan-assembler "fcmphz\.32" } }*/ +/* { dg-final { scan-assembler "fcmphz\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c new file mode 100644 index 0000000..3bb6ac6 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float fls32(float a, float b, float c, float d){ + if(a <= b) + return c; + + return d; +} + +double fhz64(double a, double b, double c, double d){ + if( a <= b) + return c; + return d; +} + +/* { dg-final { scan-assembler "fcmphs\.32" } }*/ +/* { dg-final { scan-assembler "fcmphs\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c new file mode 100644 index 0000000..6e19efa --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float flsz32(float a, float b, float c){ + if(a <= 0.0f) + return b; + else + return c; +} + +double fhz64(double a, double b, double c){ + if( a <= 0.0) + return b; + else + return c; +} + +/* { dg-final { scan-assembler "fcmplsz\.32" } }*/ +/* { dg-final { scan-assembler "fcmplsz\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c new file mode 100644 index 0000000..e4a716f --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float flt32(float a, float b, float c, float d){ + if(a < b) + return c; + return d; +} + +double flt64(double a, double b, double c, double d){ + if( a < b) + return c; + return d; +} + +/* { dg-final { scan-assembler "fcmplt\.32" } }*/ +/* { dg-final { scan-assembler "fcmplt\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c new file mode 100644 index 0000000..984079c --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float fltz32(float a, float b, float c){ + if(a < 0.0f) + return b; + else + return c; +} + +double fltz64(double a, double b, double c){ + if( a < 0.0) + return b; + else + return c; +} + +/* { dg-final { scan-assembler "fcmpltz\.32" } }*/ +/* { dg-final { scan-assembler "fcmpltz\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c new file mode 100644 index 0000000..32fb74e --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +extern float fmaxf( float x, float y ); +float fmax32(float a, float b){ + return fmaxf(a, b); +} + +extern double fmax( double x, double y ); +double fmax64(double a, double b){ + return fmax(a, b); +} + +/* { dg-final { scan-assembler "fmaxnm\.32" } }*/ +/* { dg-final { scan-assembler "fmaxnm\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c new file mode 100644 index 0000000..95c0878 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +extern float fminf( float x, float y ); +float fmin32(float a, float b){ + return fminf(a, b); +} + +extern double fmin( double x, double y ); +double fmin64(double a, double b){ + return fmin(a, b); +} + +/* { dg-final { scan-assembler "fminnm\.32" } }*/ +/* { dg-final { scan-assembler "fminnm\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c new file mode 100644 index 0000000..a168dc7 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float mul32(float a, float b){ + return a*b; +} + +double mul64(double a, double b){ + return a*b; +} + +/* { dg-final { scan-assembler "fmul\.32" } }*/ +/* { dg-final { scan-assembler "fmul\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c new file mode 100644 index 0000000..f78534e --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float func32(float a, float b, float c){ + a += b * c; + return a; +} + +double func64(double a, double b, double c){ + a += b * c; + return a; +} + +/* { dg-final { scan-assembler "fmula\.32" } }*/ +/* { dg-final { scan-assembler "fmula\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c new file mode 100644 index 0000000..f144e45 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float muls32(float a, float b, float c){ + a -= b * c; + return a; +} + +double muls64(double a, double b, double c){ + a -= b * c; + return a; +} + +/* { dg-final { scan-assembler "fmuls\.32" } }*/ +/* { dg-final { scan-assembler "fmuls\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c new file mode 100644 index 0000000..c24f0ce --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float fne32(float a, float b, float c, float d){ + if(a != b) + return c; + return d; +} + +double fne64(double a, double b, double c, double d){ + if( a != b) + return c; + return d; +} + +/* { dg-final { scan-assembler "fcmpne\.32" } }*/ +/* { dg-final { scan-assembler "fcmpne\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c new file mode 100644 index 0000000..348211d --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float fnez32(float a, float b, float c){ + if(a != 0.0f) + return b; + else + return c; +} + +double fnez64(double a, double b, double c){ + if( a != 0.0) + return b; + else + return c; +} + +/* { dg-final { scan-assembler "fcmpnez\.32" } }*/ +/* { dg-final { scan-assembler "fcmpnez\.64" } }*/ + diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c new file mode 100644 index 0000000..cadd367 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "" } */ + +float recip32(float a){ + return 1.0f/a; +} + +double recip64(double a){ + return 1.0/a; +} + +/* { dg-final { scan-assembler "frecip\.32" } }*/ +/* { dg-final { scan-assembler "frecip\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c new file mode 100644 index 0000000..4d79900 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +float sqrtf(float); +float sqrt32(float a){ + return sqrtf(a); +} + +double sqrt(double); +double sqrt64(double a){ + return sqrt(a); +} + +/* { dg-final { scan-assembler "fsqrt\.32" } }*/ +/* { dg-final { scan-assembler "fsqrt\.64" } }*/ diff --git a/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c new file mode 100644 index 0000000..3539eb4 --- /dev/null +++ b/gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-skip-if "test is specific to ck860f" { csky-*-* } { "*" } { "-mcpu=ck860*f* -mfloat-abi=hard" "-mcpu=ck860*f* -mhard-float" } } */ +/* { dg-options "-O2" } */ + +int func32(float a, float b) +{ + return __builtin_isunordered(a, b); +} + +int func64(double a, double b) +{ + return __builtin_isunordered(a, b); +} + +/* { dg-final { scan-assembler "fcmpuo\.32" } }*/ +/* { dg-final { scan-assembler "fcmpuo\.64" } }*/ + +int func32z(float a) +{ + return __builtin_isunordered(a, 0); +} + +int func64z(double a) +{ + return __builtin_isunordered(a, 0); +} + +/* { dg-final { scan-assembler "fcmpuoz\.32" } }*/ +/* { dg-final { scan-assembler "fcmpuoz\.64" } }*/