1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32,FP32 3; RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32,FP64 4 5define float @float_in_fpr(float %a, float %b) { 6; MIPS32-LABEL: float_in_fpr: 7; MIPS32: # %bb.0: # %entry 8; MIPS32-NEXT: mov.s $f0, $f14 9; MIPS32-NEXT: jr $ra 10; MIPS32-NEXT: nop 11entry: 12 ret float %b 13} 14 15define double @double_in_fpr(double %a, double %b) { 16; MIPS32-LABEL: double_in_fpr: 17; MIPS32: # %bb.0: # %entry 18; MIPS32-NEXT: mov.d $f0, $f14 19; MIPS32-NEXT: jr $ra 20; MIPS32-NEXT: nop 21entry: 22 ret double %b 23} 24 25define float @float_in_gpr(i32 %a, float %b) { 26; MIPS32-LABEL: float_in_gpr: 27; MIPS32: # %bb.0: # %entry 28; MIPS32-NEXT: mtc1 $5, $f0 29; MIPS32-NEXT: jr $ra 30; MIPS32-NEXT: nop 31entry: 32 ret float %b 33} 34 35define double @double_in_gpr(i32 %a, double %b) { 36; FP32-LABEL: double_in_gpr: 37; FP32: # %bb.0: # %entry 38; FP32-NEXT: mtc1 $6, $f0 39; FP32-NEXT: mtc1 $7, $f1 40; FP32-NEXT: jr $ra 41; FP32-NEXT: nop 42; 43; FP64-LABEL: double_in_gpr: 44; FP64: # %bb.0: # %entry 45; FP64-NEXT: mtc1 $6, $f0 46; FP64-NEXT: mthc1 $7, $f0 47; FP64-NEXT: jr $ra 48; FP64-NEXT: nop 49entry: 50 ret double %b 51} 52 53define float @call_float_in_fpr(float %a, float %b) { 54; MIPS32-LABEL: call_float_in_fpr: 55; MIPS32: # %bb.0: # %entry 56; MIPS32-NEXT: addiu $sp, $sp, -24 57; MIPS32-NEXT: .cfi_def_cfa_offset 24 58; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 59; MIPS32-NEXT: .cfi_offset 31, -4 60; MIPS32-NEXT: jal float_in_fpr 61; MIPS32-NEXT: nop 62; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 63; MIPS32-NEXT: addiu $sp, $sp, 24 64; MIPS32-NEXT: jr $ra 65; MIPS32-NEXT: nop 66entry: 67 %call = call float @float_in_fpr(float %a, float %b) 68 ret float %call 69} 70 71define double @call_double_in_fpr(double %a, double %b) { 72; MIPS32-LABEL: call_double_in_fpr: 73; MIPS32: # %bb.0: # %entry 74; MIPS32-NEXT: addiu $sp, $sp, -24 75; MIPS32-NEXT: .cfi_def_cfa_offset 24 76; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 77; MIPS32-NEXT: .cfi_offset 31, -4 78; MIPS32-NEXT: jal double_in_fpr 79; MIPS32-NEXT: nop 80; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 81; MIPS32-NEXT: addiu $sp, $sp, 24 82; MIPS32-NEXT: jr $ra 83; MIPS32-NEXT: nop 84entry: 85 %call = call double @double_in_fpr(double %a, double %b) 86 ret double %call 87} 88 89define float @call_float_in_gpr(i32 %a, float %b) { 90; MIPS32-LABEL: call_float_in_gpr: 91; MIPS32: # %bb.0: # %entry 92; MIPS32-NEXT: addiu $sp, $sp, -24 93; MIPS32-NEXT: .cfi_def_cfa_offset 24 94; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 95; MIPS32-NEXT: .cfi_offset 31, -4 96; MIPS32-NEXT: jal float_in_gpr 97; MIPS32-NEXT: nop 98; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 99; MIPS32-NEXT: addiu $sp, $sp, 24 100; MIPS32-NEXT: jr $ra 101; MIPS32-NEXT: nop 102entry: 103 %call = call float @float_in_gpr(i32 %a, float %b) 104 ret float %call 105} 106 107 108define double @call_double_in_gpr(i32 %a, double %b) { 109; MIPS32-LABEL: call_double_in_gpr: 110; MIPS32: # %bb.0: # %entry 111; MIPS32-NEXT: addiu $sp, $sp, -24 112; MIPS32-NEXT: .cfi_def_cfa_offset 24 113; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 114; MIPS32-NEXT: .cfi_offset 31, -4 115; MIPS32-NEXT: jal double_in_gpr 116; MIPS32-NEXT: nop 117; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 118; MIPS32-NEXT: addiu $sp, $sp, 24 119; MIPS32-NEXT: jr $ra 120; MIPS32-NEXT: nop 121entry: 122 %call = call double @double_in_gpr(i32 %a, double %b) 123 ret double %call 124} 125