[RFC ARM] Cortex A8 Neon description fix.

Ramana Radhakrishnan ramana.radhakrishnan@arm.com
Tue Aug 17 15:01:00 GMT 2010


Hi, 

So, I've been playing with Neon pipeline descriptions and noticed this with the A8 Neon pipeline description.



Consider the following testcase :

#include <arm_neon.h>

void neon_add(float * __restrict out, float * __restrict a, float * __restrict
b)
{
    float32x2_t tmp1, tmp2;
    tmp1 = vset_lane_f32(*a, tmp1, 0);
    tmp2 = vset_lane_f32(*b, tmp2, 0);
    tmp1 = vadd_f32(tmp1, tmp2);
    *out = vget_lane_f32(tmp1, 0);
}



There are 2 attributes for every pattern in the ARM backend "type" which is by default "alu" for all the insn 
patterns (neon_type which is none for all integer and VFP instructions but set to something for Neon instructions.). 
Because the first reservation unit in the A8 pipeline description defines the reservation for all insns of "type" alu, 
by default all Neon patterns appear to get scheduler reservation behaviour as defined by cortex_a8_default. 

Looking at the output of -fdump-rtl-sched2 from before and after on trunk. It doesn't seem to be using any of the 
Neon functional units defined in cortex-a8-neon.md. The bit that got me interested was the fact that the 
vadd.f32 d16, d17, d16 appears to be scheduled as per the reservation of cortex_a8_default which sounds to be absolutely wrong ! 

There is another option ofcourse to change the default value of the "type" attribute to be none, but that would mean
a careful audit every single pattern in the ARM backend to have the right "alu" "type" rather than just relying on the default
value that we end up giving it depending on alternatives that match. 



With this simple patch now applied - I get :

;;   ======================================================
;;   -- basic block 2 from 42 to 46 -- after reload
;;   ======================================================

;;        0-->    42 r3=0x0                            :cortex_a8_default
;;        0-->    10 r2=[r2]                           :cortex_a8_load_store_1
;;        2-->    18 d16=unspec[r3] 91                 :cortex_a8_neon_perm
;;        2-->     8 r3=[r1]                           :cortex_a8_load_store_1
;;        3-->    20 d17=d16                           :cortex_a8_neon_dp
;;        5-->     9 d16=unspec[r3,d16,0x0] 170        :cortex_a8_neon_perm
;;        6-->    11 d17=unspec[r2,d17,0x0] 170        :cortex_a8_neon_perm
;;        7-->    12 d16=unspec[d16,d17,0x3] 72        :cortex_a8_neon_fadd
;;       12-->    14 [r0]=vec_select                   :cortex_a8_neon_ls_2
;;       13-->    46 return                            :cortex_a8_load_store_1

rather than :

;;   ======================================================
;;   -- basic block 2 from 42 to 45 -- after reload
;;   ======================================================

;;        0-->    42 r3=0x0                            :cortex_a8_default
;;        0-->    10 r2=[r2]                           :cortex_a8_load_store_1
;;        1-->    18 d16=unspec[r3] 91                 :cortex_a8_default
;;        1-->     8 r3=[r1]                           :cortex_a8_load_store_1
;;        2-->    20 d17=d16                           :cortex_a8_default
;;        3-->    11 d17=unspec[r2,d17,0x0] 170        :cortex_a8_default
;;        3-->     9 d16=unspec[r3,d16,0x0] 170        :cortex_a8_default
;;        4-->    12 d16=unspec[d16,d17,0x3] 72        :cortex_a8_default
;;        5-->    14 [r0]=vec_select                   :cortex_a8_default
;;        5-->    45 return                            :cortex_a8_load_store_1
;;      Ready list (final):  


Options ? 

cheers
Ramana

2010-08-17  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

	* config/arm/cortex-a8.md: Fix include of cortex-a8-neon.md 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: p1.txt
Type: text/x-patch
Size: 673 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100817/d4c54f33/attachment.bin>


More information about the Gcc-patches mailing list