This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Enable two UNSIGNED_FLOAT simplifications in simplify_unary_operation_1


On 20 March 2015 at 18:03, Renlin Li <renlin.li@arm.com> wrote:
> Hi all,
>
> This is a simple patch to enable two simplifications for UNSIGNED_FLOAT
> expression.
>
> For the following rtx patterns, they can be simplified when the integer x
> can be
> represented in float mode without precision loss:
>
> float_truncate (float x) --> float x
> float_extend (float x) --> float x
>
> Those two simplifications are also applicable to UNSIGNED_FLOAT expression.
>
> For example, compile the following code using aarch64-none-elf toolchain
> with -O1 flag.
> double
> f1 (uint16_t x)
> {
>   return (double)(float)x;
> }
> Before the change, the compiler generates the following code:
> f1:
>         uxth    w0, w0
>         ucvtf   s0, w0
>         fcvt    d0, s0
>         ret
> After the change, the following simplified asm code snipts are generated.
> f1:
>         uxth    w0, w0
>         ucvtf   d0, w0
>         ret
>
>
> aarch64-none-elf regression test runs Okay. x86_64 bootstraps Okay.
> Okay to commit?
>
> gcc/ChangeLog:
>
> 2015-03-20  Renlin Li  <renlin.li@arm.com>
>
>     * simplify-rtx.c (simplify_unary_operation_1): Fix a typo. Enable two
>     simplifications for UNSIGNED_FLOAT.
>
> gcc/testsuite/ChangeLog:
>
> 2015-03-20  Renlin Li  <renlin.li@arm.com>
>
>     * gcc.target/aarch64/unsigned-float.c: New.
>     * gcc.target/arm/unsigned-float.c: New.

This new test fails on ARM targets defaulting to hard-float which have
no softfp multilib.
I'm not sure about the best way to fix this.

Note that dg-require-effective-target arm_vfp_ok passes, but the
testcase fails because it includes stdint.h, leading to:
sysroot-arm-none-linux-gnueabihf/usr/include/gnu/stubs.h:7:29: fatal
error: gnu/stubs-soft.h: No such file or directory

Christophe.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]