224 lines · plain
1; RUN: llc -mtriple=mips -relocation-model=static -mattr=+soft-float < %s | FileCheck --check-prefixes=ALL,SYM32,O32 %s2; RUN: llc -mtriple=mipsel -relocation-model=static -mattr=+soft-float < %s | FileCheck --check-prefixes=ALL,SYM32,O32 %s3 4; RUN-TODO: llc -mtriple=mips64 -relocation-model=static -mattr=+soft-float -target-abi o32 < %s | FileCheck --check-prefixes=ALL,SYM32,O32 %s5; RUN-TODO: llc -mtriple=mips64el -relocation-model=static -mattr=+soft-float -target-abi o32 < %s | FileCheck --check-prefixes=ALL,SYM32,O32 %s6 7; RUN: llc -mtriple=mips64 -relocation-model=static -mattr=+soft-float -target-abi n32 < %s | FileCheck --check-prefixes=ALL,SYM32,NEW %s8; RUN: llc -mtriple=mips64el -relocation-model=static -mattr=+soft-float -target-abi n32 < %s | FileCheck --check-prefixes=ALL,SYM32,NEW %s9 10; RUN: llc -mtriple=mips64 -relocation-model=static -mattr=+soft-float -target-abi n64 < %s | FileCheck --check-prefixes=ALL,SYM64,NEW %s11; RUN: llc -mtriple=mips64el -relocation-model=static -mattr=+soft-float -target-abi n64 < %s | FileCheck --check-prefixes=ALL,SYM64,NEW %s12 13; Test the floating point arguments for all ABI's and byte orders as specified14; by section 5 of MD00305 (MIPS ABIs Described).15;16; N32/N64 are identical in this area so their checks have been combined into17; the 'NEW' prefix (the N stands for New).18 19@bytes = global [11 x i8] zeroinitializer20@dwords = global [11 x i64] zeroinitializer21@floats = global [11 x float] zeroinitializer22@doubles = global [11 x double] zeroinitializer23 24define void @double_args(double %a, double %b, double %c, double %d, double %e,25 double %f, double %g, double %h, double %i) nounwind {26entry:27 %0 = getelementptr [11 x double], ptr @doubles, i32 0, i32 128 store volatile double %a, ptr %029 %1 = getelementptr [11 x double], ptr @doubles, i32 0, i32 230 store volatile double %b, ptr %131 %2 = getelementptr [11 x double], ptr @doubles, i32 0, i32 332 store volatile double %c, ptr %233 %3 = getelementptr [11 x double], ptr @doubles, i32 0, i32 434 store volatile double %d, ptr %335 %4 = getelementptr [11 x double], ptr @doubles, i32 0, i32 536 store volatile double %e, ptr %437 %5 = getelementptr [11 x double], ptr @doubles, i32 0, i32 638 store volatile double %f, ptr %539 %6 = getelementptr [11 x double], ptr @doubles, i32 0, i32 740 store volatile double %g, ptr %641 %7 = getelementptr [11 x double], ptr @doubles, i32 0, i32 842 store volatile double %h, ptr %743 %8 = getelementptr [11 x double], ptr @doubles, i32 0, i32 944 store volatile double %i, ptr %845 ret void46}47 48; ALL-LABEL: double_args:49; We won't test the way the global address is calculated in this test. This is50; just to get the register number for the other checks.51; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(doubles)52; SYM64-DAG: daddiu [[R2:\$[0-9]]], ${{[0-9]+}}, %lo(doubles)53 54; The first four arguments are the same in O32/N32/N64.55; The first argument is floating point but soft-float is enabled so floating56; point registers are not used.57; O32-DAG: sw $4, 8([[R2]])58; O32-DAG: sw $5, 12([[R2]])59; NEW-DAG: sd $4, 8([[R2]])60 61; O32-DAG: sw $6, 16([[R2]])62; O32-DAG: sw $7, 20([[R2]])63; NEW-DAG: sd $5, 16([[R2]])64 65; O32 has run out of argument registers and starts using the stack66; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 16($sp)67; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 20($sp)68; O32-DAG: sw [[R3]], 24([[R2]])69; O32-DAG: sw [[R4]], 28([[R2]])70; NEW-DAG: sd $6, 24([[R2]])71 72; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 24($sp)73; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 28($sp)74; O32-DAG: sw [[R3]], 32([[R2]])75; O32-DAG: sw [[R4]], 36([[R2]])76; NEW-DAG: sd $7, 32([[R2]])77 78; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 32($sp)79; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 36($sp)80; O32-DAG: sw [[R3]], 40([[R2]])81; O32-DAG: sw [[R4]], 44([[R2]])82; NEW-DAG: sd $8, 40([[R2]])83 84; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 40($sp)85; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 44($sp)86; O32-DAG: sw [[R3]], 48([[R2]])87; O32-DAG: sw [[R4]], 52([[R2]])88; NEW-DAG: sd $9, 48([[R2]])89 90; O32-DAG: lw [[R3:\$([0-9]+|gp)]], 48($sp)91; O32-DAG: lw [[R4:\$([0-9]+|gp)]], 52($sp)92; O32-DAG: sw [[R3]], 56([[R2]])93; O32-DAG: sw [[R4]], 60([[R2]])94; NEW-DAG: sd $10, 56([[R2]])95 96; N32/N64 have run out of registers and starts using the stack too97; O32-DAG: lw [[R3:\$[0-9]+]], 56($sp)98; O32-DAG: lw [[R4:\$[0-9]+]], 60($sp)99; O32-DAG: sw [[R3]], 64([[R2]])100; O32-DAG: sw [[R4]], 68([[R2]])101; NEW-DAG: ld [[R3:\$[0-9]+]], 0($sp)102; NEW-DAG: sd $11, 64([[R2]])103 104define void @float_args(float %a, float %b, float %c, float %d, float %e,105 float %f, float %g, float %h, float %i, float %j)106 nounwind {107entry:108 %0 = getelementptr [11 x float], ptr @floats, i32 0, i32 1109 store volatile float %a, ptr %0110 %1 = getelementptr [11 x float], ptr @floats, i32 0, i32 2111 store volatile float %b, ptr %1112 %2 = getelementptr [11 x float], ptr @floats, i32 0, i32 3113 store volatile float %c, ptr %2114 %3 = getelementptr [11 x float], ptr @floats, i32 0, i32 4115 store volatile float %d, ptr %3116 %4 = getelementptr [11 x float], ptr @floats, i32 0, i32 5117 store volatile float %e, ptr %4118 %5 = getelementptr [11 x float], ptr @floats, i32 0, i32 6119 store volatile float %f, ptr %5120 %6 = getelementptr [11 x float], ptr @floats, i32 0, i32 7121 store volatile float %g, ptr %6122 %7 = getelementptr [11 x float], ptr @floats, i32 0, i32 8123 store volatile float %h, ptr %7124 %8 = getelementptr [11 x float], ptr @floats, i32 0, i32 9125 store volatile float %i, ptr %8126 %9 = getelementptr [11 x float], ptr @floats, i32 0, i32 10127 store volatile float %j, ptr %9128 ret void129}130 131; ALL-LABEL: float_args:132; We won't test the way the global address is calculated in this test. This is133; just to get the register number for the other checks.134; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)135; SYM64-DAG: daddiu [[R2:\$[0-9]]], ${{[0-9]+}}, %lo(floats)136 137; The first four arguments are the same in O32/N32/N64.138; The first argument is floating point but soft-float is enabled so floating139; point registers are not used.140; MD00305 and GCC disagree on this one. MD00305 says that floats are treated141; as 8-byte aligned and occupy two slots on O32. GCC is treating them as 4-byte142; aligned and occupying one slot. We'll use GCC's definition.143; ALL-DAG: sw $4, 4([[R2]])144; ALL-DAG: sw $5, 8([[R2]])145; ALL-DAG: sw $6, 12([[R2]])146; ALL-DAG: sw $7, 16([[R2]])147 148; O32 has run out of argument registers and starts using the stack149; O32-DAG: lw [[R3:\$[0-9]+]], 16($sp)150; O32-DAG: sw [[R3]], 20([[R2]])151; NEW-DAG: sw $8, 20([[R2]])152 153; O32-DAG: lw [[R3:\$[0-9]+]], 20($sp)154; O32-DAG: sw [[R3]], 24([[R2]])155; NEW-DAG: sw $9, 24([[R2]])156 157; O32-DAG: lw [[R3:\$[0-9]+]], 24($sp)158; O32-DAG: sw [[R3]], 28([[R2]])159; NEW-DAG: sw $10, 28([[R2]])160 161; O32-DAG: lw [[R3:\$[0-9]+]], 28($sp)162; O32-DAG: sw [[R3]], 32([[R2]])163; NEW-DAG: sw $11, 32([[R2]])164 165; N32/N64 have run out of registers and start using the stack too166; O32-DAG: lw [[R3:\$[0-9]+]], 32($sp)167; O32-DAG: sw [[R3]], 36([[R2]])168; NEW-DAG: lw [[R3:\$[0-9]+]], 0($sp)169; NEW-DAG: sw [[R3]], 36([[R2]])170 171define void @double_arg2(i8 %a, double %b) nounwind {172entry:173 %0 = getelementptr [11 x i8], ptr @bytes, i32 0, i32 1174 store volatile i8 %a, ptr %0175 %1 = getelementptr [11 x double], ptr @doubles, i32 0, i32 1176 store volatile double %b, ptr %1177 ret void178}179 180; ALL-LABEL: double_arg2:181; We won't test the way the global address is calculated in this test. This is182; just to get the register number for the other checks.183; SYM32-DAG: addiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)184; SYM64-DAG: daddiu [[R1:\$[0-9]]], ${{[0-9]+}}, %lo(bytes)185; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(doubles)186; SYM64-DAG: daddiu [[R2:\$[0-9]]], ${{[0-9]+}}, %lo(doubles)187 188; The first four arguments are the same in O32/N32/N64.189; The first argument isn't floating point so floating point registers are not190; used.191; The second slot is insufficiently aligned for double on O32 so it is skipped.192; Also, double occupies two slots on O32 and only one for N32/N64.193; ALL-DAG: sb $4, 1([[R1]])194; O32-DAG: sw $6, 8([[R2]])195; O32-DAG: sw $7, 12([[R2]])196; NEW-DAG: sd $5, 8([[R2]])197 198define void @float_arg2(i8 signext %a, float %b) nounwind {199entry:200 %0 = getelementptr [11 x i8], ptr @bytes, i32 0, i32 1201 store volatile i8 %a, ptr %0202 %1 = getelementptr [11 x float], ptr @floats, i32 0, i32 1203 store volatile float %b, ptr %1204 ret void205}206 207; ALL-LABEL: float_arg2:208; We won't test the way the global address is calculated in this test. This is209; just to get the register number for the other checks.210; SYM32-DAG: addiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)211; SYM64-DAG: daddiu [[R1:\$[0-9]]], ${{[0-9]+}}, %lo(bytes)212; SYM32-DAG: addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)213; SYM64-DAG: daddiu [[R2:\$[0-9]]], ${{[0-9]+}}, %lo(floats)214 215 216; The first four arguments are the same in O32/N32/N64.217; The first argument isn't floating point so floating point registers are not218; used.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; ALL-DAG: sb $4, 1([[R1]])223; ALL-DAG: sw $5, 4([[R2]])224