Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon -mcpu=hexagonv60 -enable-pipeliner < %s | FileCheck %s
      2 
      3 ; From coremark. Test that we pipeline the matrix multiplication bitextract
      4 ; function. The pipelined code should have two packets.
      5 
      6 ; CHECK: loop0(.LBB0_[[LOOP:.]],
      7 ; CHECK: .LBB0_[[LOOP]]:
      8 ; CHECK: [[REG0:(r[0-9]+)]] = mpyi([[REG1:(r[0-9]+)]],[[REG2:(r[0-9]+)]])
      9 ; CHECK: += mpyi
     10 ; CHECK: [[REG1:(r[0-9]+)]] = memh
     11 ; CHECK: = extractu([[REG0:(r[0-9]+)]],
     12 ; CHECK: = extractu([[REG0]],
     13 ; CHECK: [[REG2:(r[0-9]+)]] = memh
     14 ; CHECK: endloop0
     15 
     16 %union_h2_sem_t = type { i32 }
     17 
     18 @sem_i = common global [0 x %union_h2_sem_t] zeroinitializer, align 4
     19 
     20 define void @matrix_mul_matrix_bitextract(i32 %N, i32* %C, i16* %A, i16* %B) {
     21 entry:
     22   %cmp53 = icmp eq i32 %N, 0
     23   br i1 %cmp53, label %for_end27, label %for_body3_lr_ph_us
     24 
     25 for_body3_lr_ph_us:
     26   %i_054_us = phi i32 [ %inc26_us, %for_cond1_for_inc25_crit_edge_us ], [ 0, %entry ]
     27   %0 = mul i32 %i_054_us, %N
     28   %arrayidx9_us_us_gep = getelementptr i16, i16* %A, i32 %0
     29   br label %for_body3_us_us
     30 
     31 for_cond1_for_inc25_crit_edge_us:
     32   %inc26_us = add i32 %i_054_us, 1
     33   %exitcond89 = icmp eq i32 %inc26_us, %N
     34   br i1 %exitcond89, label %for_end27, label %for_body3_lr_ph_us
     35 
     36 for_body3_us_us:
     37   %j_052_us_us = phi i32 [ %inc23_us_us, %for_cond4_for_inc22_crit_edge_us_us ], [ 0, %for_body3_lr_ph_us ]
     38   %add_us_us = add i32 %j_052_us_us, %0
     39   %arrayidx_us_us = getelementptr inbounds i32, i32* %C, i32 %add_us_us
     40   store i32 0, i32* %arrayidx_us_us, align 4
     41   br label %for_body6_us_us
     42 
     43 for_cond4_for_inc22_crit_edge_us_us:
     44   store i32 %add21_us_us, i32* %arrayidx_us_us, align 4
     45   %inc23_us_us = add i32 %j_052_us_us, 1
     46   %exitcond88 = icmp eq i32 %inc23_us_us, %N
     47   br i1 %exitcond88, label %for_cond1_for_inc25_crit_edge_us, label %for_body3_us_us
     48 
     49 for_body6_us_us:
     50   %1 = phi i32 [ 0, %for_body3_us_us ], [ %add21_us_us, %for_body6_us_us ]
     51   %arrayidx9_us_us_phi = phi i16* [ %arrayidx9_us_us_gep, %for_body3_us_us ], [ %arrayidx9_us_us_inc, %for_body6_us_us ]
     52   %k_050_us_us = phi i32 [ 0, %for_body3_us_us ], [ %inc_us_us, %for_body6_us_us ]
     53   %2 = load i16, i16* %arrayidx9_us_us_phi, align 2
     54   %conv_us_us = sext i16 %2 to i32
     55   %mul10_us_us = mul i32 %k_050_us_us, %N
     56   %add11_us_us = add i32 %mul10_us_us, %j_052_us_us
     57   %arrayidx12_us_us = getelementptr inbounds i16, i16* %B, i32 %add11_us_us
     58   %3 = load i16, i16* %arrayidx12_us_us, align 2
     59   %conv13_us_us = sext i16 %3 to i32
     60   %mul14_us_us = mul nsw i32 %conv13_us_us, %conv_us_us
     61   %shr47_us_us = lshr i32 %mul14_us_us, 2
     62   %and_us_us = and i32 %shr47_us_us, 15
     63   %shr1548_us_us = lshr i32 %mul14_us_us, 5
     64   %and16_us_us = and i32 %shr1548_us_us, 127
     65   %mul17_us_us = mul i32 %and_us_us, %and16_us_us
     66   %add21_us_us = add i32 %mul17_us_us, %1
     67   %inc_us_us = add i32 %k_050_us_us, 1
     68   %exitcond87 = icmp eq i32 %inc_us_us, %N
     69   %arrayidx9_us_us_inc = getelementptr i16, i16* %arrayidx9_us_us_phi, i32 1
     70   br i1 %exitcond87, label %for_cond4_for_inc22_crit_edge_us_us, label %for_body6_us_us
     71 
     72 for_end27:
     73   ret void
     74 }
     75