[flang][openacc] Use OpenACC terminator instead of fir.unreachable after Stop stmt...
[llvm-project.git] / flang / test / Lower / PowerPC / ppc-intrinsics.f90
blob6d6a8ef147520f3b4484948722aa22237c7e3ea9
1 ! RUN: bbc -emit-fir %s -outline-intrinsics -o - | FileCheck --check-prefixes="CHECK-FIR" %s
2 ! RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck --check-prefixes="CHECK-LLVMIR" %s
3 ! REQUIRES: target=powerpc{{.*}}
5 ! CHECK-LABEL: fmadd_testr
6 subroutine fmadd_testr(a, x, y)
7 real :: a, x, y, z
8 z = fmadd(a, x, y)
9 ! CHECK-FIR: fir.call @fir.__ppc_fmadd.contract.f32.f32.f32.f32
10 ! CHECK-LLVMIR: call contract float @llvm.fma.f32(float %{{[0-9]}}, float %{{[0-9]}}, float %{{[0-9]}})
11 end
13 ! CHECK-LABEL: fmadd_testd
14 subroutine fmadd_testd(a, x, y)
15 real(8) :: a, x, y, z
16 z = fmadd(a, x, y)
17 ! CHECK-FIR: fir.call @fir.__ppc_fmadd.contract.f64.f64.f64.f64
18 ! CHECK-LLVMIR: call contract double @llvm.fma.f64(double %{{[0-9]}}, double %{{[0-9]}}, double %{{[0-9]}})
19 end
21 ! CHECK-LABEL: fnmadd_testr
22 subroutine fnmadd_testr(a, x, y)
23 real :: a, x, y, z
24 z = fnmadd(a, x, y)
25 ! CHECK-FIR: fir.call @fir.__ppc_fnmadd.contract.f32.f32.f32.f32
26 ! CHECK-LLVMIR: call contract float @llvm.ppc.fnmadds(float %{{[0-9]}}, float %{{[0-9]}}, float %{{[0-9]}})
27 end
29 ! CHECK-LABEL: fnmadd_testd
30 subroutine fnmadd_testd(a, x, y)
31 real(8) :: a, x, y, z
32 z = fnmadd(a, x, y)
33 ! CHECK-FIR: fir.call @fir.__ppc_fnmadd.contract.f64.f64.f64.f64
34 ! CHECK-LLVMIR: call contract double @llvm.ppc.fnmadd(double %{{[0-9]}}, double %{{[0-9]}}, double %{{[0-9]}})
35 end
37 ! CHECK-LABEL: fmsub_testr
38 subroutine fmsub_testr(a, x, y)
39 real :: a, x, y, z
40 z = fmsub(a, x, y)
41 ! CHECK-FIR: fir.call @fir.__ppc_fmsub.contract.f32.f32.f32.f32
42 ! CHECK-LLVMIR: call contract float @llvm.ppc.fmsubs(float %{{[0-9]}}, float %{{[0-9]}}, float %{{[0-9]}})
43 end
45 ! CHECK-LABEL: fmsub_testd
46 subroutine fmsub_testd(a, x, y)
47 real(8) :: a, x, y, z
48 z = fmsub(a, x, y)
49 ! CHECK-FIR: fir.call @fir.__ppc_fmsub.contract.f64.f64.f64.f64
50 ! CHECK-LLVMIR: call contract double @llvm.ppc.fmsub(double %{{[0-9]}}, double %{{[0-9]}}, double %{{[0-9]}})
51 end
53 ! CHECK-LABEL: fnmsub_testr
54 subroutine fnmsub_testr(a, x, y)
55 real :: a, x, y, z
56 z = fnmsub(a, x, y)
57 ! CHECK-FIR: fir.call @fir.__ppc_fnmsub.contract.f32.f32.f32.f32
58 ! CHECK-LLVMIR: call contract float @llvm.ppc.fnmsub.f32(float %{{[0-9]}}, float %{{[0-9]}}, float %{{[0-9]}})
59 end
61 ! CHECK-LABEL: fnmsub_testd
62 subroutine fnmsub_testd(a, x, y)
63 real(8) :: a, x, y, z
64 z = fnmsub(a, x, y)
65 ! CHECK-FIR: fir.call @fir.__ppc_fnmsub.contract.f64.f64.f64.f64
66 ! CHECK-LLVMIR: call contract double @llvm.ppc.fnmsub.f64(double %{{[0-9]}}, double %{{[0-9]}}, double %{{[0-9]}})
67 end
69 ! CHECK-LABEL: fctid_test
70 subroutine fctid_test(x)
71 real(8) :: x, r
72 r = fctid(x)
73 ! CHECK-FIR: fir.call @fir.__ppc_fctid.contract.f64.f64
74 ! CHECK-LLVMIR: call contract double @llvm.ppc.fctid(double %{{[0-9]}})
75 end
77 ! CHECK-LABEL: fctidz_test
78 subroutine fctidz_test(x)
79 real(8) :: x, r
80 r = fctidz(x)
81 ! CHECK-FIR: fir.call @fir.__ppc_fctidz.contract.f64.f64
82 ! CHECK-LLVMIR: call contract double @llvm.ppc.fctidz(double %{{[0-9]}})
83 end
85 ! CHECK-LABEL: fctiw_test
86 subroutine fctiw_test(x)
87 real(8) :: x, r
88 r = fctiw(x)
89 ! CHECK-FIR: fir.call @fir.__ppc_fctiw.contract.f64.f64
90 ! CHECK-LLVMIR: call contract double @llvm.ppc.fctiw(double %{{[0-9]}})
91 end
93 ! CHECK-LABEL: fctiwz_test
94 subroutine fctiwz_test(x)
95 real(8) :: x, r
96 r = fctiwz(x)
97 ! CHECK-FIR: fir.call @fir.__ppc_fctiwz.contract.f64.f64
98 ! CHECK-LLVMIR: call contract double @llvm.ppc.fctiwz(double %{{[0-9]}})
99 end
101 ! CHECK-LABEL: fctudz_test
102 subroutine fctudz_test(x)
103 real(8) :: x, r
104 r = fctudz(x)
105 ! CHECK-FIR: fir.call @fir.__ppc_fctudz.contract.f64.f64
106 ! CHECK-LLVMIR: call contract double @llvm.ppc.fctudz(double %{{[0-9]}})
109 ! CHECK-LABEL: fctuwz_test
110 subroutine fctuwz_test(x)
111 real(8) :: x, r
112 r = fctuwz(x)
113 ! CHECK-FIR: fir.call @fir.__ppc_fctuwz.contract.f64.f64
114 ! CHECK-LLVMIR: call contract double @llvm.ppc.fctuwz(double %{{[0-9]}})
117 ! CHECK-LABEL: fcfi_test
118 subroutine fcfi_test(i)
119 real(8) :: i, r
120 r = fcfi(i)
121 ! CHECK-FIR: fir.call @fir.__ppc_fcfi.contract.f64.f64
122 ! CHECK-LLVMIR: call contract double @llvm.ppc.fcfid(double %{{[0-9]}})
125 ! CHECK-LABEL: fcfid_test
126 subroutine fcfid_test(i)
127 real(8) :: i, r
128 r = fcfid(i)
129 ! CHECK-FIR: fir.call @fir.__ppc_fcfid.contract.f64.f64
130 ! CHECK-LLVMIR: call contract double @llvm.ppc.fcfid(double %{{[0-9]}})
133 ! CHECK-LABEL: fcfud_test
134 subroutine fcfud_test(i)
135 real(8) :: i, r
136 r = fcfud(i)
137 ! CHECK-FIR: fir.call @fir.__ppc_fcfud.contract.f64.f64
138 ! CHECK-LLVMIR: call contract double @llvm.ppc.fcfud(double %{{[0-9]}})
141 ! CHECK-LABEL: fnabs_testr(x)
142 subroutine fnabs_testr(x)
143 real :: x, y
144 y = fnabs(x)
145 ! CHECK-FIR: fir.call @fir.__ppc_fnabs.contract.f32.f32
146 ! CHECK-LLVMIR: call contract float @llvm.ppc.fnabss(float %{{[0-9]}})
149 ! CHECK-LABEL: fnabs_testd(x)
150 subroutine fnabs_testd(x)
151 real(8) :: x, y
152 y = fnabs(x)
153 ! CHECK-FIR: fir.call @fir.__ppc_fnabs.contract.f64.f64
154 ! CHECK-LLVMIR: call contract double @llvm.ppc.fnabs(double %{{[0-9]}})
157 !CHECK-LABEL: fre_test(x)
158 subroutine fre_test(x)
159 real(8) :: x, y
160 y = fre(x)
161 ! CHECK-FIR: fir.call @fir.__ppc_fre.contract.f64.f64
162 ! CHECK-LLVMIR: call contract double @llvm.ppc.fre(double %{{[0-9]}})
165 !CHECK-LABEL: fres_test(x)
166 subroutine fres_test(x)
167 real :: x, y
168 y = fres(x)
169 ! CHECK-FIR: fir.call @fir.__ppc_fres.contract.f32.f32
170 ! CHECK-LLVMIR: call contract float @llvm.ppc.fres(float %{{[0-9]}})
173 !CHECK-LABEL: frsqrte_test(x)
174 subroutine frsqrte_test(x)
175 real(8) :: x, y
176 y = frsqrte(x)
177 ! CHECK-FIR: fir.call @fir.__ppc_frsqrte.contract.f64.f64
178 ! CHECK-LLVMIR: call contract double @llvm.ppc.frsqrte(double %{{[0-9]}})
181 !CHECK-LABEL: frsqrtes_test(x)
182 subroutine frsqrtes_test(x)
183 real :: x, y
184 y = frsqrtes(x)
185 ! CHECK-FIR: fir.call @fir.__ppc_frsqrtes.contract.f32.f32
186 ! CHECK-LLVMIR: call contract float @llvm.ppc.frsqrtes(float %{{[0-9]}})
189 ! CHECK-LABEL: mtfsf_test
190 subroutine mtfsf_test(r)
191 real(8) :: r
192 call mtfsf(1, r)
193 ! CHECK-FIR: fir.call @fir.__ppc_mtfsf.void.i32.f64
194 ! CHECK-LLVMIR: call void @llvm.ppc.mtfsf(i32 {{[0-9]}}, double %{{[0-9]}})
197 ! CHECK-LABEL: mtfsfi_test
198 subroutine mtfsfi_test()
199 call mtfsfi(1, 2)
200 ! CHECK-FIR: fir.call @fir.__ppc_mtfsfi.void.i32.i32
201 ! CHECK-LLVMIR: call void @llvm.ppc.mtfsfi(i32 {{[0-9]}}, i32 {{[0-9]}})