Home | History | Annotate | Download | only in Hexagon
      1 ; RUN: llc -march=hexagon -fp-contract=fast -disable-hexagon-peephole -disable-hexagon-amodeopt < %s | FileCheck %s
      2 
      3 ; The test checks for various addressing modes for floating point loads/stores.
      4 
      5 %struct.matrix_paramsGlob = type { [50 x i8], i16, [50 x float] }
      6 %struct.matrix_params = type { [50 x i8], i16, float** }
      7 %struct.matrix_params2 = type { i16, [50 x [50 x float]] }
      8 
      9 @globB = common global %struct.matrix_paramsGlob zeroinitializer, align 4
     10 @globA = common global %struct.matrix_paramsGlob zeroinitializer, align 4
     11 @b = common global float 0.000000e+00, align 4
     12 @a = common global float 0.000000e+00, align 4
     13 
     14 ; CHECK-LABEL: test1
     15 ; CHECK: [[REG11:(r[0-9]+)]] = memw(r{{[0-9]+}}+r{{[0-9]+}}<<#2)
     16 ; CHECK: [[REG12:(r[0-9]+)]] += sfmpy({{.*}}[[REG11]]
     17 ; CHECK: memw(r{{[0-9]+}}+r{{[0-9]+}}<<#2) = [[REG12]].new
     18 
     19 ; Function Attrs: norecurse nounwind
     20 define void @test1(%struct.matrix_params* nocapture readonly %params, i32 %col1) {
     21 entry:
     22   %matrixA = getelementptr inbounds %struct.matrix_params, %struct.matrix_params* %params, i32 0, i32 2
     23   %0 = load float**, float*** %matrixA, align 4
     24   %arrayidx = getelementptr inbounds float*, float** %0, i32 2
     25   %1 = load float*, float** %arrayidx, align 4
     26   %arrayidx1 = getelementptr inbounds float, float* %1, i32 %col1
     27   %2 = load float, float* %arrayidx1, align 4
     28   %mul = fmul float %2, 2.000000e+01
     29   %add = fadd float %mul, 1.000000e+01
     30   %arrayidx3 = getelementptr inbounds float*, float** %0, i32 5
     31   %3 = load float*, float** %arrayidx3, align 4
     32   %arrayidx4 = getelementptr inbounds float, float* %3, i32 %col1
     33   store float %add, float* %arrayidx4, align 4
     34   ret void
     35 }
     36 
     37 ; CHECK-LABEL: test2
     38 ; CHECK: [[REG21:(r[0-9]+)]] = memw(##globB+92)
     39 ; CHECK: [[REG22:(r[0-9]+)]] = sfadd({{.*}}[[REG21]]
     40 ; CHECK: memw(##globA+84) = [[REG22]]
     41 
     42 ; Function Attrs: norecurse nounwind
     43 define void @test2(%struct.matrix_params* nocapture readonly %params, i32 %col1) {
     44 entry:
     45   %matrixA = getelementptr inbounds %struct.matrix_params, %struct.matrix_params* %params, i32 0, i32 2
     46   %0 = load float**, float*** %matrixA, align 4
     47   %1 = load float*, float** %0, align 4
     48   %arrayidx1 = getelementptr inbounds float, float* %1, i32 %col1
     49   %2 = load float, float* %arrayidx1, align 4
     50   %3 = load float, float* getelementptr inbounds (%struct.matrix_paramsGlob, %struct.matrix_paramsGlob* @globB, i32 0, i32 2, i32 10), align 4
     51   %add = fadd float %2, %3
     52   store float %add, float* getelementptr inbounds (%struct.matrix_paramsGlob, %struct.matrix_paramsGlob* @globA, i32 0, i32 2, i32 8), align 4
     53   ret void
     54 }
     55 
     56 ; CHECK-LABEL: test3
     57 ; CHECK: [[REG31:(r[0-9]+)]] = memw(gp+#b)
     58 ; CHECK: [[REG32:(r[0-9]+)]] = sfadd({{.*}}[[REG31]]
     59 ; CHECK: memw(gp+#a) = [[REG32]]
     60 
     61 ; Function Attrs: norecurse nounwind
     62 define void @test3(%struct.matrix_params* nocapture readonly %params, i32 %col1) {
     63 entry:
     64   %matrixA = getelementptr inbounds %struct.matrix_params, %struct.matrix_params* %params, i32 0, i32 2
     65   %0 = load float**, float*** %matrixA, align 4
     66   %1 = load float*, float** %0, align 4
     67   %arrayidx1 = getelementptr inbounds float, float* %1, i32 %col1
     68   %2 = load float, float* %arrayidx1, align 4
     69   %3 = load float, float* @b, align 4
     70   %add = fadd float %2, %3
     71   store float %add, float* @a, align 4
     72   ret void
     73 }
     74 
     75 ; CHECK-LABEL: test4
     76 ; CHECK: [[REG41:(r[0-9]+)]] = memw(r0<<#2+##globB+52)
     77 ; CHECK: [[REG42:(r[0-9]+)]] = sfadd({{.*}}[[REG41]]
     78 ; CHECK: memw(r0<<#2+##globA+60) = [[REG42]]
     79 ; Function Attrs: noinline norecurse nounwind
     80 define void @test4(i32 %col1) {
     81 entry:
     82   %arrayidx = getelementptr inbounds %struct.matrix_paramsGlob, %struct.matrix_paramsGlob* @globB, i32 0, i32 2, i32 %col1
     83   %0 = load float, float* %arrayidx, align 4
     84   %add = fadd float %0, 0.000000e+00
     85   %add1 = add nsw i32 %col1, 2
     86   %arrayidx2 = getelementptr inbounds %struct.matrix_paramsGlob, %struct.matrix_paramsGlob* @globA, i32 0, i32 2, i32 %add1
     87   store float %add, float* %arrayidx2, align 4
     88   ret void
     89 }
     90