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=LA32F
3 ; RUN: llc --mtriple=loongarch32 --mattr=+d < %s | FileCheck %s --check-prefix=LA32D
4 ; RUN: llc --mtriple=loongarch64 --mattr=+f,-d < %s | FileCheck %s --check-prefix=LA64F
5 ; RUN: llc --mtriple=loongarch64 --mattr=+d < %s | FileCheck %s --check-prefix=LA64D
7 define float @rint_f32(float %f) nounwind {
8 ; LA32F-LABEL: rint_f32:
9 ; LA32F: # %bb.0: # %entry
10 ; LA32F-NEXT: b %plt(rintf)
12 ; LA32D-LABEL: rint_f32:
13 ; LA32D: # %bb.0: # %entry
14 ; LA32D-NEXT: b %plt(rintf)
16 ; LA64F-LABEL: rint_f32:
17 ; LA64F: # %bb.0: # %entry
18 ; LA64F-NEXT: frint.s $fa0, $fa0
21 ; LA64D-LABEL: rint_f32:
22 ; LA64D: # %bb.0: # %entry
23 ; LA64D-NEXT: frint.s $fa0, $fa0
26 %0 = tail call float @llvm.rint.f32(float %f)
30 declare float @llvm.rint.f32(float)
32 define double @rint_f64(double %d) nounwind {
33 ; LA32F-LABEL: rint_f64:
34 ; LA32F: # %bb.0: # %entry
35 ; LA32F-NEXT: addi.w $sp, $sp, -16
36 ; LA32F-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
37 ; LA32F-NEXT: bl %plt(rint)
38 ; LA32F-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
39 ; LA32F-NEXT: addi.w $sp, $sp, 16
42 ; LA32D-LABEL: rint_f64:
43 ; LA32D: # %bb.0: # %entry
44 ; LA32D-NEXT: b %plt(rint)
46 ; LA64F-LABEL: rint_f64:
47 ; LA64F: # %bb.0: # %entry
48 ; LA64F-NEXT: addi.d $sp, $sp, -16
49 ; LA64F-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
50 ; LA64F-NEXT: bl %plt(rint)
51 ; LA64F-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
52 ; LA64F-NEXT: addi.d $sp, $sp, 16
55 ; LA64D-LABEL: rint_f64:
56 ; LA64D: # %bb.0: # %entry
57 ; LA64D-NEXT: frint.d $fa0, $fa0
60 %0 = tail call double @llvm.rint.f64(double %d)
64 declare double @llvm.rint.f64(double)