• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=mipsel -relocation-model=pic -O0 -fast-isel-abort=1 -mcpu=mips32r2 \
2; RUN:     < %s | FileCheck %s
3; RUN: llc -march=mipsel -relocation-model=pic -O0 -fast-isel-abort=1 -mcpu=mips32 \
4; RUN:     < %s | FileCheck %s
5
6@x = common global [128000 x float] zeroinitializer, align 4
7@y = global float* getelementptr inbounds ([128000 x float], [128000 x float]* @x, i32 0, i32 0), align 4
8@result = common global float 0.000000e+00, align 4
9@.str = private unnamed_addr constant [5 x i8] c"%f \0A\00", align 1
10
11; Function Attrs: nounwind
12define void @foo() {
13entry:
14; CHECK-LABEL:   .ent  foo
15  %0 = load float*, float** @y, align 4
16  %arrayidx = getelementptr inbounds float, float* %0, i32 64000
17  store float 5.500000e+00, float* %arrayidx, align 4
18; CHECK:        lui     $[[REG_FPCONST_INT:[0-9]+]], 16560
19; CHECK:        mtc1    $[[REG_FPCONST_INT]], $f[[REG_FPCONST:[0-9]+]]
20; CHECK:        lw      $[[REG_Y_GOT:[0-9]+]], %got(y)(${{[0-9]+}})
21; CHECK:        lw      $[[REG_Y:[0-9]+]], 0($[[REG_Y_GOT]])
22; CHECK:        lui     $[[REG_IDX_UPPER:[0-9]+]], 3
23; CHECK:        ori     $[[REG_IDX:[0-9]+]], $[[REG_IDX_UPPER]], 59392
24; CHECK:        addu    $[[REG_Y_IDX:[0-9]+]], $[[REG_IDX]], $[[REG_Y]]
25; CHECK:        swc1    $f[[REG_FPCONST]], 0($[[REG_Y_IDX]])
26  ret void
27; CHECK-LABEL:   .end  foo
28}
29
30; Function Attrs: nounwind
31define void @goo() {
32entry:
33; CHECK-LABEL:   .ent  goo
34  %0 = load float*, float** @y, align 4
35  %arrayidx = getelementptr inbounds float, float* %0, i32 64000
36  %1 = load float, float* %arrayidx, align 4
37  store float %1, float* @result, align 4
38; CHECK-DAG:    lw      $[[REG_RESULT:[0-9]+]], %got(result)(${{[0-9]+}})
39; CHECK-DAG:    lw      $[[REG_Y_GOT:[0-9]+]], %got(y)(${{[0-9]+}})
40; CHECK-DAG:    lw      $[[REG_Y:[0-9]+]], 0($[[REG_Y_GOT]])
41; CHECK-DAG:    lui     $[[REG_IDX_UPPER:[0-9]+]], 3
42; CHECK-DAG:    ori     $[[REG_IDX:[0-9]+]], $[[REG_IDX_UPPER]], 59392
43; CHECK-DAG:    addu    $[[REG_Y_IDX:[0-9]+]], $[[REG_IDX]], $[[REG_Y]]
44; CHECK-DAG:    lwc1    $f[[Y_IDX:[0-9]+]], 0($[[REG_Y_IDX]])
45; CHECK-DAG:    swc1    $f[[Y_IDX]], 0($[[REG_RESULT]])
46; CHECK-LABEL:   .end  goo
47  ret void
48}
49
50;
51; Original C code for test.
52;
53;float x[128000];
54;float *y = x;
55;float result;
56
57
58;void foo() {
59;  y[64000] = 5.5;
60;}
61
62;void goo() {
63;  result = y[64000];
64;}
65