1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 --mattr=+f,-d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 --mattr=+f,-d < %s | FileCheck %s --check-prefix=LA64
5 define float @f32_positive_zero() nounwind {
6 ; LA32-LABEL: f32_positive_zero:
8 ; LA32-NEXT: movgr2fr.w $fa0, $zero
11 ; LA64-LABEL: f32_positive_zero:
13 ; LA64-NEXT: movgr2fr.w $fa0, $zero
18 define float @f32_negative_zero() nounwind {
19 ; LA32-LABEL: f32_negative_zero:
21 ; LA32-NEXT: movgr2fr.w $fa0, $zero
22 ; LA32-NEXT: fneg.s $fa0, $fa0
25 ; LA64-LABEL: f32_negative_zero:
27 ; LA64-NEXT: movgr2fr.w $fa0, $zero
28 ; LA64-NEXT: fneg.s $fa0, $fa0
33 define float @f32_constant_pi() nounwind {
34 ; LA32-LABEL: f32_constant_pi:
36 ; LA32-NEXT: pcalau12i $a0, %pc_hi20(.LCPI2_0)
37 ; LA32-NEXT: addi.w $a0, $a0, %pc_lo12(.LCPI2_0)
38 ; LA32-NEXT: fld.s $fa0, $a0, 0
41 ; LA64-LABEL: f32_constant_pi:
43 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(.LCPI2_0)
44 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(.LCPI2_0)
45 ; LA64-NEXT: fld.s $fa0, $a0, 0
47 ret float 3.14159274101257324218750
50 define float @f32_add_fimm1(float %a) nounwind {
51 ; LA32-LABEL: f32_add_fimm1:
53 ; LA32-NEXT: addi.w $a0, $zero, 1
54 ; LA32-NEXT: movgr2fr.w $fa1, $a0
55 ; LA32-NEXT: ffint.s.w $fa1, $fa1
56 ; LA32-NEXT: fadd.s $fa0, $fa0, $fa1
59 ; LA64-LABEL: f32_add_fimm1:
61 ; LA64-NEXT: addi.w $a0, $zero, 1
62 ; LA64-NEXT: movgr2fr.w $fa1, $a0
63 ; LA64-NEXT: ffint.s.w $fa1, $fa1
64 ; LA64-NEXT: fadd.s $fa0, $fa0, $fa1
66 %1 = fadd float %a, 1.0
70 define float @f32_positive_fimm1() nounwind {
71 ; LA32-LABEL: f32_positive_fimm1:
73 ; LA32-NEXT: addi.w $a0, $zero, 1
74 ; LA32-NEXT: movgr2fr.w $fa0, $a0
75 ; LA32-NEXT: ffint.s.w $fa0, $fa0
78 ; LA64-LABEL: f32_positive_fimm1:
80 ; LA64-NEXT: addi.w $a0, $zero, 1
81 ; LA64-NEXT: movgr2fr.w $fa0, $a0
82 ; LA64-NEXT: ffint.s.w $fa0, $fa0