diff mbox

[ARM] add HFmode to arm_preferred_simd_mode

Message ID 52FD6014.8020607@linaro.org
State Not Applicable
Headers show

Commit Message

Kugan Vivekanandarajah Feb. 14, 2014, 12:15 a.m. UTC
Hi,

Is there any reason why HFmode is not there in arm_preferred_simd_mode?
NEON does support this.

Cross regression tested for arm-none-linux-gnueabi with qemu and no new
regressions.

Attached patch enables this. Is this OK for stage1.

Thanks,
Kugan

gcc/
+2014-02-14  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * config/arm/arm.c (arm_preferred_simd_mode): Add HFmode to
+        preferred modes.

Comments

Kugan Vivekanandarajah Feb. 14, 2014, 3:34 a.m. UTC | #1
On 14/02/14 11:24, Andrew Pinski wrote:
> On Thu, Feb 13, 2014 at 4:15 PM, Kugan
> <kugan.vivekanandarajah@linaro.org> wrote:
>> Hi,
>>
>> Is there any reason why HFmode is not there in arm_preferred_simd_mode?
>> NEON does support this.
> 
> Most likely because there is no support for Half-float in the vectorizer.
> 

I can see that get_vectype_for_scalar_type_and_size failing while
building vector type (with build_vector_type) for Half-float. I guess we
should add support there first.

Thanks,
Kugan
Kugan Vivekanandarajah Feb. 15, 2014, 11:15 p.m. UTC | #2
On 14/02/14 14:34, Kugan wrote:
> 
> 
> On 14/02/14 11:24, Andrew Pinski wrote:
>> On Thu, Feb 13, 2014 at 4:15 PM, Kugan
>> <kugan.vivekanandarajah@linaro.org> wrote:
>>> Hi,
>>>
>>> Is there any reason why HFmode is not there in arm_preferred_simd_mode?
>>> NEON does support this.
>>
>> Most likely because there is no support for Half-float in the vectorizer.
>>
> 
> I can see that get_vectype_for_scalar_type_and_size failing while
> building vector type (with build_vector_type) for Half-float. I guess we
> should add support there first.

Just for records, I was wrong here. ARM NEON that supports half float
does not support vector arithmetic operations in half float; it supports
vector conversions to float and operate on 32bit. Therefore HFmode is
not really a preferred mode.

And also, gcc vectorizer can support half floats. It is not valid in
this case and hence ARM backend does not provide required patterns and
hooks.

Thanks,
Kugan
diff mbox

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index b49f43e..bd90e85 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -28564,6 +28564,10 @@  arm_preferred_simd_mode (enum machine_mode mode)
   if (TARGET_NEON)
     switch (mode)
       {
+      case HFmode:
+	if (arm_fp16_format)
+	  return TARGET_NEON_VECTORIZE_DOUBLE ? V4HFmode : V8HFmode;
+	break;
       case SFmode:
 	return TARGET_NEON_VECTORIZE_DOUBLE ? V2SFmode : V4SFmode;
       case SImode: