1 /*
2  * Copyright (c) 2017-2018, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 /* Low level (backend) f90 merge intrinsics:
19  * These functions are not in the usual hpf/f90 rte directory because
20  * their calls are not generated  by the front-end.
21  */
22 
23 #include <stdint.h>
24 
25 int
ftn_i_imerge(int tsource,int fsource,int mask)26 ftn_i_imerge(int tsource, int fsource, int mask)
27 {
28   return mask ? tsource : fsource;
29 }
30 
31 int64_t
ftn_i_kmerge(int64_t tsource,int64_t fsource,int mask)32 ftn_i_kmerge(int64_t tsource, int64_t fsource, int mask)
33 {
34   return mask ? tsource : fsource;
35 }
36 
37 float
ftn_i_rmerge(float tsource,float fsource,int mask)38 ftn_i_rmerge(float tsource, float fsource, int mask)
39 {
40   return mask ? tsource : fsource;
41 }
42 
43 double
ftn_i_dmerge(double tsource,double fsource,int mask)44 ftn_i_dmerge(double tsource, double fsource, int mask)
45 {
46   return mask ? tsource : fsource;
47 }
48