1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include <stdio.h>
  26 #include <stdint.h>
  27 
  28 #include "jni.h"
  29 
  30 #ifdef __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 jfloat SS(jfloat f1, jfloat f2) {
  35   return f1 + f2;
  36 }
  37 
  38 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getFF(JNIEnv *env, jclass clazz) {
  39   return (jlong)(intptr_t)SS;
  40 }
  41 
  42 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1FF(JNIEnv *env, jclass clazz, jfloat a, jfloat b) {
  43   return SS(a, b);
  44 }
  45 
  46 jfloat SDILDS(jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  47   return (jfloat)(a + b + c + d + e + f);
  48 }
  49 
  50 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getSDILDS
  51   (JNIEnv *env, jclass clazz) {
  52   return (jlong)(intptr_t)SDILDS;
  53 }
  54 
  55 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1SDILDS
  56   (JNIEnv *env, jclass clazz, jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  57         return SDILDS(a, b, c, d, e, f);
  58 }
  59 
  60 jfloat S32SDILDS(
  61         jfloat f00, jfloat f01, jfloat f02, jfloat f03, jfloat f04, jfloat f05, jfloat f06, jfloat f07,
  62         jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f,
  63         jfloat f10, jfloat f11, jfloat f12, jfloat f13, jfloat f14, jfloat f15, jfloat f16, jfloat f17,
  64         jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f,
  65                 jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  66   return (jfloat)(
  67           f00 + f01 + f02 + f03 + f04 + f05 + f06 + f07 +
  68           f08 + f09 + f0a + f0b + f0c + f0d + f0e +  f0f +
  69           f10 + f11 + f12 + f13 + f14 + f15 + f16 + f17 +
  70           f18 + f19 + f1a + f1b + f1c + f1d + f1e + f1f +
  71                         a +   b +   c +   d +   e + f);
  72 }
  73 
  74 JNIEXPORT jlong JNICALL Java_jdk_vm_ci_code_test_NativeCallTest_getS32SDILDS
  75   (JNIEnv *env, jclass clazz) {
  76         return (jlong)(intptr_t)S32SDILDS;
  77 }
  78 
  79 JNIEXPORT jfloat JNICALL Java_jdk_vm_ci_code_test_NativeCallTest__1S32SDILDS
  80   (JNIEnv *env, jclass clazz,
  81           jfloat f00, jfloat f01, jfloat f02, jfloat f03, jfloat f04, jfloat f05, jfloat f06, jfloat f07,
  82           jfloat f08, jfloat f09, jfloat f0a, jfloat f0b, jfloat f0c, jfloat f0d, jfloat f0e, jfloat f0f,
  83           jfloat f10, jfloat f11, jfloat f12, jfloat f13, jfloat f14, jfloat f15, jfloat f16, jfloat f17,
  84           jfloat f18, jfloat f19, jfloat f1a, jfloat f1b, jfloat f1c, jfloat f1d, jfloat f1e, jfloat f1f,
  85                   jfloat a, jdouble b, jint c, jlong d, jdouble e, jfloat f) {
  86         return S32SDILDS(
  87             f00, f01, f02, f03, f04, f05, f06, f07,
  88             f08, f09, f0a, f0b, f0c, f0d, f0e, f0f,
  89             f10, f11, f12, f13, f14, f15, f16, f17,
  90             f18, f19, f1a, f1b, f1c, f1d, f1e, f1f,
  91                                 a,   b,   c,   d,   e,   f);
  92 }
  93 
  94 #ifdef __cplusplus
  95 }
  96 #endif
  97