Home | History | Annotate | Download | only in Mips
      1 ; RUN: llc -march=mipsel -mcpu=mips32r2 < %s | FileCheck %s
      2 
      3 %struct.S = type <{ [4 x float] }>
      4 %struct.S2 = type <{ [4 x double] }>
      5 %struct.S3 = type <{ i8, float }>
      6 
      7 @s = external global [4 x %struct.S]
      8 @gf = external global float
      9 @gd = external global double
     10 @s2 = external global [4 x %struct.S2]
     11 @s3 = external global %struct.S3
     12 
     13 define float @foo0(float* nocapture %b, i32 %o) nounwind readonly {
     14 entry:
     15 ; CHECK: lwxc1
     16   %arrayidx = getelementptr inbounds float* %b, i32 %o
     17   %0 = load float* %arrayidx, align 4
     18   ret float %0
     19 }
     20 
     21 define double @foo1(double* nocapture %b, i32 %o) nounwind readonly {
     22 entry:
     23 ; CHECK: ldxc1
     24   %arrayidx = getelementptr inbounds double* %b, i32 %o
     25   %0 = load double* %arrayidx, align 8
     26   ret double %0
     27 }
     28 
     29 define float @foo2(i32 %b, i32 %c) nounwind readonly {
     30 entry:
     31 ; CHECK: luxc1
     32   %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
     33   %0 = load float* %arrayidx1, align 1
     34   ret float %0
     35 }
     36 
     37 define void @foo3(float* nocapture %b, i32 %o) nounwind {
     38 entry:
     39 ; CHECK: swxc1
     40   %0 = load float* @gf, align 4
     41   %arrayidx = getelementptr inbounds float* %b, i32 %o
     42   store float %0, float* %arrayidx, align 4
     43   ret void
     44 }
     45 
     46 define void @foo4(double* nocapture %b, i32 %o) nounwind {
     47 entry:
     48 ; CHECK: sdxc1
     49   %0 = load double* @gd, align 8
     50   %arrayidx = getelementptr inbounds double* %b, i32 %o
     51   store double %0, double* %arrayidx, align 8
     52   ret void
     53 }
     54 
     55 define void @foo5(i32 %b, i32 %c) nounwind {
     56 entry:
     57 ; CHECK: suxc1
     58   %0 = load float* @gf, align 4
     59   %arrayidx1 = getelementptr inbounds [4 x %struct.S]* @s, i32 0, i32 %b, i32 0, i32 %c
     60   store float %0, float* %arrayidx1, align 1
     61   ret void
     62 }
     63 
     64 define double @foo6(i32 %b, i32 %c) nounwind readonly {
     65 entry:
     66 ; CHECK: foo6
     67 ; CHECK-NOT: ldxc1
     68   %arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
     69   %0 = load double* %arrayidx1, align 1
     70   ret double %0
     71 }
     72 
     73 define void @foo7(i32 %b, i32 %c) nounwind {
     74 entry:
     75 ; CHECK: foo7
     76 ; CHECK-NOT: sdxc1
     77   %0 = load double* @gd, align 8
     78   %arrayidx1 = getelementptr inbounds [4 x %struct.S2]* @s2, i32 0, i32 %b, i32 0, i32 %c
     79   store double %0, double* %arrayidx1, align 1
     80   ret void
     81 }
     82 
     83 define float @foo8() nounwind readonly {
     84 entry:
     85 ; CHECK: foo8
     86 ; CHECK: luxc1
     87   %0 = load float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
     88   ret float %0
     89 }
     90 
     91 define void @foo9(float %f) nounwind {
     92 entry:
     93 ; CHECK: foo9
     94 ; CHECK: suxc1
     95   store float %f, float* getelementptr inbounds (%struct.S3* @s3, i32 0, i32 1), align 1
     96   ret void
     97 }
     98 
     99