From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4436.biz.mail.alibaba.com (out4436.biz.mail.alibaba.com [47.88.44.36]) by sourceware.org (Postfix) with ESMTPS id 5A2453857437 for ; Fri, 30 Apr 2021 13:02:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5A2453857437 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R361e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04395; MF=gengqi@linux.alibaba.com; NM=1; PH=DS; RN=3; SR=0; TI=SMTPD_---0UXH0vuK_1619787733; Received: from ITEB-L-PF1LDBR8.hz.ali.com(mailfrom:gengqi@linux.alibaba.com fp:SMTPD_---0UXH0vuK_1619787733) by smtp.aliyun-inc.com(127.0.0.1); Fri, 30 Apr 2021 21:02:29 +0800 From: Geng Qi To: gcc-patches@gcc.gnu.org, cooper.qu@linux.alibaba.com Cc: Geng Qi Subject: [PATCH] C-SKY: Cases for csky fpuv3 instructions. Date: Fri, 30 Apr 2021 21:01:31 +0800 Message-Id: <20210430130131.1176-1-gengqi@linux.alibaba.com> X-Mailer: git-send-email 2.22.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-20.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Apr 2021 13:02:37 -0000 gcc/testsuite/ChangeLog: * gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c: New. * gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c: New. --- gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp | 50 +++++++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c | 15 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c | 23 ++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c | 11 +++ .../gcc.target/csky/fpuv3/fpv3_fftoi_rm.c | 55 +++++++++++++ .../gcc.target/csky/fpuv3/fpv3_fftoi_rz.c | 41 +++++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c | 11 +++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c | 72 ++++++++++++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c | 96 ++++++++++++++++++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c | 31 +++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c | 23 ++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c | 23 ++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c | 22 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c | 14 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c | 14 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c | 11 +++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c | 11 +++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c | 23 ++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c | 76 +++++++++++++++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c | 20 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c | 19 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c | 21 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c | 20 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c | 19 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c | 20 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c | 19 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c | 20 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c | 16 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c | 16 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c | 15 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c | 16 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c | 16 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c | 19 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c | 21 +++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c | 14 ++++ gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c | 16 ++++ .../gcc.target/csky/fpuv3/fpv3_unordered.c | 29 +++++++ 37 files changed, 958 insertions(+) create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpuv3.exp create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_div.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fadd.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fdtos.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rm.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fftoi_rz.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fhtos.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fitof.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmov.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmovi.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmula.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fmuls.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fneg.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmula.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fnmuls.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstod.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fstoh.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fsub.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_fxtof.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_h.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hs.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hsz.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_hz.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ls.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lsz.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_lt.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ltz.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_max.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_min.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mul.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_mula.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_muls.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_ne.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_nez.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_recip.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_sqrt.c create mode 100644 gcc/testsuite/gcc.target/csky/fpuv3/fpv3_unordered.c 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" } }*/ -- 2.7.4