brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.9 KiB · 4edc463 Raw
215 lines · plain
1; RUN: llc -mtriple=mips -relocation-model=static < %s | FileCheck --check-prefixes=ALL,SYM32,O32,O32BE %s2; RUN: llc -mtriple=mipsel -relocation-model=static < %s | FileCheck --check-prefixes=ALL,SYM32,O32,O32LE %s3 4; RUN-TODO: llc -mtriple=mips64 -relocation-model=static -target-abi o32 < %s | FileCheck --check-prefixes=ALL,SYM32,O32 %s5; RUN-TODO: llc -mtriple=mips64el -relocation-model=static -target-abi o32 < %s | FileCheck --check-prefixes=ALL,SYM32,O32 %s6 7; RUN: llc -mtriple=mips64 -relocation-model=static -target-abi n32 < %s | FileCheck --check-prefixes=ALL,SYM32,NEW %s8; RUN: llc -mtriple=mips64el -relocation-model=static -target-abi n32 < %s | FileCheck --check-prefixes=ALL,SYM32,NEW %s9 10; RUN: llc -mtriple=mips64 -relocation-model=static -target-abi n64 < %s | FileCheck --check-prefixes=ALL,SYM64,NEW %s11; RUN: llc -mtriple=mips64el -relocation-model=static -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 argument is floating point so floating point registers are used.55; The first argument is the same for O32/N32/N64 but the second argument differs56; by register57; ALL-DAG:           sdc1 $f12, 8([[R2]])58; O32-DAG:           sdc1 $f14, 16([[R2]])59; NEW-DAG:           sdc1 $f13, 16([[R2]])60 61; O32 has run out of argument registers and starts using the stack62; O32-DAG:           ldc1 [[F1:\$f[0-9]+]], 16($sp)63; O32-DAG:           sdc1 [[F1]], 24([[R2]])64; NEW-DAG:           sdc1 $f14, 24([[R2]])65; O32-DAG:           ldc1 [[F1:\$f[0-9]+]], 24($sp)66; O32-DAG:           sdc1 [[F1]], 32([[R2]])67; NEW-DAG:           sdc1 $f15, 32([[R2]])68; O32-DAG:           ldc1 [[F1:\$f[0-9]+]], 32($sp)69; O32-DAG:           sdc1 [[F1]], 40([[R2]])70; NEW-DAG:           sdc1 $f16, 40([[R2]])71; O32-DAG:           ldc1 [[F1:\$f[0-9]+]], 40($sp)72; O32-DAG:           sdc1 [[F1]], 48([[R2]])73; NEW-DAG:           sdc1 $f17, 48([[R2]])74; O32-DAG:           ldc1 [[F1:\$f[0-9]+]], 48($sp)75; O32-DAG:           sdc1 [[F1]], 56([[R2]])76; NEW-DAG:           sdc1 $f18, 56([[R2]])77; O32-DAG:           ldc1 [[F1:\$f[0-9]+]], 56($sp)78; O32-DAG:           sdc1 [[F1]], 64([[R2]])79; NEW-DAG:           sdc1 $f19, 64([[R2]])80 81; N32/N64 have run out of registers and start using the stack too82; O32-DAG:           ldc1 [[F1:\$f[0-9]+]], 64($sp)83; O32-DAG:           sdc1 [[F1]], 72([[R2]])84; NEW-DAG:           ldc1 [[F1:\$f[0-9]+]], 0($sp)85; NEW-DAG:           sdc1 [[F1]], 72([[R2]])86 87define void @float_args(float %a, float %b, float %c, float %d, float %e,88                        float %f, float %g, float %h, float %i) nounwind {89entry:90        %0 = getelementptr [11 x float], ptr @floats, i32 0, i32 191        store volatile float %a, ptr %092        %1 = getelementptr [11 x float], ptr @floats, i32 0, i32 293        store volatile float %b, ptr %194        %2 = getelementptr [11 x float], ptr @floats, i32 0, i32 395        store volatile float %c, ptr %296        %3 = getelementptr [11 x float], ptr @floats, i32 0, i32 497        store volatile float %d, ptr %398        %4 = getelementptr [11 x float], ptr @floats, i32 0, i32 599        store volatile float %e, ptr %4100        %5 = getelementptr [11 x float], ptr @floats, i32 0, i32 6101        store volatile float %f, ptr %5102        %6 = getelementptr [11 x float], ptr @floats, i32 0, i32 7103        store volatile float %g, ptr %6104        %7 = getelementptr [11 x float], ptr @floats, i32 0, i32 8105        store volatile float %h, ptr %7106        %8 = getelementptr [11 x float], ptr @floats, i32 0, i32 9107        store volatile float %i, ptr %8108        ret void109}110 111; ALL-LABEL: float_args:112; We won't test the way the global address is calculated in this test. This is113; just to get the register number for the other checks.114; SYM32-DAG:           addiu  [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)115; SYM64-DAG:           daddiu [[R1:\$[0-9]]], ${{[0-9]+}}, %lo(floats)116 117; The first argument is floating point so floating point registers are used.118; The first argument is the same for O32/N32/N64 but the second argument differs119; by register120; ALL-DAG:           swc1 $f12, 4([[R1]])121; O32-DAG:           swc1 $f14, 8([[R1]])122; NEW-DAG:           swc1 $f13, 8([[R1]])123 124; O32 has run out of argument registers and (in theory) starts using the stack125; I've yet to find a reference in the documentation about this but GCC uses up126; the remaining two argument slots in the GPR's first. We'll do the same for127; compatibility.128; O32-DAG:           mtc1 $6, $f0129; O32-DAG:           swc1 $f0, 12([[R1]])130; NEW-DAG:           swc1 $f14, 12([[R1]])131; O32-DAG:           mtc1 $7, $f0132; O32-DAG:           swc1 $f0, 16([[R1]])133; NEW-DAG:           swc1 $f15, 16([[R1]])134 135; O32 is definitely out of registers now and switches to the stack.136; O32-DAG:           lwc1 [[F1:\$f[0-9]+]], 16($sp)137; O32-DAG:           swc1 [[F1]], 20([[R1]])138; NEW-DAG:           swc1 $f16, 20([[R1]])139; O32-DAG:           lwc1 [[F1:\$f[0-9]+]], 20($sp)140; O32-DAG:           swc1 [[F1]], 24([[R1]])141; NEW-DAG:           swc1 $f17, 24([[R1]])142; O32-DAG:           lwc1 [[F1:\$f[0-9]+]], 24($sp)143; O32-DAG:           swc1 [[F1]], 28([[R1]])144; NEW-DAG:           swc1 $f18, 28([[R1]])145; O32-DAG:           lwc1 [[F1:\$f[0-9]+]], 28($sp)146; O32-DAG:           swc1 [[F1]], 32([[R1]])147; NEW-DAG:           swc1 $f19, 32([[R1]])148 149; N32/N64 have run out of registers and start using the stack too150; O32-DAG:           lwc1 [[F1:\$f[0-9]+]], 32($sp)151; O32-DAG:           swc1 [[F1]], 36([[R1]])152; NEW-DAG:           lwc1 [[F1:\$f[0-9]+]], 0($sp)153; NEW-DAG:           swc1 [[F1]], 36([[R1]])154 155 156define void @double_arg2(i8 %a, double %b) nounwind {157entry:158        %0 = getelementptr [11 x i8], ptr @bytes, i32 0, i32 1159        store volatile i8 %a, ptr %0160        %1 = getelementptr [11 x double], ptr @doubles, i32 0, i32 1161        store volatile double %b, ptr %1162        ret void163}164 165; ALL-LABEL: double_arg2:166; We won't test the way the global address is calculated in this test. This is167; just to get the register number for the other checks.168; SYM32-DAG:           addiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)169; SYM64-DAG:           daddiu [[R1:\$[0-9]]], ${{[0-9]+}}, %lo(bytes)170; SYM32-DAG:           addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(doubles)171; SYM64-DAG:           daddiu [[R2:\$[0-9]]], ${{[0-9]+}}, %lo(doubles)172 173; The first argument is the same in O32/N32/N64.174; ALL-DAG:           sb $4, 1([[R1]])175 176; The first argument isn't floating point so floating point registers are not177; used in O32, but N32/N64 will still use them.178; The second slot is insufficiently aligned for double on O32 so it is skipped.179; Also, double occupies two slots on O32 and only one for N32/N64.180; O32LE-DAG:           mtc1 $6, [[F1:\$f[0-9]*[02468]+]]181; O32LE-DAG:           mtc1 $7, [[F2:\$f[0-9]*[13579]+]]182; O32BE-DAG:           mtc1 $6, [[F2:\$f[0-9]*[13579]+]]183; O32BE-DAG:           mtc1 $7, [[F1:\$f[0-9]*[02468]+]]184; O32-DAG:           sdc1 [[F1]], 8([[R2]])185; NEW-DAG:           sdc1 $f13, 8([[R2]])186 187define void @float_arg2(i8 %a, float %b) nounwind {188entry:189        %0 = getelementptr [11 x i8], ptr @bytes, i32 0, i32 1190        store volatile i8 %a, ptr %0191        %1 = getelementptr [11 x float], ptr @floats, i32 0, i32 1192        store volatile float %b, ptr %1193        ret void194}195 196; ALL-LABEL: float_arg2:197; We won't test the way the global address is calculated in this test. This is198; just to get the register number for the other checks.199; SYM32-DAG:           addiu [[R1:\$[0-9]+]], ${{[0-9]+}}, %lo(bytes)200; SYM64-DAG:           daddiu [[R1:\$[0-9]]], ${{[0-9]+}}, %lo(bytes)201; SYM32-DAG:           addiu [[R2:\$[0-9]+]], ${{[0-9]+}}, %lo(floats)202; SYM64-DAG:           daddiu [[R2:\$[0-9]]], ${{[0-9]+}}, %lo(floats)203 204; The first argument is the same in O32/N32/N64.205; ALL-DAG:           sb $4, 1([[R1]])206 207; The first argument isn't floating point so floating point registers are not208; used in O32, but N32/N64 will still use them.209; MD00305 and GCC disagree on this one. MD00305 says that floats are treated210; as 8-byte aligned and occupy two slots on O32. GCC is treating them as 4-byte211; aligned and occupying one slot. We'll use GCC's definition.212; O32-DAG:           mtc1 $5, $f0213; O32-DAG:           swc1 $f0, 4([[R2]])214; NEW-DAG:           swc1 $f13, 4([[R2]])215