[Mips] Add additional half float tests (NFC)
For https://github.com/llvm/llvm-project/pull/110199.
diff --git a/llvm/test/CodeGen/Mips/fp16-promote.ll b/llvm/test/CodeGen/Mips/fp16-promote.ll
index 348cf38..ae032d3 100644
--- a/llvm/test/CodeGen/Mips/fp16-promote.ll
+++ b/llvm/test/CodeGen/Mips/fp16-promote.ll
@@ -260,3 +260,65 @@
ret void
}
+define half @test_fadd_fadd(half %a, half %b, half %c) nounwind {
+; CHECK-LIBCALL-LABEL: test_fadd_fadd:
+; CHECK-LIBCALL: # %bb.0:
+; CHECK-LIBCALL-NEXT: addiu $sp, $sp, -32
+; CHECK-LIBCALL-NEXT: sdc1 $f20, 24($sp) # 8-byte Folded Spill
+; CHECK-LIBCALL-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
+; CHECK-LIBCALL-NEXT: sw $16, 16($sp) # 4-byte Folded Spill
+; CHECK-LIBCALL-NEXT: move $16, $6
+; CHECK-LIBCALL-NEXT: mov.s $f20, $f12
+; CHECK-LIBCALL-NEXT: jal __gnu_f2h_ieee
+; CHECK-LIBCALL-NEXT: mov.s $f12, $f14
+; CHECK-LIBCALL-NEXT: jal __gnu_h2f_ieee
+; CHECK-LIBCALL-NEXT: move $4, $2
+; CHECK-LIBCALL-NEXT: mov.s $f21, $f0
+; CHECK-LIBCALL-NEXT: jal __gnu_f2h_ieee
+; CHECK-LIBCALL-NEXT: mov.s $f12, $f20
+; CHECK-LIBCALL-NEXT: jal __gnu_h2f_ieee
+; CHECK-LIBCALL-NEXT: move $4, $2
+; CHECK-LIBCALL-NEXT: add.s $f20, $f0, $f21
+; CHECK-LIBCALL-NEXT: jal __gnu_f2h_ieee
+; CHECK-LIBCALL-NEXT: mtc1 $16, $f12
+; CHECK-LIBCALL-NEXT: jal __gnu_h2f_ieee
+; CHECK-LIBCALL-NEXT: move $4, $2
+; CHECK-LIBCALL-NEXT: add.s $f0, $f20, $f0
+; CHECK-LIBCALL-NEXT: lw $16, 16($sp) # 4-byte Folded Reload
+; CHECK-LIBCALL-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
+; CHECK-LIBCALL-NEXT: ldc1 $f20, 24($sp) # 8-byte Folded Reload
+; CHECK-LIBCALL-NEXT: jr $ra
+; CHECK-LIBCALL-NEXT: addiu $sp, $sp, 32
+ %d = fadd half %a, %b
+ %e = fadd half %d, %c
+ ret half %e
+}
+
+define half @to_half(i16 %bits) nounwind {
+; CHECK-LIBCALL-LABEL: to_half:
+; CHECK-LIBCALL: # %bb.0:
+; CHECK-LIBCALL-NEXT: addiu $sp, $sp, -24
+; CHECK-LIBCALL-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
+; CHECK-LIBCALL-NEXT: jal __gnu_h2f_ieee
+; CHECK-LIBCALL-NEXT: nop
+; CHECK-LIBCALL-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
+; CHECK-LIBCALL-NEXT: jr $ra
+; CHECK-LIBCALL-NEXT: addiu $sp, $sp, 24
+ %f = bitcast i16 %bits to half
+ ret half %f
+}
+
+define i16 @from_half(half %f) nounwind {
+; CHECK-LIBCALL-LABEL: from_half:
+; CHECK-LIBCALL: # %bb.0:
+; CHECK-LIBCALL-NEXT: addiu $sp, $sp, -24
+; CHECK-LIBCALL-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
+; CHECK-LIBCALL-NEXT: jal __gnu_f2h_ieee
+; CHECK-LIBCALL-NEXT: nop
+; CHECK-LIBCALL-NEXT: andi $2, $2, 65535
+; CHECK-LIBCALL-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
+; CHECK-LIBCALL-NEXT: jr $ra
+; CHECK-LIBCALL-NEXT: addiu $sp, $sp, 24
+ %bits = bitcast half %f to i16
+ ret i16 %bits
+}