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 @fldx_s(ptr %a, i64 %idx) nounwind {
10 ; LA32F-NEXT: slli.w $a1, $a1, 2
11 ; LA32F-NEXT: fldx.s $fa0, $a0, $a1
14 ; LA32D-LABEL: fldx_s:
16 ; LA32D-NEXT: slli.w $a1, $a1, 2
17 ; LA32D-NEXT: fldx.s $fa0, $a0, $a1
20 ; LA64F-LABEL: fldx_s:
22 ; LA64F-NEXT: slli.d $a1, $a1, 2
23 ; LA64F-NEXT: fldx.s $fa0, $a0, $a1
26 ; LA64D-LABEL: fldx_s:
28 ; LA64D-NEXT: slli.d $a1, $a1, 2
29 ; LA64D-NEXT: fldx.s $fa0, $a0, $a1
31 %1 = getelementptr float, ptr %a, i64 %idx
32 %2 = load float, ptr %1
36 define double @fldx_d(ptr %a, i64 %idx) nounwind {
37 ; LA32F-LABEL: fldx_d:
39 ; LA32F-NEXT: alsl.w $a1, $a1, $a0, 3
40 ; LA32F-NEXT: ld.w $a0, $a1, 0
41 ; LA32F-NEXT: ld.w $a1, $a1, 4
44 ; LA32D-LABEL: fldx_d:
46 ; LA32D-NEXT: slli.w $a1, $a1, 3
47 ; LA32D-NEXT: fldx.d $fa0, $a0, $a1
50 ; LA64F-LABEL: fldx_d:
52 ; LA64F-NEXT: slli.d $a1, $a1, 3
53 ; LA64F-NEXT: ldx.d $a0, $a0, $a1
56 ; LA64D-LABEL: fldx_d:
58 ; LA64D-NEXT: slli.d $a1, $a1, 3
59 ; LA64D-NEXT: fldx.d $fa0, $a0, $a1
61 %1 = getelementptr double, ptr %a, i64 %idx
62 %2 = load double, ptr %1
66 define void @fstx_s(ptr %dst, i64 %idx, float %val) nounwind {
67 ; LA32F-LABEL: fstx_s:
69 ; LA32F-NEXT: slli.w $a1, $a1, 2
70 ; LA32F-NEXT: fstx.s $fa0, $a0, $a1
73 ; LA32D-LABEL: fstx_s:
75 ; LA32D-NEXT: slli.w $a1, $a1, 2
76 ; LA32D-NEXT: fstx.s $fa0, $a0, $a1
79 ; LA64F-LABEL: fstx_s:
81 ; LA64F-NEXT: slli.d $a1, $a1, 2
82 ; LA64F-NEXT: fstx.s $fa0, $a0, $a1
85 ; LA64D-LABEL: fstx_s:
87 ; LA64D-NEXT: slli.d $a1, $a1, 2
88 ; LA64D-NEXT: fstx.s $fa0, $a0, $a1
90 %1 = getelementptr float, ptr %dst, i64 %idx
91 store float %val, ptr %1
95 define void @fstx_d(ptr %dst, i64 %idx, double %val) nounwind {
96 ; LA32F-LABEL: fstx_d:
98 ; LA32F-NEXT: alsl.w $a0, $a1, $a0, 3
99 ; LA32F-NEXT: st.w $a4, $a0, 4
100 ; LA32F-NEXT: st.w $a3, $a0, 0
103 ; LA32D-LABEL: fstx_d:
105 ; LA32D-NEXT: slli.w $a1, $a1, 3
106 ; LA32D-NEXT: fstx.d $fa0, $a0, $a1
109 ; LA64F-LABEL: fstx_d:
111 ; LA64F-NEXT: slli.d $a1, $a1, 3
112 ; LA64F-NEXT: stx.d $a2, $a0, $a1
115 ; LA64D-LABEL: fstx_d:
117 ; LA64D-NEXT: slli.d $a1, $a1, 3
118 ; LA64D-NEXT: fstx.d $fa0, $a0, $a1
120 %1 = getelementptr double, ptr %dst, i64 %idx
121 store double %val, ptr %1