Commit b719f884 by James Greenhalgh Committed by James Greenhalgh

[Patch AArch64] Use 128-bit vectors when autovectorizing 16-bit float types

gcc/

	* config/aarch64/aarch64.c (aarch64_simd_container_mode): Handle
	HFmode.

gcc/testsuite/

	* gcc.target/aarch64/vect_fp16_1.c: New.

From-SVN: r245429
parent f6cc254a
2017-02-14 James Greenhalgh <james.greenhalgh@arm.com>
* config/aarch64/aarch64.c (aarch64_simd_container_mode): Handle
HFmode.
2017-02-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2017-02-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR rtl-optimization/68664 PR rtl-optimization/68664
......
...@@ -10845,6 +10845,8 @@ aarch64_simd_container_mode (machine_mode mode, unsigned width) ...@@ -10845,6 +10845,8 @@ aarch64_simd_container_mode (machine_mode mode, unsigned width)
return V2DFmode; return V2DFmode;
case SFmode: case SFmode:
return V4SFmode; return V4SFmode;
case HFmode:
return V8HFmode;
case SImode: case SImode:
return V4SImode; return V4SImode;
case HImode: case HImode:
...@@ -10861,6 +10863,8 @@ aarch64_simd_container_mode (machine_mode mode, unsigned width) ...@@ -10861,6 +10863,8 @@ aarch64_simd_container_mode (machine_mode mode, unsigned width)
{ {
case SFmode: case SFmode:
return V2SFmode; return V2SFmode;
case HFmode:
return V4HFmode;
case SImode: case SImode:
return V2SImode; return V2SImode;
case HImode: case HImode:
......
2017-02-14 James Greenhalgh <james.greenhalgh@arm.com>
* gcc.target/aarch64/vect_fp16_1.c: New.
2017-02-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> 2017-02-14 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* gcc.dg/gimplefe-25.c: New test. * gcc.dg/gimplefe-25.c: New test.
......
/* { dg-do compile } */
/* { dg-options "-O3 -fno-vect-cost-model" } */
/* Check that we vectorize to a full 128-bit vector for _Float16 and __fp16
types. */
/* Enable ARMv8.2-A+fp16 so we have access to the vector instructions. */
#pragma GCC target ("arch=armv8.2-a+fp16")
_Float16
sum_Float16 (_Float16 *__restrict__ __attribute__ ((__aligned__ (16))) a,
_Float16 *__restrict__ __attribute__ ((__aligned__ (16))) b,
_Float16 *__restrict__ __attribute__ ((__aligned__ (16))) c)
{
for (int i = 0; i < 256; i++)
a[i] = b[i] + c[i];
}
_Float16
sum_fp16 (__fp16 *__restrict__ __attribute__ ((__aligned__ (16))) a,
__fp16 *__restrict__ __attribute__ ((__aligned__ (16))) b,
__fp16 *__restrict__ __attribute__ ((__aligned__ (16))) c)
{
for (int i = 0; i < 256; i++)
a[i] = b[i] + c[i];
}
/* Two FADD operations on "8h" data widths, one from sum_Float16, one from
sum_fp16. */
/* { dg-final { scan-assembler-times "fadd\tv\[0-9\]\+.8h" 2 } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment