From f66e6423731a517873fdf5dfc3e67bae7f8acb48 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Fri, 9 Jun 2017 13:33:35 +0000 Subject: [PATCH] aarch64.md (lrint2): New. 2017-06-09 Tamar Christina * config/aarch64/aarch64.md (lrint2): New. gcc/testsuite/ 2017-06-09 Tamar Christina * gcc.target/aarch64/lrint-matherr.h: New. * gcc.target/aarch64/inline-lrint_1.c: New. * gcc.target/aarch64/inline-lrint_2.c: New. * gcc.target/aarch64/no-inline-lrint_1.c: New. * gcc.target/aarch64/no-inline-lrint_2.c: New. From-SVN: r249064 --- gcc/ChangeLog | 4 ++++ gcc/config/aarch64/aarch64.md | 12 ++++++++++ gcc/testsuite/ChangeLog | 8 +++++++ .../gcc.target/aarch64/inline-lrint_1.c | 20 +++++++++++++++++ .../gcc.target/aarch64/inline-lrint_2.c | 22 +++++++++++++++++++ .../gcc.target/aarch64/lrint-matherr.h | 5 +++++ .../gcc.target/aarch64/no-inline-lrint_1.c | 20 +++++++++++++++++ .../gcc.target/aarch64/no-inline-lrint_2.c | 20 +++++++++++++++++ 8 files changed, 111 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/lrint-matherr.h create mode 100644 gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/no-inline-lrint_2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9706455f5a2..6e1960f6a80 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ * tree-ssa-loop-im.c (execute_sm): Do not force multi-threaded model if the ref is always written to. +2017-06-09 Tamar Christina + + * config/aarch64/aarch64.md (lrint2): New. + 2017-06-09 Tamar Christina * config/arm/arm.c (arm_rtx_costs_internal): Make sdiv more expensive diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 2e9331fd72b..1a721bfbe42 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -4940,6 +4940,18 @@ [(set_attr "type" "f_minmax")] ) +(define_expand "lrint2" + [(match_operand:GPI 0 "register_operand") + (match_operand:GPF 1 "register_operand")] + "TARGET_FLOAT" +{ + rtx cvt = gen_reg_rtx (mode); + emit_insn (gen_rint2 (cvt, operands[1])); + emit_insn (gen_lbtrunc2 (operands[0], cvt)); + DONE; +} +) + ;; For copysign (x, y), we want to generate: ;; ;; LDR d2, #(1 << 63) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 01f2d1842ba..382805c64e0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2017-06-09 Tamar Christina + + * gcc.target/aarch64/lrint-matherr.h: New. + * gcc.target/aarch64/inline-lrint_1.c: New. + * gcc.target/aarch64/inline-lrint_2.c: New. + * gcc.target/aarch64/no-inline-lrint_1.c: New. + * gcc.target/aarch64/no-inline-lrint_2.c: New. + 2017-06-09 Tamar Christina * gcc.target/arm/sdiv_costs_1.c: New. diff --git a/gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c b/gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c new file mode 100644 index 00000000000..876cecd674b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/inline-lrint_1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O3 -fno-math-errno" } */ + +#include "lrint-matherr.h" + +TEST (dld, double, long, ) +TEST (flf, float , long, ) + +TEST (did, double, int, ) +TEST (fif, float , int, ) + +TEST (dlld, double, long long, l) +TEST (fllf, float , long long, l) + +/* { dg-final { scan-assembler-times "frintx\td\[0-9\]+, d\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "frintx\ts\[0-9\]+, s\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "fcvtzs\tx\[0-9\]+, d\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "fcvtzs\tx\[0-9\]+, s\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-not "bl" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c b/gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c new file mode 100644 index 00000000000..baa5aee7617 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/inline-lrint_2.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-O3 -fno-math-errno" } */ + +#include "lrint-matherr.h" + +TEST (dld, double, long, ) +TEST (flf, float , long, ) + +TEST (did, double, int, ) +TEST (fif, float , int, ) + +TEST (dlld, double, long long, l) +TEST (fllf, float , long long, l) + +/* { dg-final { scan-assembler-times "frintx\td\[0-9\]+, d\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "frintx\ts\[0-9\]+, s\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "fcvtzs\tx\[0-9\]+, d\[0-9\]+" 1 } } */ +/* { dg-final { scan-assembler-times "fcvtzs\tx\[0-9\]+, s\[0-9\]+" 1 } } */ +/* { dg-final { scan-assembler-times "fcvtzs\tw\[0-9\]+, d\[0-9\]+" 2 } } */ +/* { dg-final { scan-assembler-times "fcvtzs\tw\[0-9\]+, s\[0-9\]+" 2 } } */ +/* { dg-final { scan-assembler-not "bl" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/lrint-matherr.h b/gcc/testsuite/gcc.target/aarch64/lrint-matherr.h new file mode 100644 index 00000000000..cc6e3d13f9b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/lrint-matherr.h @@ -0,0 +1,5 @@ +#define TEST(name, float_type, int_type, pref) void f_##name (float_type x) \ +{ \ + volatile float_type a = __builtin_rint (x); \ + volatile int_type b = __builtin_l##pref##rint (x); \ +} diff --git a/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c new file mode 100644 index 00000000000..fb7f0655687 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_1.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O3" } */ + +#include "lrint-matherr.h" + +TEST (dld, double, long, ) +TEST (flf, float , long, ) + +TEST (did, double, int, ) +TEST (fif, float , int, ) + +TEST (dlld, double, long long, l) +TEST (fllf, float , long long, l) + +/* { dg-final { scan-assembler-times "frintx\td\[0-9\]+, d\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "frintx\ts\[0-9\]+, s\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "bl\tlrint" 4 } } */ +/* { dg-final { scan-assembler-times "bl\tllrint" 2 } } */ +/* { dg-final { scan-assembler-not "fcvtzs" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_2.c b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_2.c new file mode 100644 index 00000000000..c99843c3a25 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/no-inline-lrint_2.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-O3" } */ + +#include "lrint-matherr.h" + +TEST (dld, double, long, ) +TEST (flf, float , long, ) + +TEST (did, double, int, ) +TEST (fif, float , int, ) + +TEST (dlld, double, long long, l) +TEST (fllf, float , long long, l) + +/* { dg-final { scan-assembler-times "frintx\td\[0-9\]+, d\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "frintx\ts\[0-9\]+, s\[0-9\]+" 3 } } */ +/* { dg-final { scan-assembler-times "bl\tlrint" 4 } } */ +/* { dg-final { scan-assembler-times "bl\tllrint" 2 } } */ +/* { dg-final { scan-assembler-not "fcvtzs" } } */ -- 2.30.2