225 lines · plain
1; RUN: llc -mtriple=mips -relocation-model=static -mattr=single-float < %s \2; RUN: | FileCheck --check-prefixes=ALL,SYM32,O32 %s3; RUN: llc -mtriple=mipsel -relocation-model=static -mattr=single-float < %s \4; RUN: | FileCheck --check-prefixes=ALL,SYM32,O32 %s5 6; RUN: llc -mtriple=mips64 -relocation-model=static -target-abi n32 -mattr=single-float < %s \7; RUN: | FileCheck --check-prefixes=ALL,SYM32,NEW %s8; RUN: llc -mtriple=mips64el -relocation-model=static -target-abi n32 -mattr=single-float < %s \9; RUN: | FileCheck --check-prefixes=ALL,SYM32,NEW %s10 11; RUN: llc -mtriple=mips64 -relocation-model=static -target-abi n64 -mattr=single-float < %s \12; RUN: | FileCheck --check-prefixes=ALL,SYM64,NEW %s13; RUN: llc -mtriple=mips64el -relocation-model=static -target-abi n64 -mattr=single-float < %s \14; RUN: | FileCheck --check-prefixes=ALL,SYM64,NEW %s15 16@bytes = global [11 x i8] zeroinitializer17@dwords = global [11 x i64] zeroinitializer18@floats = global [11 x float] zeroinitializer19@doubles = global [11 x double] zeroinitializer20 21define void @double_args(double %a, double %b, double %c, double %d, double %e,22 double %f, double %g, double %h, double %i) nounwind {23entry:24 %0 = getelementptr [11 x double], ptr @doubles, i32 0, i32 125 store volatile double %a, ptr %026 %1 = getelementptr [11 x double], ptr @doubles, i32 0, i32 227 store volatile double %b, ptr %128 %2 = getelementptr [11 x double], ptr @doubles, i32 0, i32 329 store volatile double %c, ptr %230 %3 = getelementptr [11 x double], ptr @doubles, i32 0, i32 431 store volatile double %d, ptr %332 %4 = getelementptr [11 x double], ptr @doubles, i32 0, i32 533 store volatile double %e, ptr %434 %5 = getelementptr [11 x double], ptr @doubles, i32 0, i32 635 store volatile double %f, ptr %536 %6 = getelementptr [11 x double], ptr @doubles, i32 0, i32 737 store volatile double %g, ptr %638 %7 = getelementptr [11 x double], ptr @doubles, i32 0, i32 839 store volatile double %h, ptr %740 %8 = getelementptr [11 x double], ptr @doubles, i32 0, i32 941 store volatile double %i, ptr %842 ret void43}44 45; ALL-LABEL: double_args:46; We won't test the way the global address is calculated in this test. This is47; just to get the register number for the other checks.48; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(doubles)49; SYM64-DAG: daddiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(doubles)50 51; The first four arguments are the same in O32/N32/N64.52; The first argument is floating point but single-float is enabled so floating53; point registers are not used.54; O32-DAG: sw $4, 8([[R2]])55; O32-DAG: sw $5, 12([[R2]])56; NEW-DAG: sd $4, 8([[R2]])57 58; O32-DAG: sw $6, 16([[R2]])59; O32-DAG: sw $7, 20([[R2]])60; NEW-DAG: sd $5, 16([[R2]])61 62; O32 has run out of argument registers and starts using the stack63; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 16($sp)64; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 20($sp)65; O32-DAG: sw [[R3]], 24([[R2]])66; O32-DAG: sw [[R4]], 28([[R2]])67; NEW-DAG: sd $6, 24([[R2]])68 69; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 24($sp)70; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 28($sp)71; O32-DAG: sw [[R3]], 32([[R2]])72; O32-DAG: sw [[R4]], 36([[R2]])73; NEW-DAG: sd $7, 32([[R2]])74 75; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 32($sp)76; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 36($sp)77; O32-DAG: sw [[R3]], 40([[R2]])78; O32-DAG: sw [[R4]], 44([[R2]])79; NEW-DAG: sd $8, 40([[R2]])80 81; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 40($sp)82; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 44($sp)83; O32-DAG: sw [[R3]], 48([[R2]])84; O32-DAG: sw [[R4]], 52([[R2]])85; NEW-DAG: sd $9, 48([[R2]])86 87; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 48($sp)88; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 52($sp)89; O32-DAG: sw [[R3]], 56([[R2]])90; O32-DAG: sw [[R4]], 60([[R2]])91; NEW-DAG: sd $10, 56([[R2]])92 93; N32/N64 have run out of registers and starts using the stack too94; O32-DAG: lw [[R3:\$[0-9]+]], 56($sp)95; O32-DAG: lw [[R4:\$[0-9]+]], 60($sp)96; O32-DAG: sw [[R3]], 64([[R2]])97; O32-DAG: sw [[R4]], 68([[R2]])98; NEW-DAG: ld [[R3:\$[0-9]+]], 0($sp)99; NEW-DAG: sd $11, 64([[R2]])100 101define void @float_args(float %a, float %b, float %c, float %d, float %e,102 float %f, float %g, float %h, float %i) nounwind {103entry:104 %0 = getelementptr [11 x float], ptr @floats, i32 0, i32 1105 store volatile float %a, ptr %0106 %1 = getelementptr [11 x float], ptr @floats, i32 0, i32 2107 store volatile float %b, ptr %1108 %2 = getelementptr [11 x float], ptr @floats, i32 0, i32 3109 store volatile float %c, ptr %2110 %3 = getelementptr [11 x float], ptr @floats, i32 0, i32 4111 store volatile float %d, ptr %3112 %4 = getelementptr [11 x float], ptr @floats, i32 0, i32 5113 store volatile float %e, ptr %4114 %5 = getelementptr [11 x float], ptr @floats, i32 0, i32 6115 store volatile float %f, ptr %5116 %6 = getelementptr [11 x float], ptr @floats, i32 0, i32 7117 store volatile float %g, ptr %6118 %7 = getelementptr [11 x float], ptr @floats, i32 0, i32 8119 store volatile float %h, ptr %7120 %8 = getelementptr [11 x float], ptr @floats, i32 0, i32 9121 store volatile float %i, ptr %8122 ret void123}124 125; ALL-LABEL: float_args:126; We won't test the way the global address is calculated in this test. This is127; just to get the register number for the other checks.128; SYM32-DAG: addiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)129; SYM64-DAG: daddiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)130 131; The first argument is floating point so floating point registers are used.132; The first argument is the same for O32/N32/N64 but the second argument differs133; by register134; ALL-DAG: swc1 $f12, 4([[R1]])135; O32-DAG: swc1 $f14, 8([[R1]])136; NEW-DAG: swc1 $f13, 8([[R1]])137 138; O32 has run out of argument registers and (in theory) starts using the stack139; I've yet to find a reference in the documentation about this but GCC uses up140; the remaining two argument slots in the GPR's first. We'll do the same for141; compatibility.142; O32-DAG: mtc1 $6, $f0143; O32-DAG: swc1 $f0, 12([[R1]])144; NEW-DAG: swc1 $f14, 12([[R1]])145; O32-DAG: mtc1 $7, $f0146; O32-DAG: swc1 $f0, 16([[R1]])147; NEW-DAG: swc1 $f15, 16([[R1]])148 149; O32 is definitely out of registers now and switches to the stack.150; O32-DAG: lwc1 [[F1:\$f[0-9]+]], 16($sp)151; O32-DAG: swc1 [[F1]], 20([[R1]])152; NEW-DAG: swc1 $f16, 20([[R1]])153; O32-DAG: lwc1 [[F1:\$f[0-9]+]], 20($sp)154; O32-DAG: swc1 [[F1]], 24([[R1]])155; NEW-DAG: swc1 $f17, 24([[R1]])156; O32-DAG: lwc1 [[F1:\$f[0-9]+]], 24($sp)157; O32-DAG: swc1 [[F1]], 28([[R1]])158; NEW-DAG: swc1 $f18, 28([[R1]])159; O32-DAG: lwc1 [[F1:\$f[0-9]+]], 28($sp)160; O32-DAG: swc1 [[F1]], 32([[R1]])161; NEW-DAG: swc1 $f19, 32([[R1]])162 163; N32/N64 have run out of registers and start using the stack too164; O32-DAG: lwc1 [[F1:\$f[0-9]+]], 32($sp)165; O32-DAG: swc1 [[F1]], 36([[R1]])166; NEW-DAG: lwc1 [[F1:\$f[0-9]+]], 0($sp)167; NEW-DAG: swc1 [[F1]], 36([[R1]])168 169 170define void @double_arg2(i8 %a, double %b) nounwind {171entry:172 %0 = getelementptr [11 x i8], ptr @bytes, i32 0, i32 1173 store volatile i8 %a, ptr %0174 %1 = getelementptr [11 x double], ptr @doubles, i32 0, i32 1175 store volatile double %b, ptr %1176 ret void177}178 179; ALL-LABEL: double_arg2:180; We won't test the way the global address is calculated in this test. This is181; just to get the register number for the other checks.182; SYM32-DAG: addiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)183; SYM64-DAG: daddiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)184; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(doubles)185; SYM64-DAG: daddiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(doubles)186 187; The first four arguments are the same in O32/N32/N64.188; The first argument isn't floating point so floating point registers are not189; used.190; The second slot is insufficiently aligned for double on O32 so it is skipped.191; Also, double occupies two slots on O32 and only one for N32/N64.192; ALL-DAG: sb $4, 1([[R1]])193; O32-DAG: sw $6, 8([[R2]])194; O32-DAG: sw $7, 12([[R2]])195; NEW-DAG: sd $5, 8([[R2]])196 197define void @float_arg2(i8 %a, float %b) nounwind {198entry:199 %0 = getelementptr [11 x i8], ptr @bytes, i32 0, i32 1200 store volatile i8 %a, ptr %0201 %1 = getelementptr [11 x float], ptr @floats, i32 0, i32 1202 store volatile float %b, ptr %1203 ret void204}205 206; ALL-LABEL: float_arg2:207; We won't test the way the global address is calculated in this test. This is208; just to get the register number for the other checks.209; SYM32-DAG: addiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)210; SYM64-DAG: daddiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)211; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)212; SYM64-DAG: daddiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)213 214; The first argument is the same in O32/N32/N64.215; ALL-DAG: sb $4, 1([[R1]])216 217; The first argument isn't floating point so floating point registers are not218; used in O32, but N32/N64 will still use them.219; MD00305 and GCC disagree on this one. MD00305 says that floats are treated220; as 8-byte aligned and occupy two slots on O32. GCC is treating them as 4-byte221; aligned and occupying one slot. We'll use GCC's definition.222; O32-DAG: mtc1 $5, $f0223; O32-DAG: swc1 $f0, 4([[R2]])224; NEW-DAG: swc1 $f13, 4([[R2]])225