[RFC PATCH, i386]: Vectorize calls to floor, ceil, trunc and rint functions.

H.J. Lu hjl.tools@gmail.com
Wed Mar 16 18:39:00 GMT 2011


On Sun, Feb 27, 2011 at 5:45 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> Attached [RFC] patch vectorizes calls to floor, ceil, trunc and rint
> (and their float variants) functions using roundps/roundpd SSE4.1
> instruction.
>
> 2011-02-27  Uros Bizjak  <ubizjak@gmail.com>
>
>        * config/i386/i386.md (ROUND_FLOOR): New constant.
>        (ROUND_CEIL): Ditto.
>        (ROUND_TRUNC): Ditto.
>        (ROUND_MXCSR): Ditto.
>        (ROUND_NO_EXC): Ditto.
>        (rint<mode>2): Use new defines instead of numerical constant.
>        (floor<mode>2): Ditto.
>        (ceil<mode>2): Ditto.
>        (btrunc<mode>2): Ditto.
>        * config/i386/i386-builtin-types.def: Define ROUND function type
>        aliases.
>        * config/i386/i386.c (enum ix86_builtins): Add
>        IX86_BUILTIN_{FLOOR,CEIL,TRUNC,RINT}{PS,PD}{,256} defines.
>        (struct builtin_description): Add
>        __builtin_ia32_{floor,ceil,trunc,rint}{pd,ps}{,256} descriptions.
>        (ix86_expand_sse_round): New static function.
>        (ix86_expand_args_builtin): Call ix86_expand_sse_round for ROUND
>        function types.
>        (ix86_builtin_vectorized_function): Handle
>        BUILT_IN_{FLOOR,CEIL,TRUNC,RINT}{,F} builtins.
>
> Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
> (--with-fpmath=avx). Currently, it does not include test cases, but it
> is RFC at this gcc development stage anyway.

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48154

We need to check TARGET_ROUND before using __builtin_ia32_truncps.

-- 
H.J.



More information about the Gcc-patches mailing list