i386: Roundeven expansion for SSE4.1+
authorTejas Joshi <tejasjoshi9673@gmail.com>
Mon, 26 Aug 2019 12:41:59 +0000 (12:41 +0000)
committerMartin Jambor <jamborm@gcc.gnu.org>
Mon, 26 Aug 2019 12:41:59 +0000 (14:41 +0200)
commitd3b92f35d84f44a8599028086286699213b73e7c
tree68dd8aabf68a9b3ef68b677082dbe5c480fe7ae5
parent7d7b99f95bf2517caab5f9300090b471135b4fc0
i386: Roundeven expansion for SSE4.1+

gcc/ChangeLog:

2019-08-26  Tejas Joshi  <tejasjoshi9673@gmail.com>
            Uros Bizjak  <ubizjak@gmail.com>

* builtins.c (mathfn_built_in_2): Change CASE_MATHFN to
CASE_MATHFN_FLOATN for roundeven.
* config/i386/i386.c (ix86_i387_mode_needed): Add case
I387_ROUNDEVEN.
(ix86_mode_needed): Likewise.
(ix86_mode_after): Likewise.
(ix86_mode_entry): Likewise.
(ix86_mode_exit): Likewise.
(ix86_emit_mode_set): Likewise.
(emit_i387_cw_initialization): Add case I387_CW_ROUNDEVEN.
* config/i386/i386.h (ix86_stack_slot): Add SLOT_CW_ROUNDEVEN.
(ix86_entry): Add I387_ROUNDEVEN.
(avx_u128_state): Add I387_CW_ANY.
* config/i386/i386.md: Define UNSPEC_FRNDINT_ROUNDEVEN.
(define_int_iterator): Likewise.
(define_int_attr): Likewise for rounding_insn, rounding and ROUNDING.
(define_constant): Define ROUND_ROUNDEVEN mode.
(define_attr): Add roundeven mode for i387_cw.
(<rouding_insn><mode>2): Add condition for ROUND_ROUNDEVEN.
* internal-fn.def (ROUNDEVEN): New builtin function.
* optabs.def (roundeven_optab): New optab.

gcc/testsuite/ChangeLog:

2019-08-26  Tejas Joshi  <tejasjoshi9673@gmail.com>

* gcc.target/i386/sse4_1-round-roundeven-1.c: New test.
* gcc.target/i386/sse4_1-round-roundeven-2.c: New test.

Co-Authored-By: Uros Bizjak <ubizjak@gmail.com>
From-SVN: r274928
gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/i386/i386.md
gcc/internal-fn.def
gcc/optabs.def
gcc/reg-stack.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/sse4_1-round-roundeven-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/sse4_1-round-roundeven-2.c [new file with mode: 0644]