[Patch AArch64] Add floatdihf2 and floatunsdihf2 patterns

Kyrill Tkachov kyrylo.tkachov@foss.arm.com
Fri Oct 21 16:36:00 GMT 2016


On 06/09/16 10:19, James Greenhalgh wrote:
> Hi,
>
> This patch adds patterns for conversion from 64-bit integer to 16-bit
> floating-point values under AArch64 targets which don't have support for
> the ARMv8.2-A 16-bit floating point extensions.
>
> We implement these by first saturating to a SImode (we know that any
> values >= 65504 will round to infinity after conversion to HFmode), then
> converting to a DFmode (unsigned conversions could go to SFmode, but there
> is no performance benefit to this). Then converting to HFmode.
>
> Having added these patterns, the expansion path in "expand_float" will
> now try to use them for conversions from SImode to HFmode as there is no
> floatsihf2 pattern. expand_float first tries widening the integer size and
> looking for a match, so it will try SImode -> DImode. But our DI mode
> pattern is going to then saturate us back to SImode which is wasteful.
>
> Better, would be for us to provide float(uns)sihf2 patterns directly.
> So that's what this patch does.
>
> The testcase add in this patch would fail on trunk for AArch64. There is
> no libgcc routine to make the conversion, and we don't provide appropriate
> patterns in the backend, so we get a link-time error.
>
> Bootstrapped and tested on aarch64-none-linux-gnu
>
> OK for trunk?

Looks ok to me FWIW, but I can't approve.

Kyrill

> James
>
> ---
> 2016-09-06  James Greenhalgh  <james.greenhalgh@arm.com>
>
> 	* config/aarch64/aarch64.md (<optab>sihf2): Convert to expand.
> 	(<optab>dihf2): Likewise.
> 	(aarch64_fp16_<optab><mode>hf2): New.
>
> 2016-09-06  James Greenhalgh  <james.greenhalgh@arm.com>
>
> 	* gcc.target/aarch64/floatdihf2_1.c: New.
>



More information about the Gcc-patches mailing list