252 lines · plain
1; RUN: llc -mtriple=mipsel -mcpu=mips32 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,MIPS32R12; RUN: llc -mtriple=mipsel -mcpu=mips32r2 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,MIPS32R23; RUN: llc -mtriple=mipsel -mcpu=mips32r6 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,MIPS32R64; RUN: llc -mtriple=mips64el -mcpu=mips4 -target-abi=n64 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,MIPS45; RUN: llc -mtriple=mips64el -mcpu=mips64 -target-abi=n64 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,MIPS46; RUN: llc -mtriple=mips64el -mcpu=mips64r2 -target-abi=n64 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,MIPS47; RUN: llc -mtriple=mips64el -mcpu=mips64r6 -target-abi=n64 -relocation-model=pic < %s | FileCheck %s -check-prefixes=ALL,MIPS64R68 9%struct.S = type <{ [4 x float] }>10%struct.S2 = type <{ [4 x double] }>11%struct.S3 = type <{ i8, float }>12 13@s = external global [4 x %struct.S]14@gf = external global float15@gd = external global double16@s2 = external global [4 x %struct.S2]17@s3 = external global %struct.S318 19define float @foo0(ptr nocapture %b, i32 %o) nounwind readonly {20entry:21; ALL-LABEL: foo0:22 23; MIPS32R1: sll $[[T1:[0-9]+]], $5, 224; MIPS32R1: addu $[[T3:[0-9]+]], $4, $[[T1]]25; MIPS32R1: lwc1 $f0, 0($[[T3]])26 27; MIPS32R2: sll $[[T1:[0-9]+]], $5, 228; MIPS32R2: lwxc1 $f0, $[[T1]]($4)29 30; MIPS32R6: sll $[[T1:[0-9]+]], $5, 231; MIPS32R6: addu $[[T3:[0-9]+]], $4, $[[T1]]32; MIPS32R6: lwc1 $f0, 0($[[T3]])33 34; MIPS4: sll $[[T0:[0-9]+]], $5, 035; MIPS4: dsll $[[T1:[0-9]+]], $[[T0]], 236; MIPS4: lwxc1 $f0, $[[T1]]($4)37 38; MIPS64R6: sll $[[T0:[0-9]+]], $5, 039; MIPS64R6: dsll $[[T1:[0-9]+]], $[[T0]], 240; MIPS64R6: daddu $[[T3:[0-9]+]], $4, $[[T1]]41; MIPS64R6: lwc1 $f0, 0($[[T3]])42 43 %arrayidx = getelementptr inbounds float, ptr %b, i32 %o44 %0 = load float, ptr %arrayidx, align 445 ret float %046}47 48define double @foo1(ptr nocapture %b, i32 %o) nounwind readonly {49entry:50; ALL-LABEL: foo1:51 52; MIPS32R1: sll $[[T1:[0-9]+]], $5, 353; MIPS32R1: addu $[[T3:[0-9]+]], $4, $[[T1]]54; MIPS32R1: ldc1 $f0, 0($[[T3]])55 56; MIPS32R2: sll $[[T1:[0-9]+]], $5, 357; MIPS32R2: ldxc1 $f0, $[[T1]]($4)58 59; MIPS32R6: sll $[[T1:[0-9]+]], $5, 360; MIPS32R6: addu $[[T3:[0-9]+]], $4, $[[T1]]61; MIPS32R6: ldc1 $f0, 0($[[T3]])62 63; MIPS4: sll $[[T0:[0-9]+]], $5, 064; MIPS4: dsll $[[T1:[0-9]+]], $[[T0]], 365; MIPS4: ldxc1 $f0, $[[T1]]($4)66 67; MIPS64R6: sll $[[T0:[0-9]+]], $5, 068; MIPS64R6: dsll $[[T1:[0-9]+]], $[[T0]], 369; MIPS64R6: daddu $[[T3:[0-9]+]], $4, $[[T1]]70; MIPS64R6: ldc1 $f0, 0($[[T3]])71 72 %arrayidx = getelementptr inbounds double, ptr %b, i32 %o73 %0 = load double, ptr %arrayidx, align 874 ret double %075}76 77define float @foo2(i32 %b, i32 %c) nounwind readonly {78entry:79; ALL-LABEL: foo2:80 81; luxc1 did not exist in MIPS32r182; MIPS32R1-NOT: luxc183 84; luxc1 is a misnomer since it aligns the given pointer downwards and performs85; an aligned load. We mustn't use it to handle unaligned loads.86; MIPS32R2-NOT: luxc187 88; luxc1 was removed in MIPS32r689; MIPS32R6-NOT: luxc190 91; MIPS4-NOT: luxc192 93; luxc1 was removed in MIPS64r694; MIPS64R6-NOT: luxc195 96 %arrayidx1 = getelementptr inbounds [4 x %struct.S], ptr @s, i32 0, i32 %b, i32 0, i32 %c97 %0 = load float, ptr %arrayidx1, align 198 ret float %099}100 101define void @foo3(ptr nocapture %b, i32 %o) nounwind {102entry:103; ALL-LABEL: foo3:104 105; MIPS32R1-DAG: lwc1 $[[T0:f0]], 0(${{[0-9]+}})106; MIPS32R1-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}107; MIPS32R1-DAG: swc1 $[[T0]], 0($[[T1]])108 109; MIPS32R2: lwc1 $[[T0:f0]], 0(${{[0-9]+}})110; MIPS32R2: swxc1 $[[T0]], ${{[0-9]+}}($4)111 112; MIPS32R6-DAG: lwc1 $[[T0:f0]], 0(${{[0-9]+}})113; MIPS32R6-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}114; MIPS32R6-DAG: swc1 $[[T0]], 0($[[T1]])115 116; MIPS4: lwc1 $[[T0:f0]], 0(${{[0-9]+}})117; MIPS4: swxc1 $[[T0]], ${{[0-9]+}}($4)118 119; MIPS64R6-DAG: lwc1 $[[T0:f0]], 0(${{[0-9]+}})120; MIPS64R6-DAG: daddu $[[T1:[0-9]+]], $4, ${{[0-9]+}}121; MIPS64R6-DAG: swc1 $[[T0]], 0($[[T1]])122 123 %0 = load float, ptr @gf, align 4124 %arrayidx = getelementptr inbounds float, ptr %b, i32 %o125 store float %0, ptr %arrayidx, align 4126 ret void127}128 129define void @foo4(ptr nocapture %b, i32 %o) nounwind {130entry:131; ALL-LABEL: foo4:132 133; MIPS32R1-DAG: ldc1 $[[T0:f0]], 0(${{[0-9]+}})134; MIPS32R1-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}135; MIPS32R1-DAG: sdc1 $[[T0]], 0($[[T1]])136 137; MIPS32R2: ldc1 $[[T0:f0]], 0(${{[0-9]+}})138; MIPS32R2: sdxc1 $[[T0]], ${{[0-9]+}}($4)139 140; MIPS32R6-DAG: ldc1 $[[T0:f0]], 0(${{[0-9]+}})141; MIPS32R6-DAG: addu $[[T1:[0-9]+]], $4, ${{[0-9]+}}142; MIPS32R6-DAG: sdc1 $[[T0]], 0($[[T1]])143 144; MIPS4: ldc1 $[[T0:f0]], 0(${{[0-9]+}})145; MIPS4: sdxc1 $[[T0]], ${{[0-9]+}}($4)146 147; MIPS64R6-DAG: ldc1 $[[T0:f0]], 0(${{[0-9]+}})148; MIPS64R6-DAG: daddu $[[T1:[0-9]+]], $4, ${{[0-9]+}}149; MIPS64R6-DAG: sdc1 $[[T0]], 0($[[T1]])150 151 %0 = load double, ptr @gd, align 8152 %arrayidx = getelementptr inbounds double, ptr %b, i32 %o153 store double %0, ptr %arrayidx, align 8154 ret void155}156 157define void @foo5(i32 %b, i32 %c) nounwind {158entry:159; ALL-LABEL: foo5:160 161; MIPS32R1-NOT: suxc1162 163; MIPS32R2-NOT: suxc1164 165; MIPS32R6-NOT: suxc1166 167; MIPS4-NOT: suxc1168 169; MIPS64R6-NOT: suxc1170 171 %0 = load float, ptr @gf, align 4172 %arrayidx1 = getelementptr inbounds [4 x %struct.S], ptr @s, i32 0, i32 %b, i32 0, i32 %c173 store float %0, ptr %arrayidx1, align 1174 ret void175}176 177define double @foo6(i32 %b, i32 %c) nounwind readonly {178entry:179; ALL-LABEL: foo6:180 181; MIPS32R1-NOT: luxc1182 183; MIPS32R2-NOT: luxc1184 185; MIPS32R6-NOT: luxc1186 187; MIPS4-NOT: luxc1188 189; MIPS64R6-NOT: luxc1190 191 %arrayidx1 = getelementptr inbounds [4 x %struct.S2], ptr @s2, i32 0, i32 %b, i32 0, i32 %c192 %0 = load double, ptr %arrayidx1, align 1193 ret double %0194}195 196define void @foo7(i32 %b, i32 %c) nounwind {197entry:198; ALL-LABEL: foo7:199 200; MIPS32R1-NOT: suxc1201 202; MIPS32R2-NOT: suxc1203 204; MIPS32R6-NOT: suxc1205 206; MIPS4-NOT: suxc1207 208; MIPS64R6-NOT: suxc1209 210 %0 = load double, ptr @gd, align 8211 %arrayidx1 = getelementptr inbounds [4 x %struct.S2], ptr @s2, i32 0, i32 %b, i32 0, i32 %c212 store double %0, ptr %arrayidx1, align 1213 ret void214}215 216define float @foo8() nounwind readonly {217entry:218; ALL-LABEL: foo8:219 220; MIPS32R1-NOT: luxc1221 222; MIPS32R2-NOT: luxc1223 224; MIPS32R6-NOT: luxc1225 226; MIPS4-NOT: luxc1227 228; MIPS64R6-NOT: luxc1229 230 %0 = load float, ptr getelementptr inbounds (%struct.S3, ptr @s3, i32 0, i32 1), align 1231 ret float %0232}233 234define void @foo9(float %f) nounwind {235entry:236; ALL-LABEL: foo9:237 238; MIPS32R1-NOT: suxc1239 240; MIPS32R2-NOT: suxc1241 242; MIPS32R6-NOT: suxc1243 244; MIPS4-NOT: suxc1245 246; MIPS64R6-NOT: suxc1247 248 store float %f, ptr getelementptr inbounds (%struct.S3, ptr @s3, i32 0, i32 1), align 1249 ret void250}251 252