1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 --mattr=+d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 --mattr=+d < %s | FileCheck %s --check-prefix=LA64
5 define double @f64_positive_zero() nounwind {
6 ; LA32-LABEL: f64_positive_zero:
8 ; LA32-NEXT: movgr2fr.w $fa0, $zero
9 ; LA32-NEXT: movgr2frh.w $fa0, $zero
12 ; LA64-LABEL: f64_positive_zero:
14 ; LA64-NEXT: movgr2fr.d $fa0, $zero
19 define double @f64_negative_zero() nounwind {
20 ; LA32-LABEL: f64_negative_zero:
22 ; LA32-NEXT: movgr2fr.w $fa0, $zero
23 ; LA32-NEXT: movgr2frh.w $fa0, $zero
24 ; LA32-NEXT: fneg.d $fa0, $fa0
27 ; LA64-LABEL: f64_negative_zero:
29 ; LA64-NEXT: movgr2fr.d $fa0, $zero
30 ; LA64-NEXT: fneg.d $fa0, $fa0
35 define double @f64_constant_pi() nounwind {
36 ; LA32-LABEL: f64_constant_pi:
38 ; LA32-NEXT: pcalau12i $a0, %pc_hi20(.LCPI2_0)
39 ; LA32-NEXT: addi.w $a0, $a0, %pc_lo12(.LCPI2_0)
40 ; LA32-NEXT: fld.d $fa0, $a0, 0
43 ; LA64-LABEL: f64_constant_pi:
45 ; LA64-NEXT: pcalau12i $a0, %pc_hi20(.LCPI2_0)
46 ; LA64-NEXT: addi.d $a0, $a0, %pc_lo12(.LCPI2_0)
47 ; LA64-NEXT: fld.d $fa0, $a0, 0
49 ret double 3.1415926535897931159979634685441851615905761718750
52 define double @f64_add_fimm1(double %a) nounwind {
53 ; LA32-LABEL: f64_add_fimm1:
55 ; LA32-NEXT: addi.w $a0, $zero, 1
56 ; LA32-NEXT: movgr2fr.w $fa1, $a0
57 ; LA32-NEXT: ffint.s.w $fa1, $fa1
58 ; LA32-NEXT: fcvt.d.s $fa1, $fa1
59 ; LA32-NEXT: fadd.d $fa0, $fa0, $fa1
62 ; LA64-LABEL: f64_add_fimm1:
64 ; LA64-NEXT: addi.d $a0, $zero, 1
65 ; LA64-NEXT: movgr2fr.d $fa1, $a0
66 ; LA64-NEXT: ffint.d.l $fa1, $fa1
67 ; LA64-NEXT: fadd.d $fa0, $fa0, $fa1
69 %1 = fadd double %a, 1.0
73 define double @f64_positive_fimm1() nounwind {
74 ; LA32-LABEL: f64_positive_fimm1:
76 ; LA32-NEXT: addi.w $a0, $zero, 1
77 ; LA32-NEXT: movgr2fr.w $fa0, $a0
78 ; LA32-NEXT: ffint.s.w $fa0, $fa0
79 ; LA32-NEXT: fcvt.d.s $fa0, $fa0
82 ; LA64-LABEL: f64_positive_fimm1:
84 ; LA64-NEXT: addi.d $a0, $zero, 1
85 ; LA64-NEXT: movgr2fr.d $fa0, $a0
86 ; LA64-NEXT: ffint.d.l $fa0, $fa0