Merge "EncodeDecodeTest: Test both VP8 and AVC"
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index dab7b67..8a37b72 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -139,7 +139,10 @@
cts_native_exes := \
NativeMediaTest_SL \
NativeMediaTest_XA \
- bionic-unit-tests-cts \
+
+ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
+cts_native_exes += bionic-unit-tests-cts
+endif
cts_ui_tests := \
CtsUiAutomatorTests
@@ -164,4 +167,4 @@
# The following files will be placed in the tools directory of the CTS distribution
-CTS_TOOLS_LIST :=
\ No newline at end of file
+CTS_TOOLS_LIST :=
diff --git a/apps/CtsVerifier/res/layout/intent_driven_test.xml b/apps/CtsVerifier/res/layout/intent_driven_test.xml
index 1b68074..67329d4 100644
--- a/apps/CtsVerifier/res/layout/intent_driven_test.xml
+++ b/apps/CtsVerifier/res/layout/intent_driven_test.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
@@ -24,13 +24,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- >
<include layout="@layout/pass_fail_buttons"/>
</LinearLayout>
-</RelativeLayout>
+
+</ScrollView>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
old mode 100644
new mode 100755
index 7856591..3e52ed8
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
@@ -34,13 +34,17 @@
import android.os.Handler;
import android.util.Log;
import android.util.SparseArray;
+import android.view.Menu;
+import android.view.MenuItem;
import android.view.View;
import android.view.Surface;
import android.view.TextureView;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.ImageView;
import android.widget.Spinner;
+import android.widget.Toast;
import java.io.IOException;
import java.lang.InterruptedException;
@@ -100,11 +104,22 @@
private TreeSet<String> mTestedCombinations = new TreeSet<String>();
private TreeSet<String> mUntestedCombinations = new TreeSet<String>();
+ private int mAllCombinationsSize = 0;
+
+ // Menu to show the test progress
+ private static final int MENU_ID_PROGRESS = Menu.FIRST + 1;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cf_main);
+
+ mAllCombinationsSize = calcAllCombinationsSize();
+
+ // disable "Pass" button until all combinations are tested
+ setPassButtonEnabled(false);
+
setPassFailButtonClickListeners();
setInfoResources(R.string.camera_format, R.string.cf_info, -1);
@@ -161,6 +176,36 @@
}
@Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ menu.add(Menu.NONE, MENU_ID_PROGRESS, Menu.NONE, "Current Progress");
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ boolean ret = true;
+ switch (item.getItemId()) {
+ case MENU_ID_PROGRESS:
+ showCombinationsDialog();
+ ret = true;
+ break;
+ default:
+ ret = super.onOptionsItemSelected(item);
+ break;
+ }
+ return ret;
+ }
+
+ private void showCombinationsDialog() {
+ AlertDialog.Builder builder =
+ new AlertDialog.Builder(CameraFormatsActivity.this);
+ builder.setMessage(getTestDetails())
+ .setTitle("Current Progress")
+ .setPositiveButton("OK", null);
+ builder.show();
+ }
+
+ @Override
public void onResume() {
super.onResume();
@@ -402,9 +447,15 @@
float widthRatio = mNextPreviewSize.width / (float)mPreviewTexWidth;
float heightRatio = mNextPreviewSize.height / (float)mPreviewTexHeight;
- transform.setScale(1, heightRatio/widthRatio);
- transform.postTranslate(0,
+ if (heightRatio < widthRatio) {
+ transform.setScale(1, heightRatio/widthRatio);
+ transform.postTranslate(0,
mPreviewTexHeight * (1 - heightRatio/widthRatio)/2);
+ } else {
+ transform.setScale(widthRatio/heightRatio, 1);
+ transform.postTranslate(mPreviewTexWidth * (1 - widthRatio/heightRatio)/2,
+ 0);
+ }
mPreviewView.setTransform(transform);
@@ -520,6 +571,12 @@
+ "\n";
mUntestedCombinations.remove(combination);
mTestedCombinations.add(combination);
+
+ displayToast(combination.replace("\n", ""));
+
+ if (mTestedCombinations.size() == mAllCombinationsSize) {
+ setPassButtonEnabled(true);
+ }
}
}
mProcessInProgress = false;
@@ -527,6 +584,34 @@
}
+ private void setPassButtonEnabled(boolean enabled) {
+ Button pass_button = (Button) findViewById(R.id.pass_button);
+ pass_button.setEnabled(enabled);
+ }
+
+ private int calcAllCombinationsSize() {
+ int allCombinationsSize = 0;
+ int numCameras = Camera.getNumberOfCameras();
+
+ for (int i = 0; i<numCameras; i++) {
+ // must release a Camera object before a new Camera object is created
+ shutdownCamera();
+
+ mCamera = Camera.open(i);
+ Camera.Parameters p = mCamera.getParameters();
+
+ allCombinationsSize +=
+ p.getSupportedPreviewSizes().size() * // resolutions
+ p.getSupportedPreviewFormats().size(); // formats
+ }
+
+ return allCombinationsSize;
+ }
+
+ private void displayToast(String combination) {
+ Toast.makeText(this, "\"" + combination + "\"\n" + " has been tested.", Toast.LENGTH_LONG).show();
+ }
+
public void onPreviewFrame(byte[] data, Camera camera) {
if (mProcessInProgress || mState != STATE_PREVIEW) return;
@@ -720,4 +805,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/build/test_executable.mk b/build/test_executable.mk
index 74b3a95..fb41b73 100644
--- a/build/test_executable.mk
+++ b/build/test_executable.mk
@@ -27,14 +27,15 @@
cts_executable_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).xml
-$(cts_executable_xml): PRIVATE_PATH := $(cts_src_test_path)
$(cts_executable_xml): PRIVATE_TEST_PACKAGE := $(LOCAL_CTS_TEST_PACKAGE)
$(cts_executable_xml): PRIVATE_EXECUTABLE := $(LOCAL_MODULE)
-$(cts_executable_xml): $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) $(CTS_EXPECTATIONS) $(CTS_NATIVE_TEST_SCANNER) $(CTS_XML_GENERATOR)
+$(cts_executable_xml): PRIVATE_LIST_EXECUTABLE := $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)_list
+$(cts_executable_xml): $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)_list
+$(cts_executable_xml): $(addprefix $(LOCAL_PATH)/,$(LOCAL_SRC_FILES)) $(CTS_EXPECTATIONS) $(CTS_NATIVE_TEST_SCANNER) $(CTS_XML_GENERATOR) $(cts_list_executable)
$(hide) echo Generating test description for native package $(PRIVATE_TEST_PACKAGE)
$(hide) mkdir -p $(CTS_TESTCASES_OUT)
- $(hide) $(CTS_NATIVE_TEST_SCANNER) -s $(PRIVATE_PATH) \
- -t $(PRIVATE_TEST_PACKAGE) | \
+ $(hide) $(PRIVATE_LIST_EXECUTABLE) --gtest_list_tests | \
+ $(CTS_NATIVE_TEST_SCANNER) -t $(PRIVATE_TEST_PACKAGE) | \
$(CTS_XML_GENERATOR) -t native \
-n $(PRIVATE_EXECUTABLE) \
-p $(PRIVATE_TEST_PACKAGE) \
diff --git a/hostsidetests/aadb/src/com/android/cts/aadb/TestDeviceStressTest.java b/hostsidetests/aadb/src/com/android/cts/aadb/TestDeviceStressTest.java
index c780fb9..2c6fcef 100644
--- a/hostsidetests/aadb/src/com/android/cts/aadb/TestDeviceStressTest.java
+++ b/hostsidetests/aadb/src/com/android/cts/aadb/TestDeviceStressTest.java
@@ -36,7 +36,7 @@
*/
public class TestDeviceStressTest extends DeviceTestCase {
- private int mIterations = 50;
+ private int mIterations = 25;
private static final String LOG_TAG = "TestDeviceStressTest";
private static final int TEST_FILE_COUNT= 200;
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
index f38236b..5b4d9f7 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
@@ -274,8 +274,38 @@
}
}
+ private static boolean isWhiteList(File file) {
+ final String[] whiteLists = {
+ "autorun.inf", ".android_secure", "android_secure"
+ };
+ if (file.getParentFile().getAbsolutePath().equals(
+ Environment.getExternalStorageDirectory().getAbsolutePath())) {
+ for (String whiteList : whiteLists) {
+ if (file.getName().equalsIgnoreCase(whiteList)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static File[] removeWhiteList(File[] files) {
+ List<File> fileList = new ArrayList<File>();
+ if (files == null) {
+ return null;
+ }
+
+ for (File file : files) {
+ if (!isWhiteList(file)) {
+ fileList.add(file);
+ }
+ }
+ return fileList.toArray(new File[fileList.size()]);
+ }
+
public static void deleteContents(File dir) throws IOException {
File[] files = dir.listFiles();
+ files = removeWhiteList(files);
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
@@ -283,7 +313,9 @@
}
assertTrue(file.delete());
}
- assertEquals(0, dir.listFiles().length);
+
+ File[] dirs = removeWhiteList(dir.listFiles());
+ assertEquals(0, dirs.length);
}
}
diff --git a/libs/testserver/src/android/webkit/cts/CtsTestServer.java b/libs/testserver/src/android/webkit/cts/CtsTestServer.java
index e4ac46e..928a68e 100644
--- a/libs/testserver/src/android/webkit/cts/CtsTestServer.java
+++ b/libs/testserver/src/android/webkit/cts/CtsTestServer.java
@@ -59,6 +59,7 @@
import java.net.Socket;
import java.net.URI;
import java.net.URL;
+import java.net.URLEncoder;
import java.net.URLConnection;
import java.security.KeyManagementException;
import java.security.KeyStore;
@@ -106,6 +107,7 @@
public static final String APPCACHE_PATH = "/appcache.html";
public static final String APPCACHE_MANIFEST_PATH = "/appcache.manifest";
public static final String REDIRECT_PREFIX = "/redirect";
+ public static final String QUERY_REDIRECT_PATH = "/alt_redirect";
public static final String DELAY_PREFIX = "/delayed";
public static final String BINARY_PREFIX = "/binary";
public static final String COOKIE_PREFIX = "/cookie";
@@ -339,6 +341,24 @@
return sb.toString();
}
+ /**
+ * Return an absolute URL that indirectly refers to the given asset, without having
+ * the destination path be part of the redirecting path.
+ * When a client fetches this URL, the server will respond with a temporary redirect (302)
+ * referring to the absolute URL of the given asset.
+ * @param path The path of the asset. See {@link AssetManager#open(String)}
+ */
+ public String getQueryRedirectingAssetUrl(String path) {
+ StringBuilder sb = new StringBuilder(getBaseUri());
+ sb.append(QUERY_REDIRECT_PATH);
+ sb.append("?dest=");
+ try {
+ sb.append(URLEncoder.encode(getAssetUrl(path), "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ }
+ return sb.toString();
+ }
+
public String getBinaryUrl(String mimeType, int contentLength) {
StringBuilder sb = new StringBuilder(getBaseUri());
sb.append(BINARY_PREFIX);
@@ -585,6 +605,13 @@
String location = getBaseUri() + path.substring(REDIRECT_PREFIX.length());
Log.i(TAG, "Redirecting to: " + location);
response.addHeader("Location", location);
+ } else if (path.equals(QUERY_REDIRECT_PATH)) {
+ String location = Uri.parse(uriString).getQueryParameter("dest");
+ if (location != null) {
+ Log.i(TAG, "Redirecting to: " + location);
+ response = createResponse(HttpStatus.SC_MOVED_TEMPORARILY);
+ response.addHeader("Location", location);
+ }
} else if (path.startsWith(COOKIE_PREFIX)) {
/*
* Return a page with a title containing a list of all incoming cookies,
diff --git a/suite/cts/deviceTests/opengl/jni/Android.mk b/suite/cts/deviceTests/opengl/jni/Android.mk
index 8f10509..7b58170 100644
--- a/suite/cts/deviceTests/opengl/jni/Android.mk
+++ b/suite/cts/deviceTests/opengl/jni/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_TAGS := optional
# Needed in order to use fences for synchronization
-LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES
+LOCAL_CFLAGS += -DEGL_EGLEXT_PROTOTYPES -funsigned-char
# Get all cpp files but not hidden files
LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \
diff --git a/suite/cts/hostTests/jank/app/src/com/android/cts/jank/opengl/CtsDeviceJankOpenGl.java b/suite/cts/hostTests/jank/app/src/com/android/cts/jank/opengl/CtsDeviceJankOpenGl.java
index 00bb73b..fbe3cd6 100644
--- a/suite/cts/hostTests/jank/app/src/com/android/cts/jank/opengl/CtsDeviceJankOpenGl.java
+++ b/suite/cts/hostTests/jank/app/src/com/android/cts/jank/opengl/CtsDeviceJankOpenGl.java
@@ -63,7 +63,7 @@
sb.append(String.format(START_CMD, COMPONENT));
sb.append(String.format(INTENT_STRING_EXTRA, "benchmark_name", benchmark));
sb.append(String.format(INTENT_BOOLEAN_EXTRA, "offscreen", false));
- sb.append(String.format(INTENT_INTEGER_EXTRA, "num_frames", 200));
+ sb.append(String.format(INTENT_INTEGER_EXTRA, "num_frames", 400));
sb.append(String.format(INTENT_INTEGER_EXTRA, "num_iterations", 1));
sb.append(String.format(INTENT_INTEGER_EXTRA, "timeout", 10000));
final String startCommand = sb.toString();
diff --git a/tests/SignatureTest/Android.mk b/tests/SignatureTest/Android.mk
index 209e78a..696f99e 100644
--- a/tests/SignatureTest/Android.mk
+++ b/tests/SignatureTest/Android.mk
@@ -44,8 +44,6 @@
include $(BUILD_CTS_PACKAGE)
-$(info $(call local-intermediates-dir))
-
generated_res_stamp := $(intermediates.COMMON)/genres.stamp
api_ver_file := $(intermediates.COMMON)/api_ver_is_$(CTS_API_VERSION)
diff --git a/tests/core/libcore/com/Android.mk b/tests/core/libcore/com/Android.mk
index 02dc3de..db08dbd 100644
--- a/tests/core/libcore/com/Android.mk
+++ b/tests/core/libcore/com/Android.mk
@@ -14,10 +14,6 @@
LOCAL_PATH:= $(call my-dir)
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.com
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
diff --git a/tests/core/libcore/dalvik/Android.mk b/tests/core/libcore/dalvik/Android.mk
index 7b77a75..42d14f3 100644
--- a/tests/core/libcore/dalvik/Android.mk
+++ b/tests/core/libcore/dalvik/Android.mk
@@ -14,10 +14,6 @@
LOCAL_PATH:= $(call my-dir)
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.dalvik
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
diff --git a/tests/core/libcore/harmony_annotation/Android.mk b/tests/core/libcore/harmony_annotation/Android.mk
new file mode 100644
index 0000000..e9f716e
--- /dev/null
+++ b/tests/core/libcore/harmony_annotation/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_annotation
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_annotation/AndroidManifest.xml b/tests/core/libcore/harmony_annotation/AndroidManifest.xml
new file mode 100644
index 0000000..0c59b1b
--- /dev/null
+++ b/tests/core/libcore/harmony_annotation/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_annotation">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_beans/Android.mk b/tests/core/libcore/harmony_beans/Android.mk
new file mode 100644
index 0000000..2131ae0
--- /dev/null
+++ b/tests/core/libcore/harmony_beans/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_beans
+LOCAL_STATIC_JAVA_LIBRARIES := apache-harmony-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_beans/AndroidManifest.xml b/tests/core/libcore/harmony_beans/AndroidManifest.xml
new file mode 100644
index 0000000..b4932dd
--- /dev/null
+++ b/tests/core/libcore/harmony_beans/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_beans">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_java_io/Android.mk b/tests/core/libcore/harmony_java_io/Android.mk
new file mode 100644
index 0000000..a8d4fa0
--- /dev/null
+++ b/tests/core/libcore/harmony_java_io/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_io
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_io/AndroidManifest.xml b/tests/core/libcore/harmony_java_io/AndroidManifest.xml
new file mode 100644
index 0000000..65d64ab
--- /dev/null
+++ b/tests/core/libcore/harmony_java_io/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_java_io">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_java_lang/Android.mk b/tests/core/libcore/harmony_java_lang/Android.mk
new file mode 100644
index 0000000..8b1bdff
--- /dev/null
+++ b/tests/core/libcore/harmony_java_lang/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_lang
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_lang/AndroidManifest.xml b/tests/core/libcore/harmony_java_lang/AndroidManifest.xml
new file mode 100644
index 0000000..a5e499a
--- /dev/null
+++ b/tests/core/libcore/harmony_java_lang/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_java_lang">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_java_math/Android.mk b/tests/core/libcore/harmony_java_math/Android.mk
new file mode 100644
index 0000000..8310743
--- /dev/null
+++ b/tests/core/libcore/harmony_java_math/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_math
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_math/AndroidManifest.xml b/tests/core/libcore/harmony_java_math/AndroidManifest.xml
new file mode 100644
index 0000000..f8cd224
--- /dev/null
+++ b/tests/core/libcore/harmony_java_math/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_java_math">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_java_net/Android.mk b/tests/core/libcore/harmony_java_net/Android.mk
new file mode 100644
index 0000000..7917bcc
--- /dev/null
+++ b/tests/core/libcore/harmony_java_net/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_net
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_net/AndroidManifest.xml b/tests/core/libcore/harmony_java_net/AndroidManifest.xml
new file mode 100644
index 0000000..3c9fd63
--- /dev/null
+++ b/tests/core/libcore/harmony_java_net/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_java_net">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_java_nio/Android.mk b/tests/core/libcore/harmony_java_nio/Android.mk
new file mode 100644
index 0000000..2c6f673
--- /dev/null
+++ b/tests/core/libcore/harmony_java_nio/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_nio
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_nio/AndroidManifest.xml b/tests/core/libcore/harmony_java_nio/AndroidManifest.xml
new file mode 100644
index 0000000..27166d4
--- /dev/null
+++ b/tests/core/libcore/harmony_java_nio/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_java_nio">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_java_text/Android.mk b/tests/core/libcore/harmony_java_text/Android.mk
new file mode 100644
index 0000000..ecd1574
--- /dev/null
+++ b/tests/core/libcore/harmony_java_text/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_text
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_text/AndroidManifest.xml b/tests/core/libcore/harmony_java_text/AndroidManifest.xml
new file mode 100644
index 0000000..0b6beed
--- /dev/null
+++ b/tests/core/libcore/harmony_java_text/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_java_text">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_java_util/Android.mk b/tests/core/libcore/harmony_java_util/Android.mk
new file mode 100644
index 0000000..6d7bded
--- /dev/null
+++ b/tests/core/libcore/harmony_java_util/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_java_util
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_java_util/AndroidManifest.xml b/tests/core/libcore/harmony_java_util/AndroidManifest.xml
new file mode 100644
index 0000000..72fa3ef
--- /dev/null
+++ b/tests/core/libcore/harmony_java_util/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_java_util">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_javax_security/Android.mk b/tests/core/libcore/harmony_javax_security/Android.mk
new file mode 100644
index 0000000..011940d
--- /dev/null
+++ b/tests/core/libcore/harmony_javax_security/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_javax_security
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_javax_security/AndroidManifest.xml b/tests/core/libcore/harmony_javax_security/AndroidManifest.xml
new file mode 100644
index 0000000..b7b35f2
--- /dev/null
+++ b/tests/core/libcore/harmony_javax_security/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_javax_security">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_logging/Android.mk b/tests/core/libcore/harmony_logging/Android.mk
new file mode 100644
index 0000000..2ec10f1
--- /dev/null
+++ b/tests/core/libcore/harmony_logging/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_logging
+LOCAL_STATIC_JAVA_LIBRARIES := apache-harmony-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_logging/AndroidManifest.xml b/tests/core/libcore/harmony_logging/AndroidManifest.xml
new file mode 100644
index 0000000..94ee60e
--- /dev/null
+++ b/tests/core/libcore/harmony_logging/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_logging">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_prefs/Android.mk b/tests/core/libcore/harmony_prefs/Android.mk
new file mode 100644
index 0000000..92b0c7d
--- /dev/null
+++ b/tests/core/libcore/harmony_prefs/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_prefs
+LOCAL_STATIC_JAVA_LIBRARIES := apache-harmony-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_prefs/AndroidManifest.xml b/tests/core/libcore/harmony_prefs/AndroidManifest.xml
new file mode 100644
index 0000000..f8fdea2
--- /dev/null
+++ b/tests/core/libcore/harmony_prefs/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_prefs">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/harmony_sql/Android.mk b/tests/core/libcore/harmony_sql/Android.mk
new file mode 100644
index 0000000..b1df215
--- /dev/null
+++ b/tests/core/libcore/harmony_sql/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2012 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifeq ($(BUILD_CTSCORE_PACKAGE),)
+ $(error BUILD_CTSCORE_PACKAGE must be defined)
+endif
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.harmony_sql
+LOCAL_STATIC_JAVA_LIBRARIES := apache-harmony-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/harmony_sql/AndroidManifest.xml b/tests/core/libcore/harmony_sql/AndroidManifest.xml
new file mode 100644
index 0000000..c6c31b2
--- /dev/null
+++ b/tests/core/libcore/harmony_sql/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.harmony_sql">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/jsr166/Android.mk b/tests/core/libcore/jsr166/Android.mk
new file mode 100644
index 0000000..3f9871e
--- /dev/null
+++ b/tests/core/libcore/jsr166/Android.mk
@@ -0,0 +1,20 @@
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.jsr166
+LOCAL_STATIC_JAVA_LIBRARIES := jsr166-tests
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/jsr166/AndroidManifest.xml b/tests/core/libcore/jsr166/AndroidManifest.xml
new file mode 100644
index 0000000..3a0150e
--- /dev/null
+++ b/tests/core/libcore/jsr166/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.core.tests.libcore.package.jsr166">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/libcore/libcore/Android.mk b/tests/core/libcore/libcore/Android.mk
index 382b386..a86d2c0 100644
--- a/tests/core/libcore/libcore/Android.mk
+++ b/tests/core/libcore/libcore/Android.mk
@@ -14,10 +14,6 @@
LOCAL_PATH:= $(call my-dir)
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.libcore
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
diff --git a/tests/core/libcore/org/Android.mk b/tests/core/libcore/org/Android.mk
index d7a96b3..0f3f0ca 100644
--- a/tests/core/libcore/org/Android.mk
+++ b/tests/core/libcore/org/Android.mk
@@ -14,10 +14,6 @@
LOCAL_PATH:= $(call my-dir)
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.org
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
diff --git a/tests/core/libcore/sun/Android.mk b/tests/core/libcore/sun/Android.mk
index 44d3d70..ed6d2c7 100644
--- a/tests/core/libcore/sun/Android.mk
+++ b/tests/core/libcore/sun/Android.mk
@@ -14,10 +14,6 @@
LOCAL_PATH:= $(call my-dir)
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.sun
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
diff --git a/tests/core/libcore/tests/Android.mk b/tests/core/libcore/tests/Android.mk
index bfd235f..54ffd31 100644
--- a/tests/core/libcore/tests/Android.mk
+++ b/tests/core/libcore/tests/Android.mk
@@ -14,10 +14,6 @@
LOCAL_PATH:= $(call my-dir)
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.tests
LOCAL_STATIC_JAVA_LIBRARIES := core-tests
diff --git a/tests/expectations/knownfailures.txt b/tests/expectations/knownfailures.txt
index 5eaff9b..9b089df 100644
--- a/tests/expectations/knownfailures.txt
+++ b/tests/expectations/knownfailures.txt
@@ -29,15 +29,5 @@
name: "android.hardware.cts.SensorIntegrationTests#testSensorsWithSeveralClients",
name: "android.hardware.cts.SensorIntegrationTests#testSensorsMovingRates",
bug: 11352697
-},
-{
- name: "android.bionic.DEATHTEST",
- name: "android.bionic.TEST_NAME",
- name: "android.bionic.dlfcn",
- name: "android.bionic.math#isfinite",
- name: "android.bionic.math#signbit",
- name: "android.bionic.stack_protector",
- name: "android.bionic.stack_unwinding_DeathTest",
- bug: 11119006
}
]
diff --git a/tests/jni/Android.mk b/tests/jni/Android.mk
index 0f7511e..28aa15a 100644
--- a/tests/jni/Android.mk
+++ b/tests/jni/Android.mk
@@ -23,11 +23,12 @@
LOCAL_SRC_FILES := \
CtsJniOnLoad.cpp \
+ android_os_cts_TaggedPointer.cpp \
android_os_cts_OSFeatures.cpp \
android_os_cts_FileUtils.cpp \
android_net_cts_NetlinkSocket.cpp
-LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
+LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
LOCAL_SHARED_LIBRARIES := libnativehelper liblog
diff --git a/tests/jni/CtsJniOnLoad.cpp b/tests/jni/CtsJniOnLoad.cpp
index 99ea37e..e0bb813 100644
--- a/tests/jni/CtsJniOnLoad.cpp
+++ b/tests/jni/CtsJniOnLoad.cpp
@@ -20,6 +20,8 @@
extern int register_android_os_cts_CpuFeatures(JNIEnv*);
+extern int register_android_os_cts_TaggedPointer(JNIEnv*);
+
extern int register_android_os_cts_OSFeatures(JNIEnv*);
extern int register_android_os_cts_FileUtils(JNIEnv*);
@@ -35,6 +37,10 @@
return JNI_ERR;
}
+ if (register_android_os_cts_TaggedPointer(env)) {
+ return JNI_ERR;
+ }
+
if (register_android_os_cts_OSFeatures(env)) {
return JNI_ERR;
}
diff --git a/tests/jni/android_os_cts_CpuFeatures.cpp b/tests/jni/android_os_cts_CpuFeatures.cpp
index 053b44e..5276257 100644
--- a/tests/jni/android_os_cts_CpuFeatures.cpp
+++ b/tests/jni/android_os_cts_CpuFeatures.cpp
@@ -42,6 +42,24 @@
return cpuFamily == ANDROID_CPU_FAMILY_X86;
}
+jboolean android_os_cts_CpuFeatures_isArm64Cpu(JNIEnv* env, jobject thiz)
+{
+ AndroidCpuFamily cpuFamily = android_getCpuFamily();
+ return cpuFamily == ANDROID_CPU_FAMILY_ARM64;
+}
+
+jboolean android_os_cts_CpuFeatures_isMips64Cpu(JNIEnv* env, jobject thiz)
+{
+ AndroidCpuFamily cpuFamily = android_getCpuFamily();
+ return cpuFamily == ANDROID_CPU_FAMILY_MIPS64;
+}
+
+jboolean android_os_cts_CpuFeatures_isX86_64Cpu(JNIEnv* env, jobject thiz)
+{
+ AndroidCpuFamily cpuFamily = android_getCpuFamily();
+ return cpuFamily == ANDROID_CPU_FAMILY_X86_64;
+}
+
static JNINativeMethod gMethods[] = {
{ "isArmCpu", "()Z",
(void *) android_os_cts_CpuFeatures_isArmCpu },
@@ -51,6 +69,12 @@
(void *) android_os_cts_CpuFeatures_isMipsCpu },
{ "isX86Cpu", "()Z",
(void *) android_os_cts_CpuFeatures_isX86Cpu },
+ { "isArm64Cpu", "()Z",
+ (void *) android_os_cts_CpuFeatures_isArm64Cpu },
+ { "isMips64Cpu", "()Z",
+ (void *) android_os_cts_CpuFeatures_isMips64Cpu },
+ { "isX86_64Cpu", "()Z",
+ (void *) android_os_cts_CpuFeatures_isX86_64Cpu },
};
int register_android_os_cts_CpuFeatures(JNIEnv* env)
diff --git a/tests/jni/android_os_cts_TaggedPointer.cpp b/tests/jni/android_os_cts_TaggedPointer.cpp
new file mode 100644
index 0000000..e8f83a3
--- /dev/null
+++ b/tests/jni/android_os_cts_TaggedPointer.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include <jni.h>
+#include <inttypes.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+//mask the top 8 bits
+#define TAG_MASK ((0xFFULL) << 56)
+
+#define PATTERN 0x600DC0DE
+
+static sigjmp_buf jmpenv;
+
+static void sigsegv_handler(int signum) {
+ siglongjmp(jmpenv, 1);
+}
+
+jboolean android_os_cts_TaggedPointer_hasTaggedPointer(JNIEnv* env, jobject thiz)
+{
+ uint32_t data;
+ uint32_t *tagged;
+ uintptr_t tmp;
+ int err;
+ jboolean ret = true;
+ struct sigaction sigsegv_act;
+ struct sigaction oldact;
+
+ tmp = TAG_MASK | (uintptr_t)(&data);
+ tagged = (uint32_t *)tmp;
+ data = PATTERN;
+
+ memset(&sigsegv_act, 0, sizeof(sigsegv_act));
+ sigsegv_act.sa_handler = sigsegv_handler;
+
+ err = sigaction(SIGSEGV, &sigsegv_act, &oldact);
+ if (err) {
+ ret = false;
+ goto err_sigaction;
+ }
+
+ if (sigsetjmp(jmpenv, 1)) {
+ ret = false;
+ goto err_segfault;
+ }
+
+ if (*tagged != PATTERN) {
+ ret = false;
+ }
+
+err_segfault:
+ sigaction(SIGSEGV, &oldact, NULL);
+err_sigaction:
+ return ret;
+}
+
+static JNINativeMethod gMethods[] = {
+ { "hasTaggedPointer", "()Z",
+ (void *) android_os_cts_TaggedPointer_hasTaggedPointer },
+};
+
+int register_android_os_cts_TaggedPointer(JNIEnv* env)
+{
+ jclass clazz = env->FindClass("android/os/cts/TaggedPointer");
+
+ return env->RegisterNatives(clazz, gMethods,
+ sizeof(gMethods) / sizeof(JNINativeMethod));
+}
diff --git a/tests/plans/CTS-flaky.xml b/tests/plans/CTS-flaky.xml
index ee64ba0..5317d96 100644
--- a/tests/plans/CTS-flaky.xml
+++ b/tests/plans/CTS-flaky.xml
@@ -6,7 +6,7 @@
<Entry uri="android.mediastress" exclude="android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay00;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay10;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay11;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay07;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay08;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay10;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay05;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay11;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay06;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay03;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay04;android.mediastress.cts.MediaRecorderStressTest#testStressRecorder;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay01;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay02;android.mediastress.cts.H263QcifShortPlayerTest#testPlay07;android.mediastress.cts.MediaRecorderStressTest#testStressCamera;android.mediastress.cts.H263QcifShortPlayerTest#testPlay08;android.mediastress.cts.H263QcifShortPlayerTest#testPlay05;android.mediastress.cts.H263QcifShortPlayerTest#testPlay06;android.mediastress.cts.H263QcifShortPlayerTest#testPlay03;android.mediastress.cts.H263QcifShortPlayerTest#testPlay04;android.mediastress.cts.H263QcifShortPlayerTest#testPlay01;android.mediastress.cts.H263QcifShortPlayerTest#testPlay02;android.mediastress.cts.H264R720pAacLongPlayerTest#testPlay01;android.mediastress.cts.H264R720pAacLongPlayerTest#testPlay00;android.mediastress.cts.MediaRecorderStressTest#testStressCameraSwitchRecorder;android.mediastress.cts.H263QcifShortPlayerTest#testPlay09;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay06;android.mediastress.cts.NativeMediaTest#test1080pPlay;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay05;android.mediastress.cts.NativeMediaTest#testDefaultPlay;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay08;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay07;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay02;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay03;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay09;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay00;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay01;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay06;android.mediastress.cts.H263QcifShortPlayerTest#testPlay00;android.mediastress.cts.H264R1080pAacShortPlayerTest#testPlay00;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay07;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay04;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay00;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay05;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay02;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay01;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay08;android.mediastress.cts.H264R1080pAacShortPlayerTest#testPlay02;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay04;android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay09;android.mediastress.cts.H264R1080pAacShortPlayerTest#testPlay01;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay03;android.mediastress.cts.H264R1080pAacRepeatedPlayerTest#testPlay00;android.mediastress.cts.H263QcifShortPlayerTest#testPlay13;android.mediastress.cts.H263QcifShortPlayerTest#testPlay12;android.mediastress.cts.H263QcifShortPlayerTest#testPlay15;android.mediastress.cts.H263QcifShortPlayerTest#testPlay14;android.mediastress.cts.H263QcifLongPlayerTest#testPlay00;android.mediastress.cts.H263QcifShortPlayerTest#testPlay17;android.mediastress.cts.H264R480pAacLongPlayerTest#testPlay00;android.mediastress.cts.H263QcifShortPlayerTest#testPlay16;android.mediastress.cts.H263QcifShortPlayerTest#testPlay19;android.mediastress.cts.H263QcifShortPlayerTest#testPlay18;android.mediastress.cts.H263QcifShortPlayerTest#testPlay10;android.mediastress.cts.H263QcifShortPlayerTest#testPlay11;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay11;android.mediastress.cts.H264R480x360AacShortPlayerTest#testPlay10;android.mediastress.cts.NativeMediaTest#test720pPlay;android.mediastress.cts.H264R1080pAacLongPlayerTest#testPlay00;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay12;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay01;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay00;android.mediastress.cts.H263QcifShortPlayerTest#testPlay23;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay11;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay10;android.mediastress.cts.H263QcifShortPlayerTest#testPlay21;android.mediastress.cts.H263QcifShortPlayerTest#testPlay22;android.mediastress.cts.H263QcifShortPlayerTest#testPlay20;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay02;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay03;android.mediastress.cts.MediaRecorderStressTest#testStressRecordVideoAndPlayback;android.mediastress.cts.H264R720pAacShortPlayerTest#testPlay09;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay04;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay05;android.mediastress.cts.Vp8R480x360LongPlayerTest#testPlay00;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay06;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay07;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay08;android.mediastress.cts.H264R480pAacShortPlayerTest#testPlay09" />
<Entry uri="android.net" exclude="android.net.wifi.cts.ScanResultTest#testScanResultProperties;android.net.wifi.cts.WifiManagerTest#testWifiManagerActions;android.net.cts.UriTest#testStringUri;android.net.cts.UrlQuerySanitizer_IllegalCharacterValueSanitizerTest#testAndroidTestCaseSetupProperly;android.net.rtp.cts.AudioGroupTest#testAdd;android.net.rtp.cts.AudioGroupTest#testAndroidTestCaseSetupProperly;android.net.rtp.cts.AudioGroupTest#testRemove;android.net.cts.LocalSocketTest#testAccessors;android.net.http.cts.SslErrorTest#testConstructorIgnoresInvalidValues;android.net.cts.UriTest#testCompareTo;android.net.http.cts.SslErrorTest#testAddErrorIgnoresInvalidValues;android.net.cts.VpnServiceTest#testProtect_DatagramSocket;android.net.wifi.cts.WifiConfigurationTest#testAndroidTestCaseSetupProperly;android.net.rtp.cts.AudioCodecTest#testGetCodecs;android.net.http.cts.ApacheHttpClientTest#testExecute_withWifi;android.net.cts.DnsTest#testAndroidTestCaseSetupProperly;android.net.cts.VpnServiceTest#testAndroidTestCaseSetupProperly;android.net.wifi.cts.SupplicantStateTest#testAndroidTestCaseSetupProperly;android.net.cts.NetworkInfo_StateTest#testValues;android.net.cts.UriTest#testAndroidTestCaseSetupProperly;android.net.cts.LocalSocketTest#testLocalConnections;android.net.wifi.cts.WifiManager_WifiLockTest#testAndroidTestCaseSetupProperly;android.net.wifi.cts.WifiManagerTest#testWifiManagerNetWork;android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo;android.net.rtp.cts.AudioGroupTest#testTraffic;android.net.cts.Uri_BuilderTest#testBuilderOperations;android.net.cts.UriTest#testBuildUpon;android.net.cts.TrafficStatsTest#testAndroidTestCaseSetupProperly;android.net.cts.ProxyTest#testConstructor;android.net.rtp.cts.AudioCodecTest#testGetCodec;android.net.cts.DhcpInfoTest#testConstructor;android.net.cts.LocalSocketAddress_NamespaceTest#testValues;android.net.cts.ConnectivityManagerTest#testRequestRouteToHost;android.net.cts.ConnectivityManagerTest#testSetNetworkPreference;android.net.http.cts.SslCertificateTest#testState;android.net.cts.NetworkInfo_DetailedStateTest#testAndroidTestCaseSetupProperly;android.net.rtp.cts.AudioCodecTest#testConstants;android.net.http.cts.SslCertificateTest#testSslCertificate;android.net.cts.ProxyTest#testAccessProperties;android.net.cts.CredentialsTest#testCredentials;android.net.rtp.cts.AudioStreamTest#testDoubleRelease;android.net.cts.TrafficStatsTest#testValidMobileStats;android.net.http.cts.SslErrorTest#testGetUrlWithDeprecatedConstructor;android.net.cts.VpnServiceTest#testProtect_int;android.net.cts.ConnectivityManagerTest#testGetNetworkInfo;android.net.cts.MailToTest#testAndroidTestCaseSetupProperly;android.net.cts.LocalSocketTest#testAndroidTestCaseSetupProperly;android.net.cts.LocalSocketAddress_NamespaceTest#testAndroidTestCaseSetupProperly;android.net.cts.NetworkInfo_DetailedStateTest#testValueOf;android.net.cts.DhcpInfoTest#testAndroidTestCaseSetupProperly;android.net.cts.UriTest#testPathOperations;android.net.rtp.cts.AudioStreamTest#testAndroidTestCaseSetupProperly;android.net.http.cts.SslCertificate_DNameTest#testDName;android.net.wifi.cts.WifiManagerTest#testSignal;android.net.cts.UrlQuerySanitizerTest#testUrlQuerySanitizer;android.net.wifi.cts.WifiManager_WifiLockTest#testWifiLock;android.net.rtp.cts.AudioStreamTest#testSetCodec;android.net.cts.MailToTest#testParseMailToURI;android.net.cts.UriTest#testParcelling;android.net.cts.UrlQuerySanitizerTest#testAndroidTestCaseSetupProperly;android.net.wifi.cts.WifiConfigurationTest#testWifiConfiguration;android.net.cts.NetworkInfoTest#testAccessNetworkInfoProperties;android.net.cts.ConnectivityManagerTest#testTest;android.net.http.cts.SslErrorTest#testGetPrimaryError;android.net.cts.NetworkInfo_StateTest#testValueOf;android.net.cts.UriTest#testFromFile;android.net.cts.VpnServiceTest#testTunDevice;android.net.rtp.cts.AudioStreamTest#testSetDtmfType;android.net.cts.SSLCertificateSocketFactoryTest#testAndroidTestCaseSetupProperly;android.net.http.cts.SslCertificateTest#testConstructor;android.net.http.cts.SslErrorTest#testAddError;android.net.cts.UriTest#testNormalizeScheme;android.net.wifi.cts.WifiInfoTest#testAndroidTestCaseSetupProperly;android.net.cts.ConnectivityManagerTest#testStartUsingNetworkFeature;android.net.cts.UriTest#testHierarchicalUris;android.net.cts.DhcpInfoTest#testToString;android.net.rtp.cts.AudioStreamTest#testV6Stream;android.net.cts.LocalSocketAddressTest#testAndroidTestCaseSetupProperly;android.net.cts.UrlQuerySanitizer_IllegalCharacterValueSanitizerTest#testSanitize;android.net.rtp.cts.AudioStreamTest#testV4Stream;android.net.wifi.cts.ConcurrencyTest#testConcurrency;android.net.cts.LocalSocketAddress_NamespaceTest#testValueOf;android.net.wifi.cts.WifiManagerTest#testWifiWatchdog;android.net.cts.UriTest#testEqualsAndHashCode;android.net.cts.VpnServiceTest#testPrepare;android.net.cts.UriTest#testOpaqueUri;android.net.cts.UriTest#testQueryParameters;android.net.cts.TrafficStatsTest#testThreadStatsTag;android.net.wifi.cts.SupplicantStateTest#testIsValidState;android.net.http.cts.SslErrorTest#testHasError;android.net.cts.SSLCertificateSocketFactoryTest#testAccessProperties;android.net.cts.VpnServiceTest#testEstablish;android.net.ipv6.cts.PingTest#testAndroidTestCaseSetupProperly;android.net.cts.NetworkInfoTest#testAndroidTestCaseSetupProperly;android.net.cts.ConnectivityManagerTest#testAndroidTestCaseSetupProperly;android.net.cts.UriTest#testEncodeAndDecode;android.net.rtp.cts.AudioGroupTest#testClear;android.net.cts.NetworkInfo_StateTest#testAndroidTestCaseSetupProperly;android.net.cts.UrlQuerySanitizer_ParameterValuePairTest#testAndroidTestCaseSetupProperly;android.net.cts.ProxyTest#testAndroidTestCaseSetupProperly;android.net.cts.LocalServerSocketTest#testLocalServerSocket;android.net.cts.CredentialsTest#testAndroidTestCaseSetupProperly;android.net.rtp.cts.AudioCodecTest#testAndroidTestCaseSetupProperly;android.net.cts.UrlQuerySanitizer_ParameterValuePairTest#testConstructor;android.net.cts.NetworkInfo_DetailedStateTest#testValues;android.net.http.cts.SslErrorTest#testGetPrimaryErrorWithEmptySet;android.net.rtp.cts.AudioGroupTest#testSetMode;android.net.wifi.cts.WifiInfoTest#testWifiInfoProperties;android.net.wifi.cts.ConcurrencyTest#testAndroidTestCaseSetupProperly;android.net.http.cts.ApacheHttpClientTest#testAndroidTestCaseSetupProperly;android.net.wifi.cts.WifiManagerTest#testWifiManagerProperties;android.net.rtp.cts.AudioGroupTest#testDoubleClear;android.net.wifi.cts.WifiManagerTest#testAndroidTestCaseSetupProperly;android.net.cts.ConnectivityManagerTest#testGetActiveNetworkInfo;android.net.cts.LocalSocketAddressTest#testNewLocalSocketAddressWithDefaultNamespace;android.net.http.cts.SslErrorTest#testGetUrl;android.net.ipv6.cts.PingTest#testLoopbackPing;android.net.cts.TrafficStatsTest#testValidTotalStats;android.net.wifi.cts.WifiEnterpriseConfigTest#testAddEapNetwork;android.net.cts.VpnServiceTest#testProtect_Socket;android.net.wifi.cts.WifiEnterpriseConfigTest#testAndroidTestCaseSetupProperly;android.net.cts.ConnectivityManagerTest#testIsNetworkTypeValid;android.net.cts.ConnectivityManagerTest#testIsNetworkSupported;android.net.cts.LocalServerSocketTest#testAndroidTestCaseSetupProperly;android.net.wifi.cts.WifiEnterpriseConfigTest#testSettersAndGetters;android.net.http.cts.ApacheHttpClientTest#testExecute_withMobile" />
<Entry uri="android.provider" exclude="android.provider.cts.ContactsContract_CommonDataKinds_EventTest#testGetTypeLabel;android.provider.cts.MediaStore_Audio_Genres_MembersTest#testStoreAudioGenresMembersInternal;android.provider.cts.ContactsContract_DataTest#testDataInsert_updatesContactLastUpdatedTimestamp;android.provider.cts.ContactsContract_CommonDataKinds_EmailTest#testGetTypeLabel;android.provider.cts.Settings_NameValueTableTest#testPutString;android.provider.cts.CalendarTest#testCalendarEntityQuery;android.provider.cts.ContactsContract_DataUsageTest#testSingleDataUsageFeedback_incrementsCorrectDataItems;android.provider.cts.BrowserTest#testSendString;android.provider.cts.MediaStore_Video_MediaTest#testStoreVideoMediaInternal;android.provider.cts.UserDictionary_WordsTest#testAddWord_deprecated;android.provider.cts.MediaStoreIntentsTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsContract_DeletedContacts#testQuerySinceTimestamp;android.provider.cts.BrowserTest#testRequestAllIcons;android.provider.cts.ContactsContract_CommonDataKinds_EmailTest#testAndroidTestCaseSetupProperly;android.provider.cts.CalendarTest#testReminders;android.provider.cts.MediaStore_Audio_ArtistsTest#testStoreAudioArtistsExternal;android.provider.cts.ContactsContractIntentsTest#testViewContactDir;android.provider.cts.CalendarTest#testBulkUpdate;android.provider.cts.ContactsContract_PhotoTest#testAddPhoto;android.provider.cts.Settings_NameValueTableTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsProvider2_AccountRemovalTest#testAccountRemovalWithMergedContact_hasDeleteLogsForContacts;android.provider.cts.ContactsContract_PhotoTest#testAddEmptyPhoto;android.provider.cts.Settings_SecureTest#testGetPutFloat;android.provider.cts.MediaStore_Images_MediaTest#testGetContentUri;android.provider.cts.ContactsContract_DeletedContacts#testDelete_isUnsupported;android.provider.cts.CalendarTest#testCalendarCreationAndDeletion;android.provider.cts.BrowserTest#testBookmarksTable;android.provider.cts.Settings_SecureTest#testGetUriFor;android.provider.cts.ContactsContract_StatusUpdatesTest#testGetPresenceIconresourceId;android.provider.cts.MediaStore_Audio_Playlists_MembersTest#testStoreAudioPlaylistsMembersInternal;android.provider.cts.ContactsContract_CommonDataKinds_EventTest#testAndroidTestCaseSetupProperly;android.provider.cts.Contacts_PhonesTest#testGetDisplayLabel;android.provider.cts.ContactsContract_DeletedContacts#testInsert_isUnsupported;android.provider.cts.MediaStore_Audio_AlbumsTest#testStoreAudioAlbumsExternal;android.provider.cts.ContactsContract_DeletedContacts#testAndroidTestCaseSetupProperly;android.provider.cts.BrowserTest#testGetAllVisitedUrls;android.provider.cts.Contacts_ContactMethodsTest#testEncodeAndDecodeProtocol;android.provider.cts.ContactsContract_DeletedContacts#testQueryAll;android.provider.cts.MediaStore_Audio_MediaTest#testStoreAudioMediaInternal;android.provider.cts.ContactsContract_RawContactsTest#testRawContactPsuedoDelete_hasDeleteLogForContact;android.provider.cts.MediaStore_FilesTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Images_MediaTest#testStoreImagesMediaInternal;android.provider.cts.MediaStore_Audio_AlbumsTest#testAlbumArt;android.provider.cts.ContactsContract_ContactsTest#testLookupUri;android.provider.cts.MediaStoreIntentsTest#testPickVideoDir;android.provider.cts.MediaStore_Images_MediaTest#testInsertImageWithBitmap;android.provider.cts.MediaStoreIntentsTest#testViewAudioFile;android.provider.cts.MediaStore_Audio_Genres_MembersTest#testStoreAudioGenresMembersExternal;android.provider.cts.ContactsContract_CommonDataKinds_StructuredPostalTest#testAndroidTestCaseSetupProperly;android.provider.cts.CalendarTest#testInstanceSearch;android.provider.cts.VoicemailContractTest#testStatusTablePermissions;android.provider.cts.ContactsContract_CommonDataKinds_OrganizationTest#testAndroidTestCaseSetupProperly;android.provider.cts.SettingsTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Audio_PlaylistsTest#testStoreAudioPlaylistsInternal;android.provider.cts.ContactsContract_DumpFileProviderTest#testQuery_worksWithValidFileName;android.provider.cts.Settings_SecureTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Video_MediaTest#testAndroidTestCaseSetupProperly;android.provider.cts.BrowserTest#testAccessHistory;android.provider.cts.ContactsContract_DataTest#testContactablesFilterByPhonePrefix_returnsCorrectDataRows;android.provider.cts.MediaStore_Images_ThumbnailsTest#testStoreImagesMediaInternal;android.provider.cts.ContactsTest#testCallsTable;android.provider.cts.CalendarTest#testEventCreationAndDeletion;android.provider.cts.VoicemailContractTest#testVoicemailTablePermissions;android.provider.cts.CalendarTest#testEventsUid2445;android.provider.cts.MediaStore_VideoTest#testQuery;android.provider.cts.CalendarTest#testDefaultProjections;android.provider.cts.MediaStoreIntentsTest#testViewVideoDir;android.provider.cts.MediaStore_FilesTest#testGetContentUri;android.provider.cts.ContactsContract_ContactsTest#testInsert_isUnsupported;android.provider.cts.ContactsContract_CommonDataKinds_PhoneTest#testGetTypeLabel;android.provider.cts.VoicemailContractTest#testVoicemailsTable;android.provider.cts.ContactsContract_CommonDataKinds_RelationTest#testGetTypeLabel;android.provider.cts.Settings_SystemTest#testGetDefaultValues;android.provider.cts.ContactsContract_RawContactsTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStoreTest#testGetMediaScannerUri;android.provider.cts.ContactsContract_RawContactsTest#testRawContactDelete_removesRecord;android.provider.cts.Settings_SecureTest#testGetPutString;android.provider.cts.ContactsTest#testGroupMembershipTable;android.provider.cts.MediaStore_Audio_MediaTest#testGetContentUri;android.provider.cts.CalendarTest#testFullRecurrenceUpdate;android.provider.cts.MediaStore_FilesTest#testCaseSensitivity;android.provider.cts.MediaStore_Audio_AlbumsTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Audio_ArtistsTest#testStoreAudioArtistsInternal;android.provider.cts.ContactsContract_ContactsTest#testContactDelete_hasDeleteLog;android.provider.cts.ContactsContract_DataUsageTest#testMultiIdDataUsageFeedback_incrementsCorrectDataItems;android.provider.cts.CalendarTest#testSyncOnlyInsertEnforcement;android.provider.cts.VoicemailContractTest#testDataColumnUpdate_throwsIllegalArgumentException;android.provider.cts.CalendarTest#testColorWriteRequirements;android.provider.cts.CalendarTest#testWhenByDayQuery;android.provider.cts.ContactsContract_StreamItemsTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsContract_CommonDataKinds_ImTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_AudioTest#testKeyFor;android.provider.cts.ContactsContract_ContactsTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Images_ThumbnailsTest#testQueryInternalThumbnails;android.provider.cts.ContactsContract_DumpFileProviderTest#testOpenFileDescriptor_throwsErrorWithIllegalFileName;android.provider.cts.CalendarTest#testEventColors;android.provider.cts.SettingsTest#testBluetoothDevicesTable;android.provider.cts.ContactsContract_RawContactsTest#testRawContactUpdate_updatesContactUpdatedTimestamp;android.provider.cts.ContactsContract_CommonDataKinds_RelationTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStoreTest#testGetVersion;android.provider.cts.MediaStore_Audio_GenresTest#testGetContentUri;android.provider.cts.ContactsContract_DataTest#testDataDelete_updatesContactLastUpdatedTimestamp;android.provider.cts.ContactsContract_CommonDataKinds_SipAddressTest#testGetTypeLabel;android.provider.cts.BrowserTest#testSaveBookmark;android.provider.cts.ContactsProvider2_AccountRemovalTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Video_MediaTest#testGetContentUri;android.provider.cts.CalendarTest#testExtendedProperties;android.provider.cts.Settings_SystemTest#testAndroidTestCaseSetupProperly;android.provider.cts.CalendarTest#testNonAdapterRecurrenceExceptions;android.provider.cts.CalendarTest#testOutOfOrderRecurrenceExceptions;android.provider.cts.CalendarTest#testConversionToRecurring;android.provider.cts.MediaStore_Audio_Playlists_MembersTest#testStoreAudioPlaylistsMembersExternal;android.provider.cts.CalendarTest#testMultiRuleRecurrence;android.provider.cts.MediaStoreIntentsTest#testPickAudioDir;android.provider.cts.MediaStore_Audio_GenresTest#testStoreAudioGenresExternal;android.provider.cts.MediaStoreIntentsTest#testViewVideoFile;android.provider.cts.ContactsProvider2_AccountRemovalTest#testAccountRemoval_deletesContacts;android.provider.cts.Contacts_ContactMethodsTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsContract_GroupMembershipTest#testAddGroupMembershipWithGroupRowId;android.provider.cts.TelephonyProviderTest#testOpeningAnyFile;android.provider.cts.MediaStore_Audio_GenresTest#testGetContentUriForAudioId;android.provider.cts.ContactsContract_CommonDataKinds_PhoneTest#testAndroidTestCaseSetupProperly;android.provider.cts.Contacts_PeopleTest#testMarkAsContacted;android.provider.cts.MediaStore_FilesTest#testAccess;android.provider.cts.ContactsContract_CommonDataKinds_ImTest#testGetTypeLabel;android.provider.cts.SearchRecentSuggestionsTest#testSuggestionsTable;android.provider.cts.CalendarTest#testAttendees;android.provider.cts.SettingsTest#testAccessNonTable;android.provider.cts.MediaStoreIntentsTest#testPickImageDir;android.provider.cts.BrowserTest#testSearchesTable;android.provider.cts.Contacts_SettingsTest#testAccessSetting;android.provider.cts.ContactsContract_StreamItemPhotosTest#testContentPhotoUri;android.provider.cts.ContactsContract_DataTest#testGetLookupUriByDisplayName;android.provider.cts.ContactsContract_StatusUpdatesTest#testInsertStatus;android.provider.cts.MediaStore_Video_ThumbnailsTest#testGetContentUri;android.provider.cts.MediaStore_Audio_GenresTest#testStoreAudioGenresInternal;android.provider.cts.MediaStore_Images_MediaTest#testInsertImageWithImagePath;android.provider.cts.CalendarTest#testForwardRecurrenceExceptions;android.provider.cts.Settings_SecureTest#testUnknownSourcesOffByDefault;android.provider.cts.CalendarTest#testBadRequests;android.provider.cts.ContactsTest#testSettingsTable;android.provider.cts.VoicemailContractTest#testInsert_doesNotUpdateDataColumn;android.provider.cts.ContactsContract_RawContactsTest#testRawContactCreate_updatesContactUpdatedTimestamp;android.provider.cts.MediaStoreIntentsTest#testViewImageDir;android.provider.cts.ContactsContract_ContactsTest#testContactDelete_removesContactRecord;android.provider.cts.MediaStore_Images_ThumbnailsTest#testQueryExternalMiniThumbnails;android.provider.cts.ContactsContract_ContactsTest#testContactUpdate_updatesContactUpdatedTimestamp;android.provider.cts.Settings_SettingNotFoundExceptionTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsContract_RawContactsTest#testGetLookupUriByDisplayName;android.provider.cts.BrowserTest#testAccessSearches;android.provider.cts.ContactsContract_CommonDataKinds_SipAddressTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsContract_GroupMembershipTest#testAddGroupMembershipWithUnknownGroupSourceId;android.provider.cts.MediaStore_Audio_MediaTest#testStoreAudioMediaExternal;android.provider.cts.MediaStore_Audio_PlaylistsTest#testGetContentUri;android.provider.cts.ContactsTest#testGroupsTable;android.provider.cts.MediaStore_Audio_AlbumsTest#testGetContentUri;android.provider.cts.Settings_SystemTest#testGetUriFor;android.provider.cts.ContactsContract_StreamItemPhotosTest#testContentDirectoryUri;android.provider.cts.SearchRecentSuggestionsTest#testSearchRecentSuggestions;android.provider.cts.Contacts_ContactMethodsTest#testAddPostalLocation;android.provider.cts.MediaStore_Audio_Artists_AlbumsTest#testGetContentUri;android.provider.cts.SearchRecentSuggestionsTest#testConstructor;android.provider.cts.ContactsContract_ContactsTest#testMarkAsContacted;android.provider.cts.ContactsTest#testPeopleTable;android.provider.cts.CalendarTest#testCalendarColors;android.provider.cts.CalendarTest#testCalendarIsPrimary;android.provider.cts.ContactsContract_RawContactsTest#testRawContactDelete_hasDeleteLogForContact;android.provider.cts.Settings_SystemTest#testSystemSettings;android.provider.cts.CalendarTest#testRecurrence;android.provider.cts.ContactsContract_GroupMembershipTest#testAddGroupMembershipWithGroupSourceId;android.provider.cts.MediaStore_Audio_Genres_MembersTest#testGetContentUri;android.provider.cts.VoicemailContractTest#testStatusTable;android.provider.cts.ContactsContract_DataTest#testContactablesFilterByFirstName_returnsCorrectDataRows;android.provider.cts.Settings_NameValueTableTest#testGetUriFor;android.provider.cts.ContactsContract_DumpFileProviderTest#testQuery_throwsErrorWithIllegalFileName;android.provider.cts.ContactsTest#testContactMethodsTable;android.provider.cts.ContactsContractIntentsTest#testPickContactDir;android.provider.cts.MediaStore_Audio_AlbumsTest#testStoreAudioAlbumsInternal;android.provider.cts.Contacts_PeopleTest#testAddToGroup;android.provider.cts.ContactsContract_DataTest#testContactablesFilterByEmailPrefix_returnsCorrectDataRows;android.provider.cts.ContactsContract_StatusUpdatesTest#testGetPresencePrecedence;android.provider.cts.BrowserTest#testUpdateVisitedHistory;android.provider.cts.SettingsTest#testSecureTable;android.provider.cts.ContactsContract_StreamItemsTest#testContentUri;android.provider.cts.MediaStore_Audio_Artists_AlbumsTest#testStoreAudioArtistsAlbumsInternal;android.provider.cts.MediaStore_Video_ThumbnailsTest#testGetThumbnail;android.provider.cts.ContactsContractIntentsTest#testGetContentContactDir;android.provider.cts.SettingsTest#testSystemTable;android.provider.cts.CalendarTest#testEventUpdateAsApp;android.provider.cts.MediaStore_Images_MediaTest#testStoreImagesMediaExternal;android.provider.cts.CalendarTest#testEventsEntityQuery;android.provider.cts.ContactsContractIntentsTest#testAndroidTestCaseSetupProperly;android.provider.cts.CalendarTest#testSyncState;android.provider.cts.MediaStore_Video_ThumbnailsTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsContract_DataTest#testGetLookupUriBySourceId;android.provider.cts.UserDictionary_WordsTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsTest#testExtensionsTable;android.provider.cts.ContactsContract_DataTest#testContactablesUri;android.provider.cts.ContactsContract_CommonDataKinds_ImTest#testGetProtocolLabel;android.provider.cts.Settings_SettingNotFoundExceptionTest#testConstructor;android.provider.cts.CalendarTest#testEventsIsOrganizer;android.provider.cts.ContactsContract_StreamItemsTest#testContentDirectoryUri;android.provider.cts.Contacts_PeopleTest#testAccessPhotoData;android.provider.cts.UserDictionary_WordsTest#testAddWord;android.provider.cts.CalendarTest#testSingleRecurrenceExceptions;android.provider.cts.BrowserTest#testGetAllBookmarks;android.provider.cts.ContactsContract_RawContactsTest#testRawContactDelete_setsDeleteFlag;android.provider.cts.MediaStoreIntentsTest#testViewImageFile;android.provider.cts.Settings_SecureTest#testGetPutLong;android.provider.cts.ContactsContract_DataTest#testContactablesFilterByLastName_returnsCorrectDataRows;android.provider.cts.SearchRecentSuggestionsTest#testAndroidTestCaseSetupProperly;android.provider.cts.Contacts_PhonesTest#testGetDisplayLabelCharSequenceArray;android.provider.cts.SettingsTest#testUserDictionarySettingsExists;android.provider.cts.Contacts_OrganizationsTest#testGetDisplayLabel;android.provider.cts.Settings_SecureTest#testGetDefaultValues;android.provider.cts.ContactsContract_ContactsTest#testContactDelete_marksRawContactsForDeletion;android.provider.cts.ContactsTest#testPhotosTable;android.provider.cts.ContactsContract_ContactsTest#testContentUri;android.provider.cts.MediaStore_Audio_Artists_AlbumsTest#testStoreAudioArtistsAlbumsExternal;android.provider.cts.Contacts_PhonesTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsProvider2_AccountRemovalTest#testAccountRemovalWithMergedContact_doesNotDeleteContactAndTimestampUpdated;android.provider.cts.ContactsTest#testOrganizationsTable;android.provider.cts.MediaStore_Audio_Playlists_MembersTest#testGetContentUri;android.provider.cts.MediaStore_Audio_PlaylistsTest#testStoreAudioPlaylistsExternal;android.provider.cts.Contacts_OrganizationsTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsTest#testPhonesTable;android.provider.cts.Settings_SecureTest#testGetPutInt;android.provider.cts.ContactsContract_StatusUpdatesTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Audio_MediaTest#testGetContentUriForPath;android.provider.cts.CalendarTest#testCalendarUpdateAsApp;android.provider.cts.ContactsContract_DeletedContacts#testQueryByContactId;android.provider.cts.ContactsProvider2_AccountRemovalTest#testAccountRemoval_hasDeleteLogsForContacts;android.provider.cts.ContactsContract_StreamItemPhotosTest#testAndroidTestCaseSetupProperly;android.provider.cts.MediaStore_Audio_ArtistsTest#testGetContentUri;android.provider.cts.ContactsContract_DumpFileProviderTest#testAndroidTestCaseSetupProperly;android.provider.cts.ContactsContract_DataTest#testDataUpdate_updatesContactLastUpdatedTimestamp;android.provider.cts.ContactsProvider2_AccountRemovalTest#testAccountRemovalWithMergedContact_deletesContacts;android.provider.cts.ContactsContract_RawContactsTest#testGetLookupUriBySourceId;android.provider.cts.MediaStore_Images_ThumbnailsTest#testGetContentUri;android.provider.cts.ContactsContract_DumpFileProviderTest#testOpenFileDescriptor_worksWithValidFileName;android.provider.cts.ContactsContract_CommonDataKinds_StructuredPostalTest#testGetTypeLabel;android.provider.cts.ContactsContract_DataUsageTest#testAndroidTestCaseSetupProperly;android.provider.cts.Contacts_ContactMethodsTest#test;android.provider.cts.MediaStore_Video_MediaTest#testStoreVideoMediaExternal;android.provider.cts.ContactsContract_CommonDataKinds_OrganizationTest#testGetTypeLabel;android.provider.cts.MediaStore_Images_ThumbnailsTest#testStoreImagesMediaExternal;android.provider.cts.ContactsContract_DataTest#testContactablesFilter_doesNotExist_returnsCorrectDataRows;android.provider.cts.ContactsContract_DeletedContacts#testQuery_returnsProperColumns" />
- <Entry uri="android.security" exclude="android.security.cts.KeystoreExploitTest#testAndroidTestCaseSetupProperly;android.security.cts.CharDeviceTest#testExynosKernelMemoryRead;android.security.cts.VoldExploitTest#testAndroidTestCaseSetupProperly;android.security.cts.LoadEffectLibraryTest#testLoadLibrary;android.security.cts.BrowserTest#testAndroidTestCaseSetupProperly;android.security.cts.LinuxRngTest#testDevUrandomMajorMinor;android.security.cts.ServicePermissionsTest#testDumpProtected;android.security.cts.BannedFilesTest#testNoSetuidTcpdump;android.security.cts.SqliteJournalLeakTest#testShm;android.security.cts.LinuxRngTest#testDevRandomMajorMinor;android.security.cts.ClonedSecureRandomTest#testCheckForDuplicateOutput;android.security.cts.BrowserTest#testBrowserPrivateDataAccess;android.security.cts.BrowserTest#testTabExhaustion;android.security.cts.KeystoreExploitTest#testKeystoreCrash;android.security.cts.SqliteJournalLeakTest#testJournal;android.security.cts.BannedFilesTest#testNoCmdClient;android.security.cts.BannedFilesTest#testNoSetuidIp;android.security.cts.BannedFilesTest#testNoSyncAgent;android.security.cts.BannedFilesTest#testNoInitRunIt;android.security.cts.ListeningPortsTest#testNoListeningLoopbackTcp6Ports;android.security.cts.KernelSettingsTest#testKptrRestrict;android.security.cts.AslrTest#testVaRandomize;android.security.cts.KernelSettingsTest#testMmapMinAddr;android.security.cts.CertificateTest#testBlockCertificates;android.security.cts.BrowserTest#testTabReuse;android.security.cts.KernelSettingsTest#testSELinuxEnforcing;android.security.cts.ListeningPortsTest#testNoListeningLoopbackUdp6Ports;android.security.cts.NativeCodeTest#testPerfEvent;android.security.cts.KernelSettingsTest#testSetuidDumpable;android.security.cts.PackageSignatureTest#testAndroidTestCaseSetupProperly;android.security.cts.ServicePermissionsTest#testAndroidTestCaseSetupProperly;android.security.cts.CertificateTest#testCertificates;android.security.cts.KernelSettingsTest#testNoConfigGz;android.security.cts.KernelSettingsTest#testDmesgRestrict;android.security.cts.ListeningPortsTest#testAndroidTestCaseSetupProperly;android.security.cts.SqliteJournalLeakTest#testAndroidTestCaseSetupProperly;android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningTcp6Ports;android.security.cts.ListeningPortsTest#testNoListeningLoopbackTcpPorts;android.security.cts.ClonedSecureRandomTest#testAndroidTestCaseSetupProperly;android.security.cts.VoldExploitTest#testTryCommandInjection;android.security.cts.VoldExploitTest#testZergRushCrash;android.security.cts.AslrTest#testOneExecutableIsPie;android.security.cts.VoldExploitTest#testTryToCrashVold;android.security.cts.ListeningPortsTest#testNoListeningLoopbackUdpPorts;android.security.cts.CertificateTest#testAndroidTestCaseSetupProperly;android.security.cts.SqliteJournalLeakTest#testWal;android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningTcpPorts;android.security.cts.CharDeviceTest#testExynosRootingVuln" />
+ <Entry uri="android.security" exclude="android.security.cts.KeystoreExploitTest#testAndroidTestCaseSetupProperly;android.security.cts.CharDeviceTest#testExynosKernelMemoryRead;android.security.cts.VoldExploitTest#testAndroidTestCaseSetupProperly;android.security.cts.LoadEffectLibraryTest#testLoadLibrary;android.security.cts.BrowserTest#testAndroidTestCaseSetupProperly;android.security.cts.LinuxRngTest#testDevUrandomMajorMinor;android.security.cts.ServicePermissionsTest#testDumpProtected;android.security.cts.BannedFilesTest#testNoSetuidTcpdump;android.security.cts.SqliteJournalLeakTest#testShm;android.security.cts.LinuxRngTest#testDevRandomMajorMinor;android.security.cts.ClonedSecureRandomTest#testCheckForDuplicateOutput;android.security.cts.BrowserTest#testBrowserPrivateDataAccess;android.security.cts.BrowserTest#testTabExhaustion;android.security.cts.KeystoreExploitTest#testKeystoreCrash;android.security.cts.SqliteJournalLeakTest#testJournal;android.security.cts.BannedFilesTest#testNoCmdClient;android.security.cts.BannedFilesTest#testNoSetuidIp;android.security.cts.BannedFilesTest#testNoSyncAgent;android.security.cts.BannedFilesTest#testNoRootCmdSocket;android.security.cts.ListeningPortsTest#testNoListeningLoopbackTcp6Ports;android.security.cts.KernelSettingsTest#testKptrRestrict;android.security.cts.AslrTest#testVaRandomize;android.security.cts.KernelSettingsTest#testMmapMinAddr;android.security.cts.CertificateTest#testBlockCertificates;android.security.cts.BrowserTest#testTabReuse;android.security.cts.KernelSettingsTest#testSELinuxEnforcing;android.security.cts.ListeningPortsTest#testNoListeningLoopbackUdp6Ports;android.security.cts.NativeCodeTest#testPerfEvent;android.security.cts.KernelSettingsTest#testSetuidDumpable;android.security.cts.PackageSignatureTest#testAndroidTestCaseSetupProperly;android.security.cts.ServicePermissionsTest#testAndroidTestCaseSetupProperly;android.security.cts.CertificateTest#testCertificates;android.security.cts.KernelSettingsTest#testNoConfigGz;android.security.cts.KernelSettingsTest#testDmesgRestrict;android.security.cts.ListeningPortsTest#testAndroidTestCaseSetupProperly;android.security.cts.SqliteJournalLeakTest#testAndroidTestCaseSetupProperly;android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningTcp6Ports;android.security.cts.ListeningPortsTest#testNoListeningLoopbackTcpPorts;android.security.cts.ClonedSecureRandomTest#testAndroidTestCaseSetupProperly;android.security.cts.VoldExploitTest#testTryCommandInjection;android.security.cts.VoldExploitTest#testZergRushCrash;android.security.cts.AslrTest#testOneExecutableIsPie;android.security.cts.VoldExploitTest#testTryToCrashVold;android.security.cts.ListeningPortsTest#testNoListeningLoopbackUdpPorts;android.security.cts.CertificateTest#testAndroidTestCaseSetupProperly;android.security.cts.SqliteJournalLeakTest#testWal;android.security.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningTcpPorts;android.security.cts.CharDeviceTest#testExynosRootingVuln" />
<Entry uri="android.webkit" exclude="android.webkit.cts.WebViewTest#testDocumentHasImages;android.webkit.cts.WebViewTest#testScrollBarOverlay;android.webkit.cts.WebViewTest#testGoBackAndForward;android.webkit.cts.WebViewTest#testGetContentHeight;android.webkit.cts.WebChromeClientTest#testOnJsConfirm;android.webkit.cts.WebChromeClientTest#testOnProgressChanged;android.webkit.cts.WebViewTest#testAddJavascriptInterfaceNullObject;android.webkit.cts.WebViewTest#testConstructor;android.webkit.cts.WebViewTest#testInvokeZoomPicker;android.webkit.cts.WebSettingsTest#testAccessMinimumLogicalFontSize;android.webkit.cts.WebViewStartupTest#testCookieManagerBlockingUiThread;android.webkit.cts.WebViewTest#testInternals;android.webkit.cts.WebViewClientTest#testShouldOverrideUrlLoading;android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptOnce;android.webkit.cts.WebSettingsTest#testDatabaseDisabled;android.webkit.cts.WebView_WebViewTransportTest#testAccessWebView;android.webkit.cts.WebSettingsTest#testAccessJavaScriptCanOpenWindowsAutomatically;android.webkit.cts.WebSettingsTest#testAppCacheEnabled;android.webkit.cts.WebSettingsTest#testAccessUserAgentString;android.webkit.cts.WebViewTest#testClearHistory;android.webkit.cts.WebSettingsTest#testAccessSerifFontFamily;android.webkit.cts.WebSettingsTest#testAccessLayoutAlgorithm;android.webkit.cts.WebSettingsTest#testAccessFantasyFontFamily;android.webkit.cts.WebViewTest#testAddJavascriptInterface;android.webkit.cts.WebSettingsTest#testAccessCacheMode;android.webkit.cts.WebViewTest#testDebugDump;android.webkit.cts.WebViewTest#testSslErrorProceedResponseNotReusedForDifferentHost;android.webkit.cts.WebSettingsTest#testLocalImageLoads;android.webkit.cts.WebViewTest#testSslErrorProceedResponseReusedForSameHost;android.webkit.cts.HttpAuthHandlerTest#testUseHttpAuthUsernamePassword;android.webkit.cts.WebViewTest#testSetLayoutParams;android.webkit.cts.WebViewTest#testAppInjectedXRequestedWithHeaderIsNotOverwritten;android.webkit.cts.WebSettingsTest#testAccessUseDoubleTree;android.webkit.cts.WebViewTest#testOnReceivedSslErrorCancel;android.webkit.cts.URLUtilTest#testIsHttpUrl;android.webkit.cts.DateSorterTest#testConstants;android.webkit.cts.WebSettingsTest#testAccessFixedFontFamily;android.webkit.cts.WebSettingsTest#testSetRenderPriority;android.webkit.cts.WebViewTest#testRemoveJavascriptInterface;android.webkit.cts.WebViewTest#testAndroidAssetAnchor;android.webkit.cts.WebViewTest#testOnReceivedSslError;android.webkit.cts.CookieTest#testEmptyValue;android.webkit.cts.WebViewTest#testPauseResumeTimers;android.webkit.cts.URLUtilTest#testIsContentUrl;android.webkit.cts.WebChromeClientTest#testBlockWindowsAsync;android.webkit.cts.WebViewTest#testGetVisibleTitleHeight;android.webkit.cts.WebBackForwardListTest#testClone;android.webkit.cts.WebSettingsTest#testAccessDefaultTextEncodingName;android.webkit.cts.URLUtilTest#testGuessUrl;android.webkit.cts.MimeTypeMapTest#testAndroidTestCaseSetupProperly;android.webkit.cts.WebChromeClientTest#testOnReceivedIcon;android.webkit.cts.CookieTest#testAndroidTestCaseSetupProperly;android.webkit.cts.CookieManagerTest#testRemoveCookies;android.webkit.cts.WebSettingsTest#testAccessPluginsPath;android.webkit.cts.WebSettingsTest#testAccessAllowFileAccess;android.webkit.cts.WebSettingsTest#testAccessSupportMultipleWindows;android.webkit.cts.WebViewTest#testAppCanInjectHeadersViaImmutableMap;android.webkit.cts.WebViewTest#testSecureSiteSetsCertificate;android.webkit.cts.WebViewTest#testSetWebViewClient;android.webkit.cts.WebViewTest#testSetScrollBarStyle;android.webkit.cts.CookieTest#testDomain;android.webkit.cts.WebViewTest#testZoom;android.webkit.cts.URLUtilTest#testIsDataUrl;android.webkit.cts.CookieManagerTest#testAcceptCookie;android.webkit.cts.WebChromeClientTest#testOnReceivedTitle;android.webkit.cts.URLUtilTest#testIsFileUrl;android.webkit.cts.WebSettingsTest#testAccessJavaScriptEnabled;android.webkit.cts.URLUtilTest#testIsNetworkUrl;android.webkit.cts.WebViewTest#testFindAddress;android.webkit.cts.WebViewTest#testSetNetworkAvailable;android.webkit.cts.WebViewTest#testClearSslPreferences;android.webkit.cts.URLUtilTest#testIsHttpsUrl;android.webkit.cts.MimeTypeMapTest#testGetFileExtensionFromUrl;android.webkit.cts.WebViewTest#testGetOriginalUrl;android.webkit.cts.WebChromeClientTest#testBlockWindowsSync;android.webkit.cts.WebViewTest#testLoadData;android.webkit.cts.WebViewTest#testInsecureSiteClearsCertificate;android.webkit.cts.WebBackForwardListTest#testGetCurrentItem;android.webkit.cts.URLUtilTest#testStripAnchor;android.webkit.cts.URLUtilTest#testGuessFileName;android.webkit.cts.URLUtilTest#testAndroidTestCaseSetupProperly;android.webkit.cts.WebViewTest#testEvaluateJavascript;android.webkit.cts.DateSorterTest#testConstructor;android.webkit.cts.WebViewTest#testPageScroll;android.webkit.cts.WebSettingsTest#testIframesWhenAccessFromFileURLsEnabled;android.webkit.cts.WebViewTest#testFlingScroll;android.webkit.cts.WebSettingsTest#testXHRWhenAccessFromFileURLsEnabled;android.webkit.cts.WebChromeClientTest#testOnJsPrompt;android.webkit.cts.WebSettingsTest#testAccessSupportZoom;android.webkit.cts.WebSettingsTest#testLoadsImagesAutomatically;android.webkit.cts.URLUtilTest#testIsValidUrl;android.webkit.cts.WebViewTest#testRequestFocusNodeHref;android.webkit.cts.WebViewTest#testLoadDataWithBaseUrl;android.webkit.cts.WebChromeClientTest#testOnJsAlert;android.webkit.cts.WebSettingsTest#testAccessSansSerifFontFamily;android.webkit.cts.CookieManagerTest#testCookieManager;android.webkit.cts.WebViewTest#testSetMapTrackballToArrowKeys;android.webkit.cts.WebViewTest#testCreatingWebViewCreatesCookieSyncManager;android.webkit.cts.DateSorterTest#testGetIndex;android.webkit.cts.GeolocationTest#testGeolocationPermissions;android.webkit.cts.WebChromeClientTest#testOnJsBeforeUnload;android.webkit.cts.CookieManagerTest#testClone;android.webkit.cts.CookieManagerTest#testGetInstance;android.webkit.cts.WebViewTest#testGetZoomControls;android.webkit.cts.CookieTest#testSubDomain;android.webkit.cts.WebSettingsTest#testUserAgentString_default;android.webkit.cts.MimeTypeMapTest#testGetMimeTypeFromExtension;android.webkit.cts.WebSettingsTest#testBlockNetworkImage;android.webkit.cts.WebViewTest#testPlatformNotifications;android.webkit.cts.URLUtilTest#testIsAboutUrl;android.webkit.cts.WebViewTest#testSetPictureListener;android.webkit.cts.MimeTypeMapTest#testHasMimeType;android.webkit.cts.WebViewTest#testOnReceivedSslErrorProceed;android.webkit.cts.DateSorterTest#testGetLabel;android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestAcceptAlways;android.webkit.cts.URLUtilTest#testDecode;android.webkit.cts.HttpAuthHandlerTest#testProceed;android.webkit.cts.WebSettingsTest#testSetNeedInitialFocus;android.webkit.cts.WebSettingsTest#testIframesWhenAccessFromFileURLsDisabled;android.webkit.cts.WebSettingsTest#testAccessCursiveFontFamily;android.webkit.cts.WebViewTest#testFindAll;android.webkit.cts.WebViewTest#testStopLoading;android.webkit.cts.DateSorterTest#testAndroidTestCaseSetupProperly;android.webkit.cts.WebSettingsTest#testAccessDefaultFixedFontSize;android.webkit.cts.CookieManagerTest#testb3167208;android.webkit.cts.WebSettingsTest#testAccessMinimumFontSize;android.webkit.cts.WebSettingsTest#testAccessUseWideViewPort;android.webkit.cts.WebSettingsTest#testAccessSaveFormData;android.webkit.cts.WebViewTest#testRequestChildRectangleOnScreen;android.webkit.cts.URLUtilTest#testIsJavaScriptUrl;android.webkit.cts.WebViewTest#testFindNext;android.webkit.cts.MimeTypeMapTest#testHasExtension;android.webkit.cts.WebViewTest#testSetDownloadListener;android.webkit.cts.WebSettingsTest#testXHRWhenAccessFromFileURLsDisabled;android.webkit.cts.WebViewTest#testDestroy;android.webkit.cts.MimeTypeMapTest#testGetSingleton;android.webkit.cts.WebViewTest#testAndroidAssetQueryParam;android.webkit.cts.WebViewTest#testAccessPluginList;android.webkit.cts.CookieTest#testPath;android.webkit.cts.WebViewTest#testAccessHttpAuthUsernamePassword;android.webkit.cts.WebViewTest#testUseRemovedJavascriptInterface;android.webkit.cts.WebSettingsTest#testAccessTextSize;android.webkit.cts.URLUtilTest#testIsAssetUrl;android.webkit.cts.CookieTest#testInvalidDomain;android.webkit.cts.CookieSyncManagerTest#testCookieSyncManager;android.webkit.cts.URLUtilTest#testComposeSearchUrl;android.webkit.cts.WebChromeClientTest#testWindows;android.webkit.cts.WebViewTest#testRequestImageRef;android.webkit.cts.WebSettingsTest#testAccessDefaultFontSize;android.webkit.cts.WebViewClientTest#testShouldOverrideKeyEvent;android.webkit.cts.WebHistoryItemTest#testWebHistoryItem;android.webkit.cts.WebSettingsTest#testAccessBuiltInZoomControls;android.webkit.cts.WebSettingsTest#testAppCacheDisabled;android.webkit.cts.WebViewTest#testSetWebChromeClient;android.webkit.cts.WebViewTest#testGetHitTestResult;android.webkit.cts.WebSettingsTest#testAccessStandardFontFamily;android.webkit.cts.GeolocationTest#testSimpleGeolocationRequestReject;android.webkit.cts.WebSettingsTest#testBlockNetworkLoads;android.webkit.cts.DateSorterTest#testGetBoundary;android.webkit.cts.WebViewTest#testCapturePicture;android.webkit.cts.WebSettingsTest#testAccessPluginsEnabled;android.webkit.cts.WebViewTest#testSaveAndRestoreState;android.webkit.cts.WebViewTest#testLoadUrl;android.webkit.cts.HttpAuthHandlerTest#testCancel;android.webkit.cts.URLUtilTest#testIsCookielessProxyUrl;android.webkit.cts.WebViewTest#testGetFavicon;android.webkit.cts.MimeTypeMapTest#testGetExtensionFromMimeType" />
<Entry uri="android.widget" exclude="android.widget.cts.ImageSwitcherTest#testSetImageDrawable;android.widget.cts.ExpandableListViewTest#testOnSaveInstanceState;android.widget.cts.RemoteViewsTest#testSetFloat;android.widget.cts.ToggleButtonTest#testConstructor;android.widget.cts.CursorTreeAdapterTest#testOnGroupCollapsed;android.widget.cts.ListViewTest#testDispatchDraw;android.widget.cts.HorizontalScrollViewTest#testRequestLayout;android.widget.cts.TextViewTest#testDrawableResolution;android.widget.cts.CursorTreeAdapterTest#testGetGroup;android.widget.cts.RemoteViewsTest#testSetBoolean;android.widget.cts.SimpleExpandableListAdapterTest#testGetChildrenCount;android.widget.cts.TimePickerTest#testSetEnabled;android.widget.cts.RemoteViewsTest#testSetChronometer;android.widget.cts.BaseExpandableListAdapterTest#testNotifyDataSetChanged;android.widget.cts.TextViewTest#testConstructor;android.widget.cts.FrameLayoutTest#testGenerateLayoutParams2;android.widget.cts.FrameLayoutTest#testGenerateLayoutParams1;android.widget.cts.DialerFilterTest#testClearText;android.widget.cts.ListViewTest#testFindViewWithTagTraversal;android.widget.cts.TextViewTest#testGetResolvedTextAlignmentWithInheritance;android.widget.cts.SimpleAdapterTest#testSetDropDownViewResource;android.widget.cts.GalleryTest#testShowContextMenu;android.widget.cts.ExpandableListViewTest#testSetChildIndicator;android.widget.cts.GalleryTest#testConstructor;android.widget.cts.CursorTreeAdapterTest#testGetGroupCount;android.widget.cts.TextViewTest#testDebug;android.widget.cts.ExpandableListViewTest#testSetIndicatorBounds;android.widget.cts.AutoCompleteTextViewTest#testOnKeyPreIme;android.widget.cts.TextViewTest#testOnTrackballEvent;android.widget.cts.ExpandableListViewTest#testAndroidTestCaseSetupProperly;android.widget.cts.PopupWindowTest#testAccessBackground;android.widget.cts.PopupWindowTest#testGetMaxAvailableHeight;android.widget.cts.TextViewTest#testGetTotalPaddingLeft;android.widget.cts.AutoCompleteTextViewTest#testAccessAdapter;android.widget.cts.AutoCompleteTextViewTest#testPerformCompletion;android.widget.cts.ZoomButtonTest#testDispatchUnhandledMove;android.widget.cts.AbsSpinnerTest#testOnMeasure;android.widget.cts.TextViewTest#testOnWindowFocusChanged;android.widget.cts.PopupWindowTest#testUpdateDimensionAndAlignAnchorViewWithOffsets;android.widget.cts.GridLayoutTest#testCheckLayoutParams;android.widget.cts.TabHostTest#testNewTabSpec;android.widget.cts.ViewAnimatorTest#testGetCurrentView;android.widget.cts.ListViewTest#testDispatchKeyEvent;android.widget.cts.TextViewTest#testSetMinEms;android.widget.cts.FrameLayoutTest#testGatherTransparentRegion;android.widget.cts.AbsListViewTest#testDraw;android.widget.cts.ZoomControlsTest#testHasFocus;android.widget.cts.RemoteViews_ActionExceptionTest#testConstructor;android.widget.cts.ViewFlipperTest#testActivityTestCaseSetUpProperly;android.widget.cts.RemoteViewsTest#testSetString;android.widget.cts.SimpleExpandableListAdapterTest#testConstructor;android.widget.cts.GalleryTest#testComputeHorizontalScrollExtent;android.widget.cts.DialerFilterTest#testGetFilterText;android.widget.cts.RadioGroupTest#testGenerateDefaultLayoutParams;android.widget.cts.DialerFilterTest#testSetFilterWatcher;android.widget.cts.CheckBoxTest#testConstructor;android.widget.cts.ProgressBarTest#testDrawableStateChanged;android.widget.cts.MultiAutoCompleteTextViewTest#testPerformFiltering;android.widget.cts.TextViewTest#testOnKeyMultiple;android.widget.cts.ProgressBarTest#testPostInvalidate;android.widget.cts.SlidingDrawerTest#testOpenAndClose;android.widget.cts.AutoCompleteTextViewTest#testConstructor;android.widget.cts.TextViewTest#testSetLineSpacing;android.widget.cts.ListViewTest#testFindViewTraversal;android.widget.cts.RadioGroupTest#testGetCheckedRadioButtonId;android.widget.cts.TabHostTest#testSetup2;android.widget.cts.TableLayout_LayoutParamsTest#testConstructor;android.widget.cts.HorizontalScrollViewTest#testRequestChildFocus;android.widget.cts.TabWidgetTest#testDispatchDraw;android.widget.cts.PopupWindowTest#testUpdate;android.widget.cts.BaseAdapterTest#testNotifyDataSetInvalidated;android.widget.cts.ProgressBarTest#testOnSaveAndRestoreInstanceState;android.widget.cts.TabHostTest#testSetup1;android.widget.cts.TextViewTest#testOnMeasure;android.widget.cts.CompoundButtonTest#testAccessInstanceState;android.widget.cts.TabWidgetTest#testOnFocusChange;android.widget.cts.DialerFilterTest#testOnFinishInflate;android.widget.cts.ImageViewTest#testSetSelected;android.widget.cts.TextViewTest#testDrawableResolution2;android.widget.cts.ExpandableListViewWithHeadersTest#testPreconditions;android.widget.cts.AbsListViewTest#testSetFilterText;android.widget.cts.ExpandableListViewTest#testGetAdapter;android.widget.cts.TextViewTest#testSingleLine;android.widget.cts.HorizontalScrollViewTest#testComputeScroll;android.widget.cts.CursorAdapterTest#testRunQueryOnBackgroundThread;android.widget.cts.ToastTest#testMakeText2;android.widget.cts.CursorAdapterTest#testGetView;android.widget.cts.ViewSwitcherTest#testSetFactory;android.widget.cts.ToastTest#testMakeText1;android.widget.cts.GridViewTest#testAccessStretchMode;android.widget.cts.AutoCompleteTextViewTest#testGetThreshold;android.widget.cts.RemoteViewsTest#testConstructor;android.widget.cts.AbsListViewTest#testCheckLayoutParams;android.widget.cts.ViewAnimatorTest#testSetAnimateFirstView;android.widget.cts.DigitalClockTest#testActivityTestCaseSetUpProperly;android.widget.cts.SlidingDrawerTest#testAnimateOpenAndClose;android.widget.cts.PopupWindowTest#testAccessFocusable;android.widget.cts.TimePickerTest#testSetOnTimeChangedListener;android.widget.cts.ScrollViewTest#testGetMaxScrollAmount;android.widget.cts.CursorAdapterTest#testOnContentChanged;android.widget.cts.TextViewTest#testGetTotalPaddingBottom;android.widget.cts.AnalogClockTest#testOnMeasure;android.widget.cts.RadioGroupTest#testCheck;android.widget.cts.CursorTreeAdapterTest#testNotifyDataSetChanged;android.widget.cts.TwoLineListItemTest#testActivityTestCaseSetUpProperly;android.widget.cts.AbsListViewTest#testGetContextMenuInfo;android.widget.cts.ViewAnimatorTest#testAccessOutAnimation;android.widget.cts.SlidingDrawerTest#testConstructor;android.widget.cts.TimePickerTest#testOnSaveInstanceStateAndOnRestoreInstanceState;android.widget.cts.AbsListViewTest#testAccessFastScrollEnabled;android.widget.cts.BaseAdapterTest#testGetItemViewType;android.widget.cts.AbsListViewTest#testSetOnScrollListener;android.widget.cts.ImageViewTest#testSetImageURI;android.widget.cts.RadioGroupTest#testOnFinishInflate;android.widget.cts.TableRowTest#testGenerateLayoutParams;android.widget.cts.DialerFilterTest#testGetLetters;android.widget.cts.HorizontalScrollViewTest#testComputeHorizontalScrollRange;android.widget.cts.TextViewTest#testSetPadding;android.widget.cts.VideoViewTest#testPlayVideo1;android.widget.cts.ArrayAdapterTest#testRemove;android.widget.cts.GridViewTest#testGetNumColumns;android.widget.cts.AbsSpinnerTest#testSetSelectionIntBoolean;android.widget.cts.LayoutDirectionTest#testDirectionForAllLayoutsWithCode;android.widget.cts.SimpleCursorAdapterTest#testAccessStringConversionColumn;android.widget.cts.ViewAnimatorTest#testGetBaseline;android.widget.cts.ChronometerTest#testConstructor;android.widget.cts.ResourceCursorTreeAdapterTest#testConstructor;android.widget.cts.AdapterViewTest#testGetPositionForView;android.widget.cts.GridViewTest#testSetVerticalSpacing;android.widget.cts.ButtonTest#testAndroidTestCaseSetupProperly;android.widget.cts.ToggleButtonTest#testToggleText;android.widget.cts.RatingBarTest#testSetMax;android.widget.cts.RemoteViewsTest#testSetViewVisibility;android.widget.cts.ScrollViewTest#testOnTouchEvent;android.widget.cts.BaseAdapterTest#testIsEnabled;android.widget.cts.ExpandableListViewTest#testSetOnChildClickListener;android.widget.cts.EditTextTest#testAndroidTestCaseSetupProperly;android.widget.cts.TextViewTest#testMarquee;android.widget.cts.ImageViewTest#testActivityTestCaseSetUpProperly;android.widget.cts.RadioGroupTest#testConstructors;android.widget.cts.DialerFilterTest#testAccessMode;android.widget.cts.DatePickerTest#testInit;android.widget.cts.TextViewTest#testGetTextColors;android.widget.cts.ProgressBarTest#testAccessProgress;android.widget.cts.TextViewTest#testGetPaint;android.widget.cts.SimpleExpandableListAdapterTest#testNewGroupView;android.widget.cts.AdapterView_AdapterContextMenuInfoTest#testConstructor;android.widget.cts.CompoundButtonTest#testConstructor;android.widget.cts.ImageViewTest#testSetImageLevel;android.widget.cts.SimpleCursorTreeAdapterTest#testBindGroupView;android.widget.cts.SimpleExpandableListAdapterTest#testGetGroup;android.widget.cts.TabWidgetTest#testFocusCurrentTab;android.widget.cts.RelativeLayoutTest#testOnLayout;android.widget.cts.ScrollViewTest#testComputeScroll;android.widget.cts.TextViewTest#testAccessHintTextColor;android.widget.cts.TableLayoutTest#testAccessShrinkAllColumns;android.widget.cts.RemoteViewsTest#testGetPackage;android.widget.cts.GridViewTest#testAttachLayoutAnimationParameters;android.widget.cts.LinearLayout_LayoutParamsTest#testAndroidTestCaseSetupProperly;android.widget.cts.CompoundButtonTest#testAndroidTestCaseSetupProperly;android.widget.cts.ImageViewTest#testSetImageDrawable;android.widget.cts.AdapterViewTest#testAccessVisiblePosition;android.widget.cts.ListViewTest#testSaveAndRestoreInstanceState;android.widget.cts.CompoundButtonTest#testToggle;android.widget.cts.TextViewTest#testMoveCursorToVisibleOffset;android.widget.cts.AutoCompleteTextViewTest#testAccessDropDownWidth;android.widget.cts.RadioGroupTest#testGenerateLayoutParams;android.widget.cts.AdapterViewTest#testCanAnimate;android.widget.cts.ScrollViewTest#testOnLayout;android.widget.cts.AutoCompleteTextViewTest#testEnoughToFilter;android.widget.cts.CheckedTextViewTest#testOnCreateDrawableState;android.widget.cts.RelativeLayout_LayoutParamsTest#testDebug;android.widget.cts.ToastTest#testAccessDuration;android.widget.cts.ToggleButtonTest#testSetChecked;android.widget.cts.HeaderViewListAdapterTest#testGetFootersCount;android.widget.cts.GridLayoutTest#testGenerateDefaultLayoutParams;android.widget.cts.AbsListViewTest#testAccessSmoothScrollbarEnabled;android.widget.cts.SlidingDrawerTest#testSetOnDrawerOpenListener;android.widget.cts.HeaderViewListAdapterTest#testGetHeadersCount;android.widget.cts.RemoteViewsTest#testSetLong;android.widget.cts.SlidingDrawerTest#testSetOnDrawerCloseListener;android.widget.cts.TextViewTest#testGetResolvedTextDirectionLtrWithInheritance;android.widget.cts.ScrollViewTest#testFullScroll;android.widget.cts.RelativeLayout_LayoutParamsTest#testAccessRule1;android.widget.cts.BaseExpandableListAdapterTest#testAreAllItemsEnabled;android.widget.cts.RelativeLayout_LayoutParamsTest#testAccessRule2;android.widget.cts.RemoteViewsActivityTest#testDerivedClass;android.widget.cts.ToastTest#testShowFailure;android.widget.cts.SimpleAdapterTest#testSetViewImage;android.widget.cts.TextViewTest#testAccessPrivateImeOptions;android.widget.cts.AdapterView_AdapterContextMenuInfoTest#testAndroidTestCaseSetupProperly;android.widget.cts.TwoLineListItemTest#testOnFinishInflate;android.widget.cts.ExpandableListViewTest#testGetExpandableListPosition;android.widget.cts.AbsListViewTest#testAccessListPadding;android.widget.cts.ExpandableListViewTest#testExpandGroup;android.widget.cts.TextViewTest#testGetUrls;android.widget.cts.LinearLayoutTest#testAccessBaselineAlignedChildIndex;android.widget.cts.CheckBoxTest#testAndroidTestCaseSetupProperly;android.widget.cts.ZoomControlsTest#testSetOnZoomInClickListener;android.widget.cts.AbsSpinnerTest#testGetCount;android.widget.cts.SimpleExpandableListAdapterTest#testNewChildView;android.widget.cts.ViewSwitcherTest#testConstructor;android.widget.cts.AutoCompleteTextViewTest#testReplaceText;android.widget.cts.ScrollViewTest#testAccessFillViewport;android.widget.cts.ToastTest#testShow;android.widget.cts.TextViewTest#testDrawableStateChanged;android.widget.cts.TimePickerTest#testGetBaseline;android.widget.cts.TextViewTest#testOnTouchEvent;android.widget.cts.ListViewTest#testOnFocusChanged;android.widget.cts.ImageViewTest#testDrawableStateChanged;android.widget.cts.FrameLayoutTest#testOnLayout;android.widget.cts.ListViewTest#testAccessItemsCanFocus;android.widget.cts.AutoCompleteTextViewTest#testOnCommitCompletion;android.widget.cts.ScrollViewTest#testAccessSmoothScrollingEnabled;android.widget.cts.TextViewTest#testSelection;android.widget.cts.CheckedTextViewTest#testOnDraw;android.widget.cts.ViewAnimatorTest#testConstructor;android.widget.cts.RadioGroupTest#testInternalPassThroughHierarchyChangeListener;android.widget.cts.SimpleCursorAdapterTest#testSetViewImage;android.widget.cts.AdapterViewTest#testGetSelected;android.widget.cts.ExpandableListViewWithHeadersTest#testSelectedPosition;android.widget.cts.ProgressBarTest#testAccessIndeterminateDrawable;android.widget.cts.TableLayoutTest#testSetOnHierarchyChangeListener;android.widget.cts.ExpandableListViewTest#testSetOnItemClickListener;android.widget.cts.ProgressBarTest#testSetVisibility;android.widget.cts.AutoCompleteTextViewTest#testConvertSelectionToString;android.widget.cts.ImageViewTest#testSetImageResource;android.widget.cts.ScrollViewTest#testGetVerticalFadingEdgeStrengths;android.widget.cts.FilterTest#testFilter2;android.widget.cts.CursorTreeAdapterTest#testAndroidTestCaseSetupProperly;android.widget.cts.FilterTest#testFilter1;android.widget.cts.ZoomControlsTest#testSetIsZoomOutEnabled;android.widget.cts.ScrollViewTest#testMeasureChildWithMargins;android.widget.cts.CompoundButtonTest#testSetOnCheckedChangeListener;android.widget.cts.TextViewTest#testGetEditableText;android.widget.cts.HorizontalScrollViewTest#testOnRequestFocusInDescendants;android.widget.cts.AbsSpinnerTest#testAccessAdapter;android.widget.cts.ChronometerTest#testAccessOnChronometerTickListener;android.widget.cts.HeaderViewListAdapterTest#testConstructor;android.widget.cts.FrameLayoutTest#testSetForegroundGravity;android.widget.cts.AbsSpinnerTest#testGetSelectedView;android.widget.cts.TextViewTest#testSetGetTextAlignment;android.widget.cts.TextViewTest#testGetLayout;android.widget.cts.ImageViewTest#testConstructor;android.widget.cts.ImageViewTest#testInvalidateDrawable;android.widget.cts.PopupWindowTest#testShowAsDropDownWithOffsets;android.widget.cts.PopupWindowTest#testIsAboveAnchor;android.widget.cts.AutoCompleteTextViewTest#testPerformFiltering;android.widget.cts.ViewFlipperTest#testConstructor;android.widget.cts.DatePickerTest#testUpdateDate;android.widget.cts.MultiAutoCompleteTextViewTest#testMultiAutoCompleteTextView;android.widget.cts.MultiAutoCompleteTextView_CommaTokenizerTest#testConstructor;android.widget.cts.RemoteViewsTest#testSetOnClickPendingIntent;android.widget.cts.HorizontalScrollViewTest#testScrollTo;android.widget.cts.HorizontalScrollViewTest#testOnTouchEvent;android.widget.cts.ListViewTest#testOnMeasure;android.widget.cts.TextViewTest#testSetHighlightColor;android.widget.cts.BaseExpandableListAdapterTest#testNotifyDataSetInvalidated;android.widget.cts.ExpandableListViewWithHeadersTest#testConvertionBetweenFlatAndPacked;android.widget.cts.HeaderViewListAdapterTest#testRemoveFooter;android.widget.cts.ListViewTest#testTransientStateStableIds;android.widget.cts.ScrollViewTest#testSmoothScrollBy;android.widget.cts.ViewSwitcherTest#testAndroidTestCaseSetupProperly;android.widget.cts.TextViewTest#testAccessAutoLinkMask;android.widget.cts.ScrollerTest#testScrollModeWithDefaultDuration;android.widget.cts.GalleryTest#testComputeHorizontalScrollRange;android.widget.cts.CheckedTextViewTest#testSetPadding;android.widget.cts.CursorTreeAdapterTest#testGetGroupId;android.widget.cts.RemoteViewsTest#testApply;android.widget.cts.DialerFilterTest#testIsQwertyKeyboard;android.widget.cts.GalleryTest#testShowContextMenuForChild;android.widget.cts.ScrollViewTest#testPageScroll;android.widget.cts.SimpleCursorTreeAdapterTest#testSetViewImage;android.widget.cts.TableLayoutTest#testOnLayout;android.widget.cts.ArrayAdapterTest#testGetPosition;android.widget.cts.TabWidgetTest#testOnSizeChanged;android.widget.cts.SimpleCursorAdapterTest#testNewDropDownView;android.widget.cts.AutoCompleteTextViewTest#testAccessListSelection;android.widget.cts.TextViewTest#testSetText1;android.widget.cts.TextViewTest#testSetText2;android.widget.cts.RemoteViewsActivityTest#testWebView;android.widget.cts.TextViewTest#testSetText3;android.widget.cts.ToastTest#testAccessGravity;android.widget.cts.HorizontalScrollViewTest#testAddViewWithIndex;android.widget.cts.ResourceCursorTreeAdapterTest#testNewChildView;android.widget.cts.HeaderViewListAdapterTest#testAndroidTestCaseSetupProperly;android.widget.cts.ExpandableListViewTest#testGetPackedPositionForGroup;android.widget.cts.ZoomControlsTest#testShowAndHide;android.widget.cts.CompoundButtonTest#testAccessChecked;android.widget.cts.SimpleAdapterTest#testGetView;android.widget.cts.DialerFilterTest#testGetDigits;android.widget.cts.ArrayAdapterTest#testDataChangeEvent;android.widget.cts.ImageSwitcherTest#testAndroidTestCaseSetupProperly;android.widget.cts.SimpleExpandableListAdapterTest#testGetChildView;android.widget.cts.ZoomControlsTest#testConstructor;android.widget.cts.CompoundButtonTest#testVerifyDrawable;android.widget.cts.TextViewTest#testSetEms;android.widget.cts.AbsSpinnerTest#testGenerateDefaultLayoutParams;android.widget.cts.TextViewTest#testAccessError;android.widget.cts.ZoomButtonTest#testOnTouchEvent;android.widget.cts.TextViewTest#testSetMaxLinesException;android.widget.cts.CompoundButtonTest#testSetButtonDrawableById;android.widget.cts.FrameLayoutTest#testGenerateDefaultLayoutParams;android.widget.cts.HorizontalScrollViewTest#testComputeScrollDeltaToGetChildRectOnScreen;android.widget.cts.ExpandableListViewTest#testSetSelectedChild;android.widget.cts.MediaControllerTest#testShow;android.widget.cts.CursorAdapterTest#testGetDropDownView;android.widget.cts.ListViewTest#testNoSelectableItems;android.widget.cts.TextViewTest#testGetBaseLine;android.widget.cts.AbsSpinnerTest#testConstructor;android.widget.cts.ListViewTest#testAccessDividerHeight;android.widget.cts.TabWidgetTest#testChildDrawableStateChanged;android.widget.cts.AbsListViewTest#testAccessSelectedItem;android.widget.cts.ScrollerTest#testTimePassed;android.widget.cts.ArrayAdapterTest#testGetItem;android.widget.cts.ImageViewTest#testVerifyDrawable;android.widget.cts.ProgressBarTest#testConstructor;android.widget.cts.ProgressBarTest#testIncrementSecondaryProgressBy;android.widget.cts.CursorTreeAdapterTest#testSetChildrenCursor;android.widget.cts.FrameLayoutTest#testCheckLayoutParams;android.widget.cts.AbsoluteLayoutTest#testGenerateDefaultLayoutParams;android.widget.cts.ZoomButtonTest#testOnKeyUp;android.widget.cts.BaseExpandableListAdapterTest#testGetCombinedId;android.widget.cts.ListViewTest#testSetSelection;android.widget.cts.SimpleCursorAdapterTest#testNewView;android.widget.cts.AutoCompleteTextViewTest#testPopupWindow;android.widget.cts.TextView_SaveStateTest#testWriteToParcel;android.widget.cts.TabHost_TabSpecTest#testSetContent2;android.widget.cts.SeekBarTest#testConstructor;android.widget.cts.TabHost_TabSpecTest#testSetContent1;android.widget.cts.TextViewTest#testSetExtractedText;android.widget.cts.TabHost_TabSpecTest#testSetContent3;android.widget.cts.SimpleExpandableListAdapterTest#testGetGroupCount;android.widget.cts.TextViewTest#testComputeVerticalScrollRange;android.widget.cts.GridLayoutTest#testAlignment;android.widget.cts.ExpandableListViewTest#testGetPackedPositionForChild;android.widget.cts.FrameLayoutTest#testConstructor;android.widget.cts.CursorAdapterTest#testAndroidTestCaseSetupProperly;android.widget.cts.RelativeLayoutTest#testSetHorizontalGravity;android.widget.cts.GalleryTest#testDispatchKeyEvent;android.widget.cts.ToastTest#testSetText1;android.widget.cts.HorizontalScrollViewTest#testFullScroll;android.widget.cts.RemoteViewsTest#testSetCharSequence;android.widget.cts.ToastTest#testSetText2;android.widget.cts.HeaderViewListAdapterTest#testRemoveHeader;android.widget.cts.TextSwitcherTest#testSetCurrentText;android.widget.cts.TwoLineListItemTest#testConstructor;android.widget.cts.MediaControllerTest#testMediaController;android.widget.cts.ListViewTest#testConstructor;android.widget.cts.AbsListViewTest#testAccessSelector;android.widget.cts.BaseExpandableListAdapterTest#testDataSetObserver;android.widget.cts.BaseAdapterTest#testHasStableIds;android.widget.cts.TextViewTest#testAccessImeActionLabel;android.widget.cts.CompoundButtonTest#testSetButtonDrawableByDrawable;android.widget.cts.AbsListViewTest#testLayoutChildren;android.widget.cts.ImageViewTest#testClearColorFilter;android.widget.cts.TextViewTest#testGetResolvedTextDirectionRtl;android.widget.cts.CheckedTextViewTest#testChecked;android.widget.cts.MultiAutoCompleteTextViewTest#testReplaceText;android.widget.cts.DigitalClockTest#testOnDetachedFromWindow;android.widget.cts.CursorTreeAdapterTest#testGetChildView;android.widget.cts.FrameLayout_LayoutParamsTest#testAndroidTestCaseSetupProperly;android.widget.cts.ImageViewTest#testSetMaxWidth;android.widget.cts.TabHostTest#testDispatchWindowFocusChanged;android.widget.cts.DigitalClockTest#testConstructor;android.widget.cts.DialerFilterTest#testOnKeyUpDown;android.widget.cts.TextViewTest#testSetHorizontallyScrolling;android.widget.cts.HeaderViewListAdapterTest#testGetViewTypeCount;android.widget.cts.AbsSeekBarTest#testAccessKeyProgressIncrement;android.widget.cts.AbsSeekBarTest#testSetThumb;android.widget.cts.ProgressBarTest#testOnDraw;android.widget.cts.TextViewTest#testSetText;android.widget.cts.PopupWindowTest#testAccessContentView;android.widget.cts.GridLayoutTest#testConstructor;android.widget.cts.PopupWindowTest#testAccessHeight;android.widget.cts.ToggleButtonTest#testAndroidTestCaseSetupProperly;android.widget.cts.ProgressBarTest#testVerifyDrawable;android.widget.cts.TableRowTest#testOnLayout;android.widget.cts.RadioGroupTest#testInternalCheckedStateTracker;android.widget.cts.HorizontalScrollViewTest#testOnSizeChanged;android.widget.cts.ResourceCursorAdapterTest#testNewView;android.widget.cts.MultiAutoCompleteTextView_CommaTokenizerTest#testFindTokenEnd;android.widget.cts.ZoomButtonTest#testOnLongClick;android.widget.cts.AnalogClockTest#testOnDetachedFromWindow;android.widget.cts.TextViewTest#testSetMaxLines;android.widget.cts.ExpandableListViewTest#testPerformItemClick;android.widget.cts.TextViewTest#testResetTextDirection;android.widget.cts.ScrollViewTest#testScrollTo;android.widget.cts.TableLayoutTest#testGenerateDefaultLayoutParams;android.widget.cts.ImageViewTest#testSetAdjustViewBounds;android.widget.cts.TableRowTest#testCheckLayoutParams;android.widget.cts.CheckedTextViewTest#testToggle;android.widget.cts.RemoteViewsTest#testSetProgressBar;android.widget.cts.VideoViewTest#testSetOnErrorListener;android.widget.cts.GalleryTest#testDispatchSetPressed;android.widget.cts.HorizontalScrollViewTest#testSmoothScrollTo;android.widget.cts.ZoomControlsTest#testSetZoomSpeed;android.widget.cts.ExpandableListViewTest#testSetAdapter;android.widget.cts.AutoCompleteTextViewTest#testOnFilterComplete;android.widget.cts.ImageViewTest#testGetDrawable;android.widget.cts.CursorTreeAdapterTest#testRunQueryOnBackgroundThread;android.widget.cts.SlidingDrawerTest#testGetHandle;android.widget.cts.BaseAdapterTest#testAndroidTestCaseSetupProperly;android.widget.cts.MediaControllerTest#testOnTrackballEvent;android.widget.cts.GalleryTest#testGenerateLayoutParams;android.widget.cts.PopupWindowTest#testConstructor;android.widget.cts.GalleryTest#testFoo;android.widget.cts.PopupWindowTest#testAccessAnimationStyle;android.widget.cts.ToggleButtonTest#testAccessTextOn;android.widget.cts.AbsoluteLayoutTest#testGenerateLayoutParams1;android.widget.cts.TextViewTest#testGetDefaultEditable;android.widget.cts.AbsoluteLayoutTest#testGenerateLayoutParams2;android.widget.cts.ArrayAdapterTest#testGetFilter;android.widget.cts.CheckedTextViewTest#testSetCheckMarkDrawableById;android.widget.cts.ScrollerTest#testAbortAnimation;android.widget.cts.LinearLayout_LayoutParamsTest#testConstructor;android.widget.cts.TextViewTest#testComputeVerticalScrollExtent;android.widget.cts.AbsSpinnerTest#testSetSelectionInt;android.widget.cts.TabHostTest#testGetTabContentView;android.widget.cts.TextViewTest#testGetDefaultMovementMethod;android.widget.cts.ScrollViewTest#testRequestChildRectangleOnScreen;android.widget.cts.TabHostTest#testGetCurrentView;android.widget.cts.TextViewTest#testAccessFilters;android.widget.cts.GalleryTest#testCheckLayoutParams;android.widget.cts.RadioGroup_LayoutParamsTest#testConstructor;android.widget.cts.BaseExpandableListAdapterTest#testOnGroupExpanded;android.widget.cts.MultiAutoCompleteTextView_CommaTokenizerTest#testTerminateToken;android.widget.cts.ScrollViewTest#testConstructor;android.widget.cts.ListViewTest#testLayoutChildren;android.widget.cts.RemoteViewsTest#testSetImageViewUri;android.widget.cts.ViewAnimatorTest#testAccessDisplayedChild;android.widget.cts.ExpandableListViewTest#testCollapseGroup;android.widget.cts.AnalogClockTest#testConstructor;android.widget.cts.CursorAdapterTest#testConvertToString;android.widget.cts.BaseAdapterTest#testIsEmpty;android.widget.cts.ResourceCursorTreeAdapterTest#testNewGroupView;android.widget.cts.ScrollViewTest#testFling;android.widget.cts.SlidingDrawerTest#testOnMeasure;android.widget.cts.TextViewTest#testSetMaxEms;android.widget.cts.LinearLayoutTest#testGenerateLayoutParams;android.widget.cts.PopupWindowTest#testAccessInputMethodMode;android.widget.cts.ListViewTest#testPerformItemClick;android.widget.cts.TextViewTest#testOnTextChanged;android.widget.cts.GridViewTest#testSetSelection;android.widget.cts.CursorAdapterTest#testHasStableIds;android.widget.cts.ProgressBarTest#testSetIndeterminate;android.widget.cts.TableRowTest#testGetVirtualChildCount;android.widget.cts.AutoCompleteTextViewTest#testOnTextChanged;android.widget.cts.TextViewTest#testSetLinesException;android.widget.cts.TextViewTest#testLength;android.widget.cts.RelativeLayoutTest#testSetGravity;android.widget.cts.RelativeLayoutTest#testConstructor;android.widget.cts.TextViewTest#testGetLineHeight;android.widget.cts.GalleryTest#testSetAnimationDuration;android.widget.cts.PopupWindowTest#testAccessTouchable;android.widget.cts.RelativeLayoutTest#testSetVerticalGravity;android.widget.cts.CursorTreeAdapterTest#testConstructor;android.widget.cts.AbsSpinnerTest#testRequestLayout;android.widget.cts.TextViewTest#testOnKeyShortcut;android.widget.cts.TableRowTest#testGetVirtualChildAt;android.widget.cts.SpinnerTest#testConstructor;android.widget.cts.SimpleAdapterTest#testGetDropDownView;android.widget.cts.ScrollViewTest#testAddViewWithLayoutParams;android.widget.cts.HeaderViewListAdapterTest#testGetItemViewType;android.widget.cts.RadioGroupTest#testSetOnCheckedChangeListener;android.widget.cts.ToggleButtonTest#testOnFinishInflate;android.widget.cts.DialerFilterTest#testAppend;android.widget.cts.HorizontalScrollViewTest#testRequestChildRectangleOnScreen;android.widget.cts.RadioButtonTest#testConstructor;android.widget.cts.PopupWindowTest#testDismiss;android.widget.cts.TableLayoutTest#testAddView2;android.widget.cts.TableLayoutTest#testAddView3;android.widget.cts.TabHostTest#testOnTouchModeChanged;android.widget.cts.TableLayoutTest#testAddView4;android.widget.cts.HeaderViewListAdapterTest#testGetWrappedAdapter;android.widget.cts.TableLayoutTest#testAddView1;android.widget.cts.ImageSwitcherTest#testSetImageResource;android.widget.cts.ToggleButtonTest#testDrawableStateChanged;android.widget.cts.EditTextTest#testSetSelectionIndex;android.widget.cts.EditTextTest#testExtendSelection;android.widget.cts.AbsSeekBarTest#testSetMax;android.widget.cts.CursorTreeAdapterTest#testChangeCursor;android.widget.cts.AdapterViewTest#testItemOrItemIdAtPosition;android.widget.cts.HorizontalScrollViewTest#testDispatchKeyEvent;android.widget.cts.TableRowTest#testGenerateDefaultLayoutParams;android.widget.cts.AbsListViewTest#testSetRecyclerListener;android.widget.cts.GalleryTest#testGetContextMenuInfo;android.widget.cts.AbsListViewTest#testAccessStackFromBottom;android.widget.cts.TextViewTest#testAccessText;android.widget.cts.SpinnerTest#testGetBaseline;android.widget.cts.ScrollViewTest#testRequestChildFocus;android.widget.cts.LinearLayoutTest#testGenerateDefaultLayoutParams;android.widget.cts.ButtonTest#testConstructor;android.widget.cts.ResourceCursorAdapterTest#testSetViewResource;android.widget.cts.ExpandableListViewBasicTest#testContextMenus;android.widget.cts.FrameLayoutTest#testVerifyDrawable;android.widget.cts.ExpandableListViewTest#testGetPackedPositionType;android.widget.cts.LinearLayoutTest#testLayoutHorizontal;android.widget.cts.ScrollViewTest#testComputeVerticalScrollRange;android.widget.cts.GridViewTest#testOnFocusChanged;android.widget.cts.ZoomControlsTest#testOnTouchEvent;android.widget.cts.GridViewTest#testActivityTestCaseSetUpProperly;android.widget.cts.ListViewTest#testAccessItemChecked;android.widget.cts.AbsoluteLayoutTest#testConstructor;android.widget.cts.TextViewTest#testComputeHorizontalScrollRange;android.widget.cts.HorizontalScrollViewTest#testAddViewWithLayoutParams;android.widget.cts.RemoteViewsTest#testGetLayoutId;android.widget.cts.CursorTreeAdapterTest#testNotifyDataSetChangedBoolean;android.widget.cts.TableRow_LayoutParamsTest#testSetBaseAttributes;android.widget.cts.HorizontalScrollViewTest#testMeasureChildWithMargins;android.widget.cts.TextViewTest#testSetIncludeFontPadding;android.widget.cts.HorizontalScrollViewTest#testAddView;android.widget.cts.TimePickerTest#testAccessCurrentMinute;android.widget.cts.TextViewTest#testGetExtendedPaddingBottom;android.widget.cts.BaseExpandableListAdapterTest#testIsEmpty;android.widget.cts.SimpleAdapterTest#testAccessViewBinder;android.widget.cts.SpinnerTest#testOnLayout;android.widget.cts.AutoCompleteTextViewTest#testAccessValidater;android.widget.cts.ScrollViewTest#testAddViewWithIndex;android.widget.cts.FrameLayoutTest#testDrawableStateChanged;android.widget.cts.PopupWindowTest#testSetTouchInterceptor;android.widget.cts.SimpleAdapterTest#testGetItem;android.widget.cts.ImageViewTest#testSetColorFilter1;android.widget.cts.ImageViewTest#testSetColorFilter2;android.widget.cts.SlidingDrawerTest#testDispatchDraw;android.widget.cts.TextViewTest#testSetOnEditorActionListener;android.widget.cts.DatePickerTest#testSetEnabled;android.widget.cts.RemoteViewsTest#testReapply;android.widget.cts.TextViewTest#testCompound;android.widget.cts.AdapterViewTest#testAccessEmptyView;android.widget.cts.Gallery_LayoutParamsTest#testConstructor;android.widget.cts.TextViewTest#testGetResolvedTextDirectionRtlWithInheritance;android.widget.cts.PopupWindowTest#testShowAtLocation;android.widget.cts.TextViewTest#testPerformLongClick;android.widget.cts.ExpandableListViewTest#testSetChildDivider;android.widget.cts.PopupWindowTest#testAccessClippingEnabled;android.widget.cts.RemoteViewsTest#testSetTextViewText;android.widget.cts.ScrollViewTest#testMeasureChild;android.widget.cts.TableLayoutTest#testAccessColumnShrinkable;android.widget.cts.TableRow_LayoutParamsTest#testConstructor;android.widget.cts.GalleryTest#testComputeHorizontalScrollOffset;android.widget.cts.ProgressBarTest#testOnMeasure;android.widget.cts.ProgressBarTest#testAccessProgressDrawable;android.widget.cts.SimpleAdapterTest#testGetFilter;android.widget.cts.RadioGroupTest#testSetOnHierarchyChangeListener;android.widget.cts.AbsListViewTest#testHandleDataChanged;android.widget.cts.AbsListViewTest#testShowContextMenuForChild;android.widget.cts.ExpandableListViewTest#testConstructor;android.widget.cts.HeaderViewListAdapterTest#testIsEmpty;android.widget.cts.AlphabetIndexerTest#testAlphabetIndexer;android.widget.cts.ChronometerTest#testAccessBase;android.widget.cts.TextViewTest#testAccessRawContentType;android.widget.cts.ScrollViewTest#testExecuteKeyEvent;android.widget.cts.SpinnerTest#testAccessPrompt;android.widget.cts.AnalogClockTest#testOnDraw;android.widget.cts.ChronometerTest#testStartAndStop;android.widget.cts.TabWidgetTest#testSetCurrentTab;android.widget.cts.CursorTreeAdapterTest#testGetFilter;android.widget.cts.ImageSwitcherTest#testSetImageURI;android.widget.cts.TabHostTest#testSetOnTabChangedListener;android.widget.cts.ScrollViewTest#testSmoothScrollTo;android.widget.cts.SimpleExpandableListAdapterTest#testGetGroupId;android.widget.cts.AbsListViewTest#testAccessCacheColorHint;android.widget.cts.TabHostTest#testSetCurrentTabByTag;android.widget.cts.HeaderViewListAdapterTest#testIsEnabled;android.widget.cts.ImageViewTest#testSetImageState;android.widget.cts.ExpandableListViewTest#testSetSelectedGroup;android.widget.cts.DialerFilterTest#testRemoveFilterWatcher;android.widget.cts.ToggleButtonTest#testAccessTextOff;android.widget.cts.TextViewTest#testSetSelectAllOnFocus;android.widget.cts.TextViewTest#testAccessKeyListener;android.widget.cts.ArrayAdapterTest#testInsert;android.widget.cts.MediaControllerTest#testSetPrevNextListeners;android.widget.cts.PopupWindowTest#testUpdatePositionAndDimension;android.widget.cts.TextViewTest#testOnDraw;android.widget.cts.TextViewTest#testSetFrame;android.widget.cts.ScrollerTest#testAccessFinalX;android.widget.cts.ScrollerTest#testAccessFinalY;android.widget.cts.AdapterViewTest#testOnLayout;android.widget.cts.ScrollViewTest#testOnRequestFocusInDescendants;android.widget.cts.TextViewTest#testCancelLongPress;android.widget.cts.GridViewTest#testAccessAdapter;android.widget.cts.ZoomButtonTest#testSetZoomSpeed;android.widget.cts.ExpandableListViewTest#testGetPackedPositionGroup;android.widget.cts.ExpandableListViewTest#testSetGroupIndicator;android.widget.cts.TextViewTest#testGetResolvedTextDirectionLtr;android.widget.cts.BaseAdapterTest#testGetDropDownView;android.widget.cts.ViewAnimatorTest#testShowPrevious;android.widget.cts.TextViewTest#testOnCreateContextMenu;android.widget.cts.TextViewTest#testAppend;android.widget.cts.DialerFilterTest#testOnFocusChanged;android.widget.cts.SlidingDrawerTest#testOnLayout;android.widget.cts.TextViewTest#testGetFocusedRect;android.widget.cts.TextSwitcherTest#testAddView;android.widget.cts.ExpandableListViewTest#testSetChildIndicatorBounds;android.widget.cts.RemoteViewsTest#testSetImageViewBitmap;android.widget.cts.CursorTreeAdapterTest#testHasStableIds;android.widget.cts.ToastTest#testConstructor;android.widget.cts.CursorTreeAdapterTest#testConvertToString;android.widget.cts.AbsListViewTest#testGetTopBottomFadingEdgeStrength;android.widget.cts.EditTextTest#testGetDefaultMovementMethod;android.widget.cts.AbsListViewTest#testAddTouchables;android.widget.cts.SeekBarTest#testSetOnSeekBarChangeListener;android.widget.cts.TextViewTest#testAccessLinkTextColor;android.widget.cts.TextViewTest#testAccessEllipsize;android.widget.cts.RatingBarTest#testAccessNumStars;android.widget.cts.ImageViewTest#testGetBaseline;android.widget.cts.AnalogClockTest#testOnAttachedToWindow;android.widget.cts.LayoutDirectionTest#testDirectionInheritanceForAllLayoutsWithCode;android.widget.cts.AutoCompleteTextViewTest#testAccessItemSelectedListener;android.widget.cts.TextSwitcherTest#testConstructor;android.widget.cts.TextViewTest#testGetResolvedTextAlignment;android.widget.cts.ExpandableListView_ExpandableListContextMenuInfoTest#testConstructor;android.widget.cts.HeaderViewListAdapterTest#testGetFilter;android.widget.cts.AbsSeekBarTest#testConstructor;android.widget.cts.ZoomControlsTest#testSetOnZoomOutClickListener;android.widget.cts.ArrayAdapterTest#testSort;android.widget.cts.HorizontalScrollViewTest#testFling;android.widget.cts.GridViewTest#testConstructor;android.widget.cts.RemoteViewsTest#testNotFeasibleSetters;android.widget.cts.RemoteViewsTest#testWriteToParcel;android.widget.cts.ScrollViewTest#testAddView;android.widget.cts.FilterTest#testConstructor;android.widget.cts.SimpleExpandableListAdapterTest#testGetChildId;android.widget.cts.AutoCompleteTextViewTest#testOnDetachedFromWindow;android.widget.cts.ScrollViewTest#testRequestLayout;android.widget.cts.ImageButtonTest#testConstructor;android.widget.cts.EditTextTest#testSelectAll;android.widget.cts.PopupWindowTest#testSetOnDismissListener;android.widget.cts.TimePickerTest#testAccessCurrentHour;android.widget.cts.ArrayAdapterTest#testCreateFromResource;android.widget.cts.TextViewTest#testSetShadowLayer;android.widget.cts.CompoundButtonTest#testOnCreateDrawableState;android.widget.cts.SimpleCursorAdapterTest#testChangeCursorAndColumns;android.widget.cts.ImageViewTest#testSetFrame;android.widget.cts.ArrayAdapterTest#testSetDropDownViewResouce;android.widget.cts.ResourceCursorAdapterTest#testNewDropDownView;android.widget.cts.ToastTest#testCancel;android.widget.cts.RatingBarTest#testAccessStepSize;android.widget.cts.CheckedTextViewTest#testSetCheckMarkDrawableByDrawable;android.widget.cts.TextViewTest#testInstanceState;android.widget.cts.AbsListViewTest#testGetFocusedRect;android.widget.cts.ViewAnimatorTest#testAddView;android.widget.cts.AdapterViewTest#testUnsupportedMethods;android.widget.cts.TextViewTest#testOnPrivateIMECommand;android.widget.cts.CursorAdapterTest#testAccessCursor;android.widget.cts.TextViewTest#testBringPointIntoView;android.widget.cts.SpinnerTest#testOnClick;android.widget.cts.TextViewTest#testSetEditableFactory;android.widget.cts.ViewSwitcherTest#testGetNextView;android.widget.cts.AbsSeekBarTest#testAccessThumbOffset;android.widget.cts.AbsoluteLayout_LayoutParamsTest#testDebug;android.widget.cts.DatePickerTest#testAccessDate;android.widget.cts.CursorAdapterTest#testConstructor;android.widget.cts.HorizontalScrollViewTest#testPageScroll;android.widget.cts.AutoCompleteTextViewTest#testPerformValidation;android.widget.cts.TextViewTest#testAccessLinksClickable;android.widget.cts.SlidingDrawerTest#testGetContent;android.widget.cts.ViewAnimatorTest#testShowNext;android.widget.cts.TextViewTest#testResetTextAlignment;android.widget.cts.ScrollerTest#testFlingMode;android.widget.cts.SlidingDrawerTest#testOnInterceptTouchEvent;android.widget.cts.DatePickerTest#testConstructor;android.widget.cts.TableLayoutTest#testAccessColumnCollapsed;android.widget.cts.AbsSeekBarTest#testVerifyDrawable;android.widget.cts.ScrollViewTest#testOnSizeChanged;android.widget.cts.TimePickerTest#testConstructors;android.widget.cts.TextViewTest#testAccessTransformationMethod;android.widget.cts.SimpleCursorTreeAdapterTest#testBindChildView;android.widget.cts.ScrollerTest#testExtendDuration;android.widget.cts.RatingBarTest#testAccessRating;android.widget.cts.RelativeLayoutTest#testCheckLayoutParams;android.widget.cts.GalleryTest#testGenerateDefaultLayoutParams;android.widget.cts.AbsoluteLayoutTest#testCheckLayoutParams;android.widget.cts.SlidingDrawerTest#testOnFinishInflate;android.widget.cts.EditTextTest#testSetSelectionStartstop;android.widget.cts.ToggleButtonTest#testSetBackgroundDrawable;android.widget.cts.HeaderViewListAdapterTest#testRegisterDataSetObserver;android.widget.cts.TextViewTest#testAccessFreezesText;android.widget.cts.ArrayAdapterTest#testAndroidTestCaseSetupProperly;android.widget.cts.ExpandableListViewTest#testGetSelectedPosition;android.widget.cts.TabHostTest#testGetCurrentTabTag;android.widget.cts.GridViewTest#testOnMeasure;android.widget.cts.HeaderViewListAdapterTest#testGetItemId;android.widget.cts.RadioButtonTest#testToggle;android.widget.cts.TextViewTest#testOnFocusChanged;android.widget.cts.AbsoluteLayout_LayoutParamsTest#testAndroidTestCaseSetupProperly;android.widget.cts.ViewAnimatorTest#testAccessInAnimation;android.widget.cts.AdapterViewTest#testDispatchSaveInstanceState;android.widget.cts.HeaderViewListAdapterTest#testHasStableIds;android.widget.cts.RelativeLayoutTest#testOnMeasure;android.widget.cts.HorizontalScrollViewTest#testSmoothScrollBy;android.widget.cts.ListViewTest#testTransientStateUnstableIds;android.widget.cts.TableRowTest#testConstructor;android.widget.cts.TabHost_TabSpecTest#testSetIndicator2;android.widget.cts.ArrayAdapterTest#testAccessView;android.widget.cts.TabHost_TabSpecTest#testSetIndicator1;android.widget.cts.HorizontalScrollViewTest#testAccessSmoothScrollingEnabled;android.widget.cts.TextViewTest#testSetCursorVisible;android.widget.cts.FrameLayout_LayoutParamsTest#testConstructor;android.widget.cts.AutoCompleteTextViewTest#testOnAttachedToWindow;android.widget.cts.CursorAdapterTest#testInit;android.widget.cts.SimpleAdapterTest#testGetItemId;android.widget.cts.TableLayout_LayoutParamsTest#testSetBaseAttributes;android.widget.cts.ExpandableListViewBasicTest#testExpandedGroupMovement;android.widget.cts.TextViewTest#testAccessPaintFlags;android.widget.cts.CursorAdapterTest#testGetItemId;android.widget.cts.GalleryTest#testSetSpacing;android.widget.cts.TextViewTest#testSetLines;android.widget.cts.ScrollerTest#testConstructor;android.widget.cts.CompoundButtonTest#testOnDraw;android.widget.cts.ListViewTest#testGetMaxScrollAmount;android.widget.cts.TwoLineListItemTest#testGetTexts;android.widget.cts.AbsListViewTest#testBeforeAndAfterTextChanged;android.widget.cts.AdapterViewTest#testConstructor;android.widget.cts.SimpleAdapterTest#testSetViewText;android.widget.cts.ExpandableListViewTest#testGetSelectedId;android.widget.cts.TableLayoutTest#testOnMeasure;android.widget.cts.DialerFilterTest#testSetDigitsWatcher;android.widget.cts.AbsListViewTest#testPointToPosition;android.widget.cts.ExpandableListViewTest#testGetPackedPositionChild;android.widget.cts.ExpandableListViewBasicTest#testSelectedPosition;android.widget.cts.RemoteViewsTest#testSetBitmap;android.widget.cts.TextViewTest#testFoo;android.widget.cts.EditTextTest#testAccessText;android.widget.cts.AbsListViewTest#testComputeVerticalScrollValues;android.widget.cts.VideoViewTest#testConstructor;android.widget.cts.EditTextTest#testGetDefaultEditable;android.widget.cts.EditTextTest#testConstructor;android.widget.cts.ExpandableListViewWithHeadersTest#testExpandOnFirstGroup;android.widget.cts.RelativeLayout_LayoutParamsTest#testStartEnd;android.widget.cts.ScrollViewTest#testAddViewWithIndexAndLayoutParams;android.widget.cts.ViewFlipperTest#testSetFlipInterval;android.widget.cts.ZoomButtonTest#testConstructor;android.widget.cts.TableRowTest#testOnMeasure;android.widget.cts.TableLayoutTest#testAccessStretchAllColumns;android.widget.cts.GridViewTest#testSetHorizontalSpacing;android.widget.cts.ExpandableListViewWithHeadersTest#testContextMenus;android.widget.cts.ListViewTest#testRequestChildRectangleOnScreen;android.widget.cts.VideoViewTest#testSetMediaController;android.widget.cts.AdapterViewTest#testAccessOnItemClickAndLongClickListener;android.widget.cts.RemoteViewsTest#testSetImageViewResource;android.widget.cts.TextViewTest#testScroll;android.widget.cts.VideoViewTest#testResolveAdjustedSize;android.widget.cts.ScrollViewTest#testOnInterceptTouchEvent;android.widget.cts.ViewAnimatorTest#testRemoveViews;android.widget.cts.AlphabetIndexerTest#testAndroidTestCaseSetupProperly;android.widget.cts.ImageViewTest#testSetMaxHeight;android.widget.cts.ImageViewTest#testOnMeasure;android.widget.cts.RadioGroup_LayoutParamsTest#testSetBaseAttributes;android.widget.cts.AbsoluteLayoutTest#testOnMeasure;android.widget.cts.CompoundButtonTest#testPerformClick;android.widget.cts.ExpandableListViewTest#testAccessExpandableListAdapter;android.widget.cts.TextView_SaveStateTest#testToString;android.widget.cts.CursorTreeAdapterTest#testGetGroupView;android.widget.cts.TextViewTest#testPressKey;android.widget.cts.ProgressBarTest#testAccessMax;android.widget.cts.TextViewTest#testBeginEndBatchEdit;android.widget.cts.HeaderViewListAdapterTest#testGetItem;android.widget.cts.LinearLayoutTest#testActivityTestCaseSetUpProperly;android.widget.cts.TextViewTest#testSetGetTextDirection;android.widget.cts.HeaderViewListAdapterTest#testGetView;android.widget.cts.ScrollerTest#testScrollMode;android.widget.cts.ProgressBarTest#testAccessInterpolator;android.widget.cts.TextViewTest#testTextAttr;android.widget.cts.AbsListViewTest#testAccessScrollingCacheEnabled;android.widget.cts.MediaControllerTest#testSetEnabled;android.widget.cts.SimpleCursorAdapterTest#testConvertToString;android.widget.cts.ExpandableListViewTest#testDispatchDraw;android.widget.cts.DigitalClockTest#testOnAttachedToWindow;android.widget.cts.BaseAdapterTest#testGetViewTypeCount;android.widget.cts.CursorAdapterTest#testGetCount;android.widget.cts.ToastTest#testAccessView;android.widget.cts.FrameLayoutTest#testOnMeasure;android.widget.cts.HorizontalScrollViewTest#testGetMaxScrollAmount;android.widget.cts.AbsListViewTest#testSetScrollIndicators;android.widget.cts.TabHostTest#testOnAttachedToAndDetachedFromWindow;android.widget.cts.CursorAdapterTest#testGetFilter;android.widget.cts.CursorTreeAdapterTest#testGetChild;android.widget.cts.SlidingDrawerTest#testSetOnDrawerScrollListener;android.widget.cts.ProgressBarTest#testOnSizeChange;android.widget.cts.TextViewTest#testGetTotalPaddingRight;android.widget.cts.GridViewTest#testPressKey;android.widget.cts.CheckedTextViewTest#testDrawableStateChanged;android.widget.cts.ScrollerTest#testGetDuration;android.widget.cts.TableLayoutTest#testRequestLayout;android.widget.cts.ImageViewTest#testAccessImageMatrix;android.widget.cts.PopupWindowTest#testAccessWidth;android.widget.cts.BaseAdapterTest#testDataSetObserver;android.widget.cts.SpinnerTest#testPerformClick;android.widget.cts.MediaControllerTest#testConstructor;android.widget.cts.SimpleCursorTreeAdapterTest#testConstructor;android.widget.cts.TextViewTest#testGetTextColor;android.widget.cts.DialerFilterTest#testOnModechange;android.widget.cts.AdapterViewTest#testDispatchRestoreInstanceState;android.widget.cts.ImageViewTest#testOnCreateDrawableState;android.widget.cts.CursorTreeAdapterTest#testNotifyDataSetInvalidated;android.widget.cts.SimpleExpandableListAdapterTest#testGetGroupView;android.widget.cts.ListViewTest#testRequestLayout;android.widget.cts.Gallery_LayoutParamsTest#testAndroidTestCaseSetupProperly;android.widget.cts.SimpleExpandableListAdapterTest#testGetChild;android.widget.cts.TableRowTest#testSetOnHierarchyChangeListener;android.widget.cts.TextViewTest#testGetExtendedPaddingTop;android.widget.cts.ResourceCursorAdapterTest#testSetDropDownViewResource;android.widget.cts.LinearLayoutTest#testAccessBaselineAligned;android.widget.cts.CursorTreeAdapterTest#testGetChildId;android.widget.cts.GridViewTest#testSetColumnWidth;android.widget.cts.AbsListViewTest#testAccessTranscriptMode;android.widget.cts.VideoViewTest#testGetBufferPercentage;android.widget.cts.LinearLayoutTest#testConstructor;android.widget.cts.TextViewTest#testAccessContentType;android.widget.cts.SimpleCursorAdapterTest#testBindView;android.widget.cts.SlidingDrawerTest#testOnTouchEvent;android.widget.cts.ListViewTest#testOnKeyUpDown;android.widget.cts.SimpleCursorAdapterTest#testAccessCursorToStringConverter;android.widget.cts.TabWidgetTest#testAddView;android.widget.cts.TextViewTest#testIsInputMethodTarget;android.widget.cts.AbsoluteLayout_LayoutParamsTest#testConstructor;android.widget.cts.RelativeLayoutTest#testGetBaseline;android.widget.cts.TextViewTest#testGetLineCount;android.widget.cts.GridLayoutTest#testActivityTestCaseSetUpProperly;android.widget.cts.ProgressBarTest#testInvalidateDrawable;android.widget.cts.AbsSpinnerTest#testOnSaveAndRestoreInstanceState;android.widget.cts.MultiAutoCompleteTextViewTest#testConstructor;android.widget.cts.ExpandableListViewTest#testGetFlatListPosition;android.widget.cts.ArrayAdapterTest#testAddAllParams;android.widget.cts.CursorTreeAdapterTest#testSetGroupCursor;android.widget.cts.TextViewTest#testDidTouchFocusSelect;android.widget.cts.SimpleCursorAdapterTest#testConstructor;android.widget.cts.TextViewTest#testAccessImeOptions;android.widget.cts.TabHostTest#testClearAllTabs;android.widget.cts.TextViewTest#testGetFadingEdgeStrength;android.widget.cts.TextViewTest#testSetMinLines;android.widget.cts.DialerFilterTest#testConstructor;android.widget.cts.AbsListViewTest#testConstructor;android.widget.cts.HorizontalScrollViewTest#testAddViewWithIndexAndLayoutParams;android.widget.cts.TextViewTest#testTextDirectionDefault;android.widget.cts.TextViewTest#testGetLineBounds;android.widget.cts.HorizontalScrollViewTest#testConstructor;android.widget.cts.AutoCompleteTextViewTest#testSetFrame;android.widget.cts.RelativeLayoutTest#testGenerateLayoutParams2;android.widget.cts.RelativeLayoutTest#testGenerateLayoutParams1;android.widget.cts.ArrayAdapterTest#testAdd;android.widget.cts.PopupWindowTest#testUpdateDimensionAndAlignAnchorView;android.widget.cts.ToastTest#testAccessMargin;android.widget.cts.RemoteViewsActivityTest#testGood;android.widget.cts.TextViewTest#testAccessTextSize;android.widget.cts.TableLayoutTest#testColumnStretchableEffect;android.widget.cts.CompoundButtonTest#testDrawableStateChanged;android.widget.cts.CursorAdapterTest#testAccessFilterQueryProvider;android.widget.cts.HorizontalScrollViewTest#testArrowScroll;android.widget.cts.ScrollViewTest#testOnMeasure;android.widget.cts.TextViewTest#testTextChangedListener;android.widget.cts.AutoCompleteTextViewTest#testSetCompletionHint;android.widget.cts.TextViewTest#testAccessTextColor;android.widget.cts.FrameLayoutTest#testAccessMeasureAllChildren;android.widget.cts.LinearLayoutTest#testAccessWeightSum;android.widget.cts.HorizontalScrollViewTest#testOnMeasure;android.widget.cts.ResourceCursorAdapterTest#testConstructor;android.widget.cts.FrameLayoutTest#testOnSizeChanged;android.widget.cts.LinearLayoutTest#testCheckLayoutParams;android.widget.cts.PopupWindowTest#testSetWindowLayoutMode;android.widget.cts.ExpandableListView_ExpandableListContextMenuInfoTest#testAndroidTestCaseSetupProperly;android.widget.cts.ListViewTest#testAccessHeaderView;android.widget.cts.RatingBarTest#testAccessOnRatingBarChangeListener;android.widget.cts.GridViewTest#testSetGravity;android.widget.cts.TextViewTest#testAccessHint;android.widget.cts.HorizontalScrollViewTest#testOnLayout;android.widget.cts.ListViewTest#testAccessAdapter;android.widget.cts.ArrayAdapterTest#testGetItemId;android.widget.cts.ImageButtonTest#testAndroidTestCaseSetupProperly;android.widget.cts.TextViewTest#testOnDetachedFromWindow;android.widget.cts.ProgressBarTest#testAccessSecondaryProgress;android.widget.cts.SimpleExpandableListAdapterTest#testIsChildSelectable;android.widget.cts.TextViewTest#testTextAlignmentDefault;android.widget.cts.TableLayoutTest#testCheckLayoutParams;android.widget.cts.AnalogClockTest#testOnSizeChanged;android.widget.cts.DialerFilterTest#testSetLettersWatcher;android.widget.cts.ViewAnimatorTest#testAccessDisplayedChildBoundary;android.widget.cts.TextViewTest#testSetSpannableFactory;android.widget.cts.ImageSwitcherTest#testConstructor;android.widget.cts.TextViewTest#testAccessMovementMethod;android.widget.cts.AbsSeekBarTest#testDrawableStateChanged;android.widget.cts.RadioGroupTest#testAddView;android.widget.cts.HorizontalScrollViewTest#testOnInterceptTouchEvent;android.widget.cts.TabHostTest#testConstructor;android.widget.cts.CursorTreeAdapterTest#testGetChildrenCount;android.widget.cts.SimpleCursorAdapterTest#testChangeCursor;android.widget.cts.HorizontalScrollViewTest#testAccessFillViewport;android.widget.cts.AbsSeekBarTest#testFoo;android.widget.cts.TableLayoutTest#testConstructor;android.widget.cts.GalleryTest#testSetUnselectedAlpha;android.widget.cts.AbsListViewTest#testInvalidateViews;android.widget.cts.HeaderViewListAdapterTest#testGetCount;android.widget.cts.RatingBarTest#testAccessIndicator;android.widget.cts.RelativeLayout_LayoutParamsTest#testConstructor;android.widget.cts.CursorAdapterTest#testNewDropDownView;android.widget.cts.ChronometerTest#testAccessFormat;android.widget.cts.ExpandableListViewBasicTest#testPreconditions;android.widget.cts.AbsListViewTest#testFoo;android.widget.cts.ListViewTest#testOnTouchEvent;android.widget.cts.TabHostTest#testAddTab;android.widget.cts.AdapterViewTest#testChangeFocusable;android.widget.cts.ListViewTest#testAccessDivider;android.widget.cts.ListViewTest#testAccessFooterView;android.widget.cts.SimpleCursorAdapterTest#testAccessViewBinder;android.widget.cts.ZoomButtonTest#testSetEnabled;android.widget.cts.CheckedTextViewTest#testConstructor;android.widget.cts.GridViewTest#testLayoutChildren;android.widget.cts.ImageViewTest#testSetAlpha;android.widget.cts.TextViewTest#testClearComposingText;android.widget.cts.ZoomControlsTest#testSetIsZoomInEnabled;android.widget.cts.TabWidgetTest#testConstructor;android.widget.cts.TableRowTest#testGenerateLayoutParams2;android.widget.cts.TextViewTest#testSetTextAppearance;android.widget.cts.FilterTest#testConvertResultToString;android.widget.cts.MultiAutoCompleteTextViewTest#testPerformValidation;android.widget.cts.TextViewTest#testHeightAndWidth;android.widget.cts.CursorTreeAdapterTest#testIsChildSelectable;android.widget.cts.ArrayAdapterTest#testAddAllCollection;android.widget.cts.AbsListView_LayoutParamsTest#testConstructors;android.widget.cts.ScrollViewTest#testDispatchKeyEvent;android.widget.cts.TabHostTest#testAccessCurrentTab;android.widget.cts.ViewSwitcherTest#testReset;android.widget.cts.TimePickerTest#testAccessIs24HourView;android.widget.cts.TextViewTest#testGetTotalPaddingTop;android.widget.cts.HorizontalScrollViewTest#testExecuteKeyEvent;android.widget.cts.AbsoluteLayoutTest#testOnLayout;android.widget.cts.ImageViewTest#testAccessScaleType;android.widget.cts.TabHostTest#testGetTabWidget;android.widget.cts.SlidingDrawerTest#testAnimateToggle;android.widget.cts.SlidingDrawerTest#testLockAndUnlock;android.widget.cts.GalleryTest#testSetGravity;android.widget.cts.ListViewTest#testOnFinishInflate;android.widget.cts.ScrollViewTest#testArrowScroll;android.widget.cts.ScrollViewTest#testComputeScrollDeltaToGetChildRectOnScreen;android.widget.cts.TabHostTest#testGetCurrentTabView;android.widget.cts.ExpandableListViewBasicTest#testExpandGroup;android.widget.cts.TextViewTest#testExtractText;android.widget.cts.RemoteViewsTest#testOnLoadClass;android.widget.cts.RadioGroupTest#testCheckLayoutParams;android.widget.cts.TextSwitcherTest#testSetText;android.widget.cts.AbsListViewTest#testGenerateLayoutParams;android.widget.cts.TabWidgetTest#testSetEnabled;android.widget.cts.AutoCompleteTextViewTest#testAccessItemClickListener;android.widget.cts.ChronometerTest#testFoo;android.widget.cts.ExpandableListViewBasicTest#testConvertionBetweenFlatAndPacked;android.widget.cts.DatePickerTest#testOnSaveInstanceState;android.widget.cts.DatePickerTest#testAndroidTestCaseSetupProperly;android.widget.cts.ImageButtonTest#testOnSetAlpha;android.widget.cts.AdapterViewTest#testAccessOnItemSelectedListener;android.widget.cts.BaseExpandableListAdapterTest#testOnGroupCollapsed;android.widget.cts.TableLayoutTest#testGenerateLayoutParams1;android.widget.cts.TableLayoutTest#testGenerateLayoutParams2;android.widget.cts.LinearLayoutTest#testLayoutVertical;android.widget.cts.CursorTreeAdapterTest#testAccessQueryProvider;android.widget.cts.TextViewTest#testSetTextKeepState1;android.widget.cts.ArrayAdapterTest#testConstructor;android.widget.cts.RemoteViewsTest#testDescribeContents;android.widget.cts.RelativeLayoutTest#testGenerateDefaultLayoutParams;android.widget.cts.SimpleExpandableListAdapterTest#testHasStableIds;android.widget.cts.TextViewTest#testOnPreDraw;android.widget.cts.ExpandableListViewBasicTest#testCollapseGroup;android.widget.cts.ExpandableListViewWithHeadersTest#testExpandOnFirstPosition;android.widget.cts.SimpleCursorAdapterTest#testSetViewText;android.widget.cts.RelativeLayoutTest#testSetIgnoreGravity;android.widget.cts.RadioGroup_LayoutParamsTest#testAndroidTestCaseSetupProperly;android.widget.cts.BaseAdapterTest#testAreAllItemsEnabled;android.widget.cts.RemoteViewsTest#testSetInt;android.widget.cts.AutoCompleteTextViewTest#testAccessDropDownAnchor;android.widget.cts.ScrollerTest#testIsFinished;android.widget.cts.TextViewTest#testAccessGravity;android.widget.cts.TableLayoutTest#testAccessColumnStretchable;android.widget.cts.ExpandableListViewTest#testSetOnGroupClickListener;android.widget.cts.AlphabetIndexerTest#testCompare;android.widget.cts.AbsListView_LayoutParamsTest#testAndroidTestCaseSetupProperly;android.widget.cts.LayoutDirectionTest#testLayoutDirectionDefaults;android.widget.cts.HeaderViewListAdapterTest#testAreAllItemsEnabled;android.widget.cts.LinearLayout_LayoutParamsTest#testDebug;android.widget.cts.CursorTreeAdapterTest#testGetCursor;android.widget.cts.ImageViewTest#testOnDraw;android.widget.cts.GalleryTest#testGetChildDrawingOrder;android.widget.cts.TextViewTest#testAccessInputExtras;android.widget.cts.LinearLayoutTest#testGetBaseline;android.widget.cts.RatingBarTest#testConstructor;android.widget.cts.RemoteViewsTest#testSetUri;android.widget.cts.SpinnerTest#testsetPromptId;android.widget.cts.RemoteViewsTest#testSetTextColor;android.widget.cts.VideoViewTest#testGetDuration;android.widget.cts.AdapterViewTest#testGetCount;android.widget.cts.MultiAutoCompleteTextView_CommaTokenizerTest#testFindTokenStart;android.widget.cts.ImageViewTest#testSetImageBitmap;android.widget.cts.HeaderViewListAdapterTest#testUnregisterDataSetObserver;android.widget.cts.PopupWindowTest#testAccessOutsideTouchable;android.widget.cts.EditTextTest#testSetEllipsize;android.widget.cts.SimpleAdapterTest#testGetCount;android.widget.cts.SpinnerTest#testSetOnItemClickListener;android.widget.cts.SlidingDrawerTest#testToggle;android.widget.cts.AbsSpinnerTest#testPointToPosition;android.widget.cts.ViewFlipperTest#testViewFlipper;android.widget.cts.TabHostTest#testDispatchKeyEvent;android.widget.cts.ExpandableListViewTest#testIsGroupExpanded;android.widget.cts.LayoutDirectionTest#testDirectionFromXml;android.widget.cts.TextViewTest#testVerifyDrawable;android.widget.cts.ProgressBarTest#testIncrementProgressBy;android.widget.cts.PopupWindowTest#testShowAsDropDown;android.widget.cts.ListViewTest#testCanAnimate;android.widget.cts.HorizontalScrollViewTest#testMeasureChild;android.widget.cts.RadioGroupTest#testClearCheck;android.widget.cts.SimpleAdapterTest#testConstructor;android.widget.cts.HorizontalScrollViewTest#testGetHorizontalFadingEdgeStrengths;android.widget.cts.CursorAdapterTest#testGetItem" />
</TestPlan>
diff --git a/tests/src/android/os/cts/CpuFeatures.java b/tests/src/android/os/cts/CpuFeatures.java
index 5009474..b767da2 100644
--- a/tests/src/android/os/cts/CpuFeatures.java
+++ b/tests/src/android/os/cts/CpuFeatures.java
@@ -37,4 +37,10 @@
public static native boolean isMipsCpu();
public static native boolean isX86Cpu();
+
+ public static native boolean isArm64Cpu();
+
+ public static native boolean isMips64Cpu();
+
+ public static native boolean isX86_64Cpu();
}
diff --git a/tests/src/android/os/cts/TaggedPointer.java b/tests/src/android/os/cts/TaggedPointer.java
new file mode 100644
index 0000000..16e76c9
--- /dev/null
+++ b/tests/src/android/os/cts/TaggedPointer.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os.cts;
+
+public class TaggedPointer {
+
+ static {
+ System.loadLibrary("cts_jni");
+ }
+
+ public static native boolean hasTaggedPointer();
+}
diff --git a/tests/src/android/renderscript/cts/TestAbs.rs b/tests/src/android/renderscript/cts/TestAbs.rs
new file mode 100644
index 0000000..8f1747e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAbs.rs
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+uchar __attribute__((kernel)) testAbsCharUchar(char inValue) {
+ return abs(inValue);
+}
+
+uchar2 __attribute__((kernel)) testAbsChar2Uchar2(char2 inValue) {
+ return abs(inValue);
+}
+
+uchar3 __attribute__((kernel)) testAbsChar3Uchar3(char3 inValue) {
+ return abs(inValue);
+}
+
+uchar4 __attribute__((kernel)) testAbsChar4Uchar4(char4 inValue) {
+ return abs(inValue);
+}
+
+ushort __attribute__((kernel)) testAbsShortUshort(short inValue) {
+ return abs(inValue);
+}
+
+ushort2 __attribute__((kernel)) testAbsShort2Ushort2(short2 inValue) {
+ return abs(inValue);
+}
+
+ushort3 __attribute__((kernel)) testAbsShort3Ushort3(short3 inValue) {
+ return abs(inValue);
+}
+
+ushort4 __attribute__((kernel)) testAbsShort4Ushort4(short4 inValue) {
+ return abs(inValue);
+}
+
+uint __attribute__((kernel)) testAbsIntUint(int inValue) {
+ return abs(inValue);
+}
+
+uint2 __attribute__((kernel)) testAbsInt2Uint2(int2 inValue) {
+ return abs(inValue);
+}
+
+uint3 __attribute__((kernel)) testAbsInt3Uint3(int3 inValue) {
+ return abs(inValue);
+}
+
+uint4 __attribute__((kernel)) testAbsInt4Uint4(int4 inValue) {
+ return abs(inValue);
+}
diff --git a/tests/src/android/renderscript/cts/TestAbsRelaxed.rs b/tests/src/android/renderscript/cts/TestAbsRelaxed.rs
new file mode 100644
index 0000000..437a467
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAbsRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAbs.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAcos.rs b/tests/src/android/renderscript/cts/TestAcos.rs
new file mode 100644
index 0000000..8e64b9c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAcos.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAcosFloatFloat(float in) {
+ return acos(in);
+}
+
+float2 __attribute__((kernel)) testAcosFloat2Float2(float2 in) {
+ return acos(in);
+}
+
+float3 __attribute__((kernel)) testAcosFloat3Float3(float3 in) {
+ return acos(in);
+}
+
+float4 __attribute__((kernel)) testAcosFloat4Float4(float4 in) {
+ return acos(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAcosRelaxed.rs b/tests/src/android/renderscript/cts/TestAcosRelaxed.rs
new file mode 100644
index 0000000..92fd9e8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAcosRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAcos.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAcosh.rs b/tests/src/android/renderscript/cts/TestAcosh.rs
new file mode 100644
index 0000000..9be2fa2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAcosh.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAcoshFloatFloat(float in) {
+ return acosh(in);
+}
+
+float2 __attribute__((kernel)) testAcoshFloat2Float2(float2 in) {
+ return acosh(in);
+}
+
+float3 __attribute__((kernel)) testAcoshFloat3Float3(float3 in) {
+ return acosh(in);
+}
+
+float4 __attribute__((kernel)) testAcoshFloat4Float4(float4 in) {
+ return acosh(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAcoshRelaxed.rs b/tests/src/android/renderscript/cts/TestAcoshRelaxed.rs
new file mode 100644
index 0000000..269cec5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAcoshRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAcosh.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAcospi.rs b/tests/src/android/renderscript/cts/TestAcospi.rs
new file mode 100644
index 0000000..90b994f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAcospi.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAcospiFloatFloat(float in) {
+ return acospi(in);
+}
+
+float2 __attribute__((kernel)) testAcospiFloat2Float2(float2 in) {
+ return acospi(in);
+}
+
+float3 __attribute__((kernel)) testAcospiFloat3Float3(float3 in) {
+ return acospi(in);
+}
+
+float4 __attribute__((kernel)) testAcospiFloat4Float4(float4 in) {
+ return acospi(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAcospiRelaxed.rs b/tests/src/android/renderscript/cts/TestAcospiRelaxed.rs
new file mode 100644
index 0000000..203fe7e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAcospiRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAcospi.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAsin.rs b/tests/src/android/renderscript/cts/TestAsin.rs
new file mode 100644
index 0000000..69586c8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAsin.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAsinFloatFloat(float in) {
+ return asin(in);
+}
+
+float2 __attribute__((kernel)) testAsinFloat2Float2(float2 in) {
+ return asin(in);
+}
+
+float3 __attribute__((kernel)) testAsinFloat3Float3(float3 in) {
+ return asin(in);
+}
+
+float4 __attribute__((kernel)) testAsinFloat4Float4(float4 in) {
+ return asin(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAsinRelaxed.rs b/tests/src/android/renderscript/cts/TestAsinRelaxed.rs
new file mode 100644
index 0000000..f972148
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAsinRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAsin.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAsinh.rs b/tests/src/android/renderscript/cts/TestAsinh.rs
new file mode 100644
index 0000000..a72a5f4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAsinh.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAsinhFloatFloat(float in) {
+ return asinh(in);
+}
+
+float2 __attribute__((kernel)) testAsinhFloat2Float2(float2 in) {
+ return asinh(in);
+}
+
+float3 __attribute__((kernel)) testAsinhFloat3Float3(float3 in) {
+ return asinh(in);
+}
+
+float4 __attribute__((kernel)) testAsinhFloat4Float4(float4 in) {
+ return asinh(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAsinhRelaxed.rs b/tests/src/android/renderscript/cts/TestAsinhRelaxed.rs
new file mode 100644
index 0000000..7540ea8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAsinhRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAsinh.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAsinpi.rs b/tests/src/android/renderscript/cts/TestAsinpi.rs
new file mode 100644
index 0000000..1e385b3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAsinpi.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAsinpiFloatFloat(float in) {
+ return asinpi(in);
+}
+
+float2 __attribute__((kernel)) testAsinpiFloat2Float2(float2 in) {
+ return asinpi(in);
+}
+
+float3 __attribute__((kernel)) testAsinpiFloat3Float3(float3 in) {
+ return asinpi(in);
+}
+
+float4 __attribute__((kernel)) testAsinpiFloat4Float4(float4 in) {
+ return asinpi(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAsinpiRelaxed.rs b/tests/src/android/renderscript/cts/TestAsinpiRelaxed.rs
new file mode 100644
index 0000000..aad672b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAsinpiRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAsinpi.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAtan.rs b/tests/src/android/renderscript/cts/TestAtan.rs
new file mode 100644
index 0000000..bb3ec7e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtan.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAtanFloatFloat(float in) {
+ return atan(in);
+}
+
+float2 __attribute__((kernel)) testAtanFloat2Float2(float2 in) {
+ return atan(in);
+}
+
+float3 __attribute__((kernel)) testAtanFloat3Float3(float3 in) {
+ return atan(in);
+}
+
+float4 __attribute__((kernel)) testAtanFloat4Float4(float4 in) {
+ return atan(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAtan2.rs b/tests/src/android/renderscript/cts/TestAtan2.rs
new file mode 100644
index 0000000..877402d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtan2.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInX;
+
+float __attribute__((kernel)) testAtan2FloatFloatFloat(float inY, unsigned int x) {
+ float inX = rsGetElementAt_float(gAllocInX, x);
+ return atan2(inY, inX);
+}
+
+float2 __attribute__((kernel)) testAtan2Float2Float2Float2(float2 inY, unsigned int x) {
+ float2 inX = rsGetElementAt_float2(gAllocInX, x);
+ return atan2(inY, inX);
+}
+
+float3 __attribute__((kernel)) testAtan2Float3Float3Float3(float3 inY, unsigned int x) {
+ float3 inX = rsGetElementAt_float3(gAllocInX, x);
+ return atan2(inY, inX);
+}
+
+float4 __attribute__((kernel)) testAtan2Float4Float4Float4(float4 inY, unsigned int x) {
+ float4 inX = rsGetElementAt_float4(gAllocInX, x);
+ return atan2(inY, inX);
+}
diff --git a/tests/src/android/renderscript/cts/TestAtan2Relaxed.rs b/tests/src/android/renderscript/cts/TestAtan2Relaxed.rs
new file mode 100644
index 0000000..d5d90a1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtan2Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAtan2.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAtan2pi.rs b/tests/src/android/renderscript/cts/TestAtan2pi.rs
new file mode 100644
index 0000000..f0520d7
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtan2pi.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInX;
+
+float __attribute__((kernel)) testAtan2piFloatFloatFloat(float inY, unsigned int x) {
+ float inX = rsGetElementAt_float(gAllocInX, x);
+ return atan2pi(inY, inX);
+}
+
+float2 __attribute__((kernel)) testAtan2piFloat2Float2Float2(float2 inY, unsigned int x) {
+ float2 inX = rsGetElementAt_float2(gAllocInX, x);
+ return atan2pi(inY, inX);
+}
+
+float3 __attribute__((kernel)) testAtan2piFloat3Float3Float3(float3 inY, unsigned int x) {
+ float3 inX = rsGetElementAt_float3(gAllocInX, x);
+ return atan2pi(inY, inX);
+}
+
+float4 __attribute__((kernel)) testAtan2piFloat4Float4Float4(float4 inY, unsigned int x) {
+ float4 inX = rsGetElementAt_float4(gAllocInX, x);
+ return atan2pi(inY, inX);
+}
diff --git a/tests/src/android/renderscript/cts/TestAtan2piRelaxed.rs b/tests/src/android/renderscript/cts/TestAtan2piRelaxed.rs
new file mode 100644
index 0000000..9f87fff
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtan2piRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAtan2pi.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAtanRelaxed.rs b/tests/src/android/renderscript/cts/TestAtanRelaxed.rs
new file mode 100644
index 0000000..cab9300
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtanRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAtan.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAtanh.rs b/tests/src/android/renderscript/cts/TestAtanh.rs
new file mode 100644
index 0000000..fc946b6
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtanh.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAtanhFloatFloat(float in) {
+ return atanh(in);
+}
+
+float2 __attribute__((kernel)) testAtanhFloat2Float2(float2 in) {
+ return atanh(in);
+}
+
+float3 __attribute__((kernel)) testAtanhFloat3Float3(float3 in) {
+ return atanh(in);
+}
+
+float4 __attribute__((kernel)) testAtanhFloat4Float4(float4 in) {
+ return atanh(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAtanhRelaxed.rs b/tests/src/android/renderscript/cts/TestAtanhRelaxed.rs
new file mode 100644
index 0000000..88dfc75
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtanhRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAtanh.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestAtanpi.rs b/tests/src/android/renderscript/cts/TestAtanpi.rs
new file mode 100644
index 0000000..c68955f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtanpi.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testAtanpiFloatFloat(float in) {
+ return atanpi(in);
+}
+
+float2 __attribute__((kernel)) testAtanpiFloat2Float2(float2 in) {
+ return atanpi(in);
+}
+
+float3 __attribute__((kernel)) testAtanpiFloat3Float3(float3 in) {
+ return atanpi(in);
+}
+
+float4 __attribute__((kernel)) testAtanpiFloat4Float4(float4 in) {
+ return atanpi(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestAtanpiRelaxed.rs b/tests/src/android/renderscript/cts/TestAtanpiRelaxed.rs
new file mode 100644
index 0000000..6183636
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestAtanpiRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestAtanpi.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestCbrt.rs b/tests/src/android/renderscript/cts/TestCbrt.rs
new file mode 100644
index 0000000..d14f508
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCbrt.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testCbrtFloatFloat(float in) {
+ return cbrt(in);
+}
+
+float2 __attribute__((kernel)) testCbrtFloat2Float2(float2 in) {
+ return cbrt(in);
+}
+
+float3 __attribute__((kernel)) testCbrtFloat3Float3(float3 in) {
+ return cbrt(in);
+}
+
+float4 __attribute__((kernel)) testCbrtFloat4Float4(float4 in) {
+ return cbrt(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestCbrtRelaxed.rs b/tests/src/android/renderscript/cts/TestCbrtRelaxed.rs
new file mode 100644
index 0000000..ad970fe
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCbrtRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestCbrt.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestCeil.rs b/tests/src/android/renderscript/cts/TestCeil.rs
new file mode 100644
index 0000000..80c8708
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCeil.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testCeilFloatFloat(float in) {
+ return ceil(in);
+}
+
+float2 __attribute__((kernel)) testCeilFloat2Float2(float2 in) {
+ return ceil(in);
+}
+
+float3 __attribute__((kernel)) testCeilFloat3Float3(float3 in) {
+ return ceil(in);
+}
+
+float4 __attribute__((kernel)) testCeilFloat4Float4(float4 in) {
+ return ceil(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestCeilRelaxed.rs b/tests/src/android/renderscript/cts/TestCeilRelaxed.rs
new file mode 100644
index 0000000..bbafb0d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCeilRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestCeil.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestClamp.rs b/tests/src/android/renderscript/cts/TestClamp.rs
new file mode 100644
index 0000000..bc0b379
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestClamp.rs
@@ -0,0 +1,317 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInMinValue;
+rs_allocation gAllocInMaxValue;
+
+float __attribute__((kernel)) testClampFloatFloatFloatFloat(float inValue, unsigned int x) {
+ float inMinValue = rsGetElementAt_float(gAllocInMinValue, x);
+ float inMaxValue = rsGetElementAt_float(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+float2 __attribute__((kernel)) testClampFloat2Float2Float2Float2(float2 inValue, unsigned int x) {
+ float2 inMinValue = rsGetElementAt_float2(gAllocInMinValue, x);
+ float2 inMaxValue = rsGetElementAt_float2(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+float3 __attribute__((kernel)) testClampFloat3Float3Float3Float3(float3 inValue, unsigned int x) {
+ float3 inMinValue = rsGetElementAt_float3(gAllocInMinValue, x);
+ float3 inMaxValue = rsGetElementAt_float3(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+float4 __attribute__((kernel)) testClampFloat4Float4Float4Float4(float4 inValue, unsigned int x) {
+ float4 inMinValue = rsGetElementAt_float4(gAllocInMinValue, x);
+ float4 inMaxValue = rsGetElementAt_float4(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+float2 __attribute__((kernel)) testClampFloat2FloatFloatFloat2(float2 inValue, unsigned int x) {
+ float inMinValue = rsGetElementAt_float(gAllocInMinValue, x);
+ float inMaxValue = rsGetElementAt_float(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+float3 __attribute__((kernel)) testClampFloat3FloatFloatFloat3(float3 inValue, unsigned int x) {
+ float inMinValue = rsGetElementAt_float(gAllocInMinValue, x);
+ float inMaxValue = rsGetElementAt_float(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+float4 __attribute__((kernel)) testClampFloat4FloatFloatFloat4(float4 inValue, unsigned int x) {
+ float inMinValue = rsGetElementAt_float(gAllocInMinValue, x);
+ float inMaxValue = rsGetElementAt_float(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+char __attribute__((kernel)) testClampCharCharCharChar(char inValue, unsigned int x) {
+ char inMinValue = rsGetElementAt_char(gAllocInMinValue, x);
+ char inMaxValue = rsGetElementAt_char(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+char2 __attribute__((kernel)) testClampChar2Char2Char2Char2(char2 inValue, unsigned int x) {
+ char2 inMinValue = rsGetElementAt_char2(gAllocInMinValue, x);
+ char2 inMaxValue = rsGetElementAt_char2(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+char3 __attribute__((kernel)) testClampChar3Char3Char3Char3(char3 inValue, unsigned int x) {
+ char3 inMinValue = rsGetElementAt_char3(gAllocInMinValue, x);
+ char3 inMaxValue = rsGetElementAt_char3(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+char4 __attribute__((kernel)) testClampChar4Char4Char4Char4(char4 inValue, unsigned int x) {
+ char4 inMinValue = rsGetElementAt_char4(gAllocInMinValue, x);
+ char4 inMaxValue = rsGetElementAt_char4(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uchar __attribute__((kernel)) testClampUcharUcharUcharUchar(uchar inValue, unsigned int x) {
+ uchar inMinValue = rsGetElementAt_uchar(gAllocInMinValue, x);
+ uchar inMaxValue = rsGetElementAt_uchar(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uchar2 __attribute__((kernel)) testClampUchar2Uchar2Uchar2Uchar2(uchar2 inValue, unsigned int x) {
+ uchar2 inMinValue = rsGetElementAt_uchar2(gAllocInMinValue, x);
+ uchar2 inMaxValue = rsGetElementAt_uchar2(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uchar3 __attribute__((kernel)) testClampUchar3Uchar3Uchar3Uchar3(uchar3 inValue, unsigned int x) {
+ uchar3 inMinValue = rsGetElementAt_uchar3(gAllocInMinValue, x);
+ uchar3 inMaxValue = rsGetElementAt_uchar3(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uchar4 __attribute__((kernel)) testClampUchar4Uchar4Uchar4Uchar4(uchar4 inValue, unsigned int x) {
+ uchar4 inMinValue = rsGetElementAt_uchar4(gAllocInMinValue, x);
+ uchar4 inMaxValue = rsGetElementAt_uchar4(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+short __attribute__((kernel)) testClampShortShortShortShort(short inValue, unsigned int x) {
+ short inMinValue = rsGetElementAt_short(gAllocInMinValue, x);
+ short inMaxValue = rsGetElementAt_short(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+short2 __attribute__((kernel)) testClampShort2Short2Short2Short2(short2 inValue, unsigned int x) {
+ short2 inMinValue = rsGetElementAt_short2(gAllocInMinValue, x);
+ short2 inMaxValue = rsGetElementAt_short2(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+short3 __attribute__((kernel)) testClampShort3Short3Short3Short3(short3 inValue, unsigned int x) {
+ short3 inMinValue = rsGetElementAt_short3(gAllocInMinValue, x);
+ short3 inMaxValue = rsGetElementAt_short3(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+short4 __attribute__((kernel)) testClampShort4Short4Short4Short4(short4 inValue, unsigned int x) {
+ short4 inMinValue = rsGetElementAt_short4(gAllocInMinValue, x);
+ short4 inMaxValue = rsGetElementAt_short4(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+ushort __attribute__((kernel)) testClampUshortUshortUshortUshort(ushort inValue, unsigned int x) {
+ ushort inMinValue = rsGetElementAt_ushort(gAllocInMinValue, x);
+ ushort inMaxValue = rsGetElementAt_ushort(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+ushort2 __attribute__((kernel)) testClampUshort2Ushort2Ushort2Ushort2(ushort2 inValue, unsigned int x) {
+ ushort2 inMinValue = rsGetElementAt_ushort2(gAllocInMinValue, x);
+ ushort2 inMaxValue = rsGetElementAt_ushort2(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+ushort3 __attribute__((kernel)) testClampUshort3Ushort3Ushort3Ushort3(ushort3 inValue, unsigned int x) {
+ ushort3 inMinValue = rsGetElementAt_ushort3(gAllocInMinValue, x);
+ ushort3 inMaxValue = rsGetElementAt_ushort3(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+ushort4 __attribute__((kernel)) testClampUshort4Ushort4Ushort4Ushort4(ushort4 inValue, unsigned int x) {
+ ushort4 inMinValue = rsGetElementAt_ushort4(gAllocInMinValue, x);
+ ushort4 inMaxValue = rsGetElementAt_ushort4(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+int __attribute__((kernel)) testClampIntIntIntInt(int inValue, unsigned int x) {
+ int inMinValue = rsGetElementAt_int(gAllocInMinValue, x);
+ int inMaxValue = rsGetElementAt_int(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+int2 __attribute__((kernel)) testClampInt2Int2Int2Int2(int2 inValue, unsigned int x) {
+ int2 inMinValue = rsGetElementAt_int2(gAllocInMinValue, x);
+ int2 inMaxValue = rsGetElementAt_int2(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+int3 __attribute__((kernel)) testClampInt3Int3Int3Int3(int3 inValue, unsigned int x) {
+ int3 inMinValue = rsGetElementAt_int3(gAllocInMinValue, x);
+ int3 inMaxValue = rsGetElementAt_int3(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+int4 __attribute__((kernel)) testClampInt4Int4Int4Int4(int4 inValue, unsigned int x) {
+ int4 inMinValue = rsGetElementAt_int4(gAllocInMinValue, x);
+ int4 inMaxValue = rsGetElementAt_int4(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uint __attribute__((kernel)) testClampUintUintUintUint(uint inValue, unsigned int x) {
+ uint inMinValue = rsGetElementAt_uint(gAllocInMinValue, x);
+ uint inMaxValue = rsGetElementAt_uint(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uint2 __attribute__((kernel)) testClampUint2Uint2Uint2Uint2(uint2 inValue, unsigned int x) {
+ uint2 inMinValue = rsGetElementAt_uint2(gAllocInMinValue, x);
+ uint2 inMaxValue = rsGetElementAt_uint2(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uint3 __attribute__((kernel)) testClampUint3Uint3Uint3Uint3(uint3 inValue, unsigned int x) {
+ uint3 inMinValue = rsGetElementAt_uint3(gAllocInMinValue, x);
+ uint3 inMaxValue = rsGetElementAt_uint3(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uint4 __attribute__((kernel)) testClampUint4Uint4Uint4Uint4(uint4 inValue, unsigned int x) {
+ uint4 inMinValue = rsGetElementAt_uint4(gAllocInMinValue, x);
+ uint4 inMaxValue = rsGetElementAt_uint4(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+char2 __attribute__((kernel)) testClampChar2CharCharChar2(char2 inValue, unsigned int x) {
+ char inMinValue = rsGetElementAt_char(gAllocInMinValue, x);
+ char inMaxValue = rsGetElementAt_char(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+char3 __attribute__((kernel)) testClampChar3CharCharChar3(char3 inValue, unsigned int x) {
+ char inMinValue = rsGetElementAt_char(gAllocInMinValue, x);
+ char inMaxValue = rsGetElementAt_char(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+char4 __attribute__((kernel)) testClampChar4CharCharChar4(char4 inValue, unsigned int x) {
+ char inMinValue = rsGetElementAt_char(gAllocInMinValue, x);
+ char inMaxValue = rsGetElementAt_char(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uchar2 __attribute__((kernel)) testClampUchar2UcharUcharUchar2(uchar2 inValue, unsigned int x) {
+ uchar inMinValue = rsGetElementAt_uchar(gAllocInMinValue, x);
+ uchar inMaxValue = rsGetElementAt_uchar(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uchar3 __attribute__((kernel)) testClampUchar3UcharUcharUchar3(uchar3 inValue, unsigned int x) {
+ uchar inMinValue = rsGetElementAt_uchar(gAllocInMinValue, x);
+ uchar inMaxValue = rsGetElementAt_uchar(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uchar4 __attribute__((kernel)) testClampUchar4UcharUcharUchar4(uchar4 inValue, unsigned int x) {
+ uchar inMinValue = rsGetElementAt_uchar(gAllocInMinValue, x);
+ uchar inMaxValue = rsGetElementAt_uchar(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+short2 __attribute__((kernel)) testClampShort2ShortShortShort2(short2 inValue, unsigned int x) {
+ short inMinValue = rsGetElementAt_short(gAllocInMinValue, x);
+ short inMaxValue = rsGetElementAt_short(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+short3 __attribute__((kernel)) testClampShort3ShortShortShort3(short3 inValue, unsigned int x) {
+ short inMinValue = rsGetElementAt_short(gAllocInMinValue, x);
+ short inMaxValue = rsGetElementAt_short(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+short4 __attribute__((kernel)) testClampShort4ShortShortShort4(short4 inValue, unsigned int x) {
+ short inMinValue = rsGetElementAt_short(gAllocInMinValue, x);
+ short inMaxValue = rsGetElementAt_short(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+ushort2 __attribute__((kernel)) testClampUshort2UshortUshortUshort2(ushort2 inValue, unsigned int x) {
+ ushort inMinValue = rsGetElementAt_ushort(gAllocInMinValue, x);
+ ushort inMaxValue = rsGetElementAt_ushort(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+ushort3 __attribute__((kernel)) testClampUshort3UshortUshortUshort3(ushort3 inValue, unsigned int x) {
+ ushort inMinValue = rsGetElementAt_ushort(gAllocInMinValue, x);
+ ushort inMaxValue = rsGetElementAt_ushort(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+ushort4 __attribute__((kernel)) testClampUshort4UshortUshortUshort4(ushort4 inValue, unsigned int x) {
+ ushort inMinValue = rsGetElementAt_ushort(gAllocInMinValue, x);
+ ushort inMaxValue = rsGetElementAt_ushort(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+int2 __attribute__((kernel)) testClampInt2IntIntInt2(int2 inValue, unsigned int x) {
+ int inMinValue = rsGetElementAt_int(gAllocInMinValue, x);
+ int inMaxValue = rsGetElementAt_int(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+int3 __attribute__((kernel)) testClampInt3IntIntInt3(int3 inValue, unsigned int x) {
+ int inMinValue = rsGetElementAt_int(gAllocInMinValue, x);
+ int inMaxValue = rsGetElementAt_int(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+int4 __attribute__((kernel)) testClampInt4IntIntInt4(int4 inValue, unsigned int x) {
+ int inMinValue = rsGetElementAt_int(gAllocInMinValue, x);
+ int inMaxValue = rsGetElementAt_int(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uint2 __attribute__((kernel)) testClampUint2UintUintUint2(uint2 inValue, unsigned int x) {
+ uint inMinValue = rsGetElementAt_uint(gAllocInMinValue, x);
+ uint inMaxValue = rsGetElementAt_uint(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uint3 __attribute__((kernel)) testClampUint3UintUintUint3(uint3 inValue, unsigned int x) {
+ uint inMinValue = rsGetElementAt_uint(gAllocInMinValue, x);
+ uint inMaxValue = rsGetElementAt_uint(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
+
+uint4 __attribute__((kernel)) testClampUint4UintUintUint4(uint4 inValue, unsigned int x) {
+ uint inMinValue = rsGetElementAt_uint(gAllocInMinValue, x);
+ uint inMaxValue = rsGetElementAt_uint(gAllocInMaxValue, x);
+ return clamp(inValue, inMinValue, inMaxValue);
+}
diff --git a/tests/src/android/renderscript/cts/TestClampRelaxed.rs b/tests/src/android/renderscript/cts/TestClampRelaxed.rs
new file mode 100644
index 0000000..15fd58c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestClampRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestClamp.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestClz.rs b/tests/src/android/renderscript/cts/TestClz.rs
new file mode 100644
index 0000000..3501e01
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestClz.rs
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+char __attribute__((kernel)) testClzCharChar(char inValue) {
+ return clz(inValue);
+}
+
+char2 __attribute__((kernel)) testClzChar2Char2(char2 inValue) {
+ return clz(inValue);
+}
+
+char3 __attribute__((kernel)) testClzChar3Char3(char3 inValue) {
+ return clz(inValue);
+}
+
+char4 __attribute__((kernel)) testClzChar4Char4(char4 inValue) {
+ return clz(inValue);
+}
+
+uchar __attribute__((kernel)) testClzUcharUchar(uchar inValue) {
+ return clz(inValue);
+}
+
+uchar2 __attribute__((kernel)) testClzUchar2Uchar2(uchar2 inValue) {
+ return clz(inValue);
+}
+
+uchar3 __attribute__((kernel)) testClzUchar3Uchar3(uchar3 inValue) {
+ return clz(inValue);
+}
+
+uchar4 __attribute__((kernel)) testClzUchar4Uchar4(uchar4 inValue) {
+ return clz(inValue);
+}
+
+short __attribute__((kernel)) testClzShortShort(short inValue) {
+ return clz(inValue);
+}
+
+short2 __attribute__((kernel)) testClzShort2Short2(short2 inValue) {
+ return clz(inValue);
+}
+
+short3 __attribute__((kernel)) testClzShort3Short3(short3 inValue) {
+ return clz(inValue);
+}
+
+short4 __attribute__((kernel)) testClzShort4Short4(short4 inValue) {
+ return clz(inValue);
+}
+
+ushort __attribute__((kernel)) testClzUshortUshort(ushort inValue) {
+ return clz(inValue);
+}
+
+ushort2 __attribute__((kernel)) testClzUshort2Ushort2(ushort2 inValue) {
+ return clz(inValue);
+}
+
+ushort3 __attribute__((kernel)) testClzUshort3Ushort3(ushort3 inValue) {
+ return clz(inValue);
+}
+
+ushort4 __attribute__((kernel)) testClzUshort4Ushort4(ushort4 inValue) {
+ return clz(inValue);
+}
+
+int __attribute__((kernel)) testClzIntInt(int inValue) {
+ return clz(inValue);
+}
+
+int2 __attribute__((kernel)) testClzInt2Int2(int2 inValue) {
+ return clz(inValue);
+}
+
+int3 __attribute__((kernel)) testClzInt3Int3(int3 inValue) {
+ return clz(inValue);
+}
+
+int4 __attribute__((kernel)) testClzInt4Int4(int4 inValue) {
+ return clz(inValue);
+}
+
+uint __attribute__((kernel)) testClzUintUint(uint inValue) {
+ return clz(inValue);
+}
+
+uint2 __attribute__((kernel)) testClzUint2Uint2(uint2 inValue) {
+ return clz(inValue);
+}
+
+uint3 __attribute__((kernel)) testClzUint3Uint3(uint3 inValue) {
+ return clz(inValue);
+}
+
+uint4 __attribute__((kernel)) testClzUint4Uint4(uint4 inValue) {
+ return clz(inValue);
+}
diff --git a/tests/src/android/renderscript/cts/TestClzRelaxed.rs b/tests/src/android/renderscript/cts/TestClzRelaxed.rs
new file mode 100644
index 0000000..c463c94
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestClzRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestClz.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestConvert.rs b/tests/src/android/renderscript/cts/TestConvert.rs
new file mode 100644
index 0000000..bf022fb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestConvert.rs
@@ -0,0 +1,609 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float2 __attribute__((kernel)) testConvertFloat2Float2Float2(float2 in) {
+ return convert_float2(in);
+}
+
+float3 __attribute__((kernel)) testConvertFloat3Float3Float3(float3 in) {
+ return convert_float3(in);
+}
+
+float4 __attribute__((kernel)) testConvertFloat4Float4Float4(float4 in) {
+ return convert_float4(in);
+}
+
+float2 __attribute__((kernel)) testConvertFloat2Char2Float2(char2 in) {
+ return convert_float2(in);
+}
+
+float3 __attribute__((kernel)) testConvertFloat3Char3Float3(char3 in) {
+ return convert_float3(in);
+}
+
+float4 __attribute__((kernel)) testConvertFloat4Char4Float4(char4 in) {
+ return convert_float4(in);
+}
+
+float2 __attribute__((kernel)) testConvertFloat2Uchar2Float2(uchar2 in) {
+ return convert_float2(in);
+}
+
+float3 __attribute__((kernel)) testConvertFloat3Uchar3Float3(uchar3 in) {
+ return convert_float3(in);
+}
+
+float4 __attribute__((kernel)) testConvertFloat4Uchar4Float4(uchar4 in) {
+ return convert_float4(in);
+}
+
+float2 __attribute__((kernel)) testConvertFloat2Short2Float2(short2 in) {
+ return convert_float2(in);
+}
+
+float3 __attribute__((kernel)) testConvertFloat3Short3Float3(short3 in) {
+ return convert_float3(in);
+}
+
+float4 __attribute__((kernel)) testConvertFloat4Short4Float4(short4 in) {
+ return convert_float4(in);
+}
+
+float2 __attribute__((kernel)) testConvertFloat2Ushort2Float2(ushort2 in) {
+ return convert_float2(in);
+}
+
+float3 __attribute__((kernel)) testConvertFloat3Ushort3Float3(ushort3 in) {
+ return convert_float3(in);
+}
+
+float4 __attribute__((kernel)) testConvertFloat4Ushort4Float4(ushort4 in) {
+ return convert_float4(in);
+}
+
+float2 __attribute__((kernel)) testConvertFloat2Int2Float2(int2 in) {
+ return convert_float2(in);
+}
+
+float3 __attribute__((kernel)) testConvertFloat3Int3Float3(int3 in) {
+ return convert_float3(in);
+}
+
+float4 __attribute__((kernel)) testConvertFloat4Int4Float4(int4 in) {
+ return convert_float4(in);
+}
+
+float2 __attribute__((kernel)) testConvertFloat2Uint2Float2(uint2 in) {
+ return convert_float2(in);
+}
+
+float3 __attribute__((kernel)) testConvertFloat3Uint3Float3(uint3 in) {
+ return convert_float3(in);
+}
+
+float4 __attribute__((kernel)) testConvertFloat4Uint4Float4(uint4 in) {
+ return convert_float4(in);
+}
+
+char2 __attribute__((kernel)) testConvertChar2Float2Char2(float2 in) {
+ return convert_char2(in);
+}
+
+char3 __attribute__((kernel)) testConvertChar3Float3Char3(float3 in) {
+ return convert_char3(in);
+}
+
+char4 __attribute__((kernel)) testConvertChar4Float4Char4(float4 in) {
+ return convert_char4(in);
+}
+
+char2 __attribute__((kernel)) testConvertChar2Char2Char2(char2 in) {
+ return convert_char2(in);
+}
+
+char3 __attribute__((kernel)) testConvertChar3Char3Char3(char3 in) {
+ return convert_char3(in);
+}
+
+char4 __attribute__((kernel)) testConvertChar4Char4Char4(char4 in) {
+ return convert_char4(in);
+}
+
+char2 __attribute__((kernel)) testConvertChar2Uchar2Char2(uchar2 in) {
+ return convert_char2(in);
+}
+
+char3 __attribute__((kernel)) testConvertChar3Uchar3Char3(uchar3 in) {
+ return convert_char3(in);
+}
+
+char4 __attribute__((kernel)) testConvertChar4Uchar4Char4(uchar4 in) {
+ return convert_char4(in);
+}
+
+char2 __attribute__((kernel)) testConvertChar2Short2Char2(short2 in) {
+ return convert_char2(in);
+}
+
+char3 __attribute__((kernel)) testConvertChar3Short3Char3(short3 in) {
+ return convert_char3(in);
+}
+
+char4 __attribute__((kernel)) testConvertChar4Short4Char4(short4 in) {
+ return convert_char4(in);
+}
+
+char2 __attribute__((kernel)) testConvertChar2Ushort2Char2(ushort2 in) {
+ return convert_char2(in);
+}
+
+char3 __attribute__((kernel)) testConvertChar3Ushort3Char3(ushort3 in) {
+ return convert_char3(in);
+}
+
+char4 __attribute__((kernel)) testConvertChar4Ushort4Char4(ushort4 in) {
+ return convert_char4(in);
+}
+
+char2 __attribute__((kernel)) testConvertChar2Int2Char2(int2 in) {
+ return convert_char2(in);
+}
+
+char3 __attribute__((kernel)) testConvertChar3Int3Char3(int3 in) {
+ return convert_char3(in);
+}
+
+char4 __attribute__((kernel)) testConvertChar4Int4Char4(int4 in) {
+ return convert_char4(in);
+}
+
+char2 __attribute__((kernel)) testConvertChar2Uint2Char2(uint2 in) {
+ return convert_char2(in);
+}
+
+char3 __attribute__((kernel)) testConvertChar3Uint3Char3(uint3 in) {
+ return convert_char3(in);
+}
+
+char4 __attribute__((kernel)) testConvertChar4Uint4Char4(uint4 in) {
+ return convert_char4(in);
+}
+
+uchar2 __attribute__((kernel)) testConvertUchar2Float2Uchar2(float2 in) {
+ return convert_uchar2(in);
+}
+
+uchar3 __attribute__((kernel)) testConvertUchar3Float3Uchar3(float3 in) {
+ return convert_uchar3(in);
+}
+
+uchar4 __attribute__((kernel)) testConvertUchar4Float4Uchar4(float4 in) {
+ return convert_uchar4(in);
+}
+
+uchar2 __attribute__((kernel)) testConvertUchar2Char2Uchar2(char2 in) {
+ return convert_uchar2(in);
+}
+
+uchar3 __attribute__((kernel)) testConvertUchar3Char3Uchar3(char3 in) {
+ return convert_uchar3(in);
+}
+
+uchar4 __attribute__((kernel)) testConvertUchar4Char4Uchar4(char4 in) {
+ return convert_uchar4(in);
+}
+
+uchar2 __attribute__((kernel)) testConvertUchar2Uchar2Uchar2(uchar2 in) {
+ return convert_uchar2(in);
+}
+
+uchar3 __attribute__((kernel)) testConvertUchar3Uchar3Uchar3(uchar3 in) {
+ return convert_uchar3(in);
+}
+
+uchar4 __attribute__((kernel)) testConvertUchar4Uchar4Uchar4(uchar4 in) {
+ return convert_uchar4(in);
+}
+
+uchar2 __attribute__((kernel)) testConvertUchar2Short2Uchar2(short2 in) {
+ return convert_uchar2(in);
+}
+
+uchar3 __attribute__((kernel)) testConvertUchar3Short3Uchar3(short3 in) {
+ return convert_uchar3(in);
+}
+
+uchar4 __attribute__((kernel)) testConvertUchar4Short4Uchar4(short4 in) {
+ return convert_uchar4(in);
+}
+
+uchar2 __attribute__((kernel)) testConvertUchar2Ushort2Uchar2(ushort2 in) {
+ return convert_uchar2(in);
+}
+
+uchar3 __attribute__((kernel)) testConvertUchar3Ushort3Uchar3(ushort3 in) {
+ return convert_uchar3(in);
+}
+
+uchar4 __attribute__((kernel)) testConvertUchar4Ushort4Uchar4(ushort4 in) {
+ return convert_uchar4(in);
+}
+
+uchar2 __attribute__((kernel)) testConvertUchar2Int2Uchar2(int2 in) {
+ return convert_uchar2(in);
+}
+
+uchar3 __attribute__((kernel)) testConvertUchar3Int3Uchar3(int3 in) {
+ return convert_uchar3(in);
+}
+
+uchar4 __attribute__((kernel)) testConvertUchar4Int4Uchar4(int4 in) {
+ return convert_uchar4(in);
+}
+
+uchar2 __attribute__((kernel)) testConvertUchar2Uint2Uchar2(uint2 in) {
+ return convert_uchar2(in);
+}
+
+uchar3 __attribute__((kernel)) testConvertUchar3Uint3Uchar3(uint3 in) {
+ return convert_uchar3(in);
+}
+
+uchar4 __attribute__((kernel)) testConvertUchar4Uint4Uchar4(uint4 in) {
+ return convert_uchar4(in);
+}
+
+short2 __attribute__((kernel)) testConvertShort2Float2Short2(float2 in) {
+ return convert_short2(in);
+}
+
+short3 __attribute__((kernel)) testConvertShort3Float3Short3(float3 in) {
+ return convert_short3(in);
+}
+
+short4 __attribute__((kernel)) testConvertShort4Float4Short4(float4 in) {
+ return convert_short4(in);
+}
+
+short2 __attribute__((kernel)) testConvertShort2Char2Short2(char2 in) {
+ return convert_short2(in);
+}
+
+short3 __attribute__((kernel)) testConvertShort3Char3Short3(char3 in) {
+ return convert_short3(in);
+}
+
+short4 __attribute__((kernel)) testConvertShort4Char4Short4(char4 in) {
+ return convert_short4(in);
+}
+
+short2 __attribute__((kernel)) testConvertShort2Uchar2Short2(uchar2 in) {
+ return convert_short2(in);
+}
+
+short3 __attribute__((kernel)) testConvertShort3Uchar3Short3(uchar3 in) {
+ return convert_short3(in);
+}
+
+short4 __attribute__((kernel)) testConvertShort4Uchar4Short4(uchar4 in) {
+ return convert_short4(in);
+}
+
+short2 __attribute__((kernel)) testConvertShort2Short2Short2(short2 in) {
+ return convert_short2(in);
+}
+
+short3 __attribute__((kernel)) testConvertShort3Short3Short3(short3 in) {
+ return convert_short3(in);
+}
+
+short4 __attribute__((kernel)) testConvertShort4Short4Short4(short4 in) {
+ return convert_short4(in);
+}
+
+short2 __attribute__((kernel)) testConvertShort2Ushort2Short2(ushort2 in) {
+ return convert_short2(in);
+}
+
+short3 __attribute__((kernel)) testConvertShort3Ushort3Short3(ushort3 in) {
+ return convert_short3(in);
+}
+
+short4 __attribute__((kernel)) testConvertShort4Ushort4Short4(ushort4 in) {
+ return convert_short4(in);
+}
+
+short2 __attribute__((kernel)) testConvertShort2Int2Short2(int2 in) {
+ return convert_short2(in);
+}
+
+short3 __attribute__((kernel)) testConvertShort3Int3Short3(int3 in) {
+ return convert_short3(in);
+}
+
+short4 __attribute__((kernel)) testConvertShort4Int4Short4(int4 in) {
+ return convert_short4(in);
+}
+
+short2 __attribute__((kernel)) testConvertShort2Uint2Short2(uint2 in) {
+ return convert_short2(in);
+}
+
+short3 __attribute__((kernel)) testConvertShort3Uint3Short3(uint3 in) {
+ return convert_short3(in);
+}
+
+short4 __attribute__((kernel)) testConvertShort4Uint4Short4(uint4 in) {
+ return convert_short4(in);
+}
+
+ushort2 __attribute__((kernel)) testConvertUshort2Float2Ushort2(float2 in) {
+ return convert_ushort2(in);
+}
+
+ushort3 __attribute__((kernel)) testConvertUshort3Float3Ushort3(float3 in) {
+ return convert_ushort3(in);
+}
+
+ushort4 __attribute__((kernel)) testConvertUshort4Float4Ushort4(float4 in) {
+ return convert_ushort4(in);
+}
+
+ushort2 __attribute__((kernel)) testConvertUshort2Char2Ushort2(char2 in) {
+ return convert_ushort2(in);
+}
+
+ushort3 __attribute__((kernel)) testConvertUshort3Char3Ushort3(char3 in) {
+ return convert_ushort3(in);
+}
+
+ushort4 __attribute__((kernel)) testConvertUshort4Char4Ushort4(char4 in) {
+ return convert_ushort4(in);
+}
+
+ushort2 __attribute__((kernel)) testConvertUshort2Uchar2Ushort2(uchar2 in) {
+ return convert_ushort2(in);
+}
+
+ushort3 __attribute__((kernel)) testConvertUshort3Uchar3Ushort3(uchar3 in) {
+ return convert_ushort3(in);
+}
+
+ushort4 __attribute__((kernel)) testConvertUshort4Uchar4Ushort4(uchar4 in) {
+ return convert_ushort4(in);
+}
+
+ushort2 __attribute__((kernel)) testConvertUshort2Short2Ushort2(short2 in) {
+ return convert_ushort2(in);
+}
+
+ushort3 __attribute__((kernel)) testConvertUshort3Short3Ushort3(short3 in) {
+ return convert_ushort3(in);
+}
+
+ushort4 __attribute__((kernel)) testConvertUshort4Short4Ushort4(short4 in) {
+ return convert_ushort4(in);
+}
+
+ushort2 __attribute__((kernel)) testConvertUshort2Ushort2Ushort2(ushort2 in) {
+ return convert_ushort2(in);
+}
+
+ushort3 __attribute__((kernel)) testConvertUshort3Ushort3Ushort3(ushort3 in) {
+ return convert_ushort3(in);
+}
+
+ushort4 __attribute__((kernel)) testConvertUshort4Ushort4Ushort4(ushort4 in) {
+ return convert_ushort4(in);
+}
+
+ushort2 __attribute__((kernel)) testConvertUshort2Int2Ushort2(int2 in) {
+ return convert_ushort2(in);
+}
+
+ushort3 __attribute__((kernel)) testConvertUshort3Int3Ushort3(int3 in) {
+ return convert_ushort3(in);
+}
+
+ushort4 __attribute__((kernel)) testConvertUshort4Int4Ushort4(int4 in) {
+ return convert_ushort4(in);
+}
+
+ushort2 __attribute__((kernel)) testConvertUshort2Uint2Ushort2(uint2 in) {
+ return convert_ushort2(in);
+}
+
+ushort3 __attribute__((kernel)) testConvertUshort3Uint3Ushort3(uint3 in) {
+ return convert_ushort3(in);
+}
+
+ushort4 __attribute__((kernel)) testConvertUshort4Uint4Ushort4(uint4 in) {
+ return convert_ushort4(in);
+}
+
+int2 __attribute__((kernel)) testConvertInt2Float2Int2(float2 in) {
+ return convert_int2(in);
+}
+
+int3 __attribute__((kernel)) testConvertInt3Float3Int3(float3 in) {
+ return convert_int3(in);
+}
+
+int4 __attribute__((kernel)) testConvertInt4Float4Int4(float4 in) {
+ return convert_int4(in);
+}
+
+int2 __attribute__((kernel)) testConvertInt2Char2Int2(char2 in) {
+ return convert_int2(in);
+}
+
+int3 __attribute__((kernel)) testConvertInt3Char3Int3(char3 in) {
+ return convert_int3(in);
+}
+
+int4 __attribute__((kernel)) testConvertInt4Char4Int4(char4 in) {
+ return convert_int4(in);
+}
+
+int2 __attribute__((kernel)) testConvertInt2Uchar2Int2(uchar2 in) {
+ return convert_int2(in);
+}
+
+int3 __attribute__((kernel)) testConvertInt3Uchar3Int3(uchar3 in) {
+ return convert_int3(in);
+}
+
+int4 __attribute__((kernel)) testConvertInt4Uchar4Int4(uchar4 in) {
+ return convert_int4(in);
+}
+
+int2 __attribute__((kernel)) testConvertInt2Short2Int2(short2 in) {
+ return convert_int2(in);
+}
+
+int3 __attribute__((kernel)) testConvertInt3Short3Int3(short3 in) {
+ return convert_int3(in);
+}
+
+int4 __attribute__((kernel)) testConvertInt4Short4Int4(short4 in) {
+ return convert_int4(in);
+}
+
+int2 __attribute__((kernel)) testConvertInt2Ushort2Int2(ushort2 in) {
+ return convert_int2(in);
+}
+
+int3 __attribute__((kernel)) testConvertInt3Ushort3Int3(ushort3 in) {
+ return convert_int3(in);
+}
+
+int4 __attribute__((kernel)) testConvertInt4Ushort4Int4(ushort4 in) {
+ return convert_int4(in);
+}
+
+int2 __attribute__((kernel)) testConvertInt2Int2Int2(int2 in) {
+ return convert_int2(in);
+}
+
+int3 __attribute__((kernel)) testConvertInt3Int3Int3(int3 in) {
+ return convert_int3(in);
+}
+
+int4 __attribute__((kernel)) testConvertInt4Int4Int4(int4 in) {
+ return convert_int4(in);
+}
+
+int2 __attribute__((kernel)) testConvertInt2Uint2Int2(uint2 in) {
+ return convert_int2(in);
+}
+
+int3 __attribute__((kernel)) testConvertInt3Uint3Int3(uint3 in) {
+ return convert_int3(in);
+}
+
+int4 __attribute__((kernel)) testConvertInt4Uint4Int4(uint4 in) {
+ return convert_int4(in);
+}
+
+uint2 __attribute__((kernel)) testConvertUint2Float2Uint2(float2 in) {
+ return convert_uint2(in);
+}
+
+uint3 __attribute__((kernel)) testConvertUint3Float3Uint3(float3 in) {
+ return convert_uint3(in);
+}
+
+uint4 __attribute__((kernel)) testConvertUint4Float4Uint4(float4 in) {
+ return convert_uint4(in);
+}
+
+uint2 __attribute__((kernel)) testConvertUint2Char2Uint2(char2 in) {
+ return convert_uint2(in);
+}
+
+uint3 __attribute__((kernel)) testConvertUint3Char3Uint3(char3 in) {
+ return convert_uint3(in);
+}
+
+uint4 __attribute__((kernel)) testConvertUint4Char4Uint4(char4 in) {
+ return convert_uint4(in);
+}
+
+uint2 __attribute__((kernel)) testConvertUint2Uchar2Uint2(uchar2 in) {
+ return convert_uint2(in);
+}
+
+uint3 __attribute__((kernel)) testConvertUint3Uchar3Uint3(uchar3 in) {
+ return convert_uint3(in);
+}
+
+uint4 __attribute__((kernel)) testConvertUint4Uchar4Uint4(uchar4 in) {
+ return convert_uint4(in);
+}
+
+uint2 __attribute__((kernel)) testConvertUint2Short2Uint2(short2 in) {
+ return convert_uint2(in);
+}
+
+uint3 __attribute__((kernel)) testConvertUint3Short3Uint3(short3 in) {
+ return convert_uint3(in);
+}
+
+uint4 __attribute__((kernel)) testConvertUint4Short4Uint4(short4 in) {
+ return convert_uint4(in);
+}
+
+uint2 __attribute__((kernel)) testConvertUint2Ushort2Uint2(ushort2 in) {
+ return convert_uint2(in);
+}
+
+uint3 __attribute__((kernel)) testConvertUint3Ushort3Uint3(ushort3 in) {
+ return convert_uint3(in);
+}
+
+uint4 __attribute__((kernel)) testConvertUint4Ushort4Uint4(ushort4 in) {
+ return convert_uint4(in);
+}
+
+uint2 __attribute__((kernel)) testConvertUint2Int2Uint2(int2 in) {
+ return convert_uint2(in);
+}
+
+uint3 __attribute__((kernel)) testConvertUint3Int3Uint3(int3 in) {
+ return convert_uint3(in);
+}
+
+uint4 __attribute__((kernel)) testConvertUint4Int4Uint4(int4 in) {
+ return convert_uint4(in);
+}
+
+uint2 __attribute__((kernel)) testConvertUint2Uint2Uint2(uint2 in) {
+ return convert_uint2(in);
+}
+
+uint3 __attribute__((kernel)) testConvertUint3Uint3Uint3(uint3 in) {
+ return convert_uint3(in);
+}
+
+uint4 __attribute__((kernel)) testConvertUint4Uint4Uint4(uint4 in) {
+ return convert_uint4(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestConvertRelaxed.rs b/tests/src/android/renderscript/cts/TestConvertRelaxed.rs
new file mode 100644
index 0000000..d13c634
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestConvertRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestConvert.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestCopysign.rs b/tests/src/android/renderscript/cts/TestCopysign.rs
new file mode 100644
index 0000000..d7bc4d0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCopysign.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testCopysignFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return copysign(inX, inY);
+}
+
+float2 __attribute__((kernel)) testCopysignFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return copysign(inX, inY);
+}
+
+float3 __attribute__((kernel)) testCopysignFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return copysign(inX, inY);
+}
+
+float4 __attribute__((kernel)) testCopysignFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return copysign(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestCopysignRelaxed.rs b/tests/src/android/renderscript/cts/TestCopysignRelaxed.rs
new file mode 100644
index 0000000..01002d7
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCopysignRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestCopysign.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestCos.rs b/tests/src/android/renderscript/cts/TestCos.rs
new file mode 100644
index 0000000..5605139
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCos.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testCosFloatFloat(float in) {
+ return cos(in);
+}
+
+float2 __attribute__((kernel)) testCosFloat2Float2(float2 in) {
+ return cos(in);
+}
+
+float3 __attribute__((kernel)) testCosFloat3Float3(float3 in) {
+ return cos(in);
+}
+
+float4 __attribute__((kernel)) testCosFloat4Float4(float4 in) {
+ return cos(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestCosRelaxed.rs b/tests/src/android/renderscript/cts/TestCosRelaxed.rs
new file mode 100644
index 0000000..1871a69
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCosRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestCos.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestCosh.rs b/tests/src/android/renderscript/cts/TestCosh.rs
new file mode 100644
index 0000000..b2d89b9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCosh.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testCoshFloatFloat(float in) {
+ return cosh(in);
+}
+
+float2 __attribute__((kernel)) testCoshFloat2Float2(float2 in) {
+ return cosh(in);
+}
+
+float3 __attribute__((kernel)) testCoshFloat3Float3(float3 in) {
+ return cosh(in);
+}
+
+float4 __attribute__((kernel)) testCoshFloat4Float4(float4 in) {
+ return cosh(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestCoshRelaxed.rs b/tests/src/android/renderscript/cts/TestCoshRelaxed.rs
new file mode 100644
index 0000000..cf28629
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCoshRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestCosh.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestCospi.rs b/tests/src/android/renderscript/cts/TestCospi.rs
new file mode 100644
index 0000000..a0cc778
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCospi.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testCospiFloatFloat(float in) {
+ return cospi(in);
+}
+
+float2 __attribute__((kernel)) testCospiFloat2Float2(float2 in) {
+ return cospi(in);
+}
+
+float3 __attribute__((kernel)) testCospiFloat3Float3(float3 in) {
+ return cospi(in);
+}
+
+float4 __attribute__((kernel)) testCospiFloat4Float4(float4 in) {
+ return cospi(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestCospiRelaxed.rs b/tests/src/android/renderscript/cts/TestCospiRelaxed.rs
new file mode 100644
index 0000000..aac7b90
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCospiRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestCospi.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestCross.rs b/tests/src/android/renderscript/cts/TestCross.rs
new file mode 100644
index 0000000..16d5d35
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCross.rs
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInRhs;
+
+float3 __attribute__((kernel)) testCrossFloat3Float3Float3(float3 inLhs, unsigned int x) {
+ float3 inRhs = rsGetElementAt_float3(gAllocInRhs, x);
+ return cross(inLhs, inRhs);
+}
+
+float4 __attribute__((kernel)) testCrossFloat4Float4Float4(float4 inLhs, unsigned int x) {
+ float4 inRhs = rsGetElementAt_float4(gAllocInRhs, x);
+ return cross(inLhs, inRhs);
+}
diff --git a/tests/src/android/renderscript/cts/TestCrossRelaxed.rs b/tests/src/android/renderscript/cts/TestCrossRelaxed.rs
new file mode 100644
index 0000000..59fa62d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestCrossRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestCross.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestDegrees.rs b/tests/src/android/renderscript/cts/TestDegrees.rs
new file mode 100644
index 0000000..78741a8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestDegrees.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testDegreesFloatFloat(float inValue) {
+ return degrees(inValue);
+}
+
+float2 __attribute__((kernel)) testDegreesFloat2Float2(float2 inValue) {
+ return degrees(inValue);
+}
+
+float3 __attribute__((kernel)) testDegreesFloat3Float3(float3 inValue) {
+ return degrees(inValue);
+}
+
+float4 __attribute__((kernel)) testDegreesFloat4Float4(float4 inValue) {
+ return degrees(inValue);
+}
diff --git a/tests/src/android/renderscript/cts/TestDegreesRelaxed.rs b/tests/src/android/renderscript/cts/TestDegreesRelaxed.rs
new file mode 100644
index 0000000..7a443bf
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestDegreesRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestDegrees.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestDistance.rs b/tests/src/android/renderscript/cts/TestDistance.rs
new file mode 100644
index 0000000..fdc1783
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestDistance.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInRhs;
+
+float __attribute__((kernel)) testDistanceFloatFloatFloat(float inLhs, unsigned int x) {
+ float inRhs = rsGetElementAt_float(gAllocInRhs, x);
+ return distance(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testDistanceFloat2Float2Float(float2 inLhs, unsigned int x) {
+ float2 inRhs = rsGetElementAt_float2(gAllocInRhs, x);
+ return distance(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testDistanceFloat3Float3Float(float3 inLhs, unsigned int x) {
+ float3 inRhs = rsGetElementAt_float3(gAllocInRhs, x);
+ return distance(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testDistanceFloat4Float4Float(float4 inLhs, unsigned int x) {
+ float4 inRhs = rsGetElementAt_float4(gAllocInRhs, x);
+ return distance(inLhs, inRhs);
+}
diff --git a/tests/src/android/renderscript/cts/TestDistanceRelaxed.rs b/tests/src/android/renderscript/cts/TestDistanceRelaxed.rs
new file mode 100644
index 0000000..ba4c096
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestDistanceRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestDistance.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestDot.rs b/tests/src/android/renderscript/cts/TestDot.rs
new file mode 100644
index 0000000..27aa8aa
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestDot.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInRhs;
+
+float __attribute__((kernel)) testDotFloatFloatFloat(float inLhs, unsigned int x) {
+ float inRhs = rsGetElementAt_float(gAllocInRhs, x);
+ return dot(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testDotFloat2Float2Float(float2 inLhs, unsigned int x) {
+ float2 inRhs = rsGetElementAt_float2(gAllocInRhs, x);
+ return dot(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testDotFloat3Float3Float(float3 inLhs, unsigned int x) {
+ float3 inRhs = rsGetElementAt_float3(gAllocInRhs, x);
+ return dot(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testDotFloat4Float4Float(float4 inLhs, unsigned int x) {
+ float4 inRhs = rsGetElementAt_float4(gAllocInRhs, x);
+ return dot(inLhs, inRhs);
+}
diff --git a/tests/src/android/renderscript/cts/TestDotRelaxed.rs b/tests/src/android/renderscript/cts/TestDotRelaxed.rs
new file mode 100644
index 0000000..53e7080
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestDotRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestDot.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestErf.rs b/tests/src/android/renderscript/cts/TestErf.rs
new file mode 100644
index 0000000..5d26ed6
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestErf.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testErfFloatFloat(float in) {
+ return erf(in);
+}
+
+float2 __attribute__((kernel)) testErfFloat2Float2(float2 in) {
+ return erf(in);
+}
+
+float3 __attribute__((kernel)) testErfFloat3Float3(float3 in) {
+ return erf(in);
+}
+
+float4 __attribute__((kernel)) testErfFloat4Float4(float4 in) {
+ return erf(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestErfRelaxed.rs b/tests/src/android/renderscript/cts/TestErfRelaxed.rs
new file mode 100644
index 0000000..1551db8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestErfRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestErf.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestErfc.rs b/tests/src/android/renderscript/cts/TestErfc.rs
new file mode 100644
index 0000000..d12ea25
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestErfc.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testErfcFloatFloat(float in) {
+ return erfc(in);
+}
+
+float2 __attribute__((kernel)) testErfcFloat2Float2(float2 in) {
+ return erfc(in);
+}
+
+float3 __attribute__((kernel)) testErfcFloat3Float3(float3 in) {
+ return erfc(in);
+}
+
+float4 __attribute__((kernel)) testErfcFloat4Float4(float4 in) {
+ return erfc(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestErfcRelaxed.rs b/tests/src/android/renderscript/cts/TestErfcRelaxed.rs
new file mode 100644
index 0000000..f6117c8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestErfcRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestErfc.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestExp.rs b/tests/src/android/renderscript/cts/TestExp.rs
new file mode 100644
index 0000000..90879d9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExp.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testExpFloatFloat(float in) {
+ return exp(in);
+}
+
+float2 __attribute__((kernel)) testExpFloat2Float2(float2 in) {
+ return exp(in);
+}
+
+float3 __attribute__((kernel)) testExpFloat3Float3(float3 in) {
+ return exp(in);
+}
+
+float4 __attribute__((kernel)) testExpFloat4Float4(float4 in) {
+ return exp(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestExp10.rs b/tests/src/android/renderscript/cts/TestExp10.rs
new file mode 100644
index 0000000..117fe26
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExp10.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testExp10FloatFloat(float in) {
+ return exp10(in);
+}
+
+float2 __attribute__((kernel)) testExp10Float2Float2(float2 in) {
+ return exp10(in);
+}
+
+float3 __attribute__((kernel)) testExp10Float3Float3(float3 in) {
+ return exp10(in);
+}
+
+float4 __attribute__((kernel)) testExp10Float4Float4(float4 in) {
+ return exp10(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestExp10Relaxed.rs b/tests/src/android/renderscript/cts/TestExp10Relaxed.rs
new file mode 100644
index 0000000..9b07598
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExp10Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestExp10.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestExp2.rs b/tests/src/android/renderscript/cts/TestExp2.rs
new file mode 100644
index 0000000..61ff900
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExp2.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testExp2FloatFloat(float in) {
+ return exp2(in);
+}
+
+float2 __attribute__((kernel)) testExp2Float2Float2(float2 in) {
+ return exp2(in);
+}
+
+float3 __attribute__((kernel)) testExp2Float3Float3(float3 in) {
+ return exp2(in);
+}
+
+float4 __attribute__((kernel)) testExp2Float4Float4(float4 in) {
+ return exp2(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestExp2Relaxed.rs b/tests/src/android/renderscript/cts/TestExp2Relaxed.rs
new file mode 100644
index 0000000..06810b3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExp2Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestExp2.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestExpRelaxed.rs b/tests/src/android/renderscript/cts/TestExpRelaxed.rs
new file mode 100644
index 0000000..f98bf80
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExpRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestExp.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestExpm1.rs b/tests/src/android/renderscript/cts/TestExpm1.rs
new file mode 100644
index 0000000..9399576
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExpm1.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testExpm1FloatFloat(float in) {
+ return expm1(in);
+}
+
+float2 __attribute__((kernel)) testExpm1Float2Float2(float2 in) {
+ return expm1(in);
+}
+
+float3 __attribute__((kernel)) testExpm1Float3Float3(float3 in) {
+ return expm1(in);
+}
+
+float4 __attribute__((kernel)) testExpm1Float4Float4(float4 in) {
+ return expm1(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestExpm1Relaxed.rs b/tests/src/android/renderscript/cts/TestExpm1Relaxed.rs
new file mode 100644
index 0000000..bd73f9d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestExpm1Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestExpm1.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFabs.rs b/tests/src/android/renderscript/cts/TestFabs.rs
new file mode 100644
index 0000000..aed0318
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFabs.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testFabsFloatFloat(float in) {
+ return fabs(in);
+}
+
+float2 __attribute__((kernel)) testFabsFloat2Float2(float2 in) {
+ return fabs(in);
+}
+
+float3 __attribute__((kernel)) testFabsFloat3Float3(float3 in) {
+ return fabs(in);
+}
+
+float4 __attribute__((kernel)) testFabsFloat4Float4(float4 in) {
+ return fabs(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestFabsRelaxed.rs b/tests/src/android/renderscript/cts/TestFabsRelaxed.rs
new file mode 100644
index 0000000..4d2214a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFabsRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFabs.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFastDistance.rs b/tests/src/android/renderscript/cts/TestFastDistance.rs
new file mode 100644
index 0000000..62c0931
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFastDistance.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInRhs;
+
+float __attribute__((kernel)) testFastDistanceFloatFloatFloat(float inLhs, unsigned int x) {
+ float inRhs = rsGetElementAt_float(gAllocInRhs, x);
+ return fast_distance(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testFastDistanceFloat2Float2Float(float2 inLhs, unsigned int x) {
+ float2 inRhs = rsGetElementAt_float2(gAllocInRhs, x);
+ return fast_distance(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testFastDistanceFloat3Float3Float(float3 inLhs, unsigned int x) {
+ float3 inRhs = rsGetElementAt_float3(gAllocInRhs, x);
+ return fast_distance(inLhs, inRhs);
+}
+
+float __attribute__((kernel)) testFastDistanceFloat4Float4Float(float4 inLhs, unsigned int x) {
+ float4 inRhs = rsGetElementAt_float4(gAllocInRhs, x);
+ return fast_distance(inLhs, inRhs);
+}
diff --git a/tests/src/android/renderscript/cts/TestFastDistanceRelaxed.rs b/tests/src/android/renderscript/cts/TestFastDistanceRelaxed.rs
new file mode 100644
index 0000000..245bc65
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFastDistanceRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFastDistance.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFastLength.rs b/tests/src/android/renderscript/cts/TestFastLength.rs
new file mode 100644
index 0000000..f4fc853
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFastLength.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testFastLengthFloatFloat(float inV) {
+ return fast_length(inV);
+}
+
+float __attribute__((kernel)) testFastLengthFloat2Float(float2 inV) {
+ return fast_length(inV);
+}
+
+float __attribute__((kernel)) testFastLengthFloat3Float(float3 inV) {
+ return fast_length(inV);
+}
+
+float __attribute__((kernel)) testFastLengthFloat4Float(float4 inV) {
+ return fast_length(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestFastLengthRelaxed.rs b/tests/src/android/renderscript/cts/TestFastLengthRelaxed.rs
new file mode 100644
index 0000000..680c3e1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFastLengthRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFastLength.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFastNormalize.rs b/tests/src/android/renderscript/cts/TestFastNormalize.rs
new file mode 100644
index 0000000..449c49c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFastNormalize.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testFastNormalizeFloatFloat(float inV) {
+ return fast_normalize(inV);
+}
+
+float2 __attribute__((kernel)) testFastNormalizeFloat2Float2(float2 inV) {
+ return fast_normalize(inV);
+}
+
+float3 __attribute__((kernel)) testFastNormalizeFloat3Float3(float3 inV) {
+ return fast_normalize(inV);
+}
+
+float4 __attribute__((kernel)) testFastNormalizeFloat4Float4(float4 inV) {
+ return fast_normalize(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestFastNormalizeRelaxed.rs b/tests/src/android/renderscript/cts/TestFastNormalizeRelaxed.rs
new file mode 100644
index 0000000..e195f60
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFastNormalizeRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFastNormalize.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFdim.rs b/tests/src/android/renderscript/cts/TestFdim.rs
new file mode 100644
index 0000000..8f68c14
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFdim.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInB;
+
+float __attribute__((kernel)) testFdimFloatFloatFloat(float inA, unsigned int x) {
+ float inB = rsGetElementAt_float(gAllocInB, x);
+ return fdim(inA, inB);
+}
+
+float2 __attribute__((kernel)) testFdimFloat2Float2Float2(float2 inA, unsigned int x) {
+ float2 inB = rsGetElementAt_float2(gAllocInB, x);
+ return fdim(inA, inB);
+}
+
+float3 __attribute__((kernel)) testFdimFloat3Float3Float3(float3 inA, unsigned int x) {
+ float3 inB = rsGetElementAt_float3(gAllocInB, x);
+ return fdim(inA, inB);
+}
+
+float4 __attribute__((kernel)) testFdimFloat4Float4Float4(float4 inA, unsigned int x) {
+ float4 inB = rsGetElementAt_float4(gAllocInB, x);
+ return fdim(inA, inB);
+}
diff --git a/tests/src/android/renderscript/cts/TestFdimRelaxed.rs b/tests/src/android/renderscript/cts/TestFdimRelaxed.rs
new file mode 100644
index 0000000..473a588
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFdimRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFdim.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFloor.rs b/tests/src/android/renderscript/cts/TestFloor.rs
new file mode 100644
index 0000000..f74fc2b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFloor.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testFloorFloatFloat(float in) {
+ return floor(in);
+}
+
+float2 __attribute__((kernel)) testFloorFloat2Float2(float2 in) {
+ return floor(in);
+}
+
+float3 __attribute__((kernel)) testFloorFloat3Float3(float3 in) {
+ return floor(in);
+}
+
+float4 __attribute__((kernel)) testFloorFloat4Float4(float4 in) {
+ return floor(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestFloorRelaxed.rs b/tests/src/android/renderscript/cts/TestFloorRelaxed.rs
new file mode 100644
index 0000000..4caf0de
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFloorRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFloor.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFma.rs b/tests/src/android/renderscript/cts/TestFma.rs
new file mode 100644
index 0000000..b0cb2dd
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFma.rs
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInB;
+rs_allocation gAllocInC;
+
+float __attribute__((kernel)) testFmaFloatFloatFloatFloat(float inA, unsigned int x) {
+ float inB = rsGetElementAt_float(gAllocInB, x);
+ float inC = rsGetElementAt_float(gAllocInC, x);
+ return fma(inA, inB, inC);
+}
+
+float2 __attribute__((kernel)) testFmaFloat2Float2Float2Float2(float2 inA, unsigned int x) {
+ float2 inB = rsGetElementAt_float2(gAllocInB, x);
+ float2 inC = rsGetElementAt_float2(gAllocInC, x);
+ return fma(inA, inB, inC);
+}
+
+float3 __attribute__((kernel)) testFmaFloat3Float3Float3Float3(float3 inA, unsigned int x) {
+ float3 inB = rsGetElementAt_float3(gAllocInB, x);
+ float3 inC = rsGetElementAt_float3(gAllocInC, x);
+ return fma(inA, inB, inC);
+}
+
+float4 __attribute__((kernel)) testFmaFloat4Float4Float4Float4(float4 inA, unsigned int x) {
+ float4 inB = rsGetElementAt_float4(gAllocInB, x);
+ float4 inC = rsGetElementAt_float4(gAllocInC, x);
+ return fma(inA, inB, inC);
+}
diff --git a/tests/src/android/renderscript/cts/TestFmaRelaxed.rs b/tests/src/android/renderscript/cts/TestFmaRelaxed.rs
new file mode 100644
index 0000000..cc80e06
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFmaRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFma.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFmax.rs b/tests/src/android/renderscript/cts/TestFmax.rs
new file mode 100644
index 0000000..50e5e3f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFmax.rs
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testFmaxFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmax(inX, inY);
+}
+
+float2 __attribute__((kernel)) testFmaxFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return fmax(inX, inY);
+}
+
+float3 __attribute__((kernel)) testFmaxFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return fmax(inX, inY);
+}
+
+float4 __attribute__((kernel)) testFmaxFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return fmax(inX, inY);
+}
+
+float2 __attribute__((kernel)) testFmaxFloat2FloatFloat2(float2 inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmax(inX, inY);
+}
+
+float3 __attribute__((kernel)) testFmaxFloat3FloatFloat3(float3 inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmax(inX, inY);
+}
+
+float4 __attribute__((kernel)) testFmaxFloat4FloatFloat4(float4 inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmax(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestFmaxRelaxed.rs b/tests/src/android/renderscript/cts/TestFmaxRelaxed.rs
new file mode 100644
index 0000000..74c8b3d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFmaxRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFmax.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFmin.rs b/tests/src/android/renderscript/cts/TestFmin.rs
new file mode 100644
index 0000000..28db18f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFmin.rs
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testFminFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmin(inX, inY);
+}
+
+float2 __attribute__((kernel)) testFminFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return fmin(inX, inY);
+}
+
+float3 __attribute__((kernel)) testFminFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return fmin(inX, inY);
+}
+
+float4 __attribute__((kernel)) testFminFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return fmin(inX, inY);
+}
+
+float2 __attribute__((kernel)) testFminFloat2FloatFloat2(float2 inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmin(inX, inY);
+}
+
+float3 __attribute__((kernel)) testFminFloat3FloatFloat3(float3 inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmin(inX, inY);
+}
+
+float4 __attribute__((kernel)) testFminFloat4FloatFloat4(float4 inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmin(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestFminRelaxed.rs b/tests/src/android/renderscript/cts/TestFminRelaxed.rs
new file mode 100644
index 0000000..571f64a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFminRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFmin.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFmod.rs b/tests/src/android/renderscript/cts/TestFmod.rs
new file mode 100644
index 0000000..c1c2bff
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFmod.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testFmodFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return fmod(inX, inY);
+}
+
+float2 __attribute__((kernel)) testFmodFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return fmod(inX, inY);
+}
+
+float3 __attribute__((kernel)) testFmodFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return fmod(inX, inY);
+}
+
+float4 __attribute__((kernel)) testFmodFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return fmod(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestFmodRelaxed.rs b/tests/src/android/renderscript/cts/TestFmodRelaxed.rs
new file mode 100644
index 0000000..02888a1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFmodRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFmod.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFract.rs b/tests/src/android/renderscript/cts/TestFract.rs
new file mode 100644
index 0000000..38351ab
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFract.rs
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocOutFloor;
+
+float __attribute__((kernel)) testFractFloatFloatFloat(float inV, unsigned int x) {
+ float outFloor = 0;
+ float out = fract(inV, &outFloor);
+ rsSetElementAt_float(gAllocOutFloor, outFloor, x);
+ return out;
+}
+
+float2 __attribute__((kernel)) testFractFloat2Float2Float2(float2 inV, unsigned int x) {
+ float2 outFloor = 0;
+ float2 out = fract(inV, &outFloor);
+ rsSetElementAt_float2(gAllocOutFloor, outFloor, x);
+ return out;
+}
+
+float3 __attribute__((kernel)) testFractFloat3Float3Float3(float3 inV, unsigned int x) {
+ float3 outFloor = 0;
+ float3 out = fract(inV, &outFloor);
+ rsSetElementAt_float3(gAllocOutFloor, outFloor, x);
+ return out;
+}
+
+float4 __attribute__((kernel)) testFractFloat4Float4Float4(float4 inV, unsigned int x) {
+ float4 outFloor = 0;
+ float4 out = fract(inV, &outFloor);
+ rsSetElementAt_float4(gAllocOutFloor, outFloor, x);
+ return out;
+}
+
+float __attribute__((kernel)) testFractFloatFloat(float inV) {
+ return fract(inV);
+}
+
+float2 __attribute__((kernel)) testFractFloat2Float2(float2 inV) {
+ return fract(inV);
+}
+
+float3 __attribute__((kernel)) testFractFloat3Float3(float3 inV) {
+ return fract(inV);
+}
+
+float4 __attribute__((kernel)) testFractFloat4Float4(float4 inV) {
+ return fract(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestFractRelaxed.rs b/tests/src/android/renderscript/cts/TestFractRelaxed.rs
new file mode 100644
index 0000000..c9a98df
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFractRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFract.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestFrexp.rs b/tests/src/android/renderscript/cts/TestFrexp.rs
new file mode 100644
index 0000000..70c6c13
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFrexp.rs
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocOutIptr;
+
+float __attribute__((kernel)) testFrexpFloatIntFloat(float inV, unsigned int x) {
+ int outIptr = 0;
+ float out = frexp(inV, &outIptr);
+ rsSetElementAt_int(gAllocOutIptr, outIptr, x);
+ return out;
+}
+
+float2 __attribute__((kernel)) testFrexpFloat2Int2Float2(float2 inV, unsigned int x) {
+ int2 outIptr = 0;
+ float2 out = frexp(inV, &outIptr);
+ rsSetElementAt_int2(gAllocOutIptr, outIptr, x);
+ return out;
+}
+
+float3 __attribute__((kernel)) testFrexpFloat3Int3Float3(float3 inV, unsigned int x) {
+ int3 outIptr = 0;
+ float3 out = frexp(inV, &outIptr);
+ rsSetElementAt_int3(gAllocOutIptr, outIptr, x);
+ return out;
+}
+
+float4 __attribute__((kernel)) testFrexpFloat4Int4Float4(float4 inV, unsigned int x) {
+ int4 outIptr = 0;
+ float4 out = frexp(inV, &outIptr);
+ rsSetElementAt_int4(gAllocOutIptr, outIptr, x);
+ return out;
+}
diff --git a/tests/src/android/renderscript/cts/TestFrexpRelaxed.rs b/tests/src/android/renderscript/cts/TestFrexpRelaxed.rs
new file mode 100644
index 0000000..8dc4c4d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestFrexpRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestFrexp.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestHalfRecip.rs b/tests/src/android/renderscript/cts/TestHalfRecip.rs
new file mode 100644
index 0000000..03c5802
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHalfRecip.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testHalfRecipFloatFloat(float inV) {
+ return half_recip(inV);
+}
+
+float2 __attribute__((kernel)) testHalfRecipFloat2Float2(float2 inV) {
+ return half_recip(inV);
+}
+
+float3 __attribute__((kernel)) testHalfRecipFloat3Float3(float3 inV) {
+ return half_recip(inV);
+}
+
+float4 __attribute__((kernel)) testHalfRecipFloat4Float4(float4 inV) {
+ return half_recip(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestHalfRecipRelaxed.rs b/tests/src/android/renderscript/cts/TestHalfRecipRelaxed.rs
new file mode 100644
index 0000000..da453fa
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHalfRecipRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestHalfRecip.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestHalfRsqrt.rs b/tests/src/android/renderscript/cts/TestHalfRsqrt.rs
new file mode 100644
index 0000000..27840d1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHalfRsqrt.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testHalfRsqrtFloatFloat(float inV) {
+ return half_rsqrt(inV);
+}
+
+float2 __attribute__((kernel)) testHalfRsqrtFloat2Float2(float2 inV) {
+ return half_rsqrt(inV);
+}
+
+float3 __attribute__((kernel)) testHalfRsqrtFloat3Float3(float3 inV) {
+ return half_rsqrt(inV);
+}
+
+float4 __attribute__((kernel)) testHalfRsqrtFloat4Float4(float4 inV) {
+ return half_rsqrt(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestHalfRsqrtRelaxed.rs b/tests/src/android/renderscript/cts/TestHalfRsqrtRelaxed.rs
new file mode 100644
index 0000000..4f94200
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHalfRsqrtRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestHalfRsqrt.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestHalfSqrt.rs b/tests/src/android/renderscript/cts/TestHalfSqrt.rs
new file mode 100644
index 0000000..d785e44
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHalfSqrt.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testHalfSqrtFloatFloat(float inV) {
+ return half_sqrt(inV);
+}
+
+float2 __attribute__((kernel)) testHalfSqrtFloat2Float2(float2 inV) {
+ return half_sqrt(inV);
+}
+
+float3 __attribute__((kernel)) testHalfSqrtFloat3Float3(float3 inV) {
+ return half_sqrt(inV);
+}
+
+float4 __attribute__((kernel)) testHalfSqrtFloat4Float4(float4 inV) {
+ return half_sqrt(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestHalfSqrtRelaxed.rs b/tests/src/android/renderscript/cts/TestHalfSqrtRelaxed.rs
new file mode 100644
index 0000000..46b979d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHalfSqrtRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestHalfSqrt.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestHypot.rs b/tests/src/android/renderscript/cts/TestHypot.rs
new file mode 100644
index 0000000..9425121
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHypot.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testHypotFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return hypot(inX, inY);
+}
+
+float2 __attribute__((kernel)) testHypotFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return hypot(inX, inY);
+}
+
+float3 __attribute__((kernel)) testHypotFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return hypot(inX, inY);
+}
+
+float4 __attribute__((kernel)) testHypotFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return hypot(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestHypotRelaxed.rs b/tests/src/android/renderscript/cts/TestHypotRelaxed.rs
new file mode 100644
index 0000000..15d02f3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestHypotRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestHypot.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestIlogb.rs b/tests/src/android/renderscript/cts/TestIlogb.rs
new file mode 100644
index 0000000..d9d62ed
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestIlogb.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+int __attribute__((kernel)) testIlogbFloatInt(float in) {
+ return ilogb(in);
+}
+
+int2 __attribute__((kernel)) testIlogbFloat2Int2(float2 in) {
+ return ilogb(in);
+}
+
+int3 __attribute__((kernel)) testIlogbFloat3Int3(float3 in) {
+ return ilogb(in);
+}
+
+int4 __attribute__((kernel)) testIlogbFloat4Int4(float4 in) {
+ return ilogb(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestIlogbRelaxed.rs b/tests/src/android/renderscript/cts/TestIlogbRelaxed.rs
new file mode 100644
index 0000000..6a60e53
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestIlogbRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestIlogb.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLdexp.rs b/tests/src/android/renderscript/cts/TestLdexp.rs
new file mode 100644
index 0000000..e8b05f2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLdexp.rs
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testLdexpFloatIntFloat(float inX, unsigned int x) {
+ int inY = rsGetElementAt_int(gAllocInY, x);
+ return ldexp(inX, inY);
+}
+
+float2 __attribute__((kernel)) testLdexpFloat2Int2Float2(float2 inX, unsigned int x) {
+ int2 inY = rsGetElementAt_int2(gAllocInY, x);
+ return ldexp(inX, inY);
+}
+
+float3 __attribute__((kernel)) testLdexpFloat3Int3Float3(float3 inX, unsigned int x) {
+ int3 inY = rsGetElementAt_int3(gAllocInY, x);
+ return ldexp(inX, inY);
+}
+
+float4 __attribute__((kernel)) testLdexpFloat4Int4Float4(float4 inX, unsigned int x) {
+ int4 inY = rsGetElementAt_int4(gAllocInY, x);
+ return ldexp(inX, inY);
+}
+
+float2 __attribute__((kernel)) testLdexpFloat2IntFloat2(float2 inX, unsigned int x) {
+ int inY = rsGetElementAt_int(gAllocInY, x);
+ return ldexp(inX, inY);
+}
+
+float3 __attribute__((kernel)) testLdexpFloat3IntFloat3(float3 inX, unsigned int x) {
+ int inY = rsGetElementAt_int(gAllocInY, x);
+ return ldexp(inX, inY);
+}
+
+float4 __attribute__((kernel)) testLdexpFloat4IntFloat4(float4 inX, unsigned int x) {
+ int inY = rsGetElementAt_int(gAllocInY, x);
+ return ldexp(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestLdexpRelaxed.rs b/tests/src/android/renderscript/cts/TestLdexpRelaxed.rs
new file mode 100644
index 0000000..ee9f5cf
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLdexpRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLdexp.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLength.rs b/tests/src/android/renderscript/cts/TestLength.rs
new file mode 100644
index 0000000..3239dbd
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLength.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testLengthFloatFloat(float inV) {
+ return length(inV);
+}
+
+float __attribute__((kernel)) testLengthFloat2Float(float2 inV) {
+ return length(inV);
+}
+
+float __attribute__((kernel)) testLengthFloat3Float(float3 inV) {
+ return length(inV);
+}
+
+float __attribute__((kernel)) testLengthFloat4Float(float4 inV) {
+ return length(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestLengthRelaxed.rs b/tests/src/android/renderscript/cts/TestLengthRelaxed.rs
new file mode 100644
index 0000000..12eba8b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLengthRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLength.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLgamma.rs b/tests/src/android/renderscript/cts/TestLgamma.rs
new file mode 100644
index 0000000..b39e592
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLgamma.rs
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testLgammaFloatFloat(float in) {
+ return lgamma(in);
+}
+
+float2 __attribute__((kernel)) testLgammaFloat2Float2(float2 in) {
+ return lgamma(in);
+}
+
+float3 __attribute__((kernel)) testLgammaFloat3Float3(float3 in) {
+ return lgamma(in);
+}
+
+float4 __attribute__((kernel)) testLgammaFloat4Float4(float4 in) {
+ return lgamma(in);
+}
+rs_allocation gAllocOutY;
+
+float __attribute__((kernel)) testLgammaFloatIntFloat(float inX, unsigned int x) {
+ int outY = 0;
+ float out = lgamma(inX, &outY);
+ rsSetElementAt_int(gAllocOutY, outY, x);
+ return out;
+}
+
+float2 __attribute__((kernel)) testLgammaFloat2Int2Float2(float2 inX, unsigned int x) {
+ int2 outY = 0;
+ float2 out = lgamma(inX, &outY);
+ rsSetElementAt_int2(gAllocOutY, outY, x);
+ return out;
+}
+
+float3 __attribute__((kernel)) testLgammaFloat3Int3Float3(float3 inX, unsigned int x) {
+ int3 outY = 0;
+ float3 out = lgamma(inX, &outY);
+ rsSetElementAt_int3(gAllocOutY, outY, x);
+ return out;
+}
+
+float4 __attribute__((kernel)) testLgammaFloat4Int4Float4(float4 inX, unsigned int x) {
+ int4 outY = 0;
+ float4 out = lgamma(inX, &outY);
+ rsSetElementAt_int4(gAllocOutY, outY, x);
+ return out;
+}
diff --git a/tests/src/android/renderscript/cts/TestLgammaRelaxed.rs b/tests/src/android/renderscript/cts/TestLgammaRelaxed.rs
new file mode 100644
index 0000000..a259576
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLgammaRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLgamma.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLog.rs b/tests/src/android/renderscript/cts/TestLog.rs
new file mode 100644
index 0000000..4261b61
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLog.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testLogFloatFloat(float in) {
+ return log(in);
+}
+
+float2 __attribute__((kernel)) testLogFloat2Float2(float2 in) {
+ return log(in);
+}
+
+float3 __attribute__((kernel)) testLogFloat3Float3(float3 in) {
+ return log(in);
+}
+
+float4 __attribute__((kernel)) testLogFloat4Float4(float4 in) {
+ return log(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestLog10.rs b/tests/src/android/renderscript/cts/TestLog10.rs
new file mode 100644
index 0000000..18fb3c3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLog10.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testLog10FloatFloat(float in) {
+ return log10(in);
+}
+
+float2 __attribute__((kernel)) testLog10Float2Float2(float2 in) {
+ return log10(in);
+}
+
+float3 __attribute__((kernel)) testLog10Float3Float3(float3 in) {
+ return log10(in);
+}
+
+float4 __attribute__((kernel)) testLog10Float4Float4(float4 in) {
+ return log10(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestLog10Relaxed.rs b/tests/src/android/renderscript/cts/TestLog10Relaxed.rs
new file mode 100644
index 0000000..c0c47f3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLog10Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLog10.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLog1p.rs b/tests/src/android/renderscript/cts/TestLog1p.rs
new file mode 100644
index 0000000..bc5577e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLog1p.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testLog1pFloatFloat(float in) {
+ return log1p(in);
+}
+
+float2 __attribute__((kernel)) testLog1pFloat2Float2(float2 in) {
+ return log1p(in);
+}
+
+float3 __attribute__((kernel)) testLog1pFloat3Float3(float3 in) {
+ return log1p(in);
+}
+
+float4 __attribute__((kernel)) testLog1pFloat4Float4(float4 in) {
+ return log1p(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestLog1pRelaxed.rs b/tests/src/android/renderscript/cts/TestLog1pRelaxed.rs
new file mode 100644
index 0000000..3136d9e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLog1pRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLog1p.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLog2.rs b/tests/src/android/renderscript/cts/TestLog2.rs
new file mode 100644
index 0000000..4cf8ef2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLog2.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testLog2FloatFloat(float in) {
+ return log2(in);
+}
+
+float2 __attribute__((kernel)) testLog2Float2Float2(float2 in) {
+ return log2(in);
+}
+
+float3 __attribute__((kernel)) testLog2Float3Float3(float3 in) {
+ return log2(in);
+}
+
+float4 __attribute__((kernel)) testLog2Float4Float4(float4 in) {
+ return log2(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestLog2Relaxed.rs b/tests/src/android/renderscript/cts/TestLog2Relaxed.rs
new file mode 100644
index 0000000..e79f105
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLog2Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLog2.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLogRelaxed.rs b/tests/src/android/renderscript/cts/TestLogRelaxed.rs
new file mode 100644
index 0000000..3fed787
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLogRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLog.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestLogb.rs b/tests/src/android/renderscript/cts/TestLogb.rs
new file mode 100644
index 0000000..8317a22
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLogb.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testLogbFloatFloat(float in) {
+ return logb(in);
+}
+
+float2 __attribute__((kernel)) testLogbFloat2Float2(float2 in) {
+ return logb(in);
+}
+
+float3 __attribute__((kernel)) testLogbFloat3Float3(float3 in) {
+ return logb(in);
+}
+
+float4 __attribute__((kernel)) testLogbFloat4Float4(float4 in) {
+ return logb(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestLogbRelaxed.rs b/tests/src/android/renderscript/cts/TestLogbRelaxed.rs
new file mode 100644
index 0000000..bcf84b7
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestLogbRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestLogb.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestMad.rs b/tests/src/android/renderscript/cts/TestMad.rs
new file mode 100644
index 0000000..bcf908b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMad.rs
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInB;
+rs_allocation gAllocInC;
+
+float __attribute__((kernel)) testMadFloatFloatFloatFloat(float inA, unsigned int x) {
+ float inB = rsGetElementAt_float(gAllocInB, x);
+ float inC = rsGetElementAt_float(gAllocInC, x);
+ return mad(inA, inB, inC);
+}
+
+float2 __attribute__((kernel)) testMadFloat2Float2Float2Float2(float2 inA, unsigned int x) {
+ float2 inB = rsGetElementAt_float2(gAllocInB, x);
+ float2 inC = rsGetElementAt_float2(gAllocInC, x);
+ return mad(inA, inB, inC);
+}
+
+float3 __attribute__((kernel)) testMadFloat3Float3Float3Float3(float3 inA, unsigned int x) {
+ float3 inB = rsGetElementAt_float3(gAllocInB, x);
+ float3 inC = rsGetElementAt_float3(gAllocInC, x);
+ return mad(inA, inB, inC);
+}
+
+float4 __attribute__((kernel)) testMadFloat4Float4Float4Float4(float4 inA, unsigned int x) {
+ float4 inB = rsGetElementAt_float4(gAllocInB, x);
+ float4 inC = rsGetElementAt_float4(gAllocInC, x);
+ return mad(inA, inB, inC);
+}
diff --git a/tests/src/android/renderscript/cts/TestMadRelaxed.rs b/tests/src/android/renderscript/cts/TestMadRelaxed.rs
new file mode 100644
index 0000000..acec458
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMadRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestMad.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestMax.rs b/tests/src/android/renderscript/cts/TestMax.rs
new file mode 100644
index 0000000..87d8040
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMax.rs
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocIn1;
+
+float __attribute__((kernel)) testMaxFloatFloatFloat(float in, unsigned int x) {
+ float in1 = rsGetElementAt_float(gAllocIn1, x);
+ return max(in, in1);
+}
+
+float2 __attribute__((kernel)) testMaxFloat2Float2Float2(float2 in, unsigned int x) {
+ float2 in1 = rsGetElementAt_float2(gAllocIn1, x);
+ return max(in, in1);
+}
+
+float3 __attribute__((kernel)) testMaxFloat3Float3Float3(float3 in, unsigned int x) {
+ float3 in1 = rsGetElementAt_float3(gAllocIn1, x);
+ return max(in, in1);
+}
+
+float4 __attribute__((kernel)) testMaxFloat4Float4Float4(float4 in, unsigned int x) {
+ float4 in1 = rsGetElementAt_float4(gAllocIn1, x);
+ return max(in, in1);
+}
+rs_allocation gAllocInV2;
+
+char __attribute__((kernel)) testMaxCharCharChar(char inV1, unsigned int x) {
+ char inV2 = rsGetElementAt_char(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uchar __attribute__((kernel)) testMaxUcharUcharUchar(uchar inV1, unsigned int x) {
+ uchar inV2 = rsGetElementAt_uchar(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+short __attribute__((kernel)) testMaxShortShortShort(short inV1, unsigned int x) {
+ short inV2 = rsGetElementAt_short(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+ushort __attribute__((kernel)) testMaxUshortUshortUshort(ushort inV1, unsigned int x) {
+ ushort inV2 = rsGetElementAt_ushort(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+int __attribute__((kernel)) testMaxIntIntInt(int inV1, unsigned int x) {
+ int inV2 = rsGetElementAt_int(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uint __attribute__((kernel)) testMaxUintUintUint(uint inV1, unsigned int x) {
+ uint inV2 = rsGetElementAt_uint(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+char2 __attribute__((kernel)) testMaxChar2Char2Char2(char2 inV1, unsigned int x) {
+ char2 inV2 = rsGetElementAt_char2(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uchar2 __attribute__((kernel)) testMaxUchar2Uchar2Uchar2(uchar2 inV1, unsigned int x) {
+ uchar2 inV2 = rsGetElementAt_uchar2(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+short2 __attribute__((kernel)) testMaxShort2Short2Short2(short2 inV1, unsigned int x) {
+ short2 inV2 = rsGetElementAt_short2(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+ushort2 __attribute__((kernel)) testMaxUshort2Ushort2Ushort2(ushort2 inV1, unsigned int x) {
+ ushort2 inV2 = rsGetElementAt_ushort2(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+int2 __attribute__((kernel)) testMaxInt2Int2Int2(int2 inV1, unsigned int x) {
+ int2 inV2 = rsGetElementAt_int2(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uint2 __attribute__((kernel)) testMaxUint2Uint2Uint2(uint2 inV1, unsigned int x) {
+ uint2 inV2 = rsGetElementAt_uint2(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+char3 __attribute__((kernel)) testMaxChar3Char3Char3(char3 inV1, unsigned int x) {
+ char3 inV2 = rsGetElementAt_char3(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uchar3 __attribute__((kernel)) testMaxUchar3Uchar3Uchar3(uchar3 inV1, unsigned int x) {
+ uchar3 inV2 = rsGetElementAt_uchar3(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+short3 __attribute__((kernel)) testMaxShort3Short3Short3(short3 inV1, unsigned int x) {
+ short3 inV2 = rsGetElementAt_short3(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+ushort3 __attribute__((kernel)) testMaxUshort3Ushort3Ushort3(ushort3 inV1, unsigned int x) {
+ ushort3 inV2 = rsGetElementAt_ushort3(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+int3 __attribute__((kernel)) testMaxInt3Int3Int3(int3 inV1, unsigned int x) {
+ int3 inV2 = rsGetElementAt_int3(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uint3 __attribute__((kernel)) testMaxUint3Uint3Uint3(uint3 inV1, unsigned int x) {
+ uint3 inV2 = rsGetElementAt_uint3(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+char4 __attribute__((kernel)) testMaxChar4Char4Char4(char4 inV1, unsigned int x) {
+ char4 inV2 = rsGetElementAt_char4(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uchar4 __attribute__((kernel)) testMaxUchar4Uchar4Uchar4(uchar4 inV1, unsigned int x) {
+ uchar4 inV2 = rsGetElementAt_uchar4(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+short4 __attribute__((kernel)) testMaxShort4Short4Short4(short4 inV1, unsigned int x) {
+ short4 inV2 = rsGetElementAt_short4(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+ushort4 __attribute__((kernel)) testMaxUshort4Ushort4Ushort4(ushort4 inV1, unsigned int x) {
+ ushort4 inV2 = rsGetElementAt_ushort4(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+int4 __attribute__((kernel)) testMaxInt4Int4Int4(int4 inV1, unsigned int x) {
+ int4 inV2 = rsGetElementAt_int4(gAllocInV2, x);
+ return max(inV1, inV2);
+}
+
+uint4 __attribute__((kernel)) testMaxUint4Uint4Uint4(uint4 inV1, unsigned int x) {
+ uint4 inV2 = rsGetElementAt_uint4(gAllocInV2, x);
+ return max(inV1, inV2);
+}
diff --git a/tests/src/android/renderscript/cts/TestMaxRelaxed.rs b/tests/src/android/renderscript/cts/TestMaxRelaxed.rs
new file mode 100644
index 0000000..fb0319b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMaxRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestMax.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestMin.rs b/tests/src/android/renderscript/cts/TestMin.rs
new file mode 100644
index 0000000..26301ff
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMin.rs
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocIn1;
+
+float __attribute__((kernel)) testMinFloatFloatFloat(float in, unsigned int x) {
+ float in1 = rsGetElementAt_float(gAllocIn1, x);
+ return min(in, in1);
+}
+
+float2 __attribute__((kernel)) testMinFloat2Float2Float2(float2 in, unsigned int x) {
+ float2 in1 = rsGetElementAt_float2(gAllocIn1, x);
+ return min(in, in1);
+}
+
+float3 __attribute__((kernel)) testMinFloat3Float3Float3(float3 in, unsigned int x) {
+ float3 in1 = rsGetElementAt_float3(gAllocIn1, x);
+ return min(in, in1);
+}
+
+float4 __attribute__((kernel)) testMinFloat4Float4Float4(float4 in, unsigned int x) {
+ float4 in1 = rsGetElementAt_float4(gAllocIn1, x);
+ return min(in, in1);
+}
+rs_allocation gAllocInV2;
+
+char __attribute__((kernel)) testMinCharCharChar(char inV1, unsigned int x) {
+ char inV2 = rsGetElementAt_char(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uchar __attribute__((kernel)) testMinUcharUcharUchar(uchar inV1, unsigned int x) {
+ uchar inV2 = rsGetElementAt_uchar(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+short __attribute__((kernel)) testMinShortShortShort(short inV1, unsigned int x) {
+ short inV2 = rsGetElementAt_short(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+ushort __attribute__((kernel)) testMinUshortUshortUshort(ushort inV1, unsigned int x) {
+ ushort inV2 = rsGetElementAt_ushort(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+int __attribute__((kernel)) testMinIntIntInt(int inV1, unsigned int x) {
+ int inV2 = rsGetElementAt_int(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uint __attribute__((kernel)) testMinUintUintUint(uint inV1, unsigned int x) {
+ uint inV2 = rsGetElementAt_uint(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+char2 __attribute__((kernel)) testMinChar2Char2Char2(char2 inV1, unsigned int x) {
+ char2 inV2 = rsGetElementAt_char2(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uchar2 __attribute__((kernel)) testMinUchar2Uchar2Uchar2(uchar2 inV1, unsigned int x) {
+ uchar2 inV2 = rsGetElementAt_uchar2(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+short2 __attribute__((kernel)) testMinShort2Short2Short2(short2 inV1, unsigned int x) {
+ short2 inV2 = rsGetElementAt_short2(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+ushort2 __attribute__((kernel)) testMinUshort2Ushort2Ushort2(ushort2 inV1, unsigned int x) {
+ ushort2 inV2 = rsGetElementAt_ushort2(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+int2 __attribute__((kernel)) testMinInt2Int2Int2(int2 inV1, unsigned int x) {
+ int2 inV2 = rsGetElementAt_int2(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uint2 __attribute__((kernel)) testMinUint2Uint2Uint2(uint2 inV1, unsigned int x) {
+ uint2 inV2 = rsGetElementAt_uint2(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+char3 __attribute__((kernel)) testMinChar3Char3Char3(char3 inV1, unsigned int x) {
+ char3 inV2 = rsGetElementAt_char3(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uchar3 __attribute__((kernel)) testMinUchar3Uchar3Uchar3(uchar3 inV1, unsigned int x) {
+ uchar3 inV2 = rsGetElementAt_uchar3(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+short3 __attribute__((kernel)) testMinShort3Short3Short3(short3 inV1, unsigned int x) {
+ short3 inV2 = rsGetElementAt_short3(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+ushort3 __attribute__((kernel)) testMinUshort3Ushort3Ushort3(ushort3 inV1, unsigned int x) {
+ ushort3 inV2 = rsGetElementAt_ushort3(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+int3 __attribute__((kernel)) testMinInt3Int3Int3(int3 inV1, unsigned int x) {
+ int3 inV2 = rsGetElementAt_int3(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uint3 __attribute__((kernel)) testMinUint3Uint3Uint3(uint3 inV1, unsigned int x) {
+ uint3 inV2 = rsGetElementAt_uint3(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+char4 __attribute__((kernel)) testMinChar4Char4Char4(char4 inV1, unsigned int x) {
+ char4 inV2 = rsGetElementAt_char4(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uchar4 __attribute__((kernel)) testMinUchar4Uchar4Uchar4(uchar4 inV1, unsigned int x) {
+ uchar4 inV2 = rsGetElementAt_uchar4(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+short4 __attribute__((kernel)) testMinShort4Short4Short4(short4 inV1, unsigned int x) {
+ short4 inV2 = rsGetElementAt_short4(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+ushort4 __attribute__((kernel)) testMinUshort4Ushort4Ushort4(ushort4 inV1, unsigned int x) {
+ ushort4 inV2 = rsGetElementAt_ushort4(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+int4 __attribute__((kernel)) testMinInt4Int4Int4(int4 inV1, unsigned int x) {
+ int4 inV2 = rsGetElementAt_int4(gAllocInV2, x);
+ return min(inV1, inV2);
+}
+
+uint4 __attribute__((kernel)) testMinUint4Uint4Uint4(uint4 inV1, unsigned int x) {
+ uint4 inV2 = rsGetElementAt_uint4(gAllocInV2, x);
+ return min(inV1, inV2);
+}
diff --git a/tests/src/android/renderscript/cts/TestMinRelaxed.rs b/tests/src/android/renderscript/cts/TestMinRelaxed.rs
new file mode 100644
index 0000000..29a4d89
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMinRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestMin.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestMix.rs b/tests/src/android/renderscript/cts/TestMix.rs
new file mode 100644
index 0000000..c2ebcb3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMix.rs
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInStop;
+rs_allocation gAllocInAmount;
+
+float __attribute__((kernel)) testMixFloatFloatFloatFloat(float inStart, unsigned int x) {
+ float inStop = rsGetElementAt_float(gAllocInStop, x);
+ float inAmount = rsGetElementAt_float(gAllocInAmount, x);
+ return mix(inStart, inStop, inAmount);
+}
+
+float2 __attribute__((kernel)) testMixFloat2Float2Float2Float2(float2 inStart, unsigned int x) {
+ float2 inStop = rsGetElementAt_float2(gAllocInStop, x);
+ float2 inAmount = rsGetElementAt_float2(gAllocInAmount, x);
+ return mix(inStart, inStop, inAmount);
+}
+
+float3 __attribute__((kernel)) testMixFloat3Float3Float3Float3(float3 inStart, unsigned int x) {
+ float3 inStop = rsGetElementAt_float3(gAllocInStop, x);
+ float3 inAmount = rsGetElementAt_float3(gAllocInAmount, x);
+ return mix(inStart, inStop, inAmount);
+}
+
+float4 __attribute__((kernel)) testMixFloat4Float4Float4Float4(float4 inStart, unsigned int x) {
+ float4 inStop = rsGetElementAt_float4(gAllocInStop, x);
+ float4 inAmount = rsGetElementAt_float4(gAllocInAmount, x);
+ return mix(inStart, inStop, inAmount);
+}
+
+float2 __attribute__((kernel)) testMixFloat2Float2FloatFloat2(float2 inStart, unsigned int x) {
+ float2 inStop = rsGetElementAt_float2(gAllocInStop, x);
+ float inAmount = rsGetElementAt_float(gAllocInAmount, x);
+ return mix(inStart, inStop, inAmount);
+}
+
+float3 __attribute__((kernel)) testMixFloat3Float3FloatFloat3(float3 inStart, unsigned int x) {
+ float3 inStop = rsGetElementAt_float3(gAllocInStop, x);
+ float inAmount = rsGetElementAt_float(gAllocInAmount, x);
+ return mix(inStart, inStop, inAmount);
+}
+
+float4 __attribute__((kernel)) testMixFloat4Float4FloatFloat4(float4 inStart, unsigned int x) {
+ float4 inStop = rsGetElementAt_float4(gAllocInStop, x);
+ float inAmount = rsGetElementAt_float(gAllocInAmount, x);
+ return mix(inStart, inStop, inAmount);
+}
diff --git a/tests/src/android/renderscript/cts/TestMixRelaxed.rs b/tests/src/android/renderscript/cts/TestMixRelaxed.rs
new file mode 100644
index 0000000..6b59e70
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestMixRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestMix.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestModf.rs b/tests/src/android/renderscript/cts/TestModf.rs
new file mode 100644
index 0000000..be10983
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestModf.rs
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocOutIret;
+
+float __attribute__((kernel)) testModfFloatFloatFloat(float inX, unsigned int x) {
+ float outIret = 0;
+ float out = modf(inX, &outIret);
+ rsSetElementAt_float(gAllocOutIret, outIret, x);
+ return out;
+}
+
+float2 __attribute__((kernel)) testModfFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 outIret = 0;
+ float2 out = modf(inX, &outIret);
+ rsSetElementAt_float2(gAllocOutIret, outIret, x);
+ return out;
+}
+
+float3 __attribute__((kernel)) testModfFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 outIret = 0;
+ float3 out = modf(inX, &outIret);
+ rsSetElementAt_float3(gAllocOutIret, outIret, x);
+ return out;
+}
+
+float4 __attribute__((kernel)) testModfFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 outIret = 0;
+ float4 out = modf(inX, &outIret);
+ rsSetElementAt_float4(gAllocOutIret, outIret, x);
+ return out;
+}
diff --git a/tests/src/android/renderscript/cts/TestModfRelaxed.rs b/tests/src/android/renderscript/cts/TestModfRelaxed.rs
new file mode 100644
index 0000000..4c9cd9a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestModfRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestModf.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNan.rs b/tests/src/android/renderscript/cts/TestNan.rs
new file mode 100644
index 0000000..bb434d6
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNan.rs
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNanUintFloat(uint in) {
+ return nan(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestNanRelaxed.rs b/tests/src/android/renderscript/cts/TestNanRelaxed.rs
new file mode 100644
index 0000000..fc7b9eb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNanRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNan.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNativeExp.rs b/tests/src/android/renderscript/cts/TestNativeExp.rs
new file mode 100644
index 0000000..6143d9f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeExp.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNativeExpFloatFloat(float inV) {
+ return native_exp(inV);
+}
+
+float2 __attribute__((kernel)) testNativeExpFloat2Float2(float2 inV) {
+ return native_exp(inV);
+}
+
+float3 __attribute__((kernel)) testNativeExpFloat3Float3(float3 inV) {
+ return native_exp(inV);
+}
+
+float4 __attribute__((kernel)) testNativeExpFloat4Float4(float4 inV) {
+ return native_exp(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestNativeExp10.rs b/tests/src/android/renderscript/cts/TestNativeExp10.rs
new file mode 100644
index 0000000..1d03607
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeExp10.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNativeExp10FloatFloat(float inV) {
+ return native_exp10(inV);
+}
+
+float2 __attribute__((kernel)) testNativeExp10Float2Float2(float2 inV) {
+ return native_exp10(inV);
+}
+
+float3 __attribute__((kernel)) testNativeExp10Float3Float3(float3 inV) {
+ return native_exp10(inV);
+}
+
+float4 __attribute__((kernel)) testNativeExp10Float4Float4(float4 inV) {
+ return native_exp10(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestNativeExp10Relaxed.rs b/tests/src/android/renderscript/cts/TestNativeExp10Relaxed.rs
new file mode 100644
index 0000000..4f12665
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeExp10Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNativeExp10.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNativeExp2.rs b/tests/src/android/renderscript/cts/TestNativeExp2.rs
new file mode 100644
index 0000000..1112900
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeExp2.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNativeExp2FloatFloat(float inV) {
+ return native_exp2(inV);
+}
+
+float2 __attribute__((kernel)) testNativeExp2Float2Float2(float2 inV) {
+ return native_exp2(inV);
+}
+
+float3 __attribute__((kernel)) testNativeExp2Float3Float3(float3 inV) {
+ return native_exp2(inV);
+}
+
+float4 __attribute__((kernel)) testNativeExp2Float4Float4(float4 inV) {
+ return native_exp2(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestNativeExp2Relaxed.rs b/tests/src/android/renderscript/cts/TestNativeExp2Relaxed.rs
new file mode 100644
index 0000000..8b99710
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeExp2Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNativeExp2.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNativeExpRelaxed.rs b/tests/src/android/renderscript/cts/TestNativeExpRelaxed.rs
new file mode 100644
index 0000000..dd3a73c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeExpRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNativeExp.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNativeLog.rs b/tests/src/android/renderscript/cts/TestNativeLog.rs
new file mode 100644
index 0000000..05a4688
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeLog.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNativeLogFloatFloat(float inV) {
+ return native_log(inV);
+}
+
+float2 __attribute__((kernel)) testNativeLogFloat2Float2(float2 inV) {
+ return native_log(inV);
+}
+
+float3 __attribute__((kernel)) testNativeLogFloat3Float3(float3 inV) {
+ return native_log(inV);
+}
+
+float4 __attribute__((kernel)) testNativeLogFloat4Float4(float4 inV) {
+ return native_log(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestNativeLog10.rs b/tests/src/android/renderscript/cts/TestNativeLog10.rs
new file mode 100644
index 0000000..3e86a13
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeLog10.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNativeLog10FloatFloat(float inV) {
+ return native_log10(inV);
+}
+
+float2 __attribute__((kernel)) testNativeLog10Float2Float2(float2 inV) {
+ return native_log10(inV);
+}
+
+float3 __attribute__((kernel)) testNativeLog10Float3Float3(float3 inV) {
+ return native_log10(inV);
+}
+
+float4 __attribute__((kernel)) testNativeLog10Float4Float4(float4 inV) {
+ return native_log10(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestNativeLog10Relaxed.rs b/tests/src/android/renderscript/cts/TestNativeLog10Relaxed.rs
new file mode 100644
index 0000000..a00ed08
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeLog10Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNativeLog10.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNativeLog2.rs b/tests/src/android/renderscript/cts/TestNativeLog2.rs
new file mode 100644
index 0000000..748a2a0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeLog2.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNativeLog2FloatFloat(float inV) {
+ return native_log2(inV);
+}
+
+float2 __attribute__((kernel)) testNativeLog2Float2Float2(float2 inV) {
+ return native_log2(inV);
+}
+
+float3 __attribute__((kernel)) testNativeLog2Float3Float3(float3 inV) {
+ return native_log2(inV);
+}
+
+float4 __attribute__((kernel)) testNativeLog2Float4Float4(float4 inV) {
+ return native_log2(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestNativeLog2Relaxed.rs b/tests/src/android/renderscript/cts/TestNativeLog2Relaxed.rs
new file mode 100644
index 0000000..71c2580
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeLog2Relaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNativeLog2.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNativeLogRelaxed.rs b/tests/src/android/renderscript/cts/TestNativeLogRelaxed.rs
new file mode 100644
index 0000000..70d5e2f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativeLogRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNativeLog.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNativePowr.rs b/tests/src/android/renderscript/cts/TestNativePowr.rs
new file mode 100644
index 0000000..06de2f9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativePowr.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testNativePowrFloatFloatFloat(float inV, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return native_powr(inV, inY);
+}
+
+float2 __attribute__((kernel)) testNativePowrFloat2Float2Float2(float2 inV, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return native_powr(inV, inY);
+}
+
+float3 __attribute__((kernel)) testNativePowrFloat3Float3Float3(float3 inV, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return native_powr(inV, inY);
+}
+
+float4 __attribute__((kernel)) testNativePowrFloat4Float4Float4(float4 inV, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return native_powr(inV, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestNativePowrRelaxed.rs b/tests/src/android/renderscript/cts/TestNativePowrRelaxed.rs
new file mode 100644
index 0000000..069e40e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNativePowrRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNativePowr.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNextafter.rs b/tests/src/android/renderscript/cts/TestNextafter.rs
new file mode 100644
index 0000000..a7ae02d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNextafter.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testNextafterFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return nextafter(inX, inY);
+}
+
+float2 __attribute__((kernel)) testNextafterFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return nextafter(inX, inY);
+}
+
+float3 __attribute__((kernel)) testNextafterFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return nextafter(inX, inY);
+}
+
+float4 __attribute__((kernel)) testNextafterFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return nextafter(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestNextafterRelaxed.rs b/tests/src/android/renderscript/cts/TestNextafterRelaxed.rs
new file mode 100644
index 0000000..2111f17
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNextafterRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNextafter.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestNormalize.rs b/tests/src/android/renderscript/cts/TestNormalize.rs
new file mode 100644
index 0000000..fbb5281
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNormalize.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testNormalizeFloatFloat(float inV) {
+ return normalize(inV);
+}
+
+float2 __attribute__((kernel)) testNormalizeFloat2Float2(float2 inV) {
+ return normalize(inV);
+}
+
+float3 __attribute__((kernel)) testNormalizeFloat3Float3(float3 inV) {
+ return normalize(inV);
+}
+
+float4 __attribute__((kernel)) testNormalizeFloat4Float4(float4 inV) {
+ return normalize(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestNormalizeRelaxed.rs b/tests/src/android/renderscript/cts/TestNormalizeRelaxed.rs
new file mode 100644
index 0000000..148bec3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestNormalizeRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestNormalize.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestPow.rs b/tests/src/android/renderscript/cts/TestPow.rs
new file mode 100644
index 0000000..855419a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestPow.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testPowFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return pow(inX, inY);
+}
+
+float2 __attribute__((kernel)) testPowFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return pow(inX, inY);
+}
+
+float3 __attribute__((kernel)) testPowFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return pow(inX, inY);
+}
+
+float4 __attribute__((kernel)) testPowFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return pow(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestPowRelaxed.rs b/tests/src/android/renderscript/cts/TestPowRelaxed.rs
new file mode 100644
index 0000000..eae1207
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestPowRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestPow.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestPown.rs b/tests/src/android/renderscript/cts/TestPown.rs
new file mode 100644
index 0000000..3ee4fc0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestPown.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testPownFloatIntFloat(float inX, unsigned int x) {
+ int inY = rsGetElementAt_int(gAllocInY, x);
+ return pown(inX, inY);
+}
+
+float2 __attribute__((kernel)) testPownFloat2Int2Float2(float2 inX, unsigned int x) {
+ int2 inY = rsGetElementAt_int2(gAllocInY, x);
+ return pown(inX, inY);
+}
+
+float3 __attribute__((kernel)) testPownFloat3Int3Float3(float3 inX, unsigned int x) {
+ int3 inY = rsGetElementAt_int3(gAllocInY, x);
+ return pown(inX, inY);
+}
+
+float4 __attribute__((kernel)) testPownFloat4Int4Float4(float4 inX, unsigned int x) {
+ int4 inY = rsGetElementAt_int4(gAllocInY, x);
+ return pown(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestPownRelaxed.rs b/tests/src/android/renderscript/cts/TestPownRelaxed.rs
new file mode 100644
index 0000000..d35cd0b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestPownRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestPown.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestPowr.rs b/tests/src/android/renderscript/cts/TestPowr.rs
new file mode 100644
index 0000000..0fd603e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestPowr.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testPowrFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return powr(inX, inY);
+}
+
+float2 __attribute__((kernel)) testPowrFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return powr(inX, inY);
+}
+
+float3 __attribute__((kernel)) testPowrFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return powr(inX, inY);
+}
+
+float4 __attribute__((kernel)) testPowrFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return powr(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestPowrRelaxed.rs b/tests/src/android/renderscript/cts/TestPowrRelaxed.rs
new file mode 100644
index 0000000..95e6f84
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestPowrRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestPowr.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestRadians.rs b/tests/src/android/renderscript/cts/TestRadians.rs
new file mode 100644
index 0000000..09aa9a0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRadians.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testRadiansFloatFloat(float inValue) {
+ return radians(inValue);
+}
+
+float2 __attribute__((kernel)) testRadiansFloat2Float2(float2 inValue) {
+ return radians(inValue);
+}
+
+float3 __attribute__((kernel)) testRadiansFloat3Float3(float3 inValue) {
+ return radians(inValue);
+}
+
+float4 __attribute__((kernel)) testRadiansFloat4Float4(float4 inValue) {
+ return radians(inValue);
+}
diff --git a/tests/src/android/renderscript/cts/TestRadiansRelaxed.rs b/tests/src/android/renderscript/cts/TestRadiansRelaxed.rs
new file mode 100644
index 0000000..fa9209f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRadiansRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestRadians.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestRemainder.rs b/tests/src/android/renderscript/cts/TestRemainder.rs
new file mode 100644
index 0000000..86f2030
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRemainder.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInY;
+
+float __attribute__((kernel)) testRemainderFloatFloatFloat(float inX, unsigned int x) {
+ float inY = rsGetElementAt_float(gAllocInY, x);
+ return remainder(inX, inY);
+}
+
+float2 __attribute__((kernel)) testRemainderFloat2Float2Float2(float2 inX, unsigned int x) {
+ float2 inY = rsGetElementAt_float2(gAllocInY, x);
+ return remainder(inX, inY);
+}
+
+float3 __attribute__((kernel)) testRemainderFloat3Float3Float3(float3 inX, unsigned int x) {
+ float3 inY = rsGetElementAt_float3(gAllocInY, x);
+ return remainder(inX, inY);
+}
+
+float4 __attribute__((kernel)) testRemainderFloat4Float4Float4(float4 inX, unsigned int x) {
+ float4 inY = rsGetElementAt_float4(gAllocInY, x);
+ return remainder(inX, inY);
+}
diff --git a/tests/src/android/renderscript/cts/TestRemainderRelaxed.rs b/tests/src/android/renderscript/cts/TestRemainderRelaxed.rs
new file mode 100644
index 0000000..7c45964
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRemainderRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestRemainder.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestRemquo.rs b/tests/src/android/renderscript/cts/TestRemquo.rs
new file mode 100644
index 0000000..032e6c0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRemquo.rs
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInC;
+rs_allocation gAllocOutD;
+
+float __attribute__((kernel)) testRemquoFloatFloatIntFloat(float inB, unsigned int x) {
+ float inC = rsGetElementAt_float(gAllocInC, x);
+ int outD = 0;
+ float out = remquo(inB, inC, &outD);
+ rsSetElementAt_int(gAllocOutD, outD, x);
+ return out;
+}
+
+float2 __attribute__((kernel)) testRemquoFloat2Float2Int2Float2(float2 inB, unsigned int x) {
+ float2 inC = rsGetElementAt_float2(gAllocInC, x);
+ int2 outD = 0;
+ float2 out = remquo(inB, inC, &outD);
+ rsSetElementAt_int2(gAllocOutD, outD, x);
+ return out;
+}
+
+float3 __attribute__((kernel)) testRemquoFloat3Float3Int3Float3(float3 inB, unsigned int x) {
+ float3 inC = rsGetElementAt_float3(gAllocInC, x);
+ int3 outD = 0;
+ float3 out = remquo(inB, inC, &outD);
+ rsSetElementAt_int3(gAllocOutD, outD, x);
+ return out;
+}
+
+float4 __attribute__((kernel)) testRemquoFloat4Float4Int4Float4(float4 inB, unsigned int x) {
+ float4 inC = rsGetElementAt_float4(gAllocInC, x);
+ int4 outD = 0;
+ float4 out = remquo(inB, inC, &outD);
+ rsSetElementAt_int4(gAllocOutD, outD, x);
+ return out;
+}
diff --git a/tests/src/android/renderscript/cts/TestRemquoRelaxed.rs b/tests/src/android/renderscript/cts/TestRemquoRelaxed.rs
new file mode 100644
index 0000000..3962532
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRemquoRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestRemquo.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestRint.rs b/tests/src/android/renderscript/cts/TestRint.rs
new file mode 100644
index 0000000..a551d68
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRint.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testRintFloatFloat(float in) {
+ return rint(in);
+}
+
+float2 __attribute__((kernel)) testRintFloat2Float2(float2 in) {
+ return rint(in);
+}
+
+float3 __attribute__((kernel)) testRintFloat3Float3(float3 in) {
+ return rint(in);
+}
+
+float4 __attribute__((kernel)) testRintFloat4Float4(float4 in) {
+ return rint(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestRintRelaxed.rs b/tests/src/android/renderscript/cts/TestRintRelaxed.rs
new file mode 100644
index 0000000..9fb4636
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRintRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestRint.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestRootn.rs b/tests/src/android/renderscript/cts/TestRootn.rs
new file mode 100644
index 0000000..e4ee02b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRootn.rs
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInN;
+
+float __attribute__((kernel)) testRootnFloatIntFloat(float inV, unsigned int x) {
+ int inN = rsGetElementAt_int(gAllocInN, x);
+ return rootn(inV, inN);
+}
+
+float2 __attribute__((kernel)) testRootnFloat2Int2Float2(float2 inV, unsigned int x) {
+ int2 inN = rsGetElementAt_int2(gAllocInN, x);
+ return rootn(inV, inN);
+}
+
+float3 __attribute__((kernel)) testRootnFloat3Int3Float3(float3 inV, unsigned int x) {
+ int3 inN = rsGetElementAt_int3(gAllocInN, x);
+ return rootn(inV, inN);
+}
+
+float4 __attribute__((kernel)) testRootnFloat4Int4Float4(float4 inV, unsigned int x) {
+ int4 inN = rsGetElementAt_int4(gAllocInN, x);
+ return rootn(inV, inN);
+}
diff --git a/tests/src/android/renderscript/cts/TestRootnRelaxed.rs b/tests/src/android/renderscript/cts/TestRootnRelaxed.rs
new file mode 100644
index 0000000..e42d664
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRootnRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestRootn.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestRound.rs b/tests/src/android/renderscript/cts/TestRound.rs
new file mode 100644
index 0000000..0442849
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRound.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testRoundFloatFloat(float in) {
+ return round(in);
+}
+
+float2 __attribute__((kernel)) testRoundFloat2Float2(float2 in) {
+ return round(in);
+}
+
+float3 __attribute__((kernel)) testRoundFloat3Float3(float3 in) {
+ return round(in);
+}
+
+float4 __attribute__((kernel)) testRoundFloat4Float4(float4 in) {
+ return round(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestRoundRelaxed.rs b/tests/src/android/renderscript/cts/TestRoundRelaxed.rs
new file mode 100644
index 0000000..ebbdccf
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRoundRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestRound.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestRsqrt.rs b/tests/src/android/renderscript/cts/TestRsqrt.rs
new file mode 100644
index 0000000..5978899
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRsqrt.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testRsqrtFloatFloat(float in) {
+ return rsqrt(in);
+}
+
+float2 __attribute__((kernel)) testRsqrtFloat2Float2(float2 in) {
+ return rsqrt(in);
+}
+
+float3 __attribute__((kernel)) testRsqrtFloat3Float3(float3 in) {
+ return rsqrt(in);
+}
+
+float4 __attribute__((kernel)) testRsqrtFloat4Float4(float4 in) {
+ return rsqrt(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestRsqrtRelaxed.rs b/tests/src/android/renderscript/cts/TestRsqrtRelaxed.rs
new file mode 100644
index 0000000..262761e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestRsqrtRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestRsqrt.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestSign.rs b/tests/src/android/renderscript/cts/TestSign.rs
new file mode 100644
index 0000000..8f35b36
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSign.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testSignFloatFloat(float inV) {
+ return sign(inV);
+}
+
+float2 __attribute__((kernel)) testSignFloat2Float2(float2 inV) {
+ return sign(inV);
+}
+
+float3 __attribute__((kernel)) testSignFloat3Float3(float3 inV) {
+ return sign(inV);
+}
+
+float4 __attribute__((kernel)) testSignFloat4Float4(float4 inV) {
+ return sign(inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestSignRelaxed.rs b/tests/src/android/renderscript/cts/TestSignRelaxed.rs
new file mode 100644
index 0000000..1bc69fb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSignRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestSign.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestSin.rs b/tests/src/android/renderscript/cts/TestSin.rs
new file mode 100644
index 0000000..15e78ba
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSin.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testSinFloatFloat(float in) {
+ return sin(in);
+}
+
+float2 __attribute__((kernel)) testSinFloat2Float2(float2 in) {
+ return sin(in);
+}
+
+float3 __attribute__((kernel)) testSinFloat3Float3(float3 in) {
+ return sin(in);
+}
+
+float4 __attribute__((kernel)) testSinFloat4Float4(float4 in) {
+ return sin(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestSinRelaxed.rs b/tests/src/android/renderscript/cts/TestSinRelaxed.rs
new file mode 100644
index 0000000..e9e4912
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSinRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestSin.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestSincos.rs b/tests/src/android/renderscript/cts/TestSincos.rs
new file mode 100644
index 0000000..82ff9cd
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSincos.rs
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocOutCosptr;
+
+float __attribute__((kernel)) testSincosFloatFloatFloat(float inV, unsigned int x) {
+ float outCosptr = 0;
+ float out = sincos(inV, &outCosptr);
+ rsSetElementAt_float(gAllocOutCosptr, outCosptr, x);
+ return out;
+}
+
+float2 __attribute__((kernel)) testSincosFloat2Float2Float2(float2 inV, unsigned int x) {
+ float2 outCosptr = 0;
+ float2 out = sincos(inV, &outCosptr);
+ rsSetElementAt_float2(gAllocOutCosptr, outCosptr, x);
+ return out;
+}
+
+float3 __attribute__((kernel)) testSincosFloat3Float3Float3(float3 inV, unsigned int x) {
+ float3 outCosptr = 0;
+ float3 out = sincos(inV, &outCosptr);
+ rsSetElementAt_float3(gAllocOutCosptr, outCosptr, x);
+ return out;
+}
+
+float4 __attribute__((kernel)) testSincosFloat4Float4Float4(float4 inV, unsigned int x) {
+ float4 outCosptr = 0;
+ float4 out = sincos(inV, &outCosptr);
+ rsSetElementAt_float4(gAllocOutCosptr, outCosptr, x);
+ return out;
+}
diff --git a/tests/src/android/renderscript/cts/TestSincosRelaxed.rs b/tests/src/android/renderscript/cts/TestSincosRelaxed.rs
new file mode 100644
index 0000000..56cb9fc
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSincosRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestSincos.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestSinh.rs b/tests/src/android/renderscript/cts/TestSinh.rs
new file mode 100644
index 0000000..bd94f0d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSinh.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testSinhFloatFloat(float in) {
+ return sinh(in);
+}
+
+float2 __attribute__((kernel)) testSinhFloat2Float2(float2 in) {
+ return sinh(in);
+}
+
+float3 __attribute__((kernel)) testSinhFloat3Float3(float3 in) {
+ return sinh(in);
+}
+
+float4 __attribute__((kernel)) testSinhFloat4Float4(float4 in) {
+ return sinh(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestSinhRelaxed.rs b/tests/src/android/renderscript/cts/TestSinhRelaxed.rs
new file mode 100644
index 0000000..8ca3390
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSinhRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestSinh.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestSinpi.rs b/tests/src/android/renderscript/cts/TestSinpi.rs
new file mode 100644
index 0000000..367040e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSinpi.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testSinpiFloatFloat(float in) {
+ return sinpi(in);
+}
+
+float2 __attribute__((kernel)) testSinpiFloat2Float2(float2 in) {
+ return sinpi(in);
+}
+
+float3 __attribute__((kernel)) testSinpiFloat3Float3(float3 in) {
+ return sinpi(in);
+}
+
+float4 __attribute__((kernel)) testSinpiFloat4Float4(float4 in) {
+ return sinpi(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestSinpiRelaxed.rs b/tests/src/android/renderscript/cts/TestSinpiRelaxed.rs
new file mode 100644
index 0000000..dd611a7
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSinpiRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestSinpi.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestSqrt.rs b/tests/src/android/renderscript/cts/TestSqrt.rs
new file mode 100644
index 0000000..f1c163b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSqrt.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testSqrtFloatFloat(float in) {
+ return sqrt(in);
+}
+
+float2 __attribute__((kernel)) testSqrtFloat2Float2(float2 in) {
+ return sqrt(in);
+}
+
+float3 __attribute__((kernel)) testSqrtFloat3Float3(float3 in) {
+ return sqrt(in);
+}
+
+float4 __attribute__((kernel)) testSqrtFloat4Float4(float4 in) {
+ return sqrt(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestSqrtRelaxed.rs b/tests/src/android/renderscript/cts/TestSqrtRelaxed.rs
new file mode 100644
index 0000000..ee5b6a8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestSqrtRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestSqrt.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestStep.rs b/tests/src/android/renderscript/cts/TestStep.rs
new file mode 100644
index 0000000..41f8462
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestStep.rs
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+rs_allocation gAllocInV;
+
+float __attribute__((kernel)) testStepFloatFloatFloat(float inEdge, unsigned int x) {
+ float inV = rsGetElementAt_float(gAllocInV, x);
+ return step(inEdge, inV);
+}
+
+float2 __attribute__((kernel)) testStepFloat2Float2Float2(float2 inEdge, unsigned int x) {
+ float2 inV = rsGetElementAt_float2(gAllocInV, x);
+ return step(inEdge, inV);
+}
+
+float3 __attribute__((kernel)) testStepFloat3Float3Float3(float3 inEdge, unsigned int x) {
+ float3 inV = rsGetElementAt_float3(gAllocInV, x);
+ return step(inEdge, inV);
+}
+
+float4 __attribute__((kernel)) testStepFloat4Float4Float4(float4 inEdge, unsigned int x) {
+ float4 inV = rsGetElementAt_float4(gAllocInV, x);
+ return step(inEdge, inV);
+}
+
+float2 __attribute__((kernel)) testStepFloat2FloatFloat2(float2 inEdge, unsigned int x) {
+ float inV = rsGetElementAt_float(gAllocInV, x);
+ return step(inEdge, inV);
+}
+
+float3 __attribute__((kernel)) testStepFloat3FloatFloat3(float3 inEdge, unsigned int x) {
+ float inV = rsGetElementAt_float(gAllocInV, x);
+ return step(inEdge, inV);
+}
+
+float4 __attribute__((kernel)) testStepFloat4FloatFloat4(float4 inEdge, unsigned int x) {
+ float inV = rsGetElementAt_float(gAllocInV, x);
+ return step(inEdge, inV);
+}
diff --git a/tests/src/android/renderscript/cts/TestStepRelaxed.rs b/tests/src/android/renderscript/cts/TestStepRelaxed.rs
new file mode 100644
index 0000000..b2bad68
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestStepRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestStep.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestTan.rs b/tests/src/android/renderscript/cts/TestTan.rs
new file mode 100644
index 0000000..1024943
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTan.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testTanFloatFloat(float in) {
+ return tan(in);
+}
+
+float2 __attribute__((kernel)) testTanFloat2Float2(float2 in) {
+ return tan(in);
+}
+
+float3 __attribute__((kernel)) testTanFloat3Float3(float3 in) {
+ return tan(in);
+}
+
+float4 __attribute__((kernel)) testTanFloat4Float4(float4 in) {
+ return tan(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestTanRelaxed.rs b/tests/src/android/renderscript/cts/TestTanRelaxed.rs
new file mode 100644
index 0000000..9297033
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTanRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestTan.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestTanh.rs b/tests/src/android/renderscript/cts/TestTanh.rs
new file mode 100644
index 0000000..a017c2b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTanh.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testTanhFloatFloat(float in) {
+ return tanh(in);
+}
+
+float2 __attribute__((kernel)) testTanhFloat2Float2(float2 in) {
+ return tanh(in);
+}
+
+float3 __attribute__((kernel)) testTanhFloat3Float3(float3 in) {
+ return tanh(in);
+}
+
+float4 __attribute__((kernel)) testTanhFloat4Float4(float4 in) {
+ return tanh(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestTanhRelaxed.rs b/tests/src/android/renderscript/cts/TestTanhRelaxed.rs
new file mode 100644
index 0000000..f99420a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTanhRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestTanh.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestTanpi.rs b/tests/src/android/renderscript/cts/TestTanpi.rs
new file mode 100644
index 0000000..883a571
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTanpi.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testTanpiFloatFloat(float in) {
+ return tanpi(in);
+}
+
+float2 __attribute__((kernel)) testTanpiFloat2Float2(float2 in) {
+ return tanpi(in);
+}
+
+float3 __attribute__((kernel)) testTanpiFloat3Float3(float3 in) {
+ return tanpi(in);
+}
+
+float4 __attribute__((kernel)) testTanpiFloat4Float4(float4 in) {
+ return tanpi(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestTanpiRelaxed.rs b/tests/src/android/renderscript/cts/TestTanpiRelaxed.rs
new file mode 100644
index 0000000..3fc9d28
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTanpiRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestTanpi.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestTgamma.rs b/tests/src/android/renderscript/cts/TestTgamma.rs
new file mode 100644
index 0000000..7dae4cf
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTgamma.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testTgammaFloatFloat(float in) {
+ return tgamma(in);
+}
+
+float2 __attribute__((kernel)) testTgammaFloat2Float2(float2 in) {
+ return tgamma(in);
+}
+
+float3 __attribute__((kernel)) testTgammaFloat3Float3(float3 in) {
+ return tgamma(in);
+}
+
+float4 __attribute__((kernel)) testTgammaFloat4Float4(float4 in) {
+ return tgamma(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestTgammaRelaxed.rs b/tests/src/android/renderscript/cts/TestTgammaRelaxed.rs
new file mode 100644
index 0000000..7d57ba0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTgammaRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestTgamma.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/TestTrunc.rs b/tests/src/android/renderscript/cts/TestTrunc.rs
new file mode 100644
index 0000000..2422ae4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTrunc.rs
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+
+float __attribute__((kernel)) testTruncFloatFloat(float in) {
+ return trunc(in);
+}
+
+float2 __attribute__((kernel)) testTruncFloat2Float2(float2 in) {
+ return trunc(in);
+}
+
+float3 __attribute__((kernel)) testTruncFloat3Float3(float3 in) {
+ return trunc(in);
+}
+
+float4 __attribute__((kernel)) testTruncFloat4Float4(float4 in) {
+ return trunc(in);
+}
diff --git a/tests/src/android/renderscript/cts/TestTruncRelaxed.rs b/tests/src/android/renderscript/cts/TestTruncRelaxed.rs
new file mode 100644
index 0000000..b365243
--- /dev/null
+++ b/tests/src/android/renderscript/cts/TestTruncRelaxed.rs
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "TestTrunc.rs"
+#pragma rs_fp_relaxed
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
diff --git a/tests/src/android/renderscript/cts/acos_f32.rs b/tests/src/android/renderscript/cts/acos_f32.rs
deleted file mode 100644
index 4bc948b..0000000
--- a/tests/src/android/renderscript/cts/acos_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void acos_f32_1 (const float* in, float* out) {
- *out = acos(*in);
-}
-
-void acos_f32_2 (const float2* in, float2* out) {
- *out = acos(*in);
-}
-
-void acos_f32_3 (const float3* in, float3* out) {
- *out = acos(*in);
-}
-
-void acos_f32_4 (const float4* in , float4* out) {
- *out = acos(*in);
-}
diff --git a/tests/src/android/renderscript/cts/acos_f32_relaxed.rs b/tests/src/android/renderscript/cts/acos_f32_relaxed.rs
deleted file mode 100644
index b553719..0000000
--- a/tests/src/android/renderscript/cts/acos_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "acos_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/acosh_f32.rs b/tests/src/android/renderscript/cts/acosh_f32.rs
deleted file mode 100644
index 8784b02..0000000
--- a/tests/src/android/renderscript/cts/acosh_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void acosh_f32_1 (const float* in, float* out) {
- *out = acosh(*in);
-}
-
-void acosh_f32_2 (const float2* in, float2* out) {
- *out = acosh(*in);
-}
-
-void acosh_f32_3 (const float3* in, float3* out) {
- *out = acosh(*in);
-}
-
-void acosh_f32_4 (const float4* in , float4* out) {
- *out = acosh(*in);
-}
diff --git a/tests/src/android/renderscript/cts/acosh_f32_relaxed.rs b/tests/src/android/renderscript/cts/acosh_f32_relaxed.rs
deleted file mode 100644
index b7995c1..0000000
--- a/tests/src/android/renderscript/cts/acosh_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "acosh_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/acospi_f32.rs b/tests/src/android/renderscript/cts/acospi_f32.rs
deleted file mode 100644
index 66d89eb..0000000
--- a/tests/src/android/renderscript/cts/acospi_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void acospi_f32_1 (const float* in, float* out) {
- *out = acospi(*in);
-}
-
-void acospi_f32_2 (const float2* in, float2* out) {
- *out = acospi(*in);
-}
-
-void acospi_f32_3 (const float3* in, float3* out) {
- *out = acospi(*in);
-}
-
-void acospi_f32_4 (const float4* in, float4* out) {
- *out = acospi(*in);
-}
diff --git a/tests/src/android/renderscript/cts/acospi_f32_relaxed.rs b/tests/src/android/renderscript/cts/acospi_f32_relaxed.rs
deleted file mode 100644
index 0d76365..0000000
--- a/tests/src/android/renderscript/cts/acospi_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "acospi_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/asin_f32.rs b/tests/src/android/renderscript/cts/asin_f32.rs
deleted file mode 100644
index 5f062f9..0000000
--- a/tests/src/android/renderscript/cts/asin_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void asin_f32_1 (const float* in, float* out) {
- *out = asin(*in);
-}
-
-void asin_f32_2 (const float2* in, float2* out) {
- *out = asin(*in);
-}
-
-void asin_f32_3 (const float3* in, float3* out) {
- *out = asin(*in);
-}
-
-void asin_f32_4 (const float4* in , float4* out) {
- *out = asin (*in) ;
-}
diff --git a/tests/src/android/renderscript/cts/asin_f32_relaxed.rs b/tests/src/android/renderscript/cts/asin_f32_relaxed.rs
deleted file mode 100644
index b5b3926..0000000
--- a/tests/src/android/renderscript/cts/asin_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "asin_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/asinh_f32.rs b/tests/src/android/renderscript/cts/asinh_f32.rs
deleted file mode 100644
index 8252507..0000000
--- a/tests/src/android/renderscript/cts/asinh_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void asinh_f32_1 (const float* in, float* out) {
- *out = asinh(*in);
-}
-
-void asinh_f32_2 (const float2* in, float2* out) {
- *out = asinh(*in);
-}
-
-void asinh_f32_3 (const float3* in, float3* out) {
- *out = asinh(*in);
-}
-
-void asinh_f32_4 (const float4* in, float4* out) {
- *out = asinh(*in);
-}
diff --git a/tests/src/android/renderscript/cts/asinh_f32_relaxed.rs b/tests/src/android/renderscript/cts/asinh_f32_relaxed.rs
deleted file mode 100644
index 02a7082..0000000
--- a/tests/src/android/renderscript/cts/asinh_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "asinh_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/asinpi_f32.rs b/tests/src/android/renderscript/cts/asinpi_f32.rs
deleted file mode 100644
index 66bf1d7..0000000
--- a/tests/src/android/renderscript/cts/asinpi_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void asinpi_f32_1 (const float* in, float* out) {
- *out = asinpi(*in);
-}
-
-void asinpi_f32_2 (const float2* in, float2* out) {
- *out = asinpi(*in);
-}
-
-void asinpi_f32_3 (const float3* in, float3* out) {
- *out = asinpi(*in);
-}
-
-void asinpi_f32_4 (const float4* in, float4* out) {
- *out = asinpi(*in);
-}
diff --git a/tests/src/android/renderscript/cts/asinpi_f32_relaxed.rs b/tests/src/android/renderscript/cts/asinpi_f32_relaxed.rs
deleted file mode 100644
index 924a534..0000000
--- a/tests/src/android/renderscript/cts/asinpi_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "asinpi_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/atan2_f32.rs b/tests/src/android/renderscript/cts/atan2_f32.rs
deleted file mode 100644
index e1bab48..0000000
--- a/tests/src/android/renderscript/cts/atan2_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct atan2_f32_in {
- float first;
- float second;
-} input;
-
-void atan2_f32_1(const input* in, float* out){
- *out = atan2(in->first, in->second);
-}
-
-typedef struct atan2_f32_2_in {
- float2 first;
- float2 second;
-} input2;
-
-void atan2_f32_2(const input2* in, float2* out){
- *out = atan2(in->first, in->second);
-}
-
-typedef struct atan2_f32_3_in {
- float3 first;
- float3 second;
-} input3;
-
-void atan2_f32_3(const input3* in, float3* out){
- *out = atan2(in->first, in->second);
-}
-
-typedef struct atan2_f32_4_in {
- float4 first;
- float4 second;
-} input4;
-
-void atan2_f32_4(const input4* in, float4* out){
- *out = atan2(in->first, in->second);
-}
diff --git a/tests/src/android/renderscript/cts/atan2_f32_relaxed.rs b/tests/src/android/renderscript/cts/atan2_f32_relaxed.rs
deleted file mode 100644
index dd749fa..0000000
--- a/tests/src/android/renderscript/cts/atan2_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "atan2_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/atan2pi_f32.rs b/tests/src/android/renderscript/cts/atan2pi_f32.rs
deleted file mode 100644
index 2fe52d8..0000000
--- a/tests/src/android/renderscript/cts/atan2pi_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-struct atan2pi_float_input {
- float x;
- float y;
-};
-
-void atan2pi_f32_1 (const struct atan2pi_float_input* in, float* out) {
- *out = atan2pi(in->x, in->y);
-}
-
-struct atan2pi_float2_input {
- float2 x;
- float2 y;
-};
-
-void atan2pi_f32_2 (const struct atan2pi_float2_input* in, float2* out) {
- *out = atan2pi(in->x, in->y);
-}
-
-struct atan2pi_float3_input {
- float3 x;
- float3 y;
-};
-
-void atan2pi_f32_3 (const struct atan2pi_float3_input* in, float3* out) {
- *out = atan2pi(in->x, in->y);
-}
-
-struct atan2pi_float4_input {
- float4 x;
- float4 y;
-};
-
-void atan2pi_f32_4 (const struct atan2pi_float4_input* in, float4* out) {
- *out = atan2pi(in->x, in->y);
-}
diff --git a/tests/src/android/renderscript/cts/atan2pi_f32_relaxed.rs b/tests/src/android/renderscript/cts/atan2pi_f32_relaxed.rs
deleted file mode 100644
index 0d4e8fb..0000000
--- a/tests/src/android/renderscript/cts/atan2pi_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "atan2pi_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/atan_f32.rs b/tests/src/android/renderscript/cts/atan_f32.rs
deleted file mode 100644
index 65a5ab5..0000000
--- a/tests/src/android/renderscript/cts/atan_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void atan_f32_1 (const float* in, float* out) {
- *out = atan(*in);
-}
-
-void atan_f32_2 (const float2* in, float2* out) {
- *out = atan(*in);
-}
-
-void atan_f32_3 (const float3* in, float3* out) {
- *out = atan(*in);
-}
-
-void atan_f32_4 (const float4* in, float4* out) {
- *out =atan(*in);
-}
diff --git a/tests/src/android/renderscript/cts/atan_f32_relaxed.rs b/tests/src/android/renderscript/cts/atan_f32_relaxed.rs
deleted file mode 100644
index e015aa8..0000000
--- a/tests/src/android/renderscript/cts/atan_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "atan_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/atanh_f32.rs b/tests/src/android/renderscript/cts/atanh_f32.rs
deleted file mode 100644
index 1f61e5e..0000000
--- a/tests/src/android/renderscript/cts/atanh_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void atanh_f32_1 (const float* in, float* out) {
- *out = atanh(*in);
-}
-
-void atanh_f32_2 (const float2* in, float2* out) {
- *out = atanh(*in);
-}
-
-void atanh_f32_3 (const float3* in, float3* out) {
- *out = atanh(*in);
-}
-
-void atanh_f32_4 (const float4* in, float4* out) {
- *out = atanh(*in);
-}
diff --git a/tests/src/android/renderscript/cts/atanh_f32_relaxed.rs b/tests/src/android/renderscript/cts/atanh_f32_relaxed.rs
deleted file mode 100644
index 2083e4d..0000000
--- a/tests/src/android/renderscript/cts/atanh_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "atanh_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/atanpi_f32.rs b/tests/src/android/renderscript/cts/atanpi_f32.rs
deleted file mode 100644
index 182a43c..0000000
--- a/tests/src/android/renderscript/cts/atanpi_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void atanpi_f32_1 (const float* in, float* out) {
- *out = atanpi(*in);
-}
-
-void atanpi_f32_2 (const float2* in, float2* out) {
- *out = atanpi(*in);
-}
-
-void atanpi_f32_3 (const float3* in, float3* out) {
- *out = atanpi(*in);
-}
-
-void atanpi_f32_4 (const float4* in, float4* out) {
- *out = atanpi(*in);
-}
diff --git a/tests/src/android/renderscript/cts/atanpi_f32_relaxed.rs b/tests/src/android/renderscript/cts/atanpi_f32_relaxed.rs
deleted file mode 100644
index fefe784..0000000
--- a/tests/src/android/renderscript/cts/atanpi_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "atanpi_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/cbrt_f32.rs b/tests/src/android/renderscript/cts/cbrt_f32.rs
deleted file mode 100644
index 273e8a4..0000000
--- a/tests/src/android/renderscript/cts/cbrt_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void cbrt_f32_1(const float *in, float *out) {
- *out = cbrt(*in);
-}
-
-void cbrt_f32_2(const float2 *in, float2 *out) {
- *out = cbrt(*in);
-}
-
-void cbrt_f32_3(const float3 *in, float3 *out) {
- *out = cbrt(*in);
-}
-
-void cbrt_f32_4(const float4 *in, float4 *out) {
- *out = cbrt(*in);
-}
diff --git a/tests/src/android/renderscript/cts/cbrt_f32_relaxed.rs b/tests/src/android/renderscript/cts/cbrt_f32_relaxed.rs
deleted file mode 100644
index 9b9e5a5..0000000
--- a/tests/src/android/renderscript/cts/cbrt_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "cbrt_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/ceil_f32.rs b/tests/src/android/renderscript/cts/ceil_f32.rs
deleted file mode 100644
index c0817e2..0000000
--- a/tests/src/android/renderscript/cts/ceil_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void ceil_f32_1(const float *in, float *out) {
- *out = ceil(*in);
-}
-
-void ceil_f32_2(const float2 *in, float2 *out) {
- *out = ceil(*in);
-}
-
-void ceil_f32_3(const float3 *in, float3 *out) {
- *out = ceil(*in);
-}
-
-void ceil_f32_4(const float4 *in, float4 *out) {
- *out = ceil(*in);
-}
diff --git a/tests/src/android/renderscript/cts/ceil_f32_relaxed.rs b/tests/src/android/renderscript/cts/ceil_f32_relaxed.rs
deleted file mode 100644
index 332ca6c..0000000
--- a/tests/src/android/renderscript/cts/ceil_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "ceil_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/clamp.rs b/tests/src/android/renderscript/cts/clamp.rs
deleted file mode 100644
index 28b00bd..0000000
--- a/tests/src/android/renderscript/cts/clamp.rs
+++ /dev/null
@@ -1,56 +0,0 @@
-#include "shared.rsh"
-
-static bool test_clamp_vector() {
- bool failed = false;
-
- float2 src2 = { 2.0f, 2.0f};
- float2 min2 = { 0.5f, -3.0f};
- float2 max2 = { 1.0f, 9.0f};
-
- float2 res2 = clamp(src2, min2, max2);
- _RS_ASSERT(res2.x == 1.0f);
- _RS_ASSERT(res2.y == 2.0f);
-
-
- float3 src3 = { 2.0f, 2.0f, 1.0f};
- float3 min3 = { 0.5f, -3.0f, 3.0f};
- float3 max3 = { 1.0f, 9.0f, 4.0f};
-
- float3 res3 = clamp(src3, min3, max3);
- _RS_ASSERT(res3.x == 1.0f);
- _RS_ASSERT(res3.y == 2.0f);
- _RS_ASSERT(res3.z == 3.0f);
-
-
- float4 src4 = { 2.0f, 2.0f, 1.0f, 4.0f };
- float4 min4 = { 0.5f, -3.0f, 3.0f, 4.0f };
- float4 max4 = { 1.0f, 9.0f, 4.0f, 4.0f };
-
- float4 res4 = clamp(src4, min4, max4);
- _RS_ASSERT(res4.x == 1.0f);
- _RS_ASSERT(res4.y == 2.0f);
- _RS_ASSERT(res4.z == 3.0f);
- _RS_ASSERT(res4.w == 4.0f);
-
- if (failed) {
- rsDebug("test_clamp_vector FAILED", 0);
- }
- else {
- rsDebug("test_clamp_vector PASSED", 0);
- }
-
- return failed;
-}
-
-void clamp_test() {
- bool failed = false;
- failed |= test_clamp_vector();
-
- if (failed) {
- rsSendToClientBlocking(RS_MSG_TEST_FAILED);
- }
- else {
- rsSendToClientBlocking(RS_MSG_TEST_PASSED);
- }
-}
-
diff --git a/tests/src/android/renderscript/cts/clamp_relaxed.rs b/tests/src/android/renderscript/cts/clamp_relaxed.rs
deleted file mode 100644
index 71c65ae..0000000
--- a/tests/src/android/renderscript/cts/clamp_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "clamp.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/copysign_f32.rs b/tests/src/android/renderscript/cts/copysign_f32.rs
deleted file mode 100644
index b0b300d..0000000
--- a/tests/src/android/renderscript/cts/copysign_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-struct copysign_f32_input {
- float x;
- float y;
-};
-
-void copysign_f32_1(const struct copysign_f32_input *in, float *out) {
- *out = copysign(in->x, in->y);
-}
-
-struct copysign_f32_2_input {
- float2 x;
- float2 y;
-};
-
-void copysign_f32_2(const struct copysign_f32_2_input *in, float2 *out) {
- *out = copysign(in->x, in->y);
-}
-
-struct copysign_f32_3_input {
- float3 x;
- float3 y;
-};
-
-void copysign_f32_3(const struct copysign_f32_3_input *in, float3 *out) {
- *out = copysign(in->x, in->y);
-}
-
-struct copysign_f32_4_input {
- float4 x;
- float4 y;
-};
-
-void copysign_f32_4(const struct copysign_f32_4_input *in, float4 *out) {
- *out = copysign(in->x, in->y);
-}
diff --git a/tests/src/android/renderscript/cts/copysign_f32_relaxed.rs b/tests/src/android/renderscript/cts/copysign_f32_relaxed.rs
deleted file mode 100644
index e7fe701..0000000
--- a/tests/src/android/renderscript/cts/copysign_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "copysign_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/cos_f32.rs b/tests/src/android/renderscript/cts/cos_f32.rs
deleted file mode 100644
index fd061dc..0000000
--- a/tests/src/android/renderscript/cts/cos_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void cos_f32_1(const float *in, float *out) {
- *out = cos(*in);
-}
-
-void cos_f32_2(const float2 *in, float2 *out) {
- *out = cos(*in);
-}
-
-void cos_f32_3(const float3 *in, float3 *out) {
- *out = cos(*in);
-}
-
-void cos_f32_4(const float4 *in, float4 *out) {
- *out = cos(*in);
-}
diff --git a/tests/src/android/renderscript/cts/cos_f32_relaxed.rs b/tests/src/android/renderscript/cts/cos_f32_relaxed.rs
deleted file mode 100644
index ceb51d2..0000000
--- a/tests/src/android/renderscript/cts/cos_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "cos_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/cosh_f32.rs b/tests/src/android/renderscript/cts/cosh_f32.rs
deleted file mode 100644
index 0f2ab0f..0000000
--- a/tests/src/android/renderscript/cts/cosh_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void cosh_f32_1(const float *in, float *out) {
- *out = cosh(*in);
-}
-
-void cosh_f32_2(const float2 *in, float2 *out) {
- *out = cosh(*in);
-}
-
-void cosh_f32_3(const float3 *in, float3 *out) {
- *out = cosh(*in);
-}
-
-void cosh_f32_4(const float4 *in, float4 *out) {
- *out = cosh(*in);
-}
diff --git a/tests/src/android/renderscript/cts/cosh_f32_relaxed.rs b/tests/src/android/renderscript/cts/cosh_f32_relaxed.rs
deleted file mode 100644
index 7f6a79b..0000000
--- a/tests/src/android/renderscript/cts/cosh_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "cosh_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/cross_f32.rs b/tests/src/android/renderscript/cts/cross_f32.rs
deleted file mode 100644
index e996e5f..0000000
--- a/tests/src/android/renderscript/cts/cross_f32.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-typedef struct _cross_f32_3_struct {
- float3 low;
- float3 high;
-} cross_f32_3_struct;
-
-void cross_f32_3(const cross_f32_3_struct *in, float3 *out) {
- *out = cross(in->low, in->high);
-}
-
-typedef struct _cross_f32_4_struct {
- float4 low;
- float4 high;
-} cross_f32_4_struct;
-
-void cross_f32_4(const cross_f32_4_struct *in, float4 *out) {
- *out = cross(in->low, in->high);
-}
diff --git a/tests/src/android/renderscript/cts/cross_f32_relaxed.rs b/tests/src/android/renderscript/cts/cross_f32_relaxed.rs
deleted file mode 100644
index d9fbfed..0000000
--- a/tests/src/android/renderscript/cts/cross_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "cross_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/degrees_f32.rs b/tests/src/android/renderscript/cts/degrees_f32.rs
deleted file mode 100644
index e571246..0000000
--- a/tests/src/android/renderscript/cts/degrees_f32.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void degrees_f32_1(const float* in, float* out) {
- *out = degrees(*in);
-}
-
-void degrees_f32_2(const float2* in, float2* out) {
- *out = degrees (*in);
-
-}
-
-void degrees_f32_3(const float3* in, float3* out) {
- *out = degrees(*in);
-
-}
-
-void degrees_f32_4(const float4* in, float4* out) {
- *out = degrees(*in);
-
-}
diff --git a/tests/src/android/renderscript/cts/degrees_f32_relaxed.rs b/tests/src/android/renderscript/cts/degrees_f32_relaxed.rs
deleted file mode 100644
index bc603a5..0000000
--- a/tests/src/android/renderscript/cts/degrees_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "degrees_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/exp10_f32.rs b/tests/src/android/renderscript/cts/exp10_f32.rs
deleted file mode 100644
index 67f5c26..0000000
--- a/tests/src/android/renderscript/cts/exp10_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void exp10_f32_1(const float *in, float *out) {
- *out = exp10(*in);
-}
-
-void exp10_f32_2(const float2 *in, float2 *out) {
- *out = exp10(*in);
-}
-
-void exp10_f32_3(const float3 *in, float3 *out) {
- *out = exp10(*in);
-}
-
-void exp10_f32_4(const float4 *in, float4 *out) {
- *out = exp10(*in);
-}
diff --git a/tests/src/android/renderscript/cts/exp10_f32_relaxed.rs b/tests/src/android/renderscript/cts/exp10_f32_relaxed.rs
deleted file mode 100644
index 6e4e007..0000000
--- a/tests/src/android/renderscript/cts/exp10_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "exp10_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/exp2_f32.rs b/tests/src/android/renderscript/cts/exp2_f32.rs
deleted file mode 100644
index 9095bf3..0000000
--- a/tests/src/android/renderscript/cts/exp2_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void exp2_f32_1(const float *in, float *out) {
- *out = exp2(*in);
-}
-
-void exp2_f32_2(const float2 *in, float2 *out) {
- *out = exp2(*in);
-}
-
-void exp2_f32_3(const float3 *in, float3 *out) {
- *out = exp2(*in);
-}
-
-void exp2_f32_4(const float4 *in, float4 *out) {
- *out = exp2(*in);
-}
diff --git a/tests/src/android/renderscript/cts/exp2_f32_relaxed.rs b/tests/src/android/renderscript/cts/exp2_f32_relaxed.rs
deleted file mode 100644
index 676b30a..0000000
--- a/tests/src/android/renderscript/cts/exp2_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "exp2_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/exp_f32.rs b/tests/src/android/renderscript/cts/exp_f32.rs
deleted file mode 100644
index 036c490..0000000
--- a/tests/src/android/renderscript/cts/exp_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void exp_f32_1(const float *in, float *out) {
- *out = exp(*in);
-}
-
-void exp_f32_2(const float2 *in, float2 *out) {
- *out = exp(*in);
-}
-
-void exp_f32_3(const float3 *in, float3 *out) {
- *out = exp(*in);
-}
-
-void exp_f32_4(const float4 *in, float4 *out) {
- *out = exp(*in);
-}
diff --git a/tests/src/android/renderscript/cts/exp_f32_relaxed.rs b/tests/src/android/renderscript/cts/exp_f32_relaxed.rs
deleted file mode 100644
index dc4b3d0..0000000
--- a/tests/src/android/renderscript/cts/exp_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "exp_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/expm1_f32.rs b/tests/src/android/renderscript/cts/expm1_f32.rs
deleted file mode 100644
index 1950131..0000000
--- a/tests/src/android/renderscript/cts/expm1_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void expm1_f32_1(const float *in, float *out) {
- *out = expm1(*in);
-}
-
-void expm1_f32_2(const float2 *in, float2 *out) {
- *out = expm1(*in);
-}
-
-void expm1_f32_3(const float3 *in, float3 *out) {
- *out = expm1(*in);
-}
-
-void expm1_f32_4(const float4 *in, float4 *out) {
- *out = expm1(*in);
-}
diff --git a/tests/src/android/renderscript/cts/expm1_f32_relaxed.rs b/tests/src/android/renderscript/cts/expm1_f32_relaxed.rs
deleted file mode 100644
index 5a3c40e..0000000
--- a/tests/src/android/renderscript/cts/expm1_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "expm1_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/fabs_f32.rs b/tests/src/android/renderscript/cts/fabs_f32.rs
deleted file mode 100644
index 1567e4d..0000000
--- a/tests/src/android/renderscript/cts/fabs_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void fabs_f32_1(const float *in, float *out) {
- *out = fabs(*in);
-}
-
-void fabs_f32_2(const float2 *in, float2 *out) {
- *out = fabs(*in);
-}
-
-void fabs_f32_3(const float3 *in, float3 *out) {
- *out = fabs(*in);
-}
-
-void fabs_f32_4(const float4 *in, float4 *out) {
- *out = fabs(*in);
-}
diff --git a/tests/src/android/renderscript/cts/fabs_f32_relaxed.rs b/tests/src/android/renderscript/cts/fabs_f32_relaxed.rs
deleted file mode 100644
index e0add35..0000000
--- a/tests/src/android/renderscript/cts/fabs_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "fabs_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/fdim_f32.rs b/tests/src/android/renderscript/cts/fdim_f32.rs
deleted file mode 100644
index e2c5fb1..0000000
--- a/tests/src/android/renderscript/cts/fdim_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-struct fdim_f32_input {
- float x;
- float y;
-};
-
-void fdim_f32_1(const struct fdim_f32_input *in, float *out) {
- *out = fdim(in->x, in->y);
-}
-
-struct fdim_f32_2_input {
- float2 x;
- float2 y;
-};
-
-void fdim_f32_2(const struct fdim_f32_2_input *in, float2 *out) {
- *out = fdim(in->x, in->y);
-}
-
-struct fdim_f32_3_input {
- float3 x;
- float3 y;
-};
-
-void fdim_f32_3(const struct fdim_f32_3_input *in, float3 *out) {
- *out = fdim(in->x, in->y);
-}
-
-struct fdim_f32_4_input {
- float4 x;
- float4 y;
-};
-
-void fdim_f32_4(const struct fdim_f32_4_input *in, float4 *out) {
- *out = fdim(in->x, in->y);
-}
diff --git a/tests/src/android/renderscript/cts/fdim_f32_relaxed.rs b/tests/src/android/renderscript/cts/fdim_f32_relaxed.rs
deleted file mode 100644
index 18c8cf0..0000000
--- a/tests/src/android/renderscript/cts/fdim_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "fdim_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/floor_f32.rs b/tests/src/android/renderscript/cts/floor_f32.rs
deleted file mode 100644
index 2300dab..0000000
--- a/tests/src/android/renderscript/cts/floor_f32.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-void floor_f32_1(const float *in, float *out) {
- *out = floor(*in);
-}
-
-void floor_f32_2(const float2 *in, float2 *out) {
- *out = floor(*in);
-}
-
-void floor_f32_3(const float3 *in, float3 *out) {
- *out = floor(*in);
-}
-
-void floor_f32_4(const float4 *in, float4 *out) {
- *out = floor(*in);
-}
diff --git a/tests/src/android/renderscript/cts/floor_f32_relaxed.rs b/tests/src/android/renderscript/cts/floor_f32_relaxed.rs
deleted file mode 100644
index d6bef83..0000000
--- a/tests/src/android/renderscript/cts/floor_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "floor_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/fma_f32.rs b/tests/src/android/renderscript/cts/fma_f32.rs
deleted file mode 100644
index 36257a5..0000000
--- a/tests/src/android/renderscript/cts/fma_f32.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct Floats {
- float fa;
- float fb;
- float fc;
-} Floats;
-
-void fma_f32_1(const Floats *in, float *out) {
- *out = fma(in->fa, in->fb, in->fc);
-}
-
-typedef struct Floats2 {
- float2 fa;
- float2 fb;
- float2 fc;
-} Floats2;
-
-void fma_f32_2(const Floats2 *in, float2 *out) {
- *out = fma(in->fa, in->fb, in->fc);
-}
-
-typedef struct Floats3 {
- float3 fa;
- float3 fb;
- float3 fc;
-} Floats3;
-
-void fma_f32_3(const Floats3 *in, float3 *out) {
- *out = fma(in->fa, in->fb, in->fc);
-}
-
-typedef struct Floats4 {
- float4 fa;
- float4 fb;
- float4 fc;
-} Floats4;
-
-void fma_f32_4(const Floats4 *in, float4 *out) {
- *out = fma(in->fa, in->fb, in->fc);
-}
diff --git a/tests/src/android/renderscript/cts/fma_f32_relaxed.rs b/tests/src/android/renderscript/cts/fma_f32_relaxed.rs
deleted file mode 100644
index 77f92df..0000000
--- a/tests/src/android/renderscript/cts/fma_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "fma_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/fmax_f32.rs b/tests/src/android/renderscript/cts/fmax_f32.rs
deleted file mode 100644
index e03f258..0000000
--- a/tests/src/android/renderscript/cts/fmax_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct fmax_f32_in {
- float first;
- float second;
-} input1;
-
-void fmax_f32_1(const input1* in, float* out){
- *out = fmax(in->first, in->second);
-}
-
-typedef struct fmax_f32_2_in {
- float2 first;
- float2 second;
-} input2;
-
-void fmax_f32_2(const input2* in, float2* out){
- *out = fmax(in->first, in->second);
-}
-
-typedef struct fmax_f32_3_in {
- float3 first;
- float3 second;
-} input3;
-
-void fmax_f32_3(const input3* in, float3* out){
- *out = fmax(in->first, in->second);
-}
-
-typedef struct fmax_f32_4_in {
- float4 first;
- float4 second;
-} input4;
-
-void fmax_f32_4(const input4* in, float4* out){
- *out = fmax(in->first, in->second);
-}
diff --git a/tests/src/android/renderscript/cts/fmax_f32_relaxed.rs b/tests/src/android/renderscript/cts/fmax_f32_relaxed.rs
deleted file mode 100644
index 23beccf..0000000
--- a/tests/src/android/renderscript/cts/fmax_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "fmax_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/fmin_f32.rs b/tests/src/android/renderscript/cts/fmin_f32.rs
deleted file mode 100644
index 49033f0..0000000
--- a/tests/src/android/renderscript/cts/fmin_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct fmin_f32_in {
- float first;
- float second;
-} input1;
-
-void fmin_f32_1(const input1* in, float* out){
- *out = fmin(in->first, in->second);
-}
-
-typedef struct fmin_f32_2_in {
- float2 first;
- float2 second;
-} input2;
-
-void fmin_f32_2(const input2* in, float2* out){
- *out = fmin(in->first, in->second);
-}
-
-typedef struct fmin_f32_3_in {
- float3 first;
- float3 second;
-} input3;
-
-void fmin_f32_3(const input3* in, float3* out){
- *out = fmin(in->first, in->second);
-}
-
-typedef struct fmin_f32_4_in {
- float4 first;
- float4 second;
-} input4;
-
-void fmin_f32_4(const input4* in, float4* out){
- *out = fmin(in->first, in->second);
-}
diff --git a/tests/src/android/renderscript/cts/fmin_f32_relaxed.rs b/tests/src/android/renderscript/cts/fmin_f32_relaxed.rs
deleted file mode 100644
index 8be4f13..0000000
--- a/tests/src/android/renderscript/cts/fmin_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "fmin_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/fmod_f32.rs b/tests/src/android/renderscript/cts/fmod_f32.rs
deleted file mode 100644
index ca8b282..0000000
--- a/tests/src/android/renderscript/cts/fmod_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-struct fmod_input_f32 {
- float param1;
- float param2;
-};
-
-void fmod_f32_1(const struct fmod_input_f32 *in, float *out) {
- *out = fmod(in->param1, in->param2);
-}
-
-struct fmod_input_f32_2 {
- float2 param1;
- float2 param2;
-};
-
-void fmod_f32_2(const struct fmod_input_f32_2 *in, float2 *out) {
- *out = fmod(in->param1, in->param2);
-}
-
-struct fmod_input_f32_3 {
- float3 param1;
- float3 param2;
-};
-
-void fmod_f32_3(const struct fmod_input_f32_3 *in, float3 *out) {
- *out = fmod(in->param1, in->param2);
-}
-
-struct fmod_input_f32_4 {
- float4 param1;
- float4 param2;
-};
-
-void fmod_f32_4(const struct fmod_input_f32_4 *in, float4 *out) {
- *out = fmod(in->param1, in->param2);
-}
diff --git a/tests/src/android/renderscript/cts/fmod_f32_relaxed.rs b/tests/src/android/renderscript/cts/fmod_f32_relaxed.rs
deleted file mode 100644
index 7a02136..0000000
--- a/tests/src/android/renderscript/cts/fmod_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "fmod_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/hypot_f32.rs b/tests/src/android/renderscript/cts/hypot_f32.rs
deleted file mode 100644
index 4f9159c..0000000
--- a/tests/src/android/renderscript/cts/hypot_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct hypot_f32_in {
- float x;
- float y;
-} hypot_input_f32;
-
-void hypot_f32_1(const hypot_input_f32 *in, float *out) {
- *out = hypot(in->x, in->y);
-}
-
-typedef struct hypot_f32_2_in {
- float2 x;
- float2 y;
-} hypot_input_f32_2;
-
-void hypot_f32_2(const hypot_input_f32_2 *in, float2 *out) {
- *out = hypot(in->x, in->y);
-}
-
-typedef struct hypot_f32_3_in {
- float3 x;
- float3 y;
-} hypot_input_f32_3;
-
-void hypot_f32_3(const hypot_input_f32_3 *in, float3 *out) {
- *out = hypot(in->x, in->y);
-}
-
-typedef struct hypot_f32_4_in {
- float4 x;
- float4 y;
-} hypot_input_f32_4;
-
-void hypot_f32_4(const hypot_input_f32_4 *in, float4 *out) {
- *out = hypot(in->x, in->y);
-}
diff --git a/tests/src/android/renderscript/cts/hypot_f32_relaxed.rs b/tests/src/android/renderscript/cts/hypot_f32_relaxed.rs
deleted file mode 100644
index 7414788..0000000
--- a/tests/src/android/renderscript/cts/hypot_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "hypot_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/log10_f32.rs b/tests/src/android/renderscript/cts/log10_f32.rs
deleted file mode 100644
index dbb5150..0000000
--- a/tests/src/android/renderscript/cts/log10_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void log10_f32_1 (const float* in, float* out) {
- *out = log10(*in);
-}
-
-void log10_f32_2 (const float2* in, float2* out) {
- *out = log10(*in);
-}
-
-void log10_f32_3 (const float3* in, float3* out) {
- *out = log10(*in);
-}
-
-void log10_f32_4 (const float4* in, float4* out) {
- *out = log10(*in);
-}
diff --git a/tests/src/android/renderscript/cts/log10_f32_relaxed.rs b/tests/src/android/renderscript/cts/log10_f32_relaxed.rs
deleted file mode 100644
index bedfa6d..0000000
--- a/tests/src/android/renderscript/cts/log10_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "log10_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/log1p_f32.rs b/tests/src/android/renderscript/cts/log1p_f32.rs
deleted file mode 100644
index 3c725fe..0000000
--- a/tests/src/android/renderscript/cts/log1p_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void log1p_f32_1 (const float* in, float* out) {
- *out = log1p(*in);
-}
-
-void log1p_f32_2 (const float2* in, float2* out) {
- *out = log1p(*in);
-}
-
-void log1p_f32_3 (const float3* in, float3* out) {
- *out = log1p(*in);
-}
-
-void log1p_f32_4 (const float4* in, float4* out) {
- *out = log1p(*in);
-}
diff --git a/tests/src/android/renderscript/cts/log1p_f32_relaxed.rs b/tests/src/android/renderscript/cts/log1p_f32_relaxed.rs
deleted file mode 100644
index c3aed11..0000000
--- a/tests/src/android/renderscript/cts/log1p_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "log1p_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/log2_f32.rs b/tests/src/android/renderscript/cts/log2_f32.rs
deleted file mode 100644
index 2ed2b98..0000000
--- a/tests/src/android/renderscript/cts/log2_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void log2_f32_1 (const float* in, float* out) {
- *out = log2(*in);
-}
-
-void log2_f32_2 (const float2* in, float2* out) {
- *out = log2(*in);
-}
-
-void log2_f32_3 (const float3* in, float3* out) {
- *out = log2(*in);
-}
-
-void log2_f32_4 (const float4* in, float4* out) {
- *out = log2(*in);
-}
diff --git a/tests/src/android/renderscript/cts/log2_f32_relaxed.rs b/tests/src/android/renderscript/cts/log2_f32_relaxed.rs
deleted file mode 100644
index 7e0883a..0000000
--- a/tests/src/android/renderscript/cts/log2_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "log2_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/log_f32.rs b/tests/src/android/renderscript/cts/log_f32.rs
deleted file mode 100644
index 14052a2..0000000
--- a/tests/src/android/renderscript/cts/log_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void log_f32_1 (const float* in, float* out) {
- *out = log(*in);
-}
-
-void log_f32_2 (const float2* in, float2* out) {
- *out = log(*in);
-}
-
-void log_f32_3 (const float3* in, float3* out) {
- *out = log(*in);
-}
-
-void log_f32_4 (const float4* in, float4* out) {
- *out = log(*in);
-}
diff --git a/tests/src/android/renderscript/cts/log_f32_relaxed.rs b/tests/src/android/renderscript/cts/log_f32_relaxed.rs
deleted file mode 100644
index d66d3c9..0000000
--- a/tests/src/android/renderscript/cts/log_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "log_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/logb_f32.rs b/tests/src/android/renderscript/cts/logb_f32.rs
deleted file mode 100644
index 1b3acfa..0000000
--- a/tests/src/android/renderscript/cts/logb_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void logb_f32_1 (const float* in, float* out) {
- *out = logb(*in);
-}
-
-void logb_f32_2 (const float2* in, float2* out) {
- *out = logb(*in);
-}
-
-void logb_f32_3 (const float3* in, float3* out) {
- *out = logb(*in);
-}
-
-void logb_f32_4 (const float4* in, float4* out) {
- *out = logb(*in);
-}
diff --git a/tests/src/android/renderscript/cts/logb_f32_relaxed.rs b/tests/src/android/renderscript/cts/logb_f32_relaxed.rs
deleted file mode 100644
index 9b906dc..0000000
--- a/tests/src/android/renderscript/cts/logb_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "logb_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/mad_f32.rs b/tests/src/android/renderscript/cts/mad_f32.rs
deleted file mode 100644
index fc5081b..0000000
--- a/tests/src/android/renderscript/cts/mad_f32.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-struct mad_input_f32 {
- float x;
- float y;
- float z;
-};
-
-void mad_f32_1(const struct mad_input_f32 *param, float *out) {
- *out = mad(param->x, param->y, param->z);
-}
-
-struct mad_input_f32_2 {
- float2 x;
- float2 y;
- float2 z;
-};
-
-void mad_f32_2(const struct mad_input_f32_2 *param, float2 *out) {
- *out = mad(param->x, param->y, param->z);
-}
-
-struct mad_input_f32_3 {
- float3 x;
- float3 y;
- float3 z;
-};
-
-void mad_f32_3(const struct mad_input_f32_3 *param, float3 *out) {
- *out = mad(param->x, param->y, param->z);
-}
-
-struct mad_input_f32_4 {
- float4 x;
- float4 y;
- float4 z;
-};
-
-void mad_f32_4(const struct mad_input_f32_4 *param, float4 *out) {
- *out = mad(param->x, param->y, param->z);
-}
diff --git a/tests/src/android/renderscript/cts/mad_f32_relaxed.rs b/tests/src/android/renderscript/cts/mad_f32_relaxed.rs
deleted file mode 100644
index 36d8306..0000000
--- a/tests/src/android/renderscript/cts/mad_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "mad_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/nextafter_f32.rs b/tests/src/android/renderscript/cts/nextafter_f32.rs
deleted file mode 100644
index 04ce73a4..0000000
--- a/tests/src/android/renderscript/cts/nextafter_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct InputData {
- float a;
- float b;
-} InputData;
-
-void nextafter_f32_1(const InputData *in, float *out) {
- *out = nextafter (in->a, in->b);
-}
-
-typedef struct InputData_2 {
- float2 a;
- float2 b;
-} InputData_2;
-
-void nextafter_f32_2(const InputData_2 *in, float2 *out) {
- *out = nextafter (in->a, in->b);
-}
-
-typedef struct InputData_3 {
- float3 a;
- float3 b;
-} InputData_3;
-
-void nextafter_f32_3(const InputData_3 *in, float3 *out) {
- *out = nextafter (in->a, in->b);
-}
-
-typedef struct InputData_4 {
- float4 a;
- float4 b;
-} InputData_4;
-
-void nextafter_f32_4(const InputData_4 *in, float4 *out) {
- *out = nextafter (in->a, in->b);
-}
diff --git a/tests/src/android/renderscript/cts/nextafter_f32_relaxed.rs b/tests/src/android/renderscript/cts/nextafter_f32_relaxed.rs
deleted file mode 100644
index 5c6edd5..0000000
--- a/tests/src/android/renderscript/cts/nextafter_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "nextafter_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/pow_f32.rs b/tests/src/android/renderscript/cts/pow_f32.rs
deleted file mode 100644
index 426d4b1..0000000
--- a/tests/src/android/renderscript/cts/pow_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct PowInputData {
- float base;
- float expo;
-} PowInputData;
-
-void pow_f32_1(const PowInputData *in, float *out) {
- *out = pow(in->base, in->expo);
-}
-
-typedef struct PowInputData_2 {
- float2 base;
- float2 expo;
-} PowInputData_2;
-
-void pow_f32_2(const PowInputData_2 *in, float2 *out) {
- *out = pow(in->base, in->expo);
-}
-
-typedef struct PowInputData_3 {
- float3 base;
- float3 expo;
-} PowInputData_3;
-
-void pow_f32_3(const PowInputData_3 *in, float3 *out) {
- *out = pow(in->base, in->expo);
-}
-
-typedef struct PowInputData_4 {
- float4 base;
- float4 expo;
-} PowInputData_4;
-
-void pow_f32_4(const PowInputData_4 *in, float4 *out) {
- *out = pow(in->base, in->expo);
-}
diff --git a/tests/src/android/renderscript/cts/pow_f32_relaxed.rs b/tests/src/android/renderscript/cts/pow_f32_relaxed.rs
deleted file mode 100644
index 5da7048..0000000
--- a/tests/src/android/renderscript/cts/pow_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "pow_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/pown_f32.rs b/tests/src/android/renderscript/cts/pown_f32.rs
deleted file mode 100644
index fa066d0..0000000
--- a/tests/src/android/renderscript/cts/pown_f32.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-rs_allocation n1;
-
-void pown_f32_1(const float *in, float *out, uint32_t x) {
- *out = pown(*in, *(int *)rsGetElementAt(n1,x));
-}
-
-rs_allocation n2;
-
-void pown_f32_2(const float2 *in, float2 *out, uint32_t x) {
- *out = pown(*in, *(int2 *)rsGetElementAt(n2,x));
-}
-
-rs_allocation n3;
-
-void pown_f32_3(const float3 *in, float3 *out, uint32_t x) {
- *out = pown(*in, *(int3 *)rsGetElementAt(n3,x));
-}
-
-rs_allocation n4;
-
-void pown_f32_4(const float4 *in, float4 *out, uint32_t x) {
- *out = pown(*in, *(int4 *)rsGetElementAt(n4,x));
-}
diff --git a/tests/src/android/renderscript/cts/pown_f32_relaxed.rs b/tests/src/android/renderscript/cts/pown_f32_relaxed.rs
deleted file mode 100644
index bdc4b47..0000000
--- a/tests/src/android/renderscript/cts/pown_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "pown_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/powr_f32.rs b/tests/src/android/renderscript/cts/powr_f32.rs
deleted file mode 100644
index 6eb36b0..0000000
--- a/tests/src/android/renderscript/cts/powr_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-typedef struct PowInputData {
- float base;
- float expo;
-} PowInputData;
-
-void powr_f32_1(const PowInputData *in, float *out) {
- *out = powr(in->base, in->expo);
-}
-
-typedef struct PowInputData_2 {
- float2 base;
- float2 expo;
-} PowInputData_2;
-
-void powr_f32_2(const PowInputData_2 *in, float2 *out) {
- *out = powr(in->base, in->expo);
-}
-
-typedef struct PowInputData_3 {
- float3 base;
- float3 expo;
-} PowInputData_3;
-
-void powr_f32_3(const PowInputData_3 *in, float3 *out) {
- *out = powr(in->base, in->expo);
-}
-
-typedef struct PowInputData_4 {
- float4 base;
- float4 expo;
-} PowInputData_4;
-
-void powr_f32_4(const PowInputData_4 *in, float4 *out) {
- *out = powr(in->base, in->expo);
-}
diff --git a/tests/src/android/renderscript/cts/powr_f32_relaxed.rs b/tests/src/android/renderscript/cts/powr_f32_relaxed.rs
deleted file mode 100644
index b8690af..0000000
--- a/tests/src/android/renderscript/cts/powr_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "powr_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/radians_f32.rs b/tests/src/android/renderscript/cts/radians_f32.rs
deleted file mode 100644
index 1aa743e..0000000
--- a/tests/src/android/renderscript/cts/radians_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void radians_f32_1(const float* in, float* out) {
- *out = radians (*in);
-}
-
-void radians_f32_2(const float2* in, float2* out) {
- *out = radians(*in);
-}
-
-void radians_f32_3(const float3* in, float3* out) {
- *out = radians(*in);
-}
-
-void radians_f32_4(const float4* in, float4* out) {
- *out = radians(*in);
-}
diff --git a/tests/src/android/renderscript/cts/radians_f32_relaxed.rs b/tests/src/android/renderscript/cts/radians_f32_relaxed.rs
deleted file mode 100644
index 4ab3070..0000000
--- a/tests/src/android/renderscript/cts/radians_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "radians_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/remainder_f32.rs b/tests/src/android/renderscript/cts/remainder_f32.rs
deleted file mode 100644
index d08a034..0000000
--- a/tests/src/android/renderscript/cts/remainder_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-struct remainder_f32 {
- float num;
- float den;
-};
-
-void remainder_f32_1 (const struct remainder_f32* in, float* out) {
- *out = remainder(in->num, in->den);
-}
-
-struct remainder_f32_2 {
- float2 num;
- float2 den;
-};
-
-void remainder_f32_2 (const struct remainder_f32_2* in, float2* out) {
- *out = remainder(in->num, in->den);
-}
-
-struct remainder_f32_3 {
- float3 num;
- float3 den;
-};
-
-void remainder_f32_3 (const struct remainder_f32_3* in, float3* out) {
- *out = remainder(in->num, in->den);
-}
-
-struct remainder_f32_4 {
- float4 num;
- float4 den;
-};
-
-void remainder_f32_4 (const struct remainder_f32_4* in, float4* out) {
- *out = remainder(in->num, in->den);
-}
diff --git a/tests/src/android/renderscript/cts/remainder_f32_relaxed.rs b/tests/src/android/renderscript/cts/remainder_f32_relaxed.rs
deleted file mode 100644
index d546e50..0000000
--- a/tests/src/android/renderscript/cts/remainder_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "remainder_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/rint_f32.rs b/tests/src/android/renderscript/cts/rint_f32.rs
deleted file mode 100644
index 46ef8b1..0000000
--- a/tests/src/android/renderscript/cts/rint_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void rint_f32_1 (const float* in, float* out) {
- *out = rint(*in);
-}
-
-void rint_f32_2 (const float2* in, float2* out) {
- *out = rint(*in);
-}
-
-void rint_f32_3 (const float3* in, float3* out) {
- *out = rint(*in);
-}
-
-void rint_f32_4 (const float4* in, float4* out) {
- *out = rint(*in);
-}
diff --git a/tests/src/android/renderscript/cts/rint_f32_relaxed.rs b/tests/src/android/renderscript/cts/rint_f32_relaxed.rs
deleted file mode 100644
index e9b4950..0000000
--- a/tests/src/android/renderscript/cts/rint_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "rint_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/rootn_f32.rs b/tests/src/android/renderscript/cts/rootn_f32.rs
deleted file mode 100644
index 1c60ea9..0000000
--- a/tests/src/android/renderscript/cts/rootn_f32.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-rs_allocation n1;
-
-void rootn_f32_1(const float *in, float *out, uint32_t x) {
- *out = rootn(*in, *(int *)rsGetElementAt(n1,x));
-}
-
-rs_allocation n2;
-
-void rootn_f32_2(const float2 *in, float2 *out, uint32_t x) {
- *out = rootn(*in, *(int2 *)rsGetElementAt(n2,x));
-}
-
-rs_allocation n3;
-
-void rootn_f32_3(const float3 *in, float3 *out, uint32_t x) {
- *out = rootn(*in, *(int3 *)rsGetElementAt(n3,x));
-}
-
-rs_allocation n4;
-
-void rootn_f32_4(const float4 *in, float4 *out, uint32_t x) {
- *out = rootn(*in, *(int4 *)rsGetElementAt(n4,x));
-}
diff --git a/tests/src/android/renderscript/cts/rootn_f32_relaxed.rs b/tests/src/android/renderscript/cts/rootn_f32_relaxed.rs
deleted file mode 100644
index f6509ae..0000000
--- a/tests/src/android/renderscript/cts/rootn_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "rootn_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/round_f32.rs b/tests/src/android/renderscript/cts/round_f32.rs
deleted file mode 100644
index 60b5e8d..0000000
--- a/tests/src/android/renderscript/cts/round_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void round_f32_1 (const float* in, float* out) {
- *out = round(*in);
-}
-
-void round_f32_2 (const float2* in , float2* out) {
- *out = round(*in);
-}
-
-void round_f32_3 (const float3* in, float3* out) {
- *out = round(*in);
-}
-
-void round_f32_4 (const float4* in , float4* out) {
- *out = round(*in);
-}
diff --git a/tests/src/android/renderscript/cts/round_f32_relaxed.rs b/tests/src/android/renderscript/cts/round_f32_relaxed.rs
deleted file mode 100644
index 026515e..0000000
--- a/tests/src/android/renderscript/cts/round_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "round_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/rsqrt_f32.rs b/tests/src/android/renderscript/cts/rsqrt_f32.rs
deleted file mode 100644
index 1e8f5a2..0000000
--- a/tests/src/android/renderscript/cts/rsqrt_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void Rsqrt_f32_1 (const float* in, float* out) {
- *out = rsqrt(*in);
-}
-
-void Rsqrt_f32_2 (const float2* in, float2* out) {
- *out = rsqrt(*in);
-}
-
-void Rsqrt_f32_3 (const float3* in, float3* out) {
- *out = rsqrt(*in);
-}
-
-void Rsqrt_f32_4 (const float4* in, float4* out) {
- *out = rsqrt(*in);
-}
diff --git a/tests/src/android/renderscript/cts/rsqrt_f32_relaxed.rs b/tests/src/android/renderscript/cts/rsqrt_f32_relaxed.rs
deleted file mode 100644
index 1d7c08b..0000000
--- a/tests/src/android/renderscript/cts/rsqrt_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "rsqrt_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/sign_f32.rs b/tests/src/android/renderscript/cts/sign_f32.rs
deleted file mode 100644
index f9edb90..0000000
--- a/tests/src/android/renderscript/cts/sign_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void sign_f32_1(const float *in, float *out) {
- *out = sign (*in);
-}
-
-void sign_f32_2(const float2 *in, float2 *out) {
- *out = sign (*in);
-}
-
-void sign_f32_3(const float3 *in, float3 *out) {
- *out = sign (*in);
-}
-
-void sign_f32_4(const float4 *in, float4 *out) {
- *out = sign (*in);
-}
diff --git a/tests/src/android/renderscript/cts/sign_f32_relaxed.rs b/tests/src/android/renderscript/cts/sign_f32_relaxed.rs
deleted file mode 100644
index 2ea41e2..0000000
--- a/tests/src/android/renderscript/cts/sign_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "sign_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/sin_f32.rs b/tests/src/android/renderscript/cts/sin_f32.rs
deleted file mode 100644
index 91652bb..0000000
--- a/tests/src/android/renderscript/cts/sin_f32.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-void sin_f32_1(const float *in, float *out) {
- *out = sin(*in);
-}
-
-void sin_f32_2(const float2 *in, float2 *out) {
- *out = sin(*in);
-}
-
-void sin_f32_3(const float3 *in, float3 *out) {
- *out = sin(*in);
-}
-
-void sin_f32_4(const float4 *in, float4 *out) {
- *out = sin(*in);
-}
diff --git a/tests/src/android/renderscript/cts/sin_f32_relaxed.rs b/tests/src/android/renderscript/cts/sin_f32_relaxed.rs
deleted file mode 100644
index 1ebf69e..0000000
--- a/tests/src/android/renderscript/cts/sin_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "sin_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/sinh_f32.rs b/tests/src/android/renderscript/cts/sinh_f32.rs
deleted file mode 100644
index b785399..0000000
--- a/tests/src/android/renderscript/cts/sinh_f32.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-void sinh_f32_1(const float *in, float *out) {
- *out = sinh(*in);
-}
-
-void sinh_f32_2(const float2 *in, float2 *out) {
- *out = sinh(*in);
-}
-
-void sinh_f32_3(const float3 *in, float3 *out) {
- *out = sinh(*in);
-}
-
-void sinh_f32_4(const float4 *in, float4 *out) {
- *out = sinh(*in);
-}
diff --git a/tests/src/android/renderscript/cts/sinh_f32_relaxed.rs b/tests/src/android/renderscript/cts/sinh_f32_relaxed.rs
deleted file mode 100644
index ba1d5c7..0000000
--- a/tests/src/android/renderscript/cts/sinh_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "sinh_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/sqrt_f32.rs b/tests/src/android/renderscript/cts/sqrt_f32.rs
deleted file mode 100644
index 253f1c0..0000000
--- a/tests/src/android/renderscript/cts/sqrt_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void sqrt_f32_1 (const float* in, float* out) {
- *out = sqrt(*in);
-}
-
-void sqrt_f32_2 (const float2* in, float2* out) {
- *out = sqrt(*in);
-}
-
-void sqrt_f32_3 (const float3* in, float3* out) {
- *out = sqrt(*in);
-}
-
-void sqrt_f32_4 (const float4* in, float4* out) {
- *out = sqrt(*in);
-}
diff --git a/tests/src/android/renderscript/cts/sqrt_f32_relaxed.rs b/tests/src/android/renderscript/cts/sqrt_f32_relaxed.rs
deleted file mode 100644
index 460ea63..0000000
--- a/tests/src/android/renderscript/cts/sqrt_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "sqrt_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/step_f32.rs b/tests/src/android/renderscript/cts/step_f32.rs
deleted file mode 100644
index d2261b3..0000000
--- a/tests/src/android/renderscript/cts/step_f32.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-struct step_input {
- float x;
- float y;
-};
-
-void step_f32_1(const struct step_input *in, float *out) {
- *out = step(in->x, in->y);
-}
-
-struct step_2_input {
- float2 x;
- float2 y;
-};
-
-void step_f32_2(const struct step_2_input *in, float2 *out) {
- *out = step(in->x, in->y);
-}
-
-struct step_3_input {
- float3 x;
- float3 y;
-};
-
-void step_f32_3(const struct step_3_input *in, float3 *out) {
- *out = step(in->x, in->y);
-}
-
-struct step_4_input {
- float4 x;
- float4 y;
-};
-
-void step_f32_4(const struct step_4_input *in, float4 *out) {
- *out = step(in->x, in->y);
-}
diff --git a/tests/src/android/renderscript/cts/step_f32_relaxed.rs b/tests/src/android/renderscript/cts/step_f32_relaxed.rs
deleted file mode 100644
index c59b548..0000000
--- a/tests/src/android/renderscript/cts/step_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "step_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/tan_f32.rs b/tests/src/android/renderscript/cts/tan_f32.rs
deleted file mode 100644
index 35ee971..0000000
--- a/tests/src/android/renderscript/cts/tan_f32.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-void tan_f32_1(const float *in, float *out) {
- *out = tan(*in);
-}
-
-void tan_f32_2(const float2 *in, float2 *out) {
- *out = tan(*in);
-}
-
-void tan_f32_3(const float3 *in, float3 *out) {
- *out = tan(*in);
-}
-
-void tan_f32_4(const float4 *in, float4 *out) {
- *out = tan(*in);
-}
diff --git a/tests/src/android/renderscript/cts/tan_f32_relaxed.rs b/tests/src/android/renderscript/cts/tan_f32_relaxed.rs
deleted file mode 100644
index adf98f0..0000000
--- a/tests/src/android/renderscript/cts/tan_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "tan_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/tanh_f32.rs b/tests/src/android/renderscript/cts/tanh_f32.rs
deleted file mode 100644
index 2b0782e..0000000
--- a/tests/src/android/renderscript/cts/tanh_f32.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-void tanh_f32_1(const float *in, float *out) {
- *out = tanh(*in);
-}
-
-void tanh_f32_2(const float2 *in, float2 *out) {
- *out = tanh(*in);
-}
-
-void tanh_f32_3(const float3 *in, float3 *out) {
- *out = tanh(*in);
-}
-
-void tanh_f32_4(const float4 *in, float4 *out) {
- *out = tanh(*in);
-}
diff --git a/tests/src/android/renderscript/cts/tanh_f32_relaxed.rs b/tests/src/android/renderscript/cts/tanh_f32_relaxed.rs
deleted file mode 100644
index 2d7463b..0000000
--- a/tests/src/android/renderscript/cts/tanh_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "tanh_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/src/android/renderscript/cts/trunc_f32.rs b/tests/src/android/renderscript/cts/trunc_f32.rs
deleted file mode 100644
index a464086..0000000
--- a/tests/src/android/renderscript/cts/trunc_f32.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#pragma version(1)
-#pragma rs java_package_name(android.renderscript.cts)
-
-void trunc_f32_1 (const float* in, float* out) {
- *out = trunc(*in);
-}
-
-void trunc_f32_2 (const float2* in, float2* out) {
- *out = trunc(*in);
-}
-
-void trunc_f32_3 (const float3* in, float3* out) {
- *out = trunc(*in);
-}
-
-void trunc_f32_4 (const float4* in, float4* out) {
- *out = trunc(*in);
-}
diff --git a/tests/src/android/renderscript/cts/trunc_f32_relaxed.rs b/tests/src/android/renderscript/cts/trunc_f32_relaxed.rs
deleted file mode 100644
index f55c8b3..0000000
--- a/tests/src/android/renderscript/cts/trunc_f32_relaxed.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "trunc_f32.rs"
-#pragma rs_fp_relaxed
diff --git a/tests/tests/bionic/Android.mk b/tests/tests/bionic/Android.mk
index 06b64ea..1a048c6 100644
--- a/tests/tests/bionic/Android.mk
+++ b/tests/tests/bionic/Android.mk
@@ -1,26 +1,49 @@
LOCAL_PATH := $(call my-dir)
+test_executable := bionic-unit-tests-cts
+list_executable := $(test_executable)_list
+
include $(CLEAR_VARS)
-cts_src_test_path := bionic/tests
+LOCAL_MODULE := $(test_executable)
LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE := bionic-unit-tests-cts
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_ADDITION_DEPENDENCIES := \
- $(LOCAL_PATH)/Android.mk \
+ $(LOCAL_PATH)/Android.mk \
LOCAL_SHARED_LIBRARIES += \
- libstlport \
- libdl \
+ libstlport \
+ libdl \
LOCAL_WHOLE_STATIC_LIBRARIES += \
- libBionicTests \
+ libBionicTests \
LOCAL_STATIC_LIBRARIES += \
- libgtest \
- libgtest_main \
+ libgtest \
+ libgtest_main \
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
LOCAL_CTS_TEST_PACKAGE := android.bionic
-
include $(BUILD_CTS_EXECUTABLE)
+
+ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := $(list_executable)
+
+LOCAL_ADDITION_DEPENDENCIES := \
+ $(LOCAL_PATH)/Android.mk \
+
+# A main without the extra output from the gtest main.
+LOCAL_SRC_FILES := \
+ main.cpp \
+
+LOCAL_LDLIBS += \
+ -lrt \
+
+LOCAL_WHOLE_STATIC_LIBRARIES += \
+ libBionicTests \
+
+include $(BUILD_HOST_NATIVE_TEST)
+endif # ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
diff --git a/tests/tests/bionic/main.cpp b/tests/tests/bionic/main.cpp
new file mode 100644
index 0000000..b661af4
--- /dev/null
+++ b/tests/tests/bionic/main.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+int main(int argc, char **argv) {
+ // Do not use gtest_main to avoid the Running main() ... output.
+ testing::InitGoogleTest(&argc, argv);
+
+ return RUN_ALL_TESTS();
+}
diff --git a/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java b/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
index 0100a7a..32c1a3a 100644
--- a/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
+++ b/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
@@ -42,8 +42,12 @@
}
public void testGetAssetInt() {
- // the return value of getAssetInt is a random number
- mAssetInputStream.getAssetInt();
+ try {
+ // getAssetInt is no longer supported.
+ mAssetInputStream.getAssetInt();
+ fail();
+ } catch (UnsupportedOperationException expected) {
+ }
}
public void testMarkReset() throws IOException {
diff --git a/tests/tests/media/assets/hls.m3u8 b/tests/tests/media/assets/hls.m3u8
new file mode 100644
index 0000000..127574a
--- /dev/null
+++ b/tests/tests/media/assets/hls.m3u8
@@ -0,0 +1,8 @@
+#EXTM3U
+#EXT-X-TARGETDURATION:10
+#EXT-X-MEDIA-SEQUENCE:0
+#EXTINF:10, no desc
+segment000000.ts
+#EXTINF:10, no desc
+segment000001.ts
+#EXT-X-ENDLIST
diff --git a/tests/tests/media/assets/segment000000.ts b/tests/tests/media/assets/segment000000.ts
new file mode 100644
index 0000000..8992c7b
--- /dev/null
+++ b/tests/tests/media/assets/segment000000.ts
Binary files differ
diff --git a/tests/tests/media/assets/segment000001.ts b/tests/tests/media/assets/segment000001.ts
new file mode 100644
index 0000000..fb112ec
--- /dev/null
+++ b/tests/tests/media/assets/segment000001.ts
Binary files differ
diff --git a/tests/tests/media/src/android/media/cts/AudioManagerTest.java b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
index 4a74b47..13e5fd9 100644
--- a/tests/tests/media/src/android/media/cts/AudioManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
@@ -40,6 +40,7 @@
import android.content.Context;
+import android.content.res.Resources;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Vibrator;
@@ -63,7 +64,7 @@
Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
mHasVibrator = (vibrator != null) && vibrator.hasVibrator();
mUseFixedVolume = mContext.getResources().getBoolean(
- com.android.internal.R.bool.config_useFixedVolume);
+ Resources.getSystem().getIdentifier("config_useFixedVolume", "bool", "android"));
}
public void testMicrophoneMute() throws Exception {
diff --git a/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
index 1d78967..37259f1 100644
--- a/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
@@ -193,4 +193,36 @@
mServer.shutdown();
}
}
+
+ public void testPlayHlsStream() throws Throwable {
+ localHlsTest("hls.m3u8", false, false);
+ }
+
+ public void testPlayHlsStreamWithQueryString() throws Throwable {
+ localHlsTest("hls.m3u8", true, false);
+ }
+
+ public void testPlayHlsStreamWithRedirect() throws Throwable {
+ localHlsTest("hls.m3u8", false, true);
+ }
+
+ private void localHlsTest(final String name, boolean appendQueryString, boolean redirect)
+ throws Throwable {
+ mServer = new CtsTestServer(mContext);
+ try {
+ String stream_url = null;
+ if (redirect) {
+ stream_url = mServer.getQueryRedirectingAssetUrl(name);
+ } else {
+ stream_url = mServer.getAssetUrl(name);
+ }
+ if (appendQueryString) {
+ stream_url += "?foo=bar/baz";
+ }
+
+ playLiveVideoTest(stream_url, 10);
+ } finally {
+ mServer.shutdown();
+ }
+ }
}
diff --git a/tests/tests/nativemedia/sl/Android.mk b/tests/tests/nativemedia/sl/Android.mk
index 90d8863..5b34b3d 100644
--- a/tests/tests/nativemedia/sl/Android.mk
+++ b/tests/tests/nativemedia/sl/Android.mk
@@ -1,13 +1,17 @@
# Build the unit tests.
LOCAL_PATH:= $(call my-dir)
+
+test_executable := NativeMediaTest_SL
+list_executable := $(test_executable)_list
+
include $(CLEAR_VARS)
-cts_src_test_path := $(LOCAL_PATH)
-
+LOCAL_MODULE := $(test_executable)
LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
-LOCAL_C_INCLUDES:= \
+LOCAL_C_INCLUDES := \
bionic \
bionic/libstdc++/include \
external/gtest/include \
@@ -15,22 +19,34 @@
external/stlport/stlport \
$(call include-path-for, wilhelm-ut)
-LOCAL_SRC_FILES:= \
+LOCAL_SRC_FILES := \
src/SLObjectCreationTest.cpp
LOCAL_SHARED_LIBRARIES := \
- libutils \
- liblog \
- libOpenSLES \
- libstlport
+ libutils \
+ liblog \
+ libOpenSLES \
+ libstlport
LOCAL_STATIC_LIBRARIES := \
libOpenSLESUT \
libgtest
-LOCAL_MODULE:= NativeMediaTest_SL
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
-
LOCAL_CTS_TEST_PACKAGE := android.nativemedia.sl
include $(BUILD_CTS_EXECUTABLE)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := $(list_executable)
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+ src/SLObjectCreationTest.cpp
+
+LOCAL_CFLAGS := \
+ -DBUILD_ONLY \
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+
+include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp b/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp
index 804263e..d0b3be0 100644
--- a/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp
+++ b/tests/tests/nativemedia/sl/src/SLObjectCreationTest.cpp
@@ -35,12 +35,16 @@
#define LOG_NDEBUG 0
#define LOG_TAG "SLObjectCreationTest"
+#include <gtest/gtest.h>
#include <utils/Log.h>
+
+#if !defined(BUILD_ONLY)
#include "SLES/OpenSLES.h"
#include "SLES/OpenSLES_Android.h"
#include "OpenSLESUT.h"
-#include <gtest/gtest.h>
+#endif
+#if !defined(BUILD_ONLY)
//-----------------------------------------------------------------
/* Checks for error and displays the error code if any */
bool IsOk(SLresult res) {
@@ -305,6 +309,20 @@
(*audioRecorderObj)->Destroy(audioRecorderObj);
}
};
+#else
+class SLObjectCreationTest : public ::testing::Test {
+protected:
+ void OutputMixCreation() { }
+ void AudioPlayerFromUriCreation() { }
+ void AudioPlayerFromFdCreation() { }
+ void AudioPlayerFromPcmBqCreation() { }
+ void AudioPlayerFromTsAbqCreation() { }
+ void AudioPlayerFromUriToPcmBqCreation() { }
+ void AudioPlayerFromFdToPcmBqCreation() { }
+ void AudioPlayerFromAdtsAbqToPcmBqCreation() { }
+ void AudioRecorderCreation(bool) { }
+};
+#endif
//-------------------------------------------------------------------------------------------------
TEST_F(SLObjectCreationTest, testEngineCreation) {
diff --git a/tests/tests/nativemedia/xa/Android.mk b/tests/tests/nativemedia/xa/Android.mk
index 9ff2110..6995bc0 100644
--- a/tests/tests/nativemedia/xa/Android.mk
+++ b/tests/tests/nativemedia/xa/Android.mk
@@ -1,13 +1,17 @@
# Build the unit tests.
LOCAL_PATH:= $(call my-dir)
+
+test_executable := NativeMediaTest_XA
+list_executable := $(test_executable)_list
+
include $(CLEAR_VARS)
-cts_src_test_path := $(LOCAL_PATH)
-
+LOCAL_MODULE:= $(test_executable)
LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
-LOCAL_C_INCLUDES:= \
+LOCAL_C_INCLUDES := \
bionic \
bionic/libstdc++/include \
external/gtest/include \
@@ -15,7 +19,7 @@
external/stlport/stlport \
$(call include-path-for, wilhelm-ut)
-LOCAL_SRC_FILES:= \
+LOCAL_SRC_FILES := \
src/XAObjectCreationTest.cpp
LOCAL_SHARED_LIBRARIES := \
@@ -27,9 +31,21 @@
LOCAL_STATIC_LIBRARIES := \
libgtest
-LOCAL_MODULE:= NativeMediaTest_XA
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest
-
LOCAL_CTS_TEST_PACKAGE := android.nativemedia.xa
include $(BUILD_CTS_EXECUTABLE)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := $(list_executable)
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := \
+ src/XAObjectCreationTest.cpp
+
+LOCAL_CFLAGS := \
+ -DBUILD_ONLY \
+
+LOCAL_SHARED_LIBRARIES := \
+ liblog \
+
+include $(BUILD_HOST_NATIVE_TEST)
diff --git a/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp b/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp
index 3ff84c2..d905451 100644
--- a/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp
+++ b/tests/tests/nativemedia/xa/src/XAObjectCreationTest.cpp
@@ -24,12 +24,15 @@
#define LOG_NDEBUG 0
#define LOG_TAG "XAObjectCreationTest"
+#include <gtest/gtest.h>
#include <utils/Log.h>
+
+#if !defined(BUILD_ONLY)
#include "OMXAL/OpenMAXAL.h"
#include "OMXAL/OpenMAXAL_Android.h"
-//#include <android/native_window_jni.h>
-#include <gtest/gtest.h>
+#endif
+#if !defined(BUILD_ONLY)
//-----------------------------------------------------------------
/* Checks for error and displays the error code if any */
bool IsOk(XAresult res) {
@@ -115,6 +118,12 @@
}
};
+#else
+class XAObjectCreationTest : public ::testing::Test {
+protected:
+ void OutputMixCreation() { }
+};
+#endif
//-------------------------------------------------------------------------------------------------
TEST_F(XAObjectCreationTest, testEngineCreation) {
diff --git a/tests/tests/os/src/android/os/cts/BundleTest.java b/tests/tests/os/src/android/os/cts/BundleTest.java
index 7674b6b..0db5fd0 100644
--- a/tests/tests/os/src/android/os/cts/BundleTest.java
+++ b/tests/tests/os/src/android/os/cts/BundleTest.java
@@ -31,9 +31,11 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Set;
public class BundleTest extends AndroidTestCase {
+
private static final boolean BOOLEANKEYVALUE = false;
private static final int INTKEYVALUE = 20;
@@ -513,12 +515,37 @@
assertBundleEquals(bundle2, (Bundle) ret.get(1));
}
- public void testGetSerializable() {
+ public void testGetSerializableWithString() {
assertNull(mBundle.getSerializable(KEY));
- mBundle.putSerializable(KEY, "android");
- assertEquals("android", mBundle.getSerializable(KEY));
+ String s = "android";
+ mBundle.putSerializable(KEY, s);
+ assertEquals(s, mBundle.getSerializable(KEY));
roundtrip();
- assertEquals("android", mBundle.getSerializable(KEY));
+ assertEquals(s, mBundle.getSerializable(KEY));
+ }
+
+ public void testGetSerializableWithStringArray() {
+ assertNull(mBundle.getSerializable(KEY));
+ String[] strings = new String[]{"first", "last"};
+ mBundle.putSerializable(KEY, strings);
+ assertEquals(Arrays.asList(strings),
+ Arrays.asList((String[]) mBundle.getSerializable(KEY)));
+ roundtrip();
+ assertEquals(Arrays.asList(strings),
+ Arrays.asList((String[]) mBundle.getSerializable(KEY)));
+ }
+
+ public void testGetSerializableWithMultiDimensionalObjectArray() {
+ assertNull(mBundle.getSerializable(KEY));
+ Object[][] objects = new Object[][] {
+ {"string", 1L}
+ };
+ mBundle.putSerializable(KEY, objects);
+ assertEquals(Arrays.asList(objects[0]),
+ Arrays.asList(((Object[][]) mBundle.getSerializable(KEY))[0]));
+ roundtrip();
+ assertEquals(Arrays.asList(objects[0]),
+ Arrays.asList(((Object[][]) mBundle.getSerializable(KEY))[0]));
}
public void testGetShort1() {
@@ -812,9 +839,5 @@
MockClassLoader() {
super();
}
-
- MockClassLoader(ClassLoader parent) {
- super(parent);
- }
}
}
diff --git a/tests/tests/os/src/android/os/cts/TaggedPointerTest.java b/tests/tests/os/src/android/os/cts/TaggedPointerTest.java
new file mode 100644
index 0000000..4c619de
--- /dev/null
+++ b/tests/tests/os/src/android/os/cts/TaggedPointerTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os.cts;
+
+
+import android.test.AndroidTestCase;
+
+import android.os.cts.CpuFeatures;
+import android.os.cts.TaggedPointer;
+
+public class TaggedPointerTest extends AndroidTestCase {
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testHasTaggedPointer() {
+ if (!CpuFeatures.isArm64Cpu()) {
+ return;
+ }
+ assertTrue("Machine does not support tagged pointers", TaggedPointer.hasTaggedPointer());
+ }
+}
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index ab6ff46..f958440 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -727,9 +727,11 @@
private static final Set<File> CHAR_DEV_EXCEPTIONS = new HashSet<File>(
Arrays.asList(
// All exceptions should be alphabetical and associated with a bug number.
+ new File("/dev/adsprpc-smd"), // b/11710243
new File("/dev/alarm"), // b/9035217
new File("/dev/ashmem"),
new File("/dev/binder"),
+ new File("/dev/quadd"),
new File("/dev/felica"),
new File("/dev/felica_ant"),
new File("/dev/felica_cen"),
@@ -748,9 +750,16 @@
new File("/dev/mali0"), // b/9106968
new File("/dev/msm_rotator"), // b/9035217
new File("/dev/null"),
+ new File("/dev/nvhost-as-gpu"),
new File("/dev/nvhost-ctrl"), // b/9088251
+ new File("/dev/nvhost-ctrl-gpu"),
+ new File("/dev/nvhost-dbg-gpu"),
+ new File("/dev/nvhost-gpu"),
new File("/dev/nvhost-gr2d"), // b/9088251
new File("/dev/nvhost-gr3d"), // b/9088251
+ new File("/dev/nvhost-tsec"),
+ new File("/dev/nvhost-prof-gpu"),
+ new File("/dev/nvhost-vic"),
new File("/dev/nvmap"), // b/9088251
new File("/dev/ptmx"), // b/9088251
new File("/dev/pvrsrvkm"), // b/9108170
@@ -760,6 +769,7 @@
new File("/dev/snfc_hsel"),
new File("/dev/snfc_intu_poll"),
new File("/dev/snfc_rfs"),
+ new File("/dev/tegra-throughput"),
new File("/dev/tiler"), // b/9108170
new File("/dev/tty"),
new File("/dev/urandom"),
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java
deleted file mode 100644
index 9d0bc7d..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AcosPiTest extends RSBaseCompute {
- private ScriptC_acospi_f32 script_f32;
- private ScriptC_acospi_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_acospi_f32(mRS);
- script_f32_relaxed = new ScriptC_acospi_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_acospi_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_acospi_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_acospi_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_acospi_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_acospi_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_acospi_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_acospi_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_acospi_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.acos((double)in[idx])/Math.PI);
- }
- }
- return ref;
- }
-
- public void testAcosPiF32() {
- doF32(0xe1, 5);
- }
-
- public void testAcosPiF32_relaxed() {
- doF32_relaxed(0xe1, 128);
- }
-
- public void testAcosPiF32_2() {
- doF32_2(0xa123, 5);
- }
-
- public void testAcosPiF32_2_relaxed() {
- doF32_2_relaxed(0xa123, 128);
- }
-
- public void testAcosPiF32_3() {
- doF32_3(0x123, 5);
- }
-
- public void testAcosPiF32_3_relaxed() {
- doF32_3_relaxed(0x123, 128);
- }
-
- public void testAcosPiF32_4() {
- doF32_4(0x123ef, 5);
-
- }
- public void testAcosPiF32_4_relaxed() {
- doF32_4_relaxed(0x123ef, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java
deleted file mode 100644
index d540c60..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AcosTest extends RSBaseCompute {
- private ScriptC_acos_f32 script_f32;
- private ScriptC_acos_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_acos_f32(mRS);
- script_f32_relaxed = new ScriptC_acos_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_acos_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_acos_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_acos_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_acos_f32_4(mIn, mOut);
- break;
- case TEST_RELAXED_F32:
- script_f32.forEach_acos_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32.forEach_acos_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32.forEach_acos_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32.forEach_acos_f32_4(mIn, mOut);
- break;
-
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.acos((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testAcosF32() {
- doF32(0x123e, 4);
- }
-
- public void testAcosF32_2() {
- doF32_2(0x1e, 4);
- }
-
- public void testAcosF32_3() {
- doF32_3(0xeaf, 4);
- }
-
- public void testAcosF32_4() {
- doF32_4(0x123, 4);
- }
-
- public void testAcosF32_relaxed() {
- doF32_relaxed(0x123e, 128);
- }
-
- public void testAcosF32_2_relaxed() {
- doF32_2_relaxed(0x1e, 128);
- }
-
- public void testAcosF32_3_relaxed() {
- doF32_3_relaxed(0xeaf, 128);
- }
-
- public void testAcosF32_4_relaxed() {
- doF32_4_relaxed(0x123, 128);
- }
-
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java
deleted file mode 100644
index 5947066..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AcoshTest extends RSBaseCompute {
- private ScriptC_acosh_f32 script_f32;
- private ScriptC_acosh_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_acosh_f32(mRS);
- script_f32_relaxed = new ScriptC_acosh_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_acosh_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_acosh_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_acosh_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_acosh_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_acosh_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_acosh_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_acosh_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_acosh_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- double x = (double)in[idx];
- ref[idxRef] = (float)(2*Math.log(Math.sqrt((x+1)/2) + Math.sqrt((x-1)/2)));
- }
- }
- return ref;
- }
-
- public void testAcoshF32() {
- doF32(0x12345678, 4);
- }
-
- public void testAcoshF32_relaxed() {
- doF32_relaxed(0x12345678, 4);
- }
-
- public void testAcoshF32_2() {
- doF32_2(0x1234ac, 4);
- }
-
- public void testAcoshF32_2_relaxed() {
- doF32_2_relaxed(0x1234ac, 4);
- }
-
- public void testAcoshF32_3() {
- doF32_3(0x123fc78, 4);
- }
-
- public void testAcoshF32_3_relaxed() {
- doF32_3_relaxed(0x123fc78, 4);
- }
-
- public void testAcoshF32_4() {
- doF32_4(0x12def8, 4);
-
- }
- public void testAcoshF32_4_relaxed() {
- doF32_4_relaxed(0x12def8, 4);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java
deleted file mode 100644
index 64a001e..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AsinPiTest extends RSBaseCompute {
- private ScriptC_asinpi_f32 script_f32;
- private ScriptC_asinpi_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_asinpi_f32(mRS);
- script_f32_relaxed = new ScriptC_asinpi_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_asinpi_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_asinpi_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_asinpi_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_asinpi_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_asinpi_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_asinpi_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_asinpi_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_asinpi_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.asin((double)in[idx])/Math.PI);
- }
- }
- return ref;
- }
-
- public void testAsinPiF32() {
- doF32(0xa, 5);
- }
-
- public void testAsinPiF32_relaxed() {
- doF32_relaxed(0xa, 5);
- }
-
- public void testAsinPiF32_2() {
- doF32_2(0xe, 5);
- }
-
- public void testAsinPiF32_2_relaxed() {
- doF32_2_relaxed(0xe, 5);
- }
-
- public void testAsinPiF32_3() {
- doF32_3(0x1234, 5);
- }
-
- public void testAsinPiF32_3_relaxed() {
- doF32_3_relaxed(0x1234, 5);
- }
-
- public void testAsinPiF32_4() {
- doF32_4(0xaf, 5);
-
- }
- public void testAsinPiF32_4_relaxed() {
- doF32_4_relaxed(0xaf, 5);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java
deleted file mode 100644
index 7f3c367..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AsinTest extends RSBaseCompute {
- private ScriptC_asin_f32 script_f32;
- private ScriptC_asin_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_asin_f32(mRS);
- script_f32_relaxed = new ScriptC_asin_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_asin_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_asin_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_asin_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_asin_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_asin_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_asin_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_asin_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_asin_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.asin((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testAsinF32() {
- doF32(0x12efa, 4);
- }
-
- public void testAsinF32_relaxed() {
- doF32_relaxed(0x12efa, 128);
- }
-
- public void testAsinF32_2() {
- doF32_2(0x34ef, 4);
- }
-
- public void testAsinF32_2_relaxed() {
- doF32_2_relaxed(0x34ef, 128);
- }
-
- public void testAsinF32_3() {
- doF32_3(0xae31, 4);
- }
-
- public void testAsinF32_3_relaxed() {
- doF32_3_relaxed(0xae31, 128);
- }
-
- public void testAsinF32_4() {
- doF32_4(0x341, 4);
-
- }
- public void testAsinF32_4_relaxed() {
- doF32_4_relaxed(0x341, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java
deleted file mode 100644
index e0204d2..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AsinhTest extends RSBaseCompute {
- private ScriptC_asinh_f32 script_f32;
- private ScriptC_asinh_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_asinh_f32(mRS);
- script_f32_relaxed = new ScriptC_asinh_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_asinh_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_asinh_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_asinh_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_asinh_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_asinh_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_asinh_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_asinh_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_asinh_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- double x = (double)in[idx];
- ref[idxRef] = (float)(Math.log(x+Math.sqrt(1+Math.pow(x, 2))));
- }
- }
- return ref;
- }
-
- public void testAsinhF32() {
- doF32(0x12, 4);
- }
-
- public void testAsinhF32_relaxed() {
- doF32_relaxed(0x12, 128);
- }
-
- public void testAsinhF32_2() {
- doF32_2(0xead, 4);
- }
-
- public void testAsinhF32_2_relaxed() {
- doF32_2_relaxed(0xead, 128);
- }
-
- public void testAsinhF32_3() {
- doF32_3(0xabc, 4);
- }
-
- public void testAsinhF32_3_relaxed() {
- doF32_3_relaxed(0xabc, 128);
- }
-
- public void testAsinhF32_4() {
- doF32_4(0xfea, 4);
-
- }
- public void testAsinhF32_4_relaxed() {
- doF32_4_relaxed(0xfea, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java
deleted file mode 100644
index f96e7d6..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import android.renderscript.Element;
-
-public class Atan2PiTest extends RSBaseCompute {
- private ScriptC_atan2pi_f32 script_f32;
- private ScriptC_atan2pi_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_atan2pi_f32(mRS);
- script_f32_relaxed = new ScriptC_atan2pi_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_atan2pi_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_atan2pi_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_atan2pi_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_atan2pi_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_atan2pi_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_atan2pi_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_atan2pi_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_atan2pi_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = (float)(Math.atan2((double)in[idx],(double)in[idx+stride]) / Math.PI);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testAtan2PiF32() {
- ScriptField_atan2pi_float_input in = new ScriptField_atan2pi_float_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12678, 6);
- }
-
- public void testAtan2PiF32_relaxed() {
- ScriptField_atan2pi_float_input in = new ScriptField_atan2pi_float_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12678, 128);
- }
-
- public void testAtan2PiF32_2() {
- ScriptField_atan2pi_float2_input in = new ScriptField_atan2pi_float2_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x1af45, 6);
- }
-
- public void testAtan2PiF32_2_relaxed() {
- ScriptField_atan2pi_float2_input in = new ScriptField_atan2pi_float2_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x1af45, 128);
- }
-
- public void testAtan2PiF32_3() {
- ScriptField_atan2pi_float3_input in = new ScriptField_atan2pi_float3_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1cd345, 6);
- }
-
- public void testAtan2PiF32_3_relaxed() {
- ScriptField_atan2pi_float3_input in = new ScriptField_atan2pi_float3_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1cd345, 128);
- }
-
- public void testAtan2PiF32_4() {
- ScriptField_atan2pi_float4_input in = new ScriptField_atan2pi_float4_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x1ca45, 6);
- }
-
- public void testAtan2PiF32_4_relaxed() {
- ScriptField_atan2pi_float4_input in = new ScriptField_atan2pi_float4_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x1ca45, 128);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java
deleted file mode 100644
index c3eabb7..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import android.renderscript.Element;
-
-public class Atan2Test extends RSBaseCompute {
- private ScriptC_atan2_f32 script_f32;
- private ScriptC_atan2_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_atan2_f32(mRS);
- script_f32_relaxed = new ScriptC_atan2_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_atan2_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_atan2_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_atan2_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_atan2_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_atan2_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_atan2_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_atan2_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_atan2_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = (float)Math.atan2((double)in[idx],(double)in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testAtan2F32() {
- ScriptField_atan2_f32_in in = new ScriptField_atan2_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12678, 6);
- }
-
- public void testAtan2F32_relaxed() {
- ScriptField_atan2_f32_in in = new ScriptField_atan2_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12678, 128);
- }
-
- public void testAtan2F32_2() {
- ScriptField_atan2_f32_2_in in = new ScriptField_atan2_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x1af45, 6);
- }
-
- public void testAtan2F32_2_relaxed() {
- ScriptField_atan2_f32_2_in in = new ScriptField_atan2_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x1af45, 128);
- }
-
- public void testAtan2F32_3() {
- ScriptField_atan2_f32_3_in in = new ScriptField_atan2_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1cd345, 6);
- }
-
- public void testAtan2F32_3_relaxed() {
- ScriptField_atan2_f32_3_in in = new ScriptField_atan2_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1cd345, 128);
- }
-
- public void testAtan2F32_4() {
- ScriptField_atan2_f32_4_in in = new ScriptField_atan2_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x1ca45, 6);
- }
-
- public void testAtan2F32_4_relaxed() {
- ScriptField_atan2_f32_4_in in = new ScriptField_atan2_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x1ca45, 128);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java
deleted file mode 100644
index 17fe5ad..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AtanPiTest extends RSBaseCompute {
- private ScriptC_atanpi_f32 script_f32;
- private ScriptC_atanpi_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_atanpi_f32(mRS);
- script_f32_relaxed = new ScriptC_atanpi_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_atanpi_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_atanpi_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_atanpi_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_atanpi_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_atanpi_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_atanpi_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_atanpi_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_atanpi_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.atan((double)in[idx])/Math.PI);
- }
- }
- return ref;
- }
-
- public void testAtanPiF32() {
- doF32(0x123, 5);
- }
-
- public void testAtanPiF32_relaxed() {
- doF32_relaxed(0x123, 128);
- }
-
- public void testAtanPiF32_2() {
- doF32_2(0x12, 5);
- }
-
- public void testAtanPiF32_2_relaxed() {
- doF32_2_relaxed(0x12, 128);
- }
-
- public void testAtanPiF32_3() {
- doF32_3(0x847, 5);
- }
-
- public void testAtanPiF32_3_relaxed() {
- doF32_3_relaxed(0x847, 128);
- }
-
- public void testAtanPiF32_4() {
- doF32_4(0xfa2, 5);
-
- }
- public void testAtanPiF32_4_relaxed() {
- doF32_4_relaxed(0xfa2, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java
deleted file mode 100644
index c41be40..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AtanTest extends RSBaseCompute {
- private ScriptC_atan_f32 script_f32;
- private ScriptC_atan_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_atan_f32(mRS);
- script_f32_relaxed = new ScriptC_atan_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_atan_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_atan_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_atan_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_atan_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_atan_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_atan_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_atan_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_atan_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.atan((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testAtanF32() {
- doF32(0x12a, 5);
- }
-
- public void testAtanF32_relaxed() {
- doF32_relaxed(0x12a, 128);
- }
-
- public void testAtanF32_2() {
- doF32_2(0xad, 5);
- }
-
- public void testAtanF32_2_relaxed() {
- doF32_2_relaxed(0xad, 128);
- }
-
- public void testAtanF32_3() {
- doF32_3(0xafe, 5);
- }
-
- public void testAtanF32_3_relaxed() {
- doF32_3_relaxed(0xafe, 128);
- }
-
- public void testAtanF32_4() {
- doF32_4(0x1238, 5);
-
- }
- public void testAtanF32_4_relaxed() {
- doF32_4_relaxed(0x1238, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java
deleted file mode 100644
index 7182251..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class AtanhTest extends RSBaseCompute {
- private ScriptC_atanh_f32 script_f32;
- private ScriptC_atanh_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_atanh_f32(mRS);
- script_f32_relaxed = new ScriptC_atanh_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_atanh_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_atanh_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_atanh_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_atanh_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_atanh_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_atanh_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_atanh_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_atanh_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- double x = (double)in[idx];
- ref[idxRef] = (float)((Math.log(1+x) - Math.log(1-x))/2);
- }
- }
- return ref;
- }
-
- public void testAtanhF32() {
- doF32(0xace, 5);
- }
-
- public void testAtanhF32_relaxed() {
- doF32_relaxed(0xace, 128);
- }
-
- public void testAtanhF32_2() {
- doF32_2(0xdae, 5);
- }
-
- public void testAtanhF32_2_relaxed() {
- doF32_2_relaxed(0xdae, 128);
- }
-
- public void testAtanhF32_3() {
- doF32_3(0x123, 5);
- }
-
- public void testAtanhF32_3_relaxed() {
- doF32_3_relaxed(0x123, 128);
- }
-
- public void testAtanhF32_4() {
- doF32_4(0x6480, 5);
-
- }
- public void testAtanhF32_4_relaxed() {
- doF32_4_relaxed(0x6480, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java
deleted file mode 100644
index 603794a..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class CbrtTest extends RSBaseCompute {
- private ScriptC_cbrt_f32 script_f32;
- private ScriptC_cbrt_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_cbrt_f32(mRS);
- script_f32_relaxed = new ScriptC_cbrt_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_cbrt_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_cbrt_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_cbrt_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_cbrt_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_cbrt_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_cbrt_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_cbrt_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_cbrt_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.cbrt((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testCbrtF32() {
- doF32(0xabe, 2);
- }
-
- public void testCbrtF32_relaxed() {
- doF32_relaxed(0xabe, 128);
- }
-
- public void testCbrtF32_2() {
- doF32_2(0x78, 2);
- }
-
- public void testCbrtF32_2_relaxed() {
- doF32_2_relaxed(0x78, 128);
- }
-
- public void testCbrtF32_3() {
- doF32_3(0x1e, 2);
- }
-
- public void testCbrtF32_3_relaxed() {
- doF32_3_relaxed(0x1e, 128);
- }
-
- public void testCbrtF32_4() {
- doF32_4(0xfe2, 2);
-
- }
- public void testCbrtF32_4_relaxed() {
- doF32_4_relaxed(0xfe2, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java
deleted file mode 100644
index 5d64b95..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class CeilTest extends RSBaseCompute {
- private ScriptC_ceil_f32 script_f32;
- private ScriptC_ceil_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_ceil_f32(mRS);
- script_f32_relaxed = new ScriptC_ceil_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_ceil_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_ceil_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_ceil_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_ceil_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_ceil_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_ceil_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_ceil_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_ceil_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.ceil((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testCeilF32() {
- doF32(0x12345ace, 0);
- }
-
- public void testCeilF32_relaxed() {
- doF32_relaxed(0x12345ace, 1);
- }
-
- public void testCeilF32_2() {
- doF32_2(0x1ac478, 0);
- }
-
- public void testCeilF32_2_relaxed() {
- doF32_2_relaxed(0x1ac478, 1);
- }
-
- public void testCeilF32_3() {
- doF32_3(0xacef, 0);
- }
-
- public void testCeilF32_3_relaxed() {
- doF32_3_relaxed(0xacef, 1);
- }
-
- public void testCeilF32_4() {
- doF32_4(0xef12, 0);
-
- }
- public void testCeilF32_4_relaxed() {
- doF32_4_relaxed(0xef12, 1);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ComputeTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ComputeTest.java
index 40611fd..d320448 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/ComputeTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ComputeTest.java
@@ -704,6 +704,7 @@
checkForErrors();
}
+ /*
public void testClamp() {
ScriptC_clamp s = new ScriptC_clamp(mRS, mRes, R.raw.clamp);
s.invoke_clamp_test();
@@ -720,6 +721,7 @@
waitForMessage();
checkForErrors();
}
+ */
/**
* Test utility functions.
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java
deleted file mode 100644
index a28caef..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class CopysignTest extends RSBaseCompute {
- private ScriptC_copysign_f32 script_f32;
- private ScriptC_copysign_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_copysign_f32(mRS);
- script_f32_relaxed = new ScriptC_copysign_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_copysign_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_copysign_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_copysign_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_copysign_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_copysign_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_copysign_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_copysign_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_copysign_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- int vec_size = stride - skip;
- float[] ref = new float[vec_size * input_size];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < vec_size; j++) {
- int idx = i * stride * 2 + j;
- ref[i*vec_size + j] = Math.copySign(in[idx], in[idx + stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- /**
- * Tests copysign(float, float).
- */
- public void testCopysignF32() {
- ScriptField_copysign_f32_input in = new ScriptField_copysign_f32_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12ac5678, 0);
- }
-
- public void testCopysignF32_relaxed() {
- ScriptField_copysign_f32_input in = new ScriptField_copysign_f32_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12ac5678, 0);
- }
-
- /**
- * Tests copysign(float2, float2).
- */
- public void testCopysignF32_2() {
- ScriptField_copysign_f32_2_input in = new ScriptField_copysign_f32_2_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x12fe5678, 0);
- }
-
- public void testCopysignF32_2_relaxed() {
- ScriptField_copysign_f32_2_input in = new ScriptField_copysign_f32_2_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x12fe5678, 0);
- }
-
- /**
- * Tests copysign(float3, float3).
- */
- public void testCopysignF32_3() {
- ScriptField_copysign_f32_3_input in = new ScriptField_copysign_f32_3_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1c345678, 0);
- }
-
- public void testCopysignF32_3_relaxed() {
- ScriptField_copysign_f32_3_input in = new ScriptField_copysign_f32_3_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1c345678, 0);
- }
-
- /**
- * Tests copysign(float4, float4).
- */
- public void testCopysignF32_4() {
- ScriptField_copysign_f32_4_input in = new ScriptField_copysign_f32_4_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x123a5f7d, 0);
- }
-
- public void testCopysignF32_4_relaxed() {
- ScriptField_copysign_f32_4_input in = new ScriptField_copysign_f32_4_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x123a5f7d, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CoreMathVerifier.java b/tests/tests/renderscript/src/android/renderscript/cts/CoreMathVerifier.java
new file mode 100644
index 0000000..8301a3f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CoreMathVerifier.java
@@ -0,0 +1,1521 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+public class CoreMathVerifier {
+ // Return the distance between two points in n-dimensional space.
+ static private float distance(float[] lhs, float[] rhs) {
+ float sum = 0.0f;
+ for (int i = 0; i < lhs.length; i++) {
+ float diff = lhs[i] - rhs[i];
+ sum += diff * diff;
+ }
+ return (float) StrictMath.sqrt(sum);
+ }
+
+ // Return the length of the n-dimensional vector.
+ static private float length(float[] array) {
+ float sum = 0.0f;
+ for (int i = 0; i < array.length; i++) {
+ sum += array[i] * array[i];
+ }
+ return (float) StrictMath.sqrt(sum);
+ }
+
+ // Normalize the n-dimensional vector, i.e. make it length 1.
+ static private void normalize(float[] in, float[] out) {
+ float l = length(in);
+ for (int i = 0; i < in.length; i++) {
+ out[i] = in[i] / l;
+ }
+ }
+
+ // Return the integer quotient and the remainder of dividing two floats.
+ static class RemainderAndQuotient {
+ public int quotient;
+ public float remainder;
+ }
+ static RemainderAndQuotient remainderAndQuotient(float numerator, float denominator) {
+ RemainderAndQuotient result = new RemainderAndQuotient();
+ if (denominator == 0.0f) {
+ result.quotient = 0;
+ result.remainder = Float.NaN;
+ } else {
+ result.quotient = (int) StrictMath.round(numerator / denominator);
+ result.remainder = numerator - result.quotient * denominator;
+ }
+ return result;
+ }
+
+ // Return the error function using Euler's method.
+ static float erf(float x) {
+ double t = 1.0 / (1.0 + 0.5 * StrictMath.abs(x));
+ double[] coeff = new double[] {
+ -1.26551223, 1.00002368 , 0.37409196, 0.09678418, -0.18628806,
+ 0.27886807, -1.13520398, +1.48851587, -0.82215223, 0.17087277
+ };
+ double sum = 0.0;
+ for (int i = coeff.length - 1; i >= 0; i--) {
+ sum = coeff[i] + t * sum;
+ }
+ double tau = t * Math.exp(sum -(x * x));
+ return (float)((x >= 0.0) ? 1.0 - tau : tau - 1.0);
+ }
+
+ static public void computeAbs(TestAbs.ArgumentsCharUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) StrictMath.abs(args.inValue);
+ }
+
+ static public void computeAbs(TestAbs.ArgumentsShortUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) StrictMath.abs(args.inValue);
+ }
+
+ static public void computeAbs(TestAbs.ArgumentsIntUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.abs(args.inValue);
+ }
+
+ static public void computeAcos(TestAcos.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.acos(args.in);
+ }
+
+ static public void computeAcosh(TestAcosh.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 4;
+ double x = (double) args.in;
+ args.out = (float) StrictMath.log(x + StrictMath.sqrt(x * x - 1.0));
+ }
+
+ static public void computeAcospi(TestAcospi.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) (StrictMath.acos(args.in) / StrictMath.PI);
+ }
+
+ static public void computeAsin(TestAsin.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.asin(args.in);
+ }
+
+ static public void computeAsinh(TestAsinh.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 5;
+ double x = (double) args.in;
+ args.out = (float) (StrictMath.log(x + StrictMath.sqrt(x * x + 1.0)));
+ }
+
+ static public void computeAsinpi(TestAsinpi.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 128;
+ args.out = (float) (StrictMath.asin(args.in) / StrictMath.PI);
+ }
+
+ static public void computeAtan(TestAtan.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.atan(args.in);
+ }
+
+ static public void computeAtanh(TestAtanh.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ double x = (double) args.in;
+ args.out = (float) (StrictMath.log((x + 1.0) / (x - 1.0)) / 2.0);
+ }
+
+ static public void computeAtanpi(TestAtanpi.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) (StrictMath.atan(args.in) / StrictMath.PI);
+ }
+
+ static public void computeAtan2(TestAtan2.ArgumentsFloatFloatFloat args) {
+ args.ulf = 6;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.atan2(args.inY, args.inX);
+ }
+
+ static public void computeAtan2pi(TestAtan2pi.ArgumentsFloatFloatFloat args) {
+ args.ulf = 6;
+ args.ulfRelaxed = 128;
+ args.out = (float) (StrictMath.atan2(args.inY, args.inX) / StrictMath.PI);
+ }
+
+ static public void computeCbrt(TestCbrt.ArgumentsFloatFloat args) {
+ args.ulf = 2;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.cbrt(args.in);
+ }
+
+ static public void computeCeil(TestCeil.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 1;
+ args.out = (float) StrictMath.ceil(args.in);
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsCharCharCharChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) StrictMath.min(args.inMaxValue,
+ StrictMath.max(args.inValue, args.inMinValue));
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsUcharUcharUcharUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) StrictMath.min(args.inMaxValue & 0xff,
+ StrictMath.max(args.inValue & 0xff, args.inMinValue & 0xff));
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsShortShortShortShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short)StrictMath.min(args.inMaxValue,
+ StrictMath.max(args.inValue, args.inMinValue));
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsUshortUshortUshortUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short)StrictMath.min(args.inMaxValue & 0xffff,
+ StrictMath.max(args.inValue & 0xffff, args.inMinValue & 0xffff));
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsIntIntIntInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.min(args.inMaxValue,
+ StrictMath.max(args.inValue, args.inMinValue));
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsUintUintUintUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ long min = args.inMinValue & 0xffffffffl;
+ long max = args.inMaxValue & 0xffffffffl;
+ long in = args.inValue & 0xffffffffl;
+ args.out = (int) StrictMath.min(max, StrictMath.max(in, min));
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsFloatFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.min(args.inMaxValue,
+ StrictMath.max(args.inValue, args.inMinValue));
+ }
+
+ /* TODO Not supporting long arguments currently
+ static public void computeClamp(TestClamp.ArgumentsLongLongLongLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.min(args.inMaxValue,
+ StrictMath.max(args.inValue, args.inMinValue));
+ }
+
+ static public void computeClamp(TestClamp.ArgumentsUlongUlongUlongUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ if (RSUtils.compareUnsignedLong(args.inValue, args.inMinValue) < 0) {
+ args.out = args.inMinValue;
+ } else if (RSUtils.compareUnsignedLong(args.inValue, args.inMaxValue) > 0) {
+ args.out = args.inMaxValue;
+ } else {
+ args.out = args.inValue;
+ }
+ }
+ */
+
+ static public void computeClz(TestClz.ArgumentsCharChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ int x = args.inValue;
+ args.out = (byte) (Integer.numberOfLeadingZeros(x & 0xff) - 24);
+ }
+
+ static public void computeClz(TestClz.ArgumentsUcharUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ int x = args.inValue;
+ args.out = (byte) (Integer.numberOfLeadingZeros(x & 0xff) - 24);
+ }
+
+ static public void computeClz(TestClz.ArgumentsShortShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) (Integer.numberOfLeadingZeros(args.inValue & 0xffff) - 16);
+ }
+
+ static public void computeClz(TestClz.ArgumentsUshortUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) (Integer.numberOfLeadingZeros(args.inValue & 0xffff) - 16);
+ }
+
+ static public void computeClz(TestClz.ArgumentsIntInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) Integer.numberOfLeadingZeros(args.inValue);
+ }
+
+ static public void computeClz(TestClz.ArgumentsUintUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) Integer.numberOfLeadingZeros(args.inValue);
+ }
+
+ static public void computeCopysign(TestCopysign.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.copySign(args.inX, args.inY);
+ }
+
+ static public void computeCos(TestCos.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 4;
+ args.out = (float) StrictMath.cos(args.in);
+ }
+
+ static public void computeCosh(TestCosh.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.cosh(args.in);
+ }
+
+ static public void computeCospi(TestCospi.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.cos(args.in * (float)StrictMath.PI);
+ }
+
+ /* TODO To be implemented
+ static public void computeCross(TestCross.ArgumentsFloatNFloatNFloatN args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 2;
+ // TODO: previous version had:Disable (relaxed) until we can add an absolute error metric
+ args.out[0] = args.inLhs[1] * args.inRhs[2] - args.inLhs[2] * args.inRhs[1];
+ args.out[1] = args.inLhs[2] * args.inRhs[0] - args.inLhs[0] * args.inRhs[2];
+ args.out[2] = args.inLhs[0] * args.inRhs[1] - args.inLhs[1] * args.inRhs[0];
+ if (args.out.length == 4) {
+ args.out[3] = 0.f;
+ }
+ }
+ */
+
+ static public void computeDegrees(TestDegrees.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 3;
+ args.out = (float) ((double)args.inValue * (180.0 / StrictMath.PI));
+ }
+
+ /* TODO To be implemented
+ static public void computeDistance(TestDistance.ArgumentsFloatFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = distance(new float[] {args.inLhs}, new float[] {args.inRhs});
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeDistance(TestDistance.ArgumentsFloatNFloatNFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = distance(args.inLhs, args.inRhs);
+ }
+
+ static public void computeDot(TestDot.ArgumentsFloatFloatFloat args) {
+ // TODO new implementation. Ulf?
+ args.ulf = 0;
+ args.ulfRelaxed = 4;
+ args.out = args.inLhs * args.inRhs;
+ }
+
+ static public void computeDot(TestDot.ArgumentsFloatNFloatNFloat args) {
+ // TODO new implementation. Ulf?
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ double sum = 0.0;
+ for (int i = 0; i < args.inLhs.length; i++) {
+ sum += args.inLhs[i] * args.inRhs[i];
+ }
+ args.out = (float) sum;
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeErf(TestErf.ArgumentsFloatFloat args) {
+ args.ulf = 4096; // TODO ulf not correct way to evaluate
+ args.ulfRelaxed = 4096;
+ args.out = erf(args.in);
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeErfc(TestErfc.ArgumentsFloatFloat args) {
+ args.ulf = 4096; // TODO ulf not correct way to evaluate
+ args.ulfRelaxed = 4096;
+ args.out = 1.0f - erf(args.in);
+ }
+ */
+
+ static public void computeExp(TestExp.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.exp(args.in);
+ }
+
+ /* TODO implement
+ static public void computeExp10(TestExp10.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.pow(10.0, args.in);
+ }
+ */
+
+ static public void computeExp2(TestExp2.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.pow(2.0, args.in);
+ }
+
+ static public void computeExpm1(TestExpm1.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.expm1(args.in);
+ }
+
+ static public void computeFabs(TestFabs.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) StrictMath.abs(args.in);
+ }
+
+ /* TODO To be implemented
+ static public void computeFastDistance(TestFastDistance.ArgumentsFloatFloatFloat args) {
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ args.out = distance(new float[] {args.inLhs}, new float[] {args.inRhs});
+ }
+
+ static public void computeFastDistance(TestFastDistance.ArgumentsFloatNFloatNFloat args) {
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ args.out = distance(args.inLhs, args.inRhs);
+ }
+
+ */
+
+ /* TODO To be implemented
+ static public void computeFastLength(TestFastLength.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 128000;
+ args.ulfRelaxed = 128000;
+ float sum = args.inV * args.inV;
+ args.out = (float) StrictMath.sqrt(sum);
+ }
+
+ static public void computeFastLength(TestFastLength.ArgumentsFloatNFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 128000;
+ args.ulfRelaxed = 128000;
+ args.out = length(args.inV);
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeFastNormalize(TestFastNormalize.ArgumentsFloatFloat args) {
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ float[] out = new float[1];
+ normalize(new float[] {args.inV}, out);
+ args.out = out[0];
+ }
+
+ static public void computeFastNormalize(TestFastNormalize.ArgumentsFloatNFloatN args) {
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ normalize(args.inV, args.out);
+ }
+ */
+
+ static public void computeFdim(TestFdim.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) StrictMath.max(0.0, args.inA - args.inB);
+ }
+
+ static public void computeFloor(TestFloor.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 1;
+ args.out = (float) StrictMath.floor(args.in);
+ }
+
+ static public void computeFma(TestFma.ArgumentsFloatFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float)((double)args.inA * (double)args.inB + (double)args.inC);
+ }
+
+ static public void computeFmax(TestFmax.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.max(args.inX, args.inY);
+ }
+
+ static public void computeFmin(TestFmin.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.min(args.inX, args.inY);
+ }
+
+ static public void computeFmod(TestFmod.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) ((double)args.inX % (double)args.inY);
+ }
+
+ static public void computeFract(TestFract.ArgumentsFloatFloatFloat args) {
+ // TODO The ulfs have been relaxed from 4, 12. Revisit.
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.outFloor = (float) StrictMath.floor(args.inV);
+ args.out = (float) StrictMath.min(args.inV - args.outFloor, 0x1.fffffep-1f);
+ }
+
+ static public void computeFract(TestFract.ArgumentsFloatFloat args) {
+ // TODO The ulfs have been relaxed from 4, 12. Revisit.
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ float floor = (float) StrictMath.floor(args.inV);
+ args.out = (float) StrictMath.min(args.inV - floor, 0x1.fffffep-1f);
+ }
+
+ /* TODO To be implemented
+ static public void computeFrexp(TestFrexp.ArgumentsFloatIntFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654;
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeHalfRecip(TestHalfRecip.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 128000;
+ args.ulfRelaxed = 128000;
+ args.out = (float) (1.0 / args.inV);
+ }
+ */
+
+ static public void computeHalfRsqrt(TestHalfRsqrt.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 128000;
+ args.ulfRelaxed = 128000;
+ args.out = (float) StrictMath.pow(args.inV, -0.5);
+ }
+
+ static public void computeHalfSqrt(TestHalfSqrt.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 128000;
+ args.ulfRelaxed = 128000;
+ args.out = (float) StrictMath.sqrt(args.inV);
+ }
+
+ static public void computeHypot(TestHypot.ArgumentsFloatFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 4;
+ args.out = (float) StrictMath.hypot(args.inX, args.inY);
+ }
+
+ /* TODO implement
+ static public void computeIlogb(TestIlogb.ArgumentsFloatInt args) {
+ // TODO verify, this is a guess. Also check the ulf.
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = (int) (((Float.floatToIntBits(args.in) >> 23) & 0xFF) - 127.0f);
+ }
+ */
+
+ static public void computeLdexp(TestLdexp.ArgumentsFloatIntFloat args) {
+ // TODO verify, this is a guess. Also check the ulf.
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = (float) (args.inX * StrictMath.pow(2.0, args.inY));
+ }
+
+ /* TODO To be implemented
+ static public void computeLength(TestLength.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = length(new float[] {args.inV});
+ }
+
+ static public void computeLength(TestLength.ArgumentsFloatNFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = length(args.inV);
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeLgamma(TestLgamma.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654;
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeLgamma(TestLgamma.ArgumentsFloatIntFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654;
+ }
+ */
+
+ static public void computeLog(TestLog.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.log(args.in);
+ }
+
+ static public void computeLog10(TestLog10.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.log10(args.in);
+ }
+
+ static public void computeLog1p(TestLog1p.ArgumentsFloatFloat args) {
+ args.ulf = 2;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.log1p(args.in);
+ }
+
+ static public void computeLog2(TestLog2.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 128;
+ args.out = (float) (StrictMath.log10(args.in) / StrictMath.log10(2.0));
+ }
+
+ /* TODO implement
+ static public void computeLogb(TestLogb.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = ((Float.floatToIntBits(args.in) >> 23) & 0xFF) - 127.0f;
+ }
+ */
+
+ static public void computeMad(TestMad.ArgumentsFloatFloatFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 4;
+ args.out = args.inA * args.inB + args.inC;
+ }
+
+ static public void computeMax(TestMax.ArgumentsCharCharChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) StrictMath.max(args.inV1, args.inV2);
+ }
+
+ static public void computeMax(TestMax.ArgumentsUcharUcharUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) StrictMath.max(args.inV1 & 0xff, args.inV2 & 0xff);
+ }
+
+ static public void computeMax(TestMax.ArgumentsShortShortShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) StrictMath.max(args.inV1, args.inV2);
+ }
+
+ static public void computeMax(TestMax.ArgumentsUshortUshortUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) StrictMath.max(args.inV1 & 0xffff, args.inV2 & 0xffff);
+ }
+
+ static public void computeMax(TestMax.ArgumentsIntIntInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.max(args.inV1, args.inV2);
+ }
+
+ static public void computeMax(TestMax.ArgumentsUintUintUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) StrictMath.max((long) (args.inV1 & 0xffffffffL),
+ (long)(args.inV2 & 0xffffffffL));
+ }
+
+ static public void computeMax(TestMax.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) StrictMath.max(args.in, args.in1);
+ }
+
+ static public void computeMin(TestMin.ArgumentsCharCharChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) StrictMath.min(args.inV1, args.inV2);
+ }
+
+ static public void computeMin(TestMin.ArgumentsUcharUcharUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) StrictMath.min(args.inV1 & 0xff, args.inV2 & 0xff);
+ }
+
+ static public void computeMin(TestMin.ArgumentsShortShortShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) StrictMath.min(args.inV1, args.inV2);
+ }
+
+ static public void computeMin(TestMin.ArgumentsUshortUshortUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) StrictMath.min(args.inV1 & 0xffff, args.inV2 & 0xffff);
+ }
+
+ static public void computeMin(TestMin.ArgumentsIntIntInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.min(args.inV1, args.inV2);
+ }
+
+ static public void computeMin(TestMin.ArgumentsUintUintUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) StrictMath.min((long) (args.inV1 & 0xffffffffL),
+ (long)(args.inV2 & 0xffffffffL));
+ }
+
+ static public void computeMin(TestMin.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) StrictMath.min(args.in, args.in1);
+ }
+
+ static public void computeMix(TestMix.ArgumentsFloatFloatFloatFloat args) {
+ // TODO new implementation, my guess. Check the ulf.
+ args.ulf = 0;
+ args.ulfRelaxed = 4;
+ args.out = (float)(args.inStart + ((args.inStop - args.inStart) * args.inAmount));
+ }
+
+ static public void computeModf(TestModf.ArgumentsFloatFloatFloat args) {
+ // TODO new implementation, my guess. Check the ulf.
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.outIret = (int)args.inX;
+ args.out = args.inX - args.outIret;
+ }
+
+ /* TODO Implement
+ static public void computeNan(TestNan.ArgumentsUintFloat args) {
+ // TODO Do we look at the input arg?
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = Float.NaN;
+ }
+ */
+
+ /* TODO Implement
+ static public void computeNativeExp(TestNativeExp.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 256000;
+ args.ulfRelaxed = 256000;
+ args.out = (float) StrictMath.exp(args.inV);
+ }
+
+ static public void computeNativeExp10(TestNativeExp10.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 256000;
+ args.ulfRelaxed = 256000;
+ args.out = (float) StrictMath.pow(10.0, args.inV);
+ }
+
+ static public void computeNativeExp2(TestNativeExp2.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 256000;
+ args.ulfRelaxed = 256000;
+ args.out = (float) StrictMath.pow(2.0, args.inV);
+ }
+
+ static public void computeNativeLog(TestNativeLog.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 256000;
+ args.ulfRelaxed = 256000;
+ args.out = (float) StrictMath.log(args.inV);
+ }
+
+ static public void computeNativeLog10(TestNativeLog10.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 256000;
+ args.ulfRelaxed = 256000;
+ args.out = (float) StrictMath.log10(args.inV);
+ }
+
+ static public void computeNativeLog2(TestNativeLog2.ArgumentsFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 256000;
+ args.ulfRelaxed = 256000;
+ args.out = (float) (StrictMath.log10(args.inV) / StrictMath.log10(2.0));
+ }
+
+ static public void computeNativePowr(TestNativePowr.ArgumentsFloatFloatFloat args) {
+ // TODO ulf was relaxed from 4096, 4096. Revisit
+ args.ulf = 256000;
+ args.ulfRelaxed = 256000;
+ // TODO By definition, y must be > 0. Make sure to conserve that when generating random.
+ args.out = (float) StrictMath.pow(args.inV, args.inY);
+ }
+ */
+
+ static public void computeNextafter(TestNextafter.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) StrictMath.nextAfter(args.inX, args.inY);
+ }
+
+ /* TODO To be implemented
+ static public void computeNormalize(TestNormalize.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ float[] out = new float[1];
+ normalize(new float[] {args.inV}, out);
+ args.out = out[0];
+ }
+
+ static public void computeNormalize(TestNormalize.ArgumentsFloatNFloatN args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ normalize(args.inV, args.out);
+ }
+ */
+
+ static public void computePow(TestPow.ArgumentsFloatFloatFloat args) {
+ args.ulf = 16;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.pow(args.inX, args.inY);
+ }
+
+ /* TODO implement
+ static public void computePown(TestPown.ArgumentsFloatIntFloat args) {
+ args.ulf = 16;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.pow(args.inX, args.inY);
+ }
+ */
+
+ static public void computePowr(TestPowr.ArgumentsFloatFloatFloat args) {
+ args.ulf = 16;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.pow(args.inX, args.inY); // TODO y must be > 0. Has an impact on thests
+ }
+
+ static public void computeRadians(TestRadians.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 3;
+ args.out = (float)((double)args.inValue * (StrictMath.PI / 180.0));
+ }
+
+ static public void computeRemainder(TestRemainder.ArgumentsFloatFloatFloat args) {
+ args.ulf = 64; // TODO Correct ULF?
+ args.ulfRelaxed = 128;
+ args.out = remainderAndQuotient(args.inX, args.inY).remainder;
+ }
+
+ /* TODO To be implemented
+ static public void computeRemquo(TestRemquo.ArgumentsFloatFloatIntFloat args) {
+ args.ulf = 64; // TODO Correct ULF?
+ args.ulfRelaxed = 128;
+ RemainderAndQuotient r = remainderAndQuotient(args.inB, args.inC);
+ args.out = r.remainder;
+ args.outD = r.quotient;
+ }
+ */
+
+ static public void computeRint(TestRint.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) StrictMath.rint(args.in);
+ }
+
+ static public void computeRootn(TestRootn.ArgumentsFloatIntFloat args) {
+ args.ulf = 16;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.pow(args.inV, 1.0 / (double)args.inN);
+ }
+
+ static public void computeRound(TestRound.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = StrictMath.round(args.in);
+ }
+
+ static public void computeRsqrt(TestRsqrt.ArgumentsFloatFloat args) {
+ args.ulf = 2;
+ args.ulfRelaxed = 2;
+ args.out = (float) StrictMath.pow(args.in, -0.5);
+ }
+
+ static public void computeSign(TestSign.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = Math.signum(args.inV);
+ }
+
+ static public void computeSin(TestSin.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.sin(args.in);
+ }
+
+ static public void computeSincos(TestSincos.ArgumentsFloatFloatFloat args) {
+ // TODO new test. ulf?
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.outCosptr = (float) StrictMath.cos(args.inV);
+ args.out = (float) StrictMath.sin(args.inV);
+ }
+
+ static public void computeSinh(TestSinh.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.sinh(args.in);
+ }
+
+ static public void computeSinpi(TestSinpi.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.sin(args.in * (float) StrictMath.PI);
+ }
+
+ static public void computeSqrt(TestSqrt.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 3;
+ args.out = (float) StrictMath.sqrt(args.in);
+ }
+
+ static public void computeStep(TestStep.ArgumentsFloatFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = args.inV < args.inEdge ? 0.0f : 1.0f;
+ }
+
+ static public void computeTan(TestTan.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.tan(args.in);
+ }
+
+ static public void computeTanh(TestTanh.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.tanh(args.in);
+ }
+
+ static public void computeTanpi(TestTanpi.ArgumentsFloatFloat args) {
+ args.ulf = 5;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.tan(args.in * (float) StrictMath.PI);
+ }
+
+ /* TODO To be implemented
+ static public void computeTgamma(TestTgamma.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654;
+ }
+ */
+
+ static public void computeTrunc(TestTrunc.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ int sign = ((Float.floatToIntBits(args.in) >> 31) & 0x01);
+ float trunc = (int) args.in;
+ if (sign == 1 && trunc == +0.0f) {
+ trunc = -0.0f;
+ }
+ args.out = trunc;
+ }
+
+ /* TODO the convert methods are not finished. Signed to unsigned transition
+ * needs more verfication.
+ */
+ /*
+ (*
+ static public void computeConvert(TestConvert.ArgumentsCharChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = args.in;
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsCharDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsCharFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsCharInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsCharLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsCharShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsCharUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsCharUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) (args.in & 0xff);
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsCharUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) (args.in & 0xff);
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsCharUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) (args.in & 0xff);
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsDoubleChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in; // TODO not sure
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in; // TODO not sure
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in; // TODO not sure
+ }
+ static public void computeConvert(TestConvert.ArgumentsDoubleUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in; // TODO not sure
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsFloatChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsFloatDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsFloatFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsFloatInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsFloatLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsFloatShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsFloatUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in; // TODO not sure
+ }
+ static public void computeConvert(TestConvert.ArgumentsFloatUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in; // TODO not sure
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsFloatUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in; // TODO not sure
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsFloatUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in; // TODO not sure
+ }
+ static public void computeConvert(TestConvert.ArgumentsIntChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsIntDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsIntFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsIntInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsIntLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsIntShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsIntUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsIntUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsIntUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsIntUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsLongChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+
+ static public void computeConvert(TestConvert.ArgumentsLongUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsLongUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsShortChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsShortDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsShortFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsShortInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsShortLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsShortShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsShortUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsShortUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) (args.in & 0xffff);
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsShortUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsShortUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUcharChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) (args.in & 0xff);
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUcharDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) (args.in & 0xff);
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUcharFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) (args.in & 0xff);
+ }
+ static public void computeConvert(TestConvert.ArgumentsUcharInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) (args.in & 0xff);
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUcharLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) (args.in & 0xff);
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUcharShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) (args.in & 0xff);
+ }
+ static public void computeConvert(TestConvert.ArgumentsUcharUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) (args.in & 0xff);
+ }
+ static public void computeConvert(TestConvert.ArgumentsUcharUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) (args.in & 0xff);
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUcharUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) (args.in & 0xff);
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUcharUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) (args.in & 0xff);
+ }
+ static public void computeConvert(TestConvert.ArgumentsUintChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUintDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUintFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUintInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUintLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUintShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUintUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUintUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUintUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUintUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUlongChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUlongUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUshortChar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ (* TODO Not supporting double arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUshortDouble args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (double) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUshortFloat args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (float) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUshortInt args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUshortLong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUshortShort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUshortUchar args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (byte) args.in;
+ }
+ static public void computeConvert(TestConvert.ArgumentsUshortUint args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (int) args.in;
+ }
+ (* TODO Not supporting long arguments currently
+ static public void computeConvert(TestConvert.ArgumentsUshortUlong args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (long) args.in;
+ }
+ *)
+ static public void computeConvert(TestConvert.ArgumentsUshortUshort args) {
+ args.ulf = 0;
+ args.ulfRelaxed = 0;
+ args.out = (short) args.in;
+ }
+*/
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java
deleted file mode 100644
index dd5db8a..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class CosTest extends RSBaseCompute {
- private ScriptC_cos_f32 script_f32;
- private ScriptC_cos_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_cos_f32(mRS);
- script_f32_relaxed = new ScriptC_cos_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_cos_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_cos_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_cos_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_cos_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_cos_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_cos_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_cos_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_cos_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.cos((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testCosF32() {
- doF32(0xe, 4);
- }
-
- public void testCosF32_relaxed() {
- doF32_relaxed(0xe, 4);
- }
-
- public void testCosF32_2() {
- doF32_2(0xb, 4);
- }
-
- public void testCosF32_2_relaxed() {
- doF32_2_relaxed(0xb, 4);
- }
-
- public void testCosF32_3() {
- doF32_3(0x12a, 4);
- }
-
- public void testCosF32_3_relaxed() {
- doF32_3_relaxed(0x12a, 4);
- }
-
- public void testCosF32_4() {
- doF32_4(0x98a, 4);
-
- }
- public void testCosF32_4_relaxed() {
- doF32_4_relaxed(0x98a, 4);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java
deleted file mode 100644
index 9fa3603..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import com.android.cts.stub.R;
-import android.renderscript.RSRuntimeException;
-
-public class CoshTest extends RSBaseCompute {
-
- private ScriptC_cosh_f32 script_f32;
- private ScriptC_cosh_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_cosh_f32(mRS);
- script_f32_relaxed = new ScriptC_cosh_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_cosh_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_cosh_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_cosh_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_cosh_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_cosh_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_cosh_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_cosh_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_cosh_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.cosh((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testCoshF32() {
- doF32(0xfe, 4);
- }
-
- public void testCoshF32_relaxed() {
- doF32_relaxed(0xfe, 128);
- }
-
- public void testCoshF32_2() {
- doF32_2(0x71, 4);
- }
-
- public void testCoshF32_2_relaxed() {
- doF32_2_relaxed(0x71, 128);
- }
-
- public void testCoshF32_3() {
- doF32_3(0xa, 4);
- }
-
- public void testCoshF32_3_relaxed() {
- doF32_3_relaxed(0xa, 128);
- }
-
- public void testCoshF32_4() {
- doF32_4(0xabe, 4);
-
- }
- public void testCoshF32_4_relaxed() {
- doF32_4_relaxed(0xabe, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java
deleted file mode 100644
index 308f5f4..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-
-public class CrossTest extends RSBaseCompute {
- private ScriptC_cross_f32 script_f32;
- private ScriptC_cross_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_cross_f32(mRS);
- script_f32_relaxed = new ScriptC_cross_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32_3:
- script_f32.forEach_cross_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_cross_f32_4(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_cross_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_cross_f32_4(mIn, mOut);
- break;
- }
-
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- int idx= i * stride * 2;
- int idxRef = i * (stride - skip);
- ref[idxRef + 0] = in[idx+1] * in[idx+2+stride] - in[idx+2] * in[idx+1+stride];
- ref[idxRef + 1] = in[idx+2] * in[idx+0+stride] - in[idx+0] * in[idx+2+stride];
- ref[idxRef + 2] = in[idx+0] * in[idx+1+stride] - in[idx+1] * in[idx+0+stride];
- if (skip == 1)
- ref[idxRef + 3] = 0.f;
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- /**
- * cross test for float3
- */
- public void testCrossF32_3() {
- ScriptField__cross_f32_3_struct in = new ScriptField__cross_f32_3_struct(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x12345678, 0);
- }
-
- /*
- Disable until we can add an absolute error metric
- public void testCrossF32_3_relaxed() {
- ScriptField__cross_f32_3_struct in = new ScriptField__cross_f32_3_struct(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x12345678, 2);
- }
- */
-
-
- /**
- * cross test for float4
- */
- public void testCrossF32_4() {
- ScriptField__cross_f32_4_struct in = new ScriptField__cross_f32_4_struct(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x12ac5678, 0);
- }
-
- /*
- Disable until we can add an absolute error metric
- public void testCrossF32_4_relaxed() {
- ScriptField__cross_f32_4_struct in = new ScriptField__cross_f32_4_struct(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x12ac5678, 2);
- }
- */
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java b/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java
deleted file mode 100644
index 38c4824..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class DegreesTest extends RSBaseCompute {
- private ScriptC_degrees_f32 script_f32;
- private ScriptC_degrees_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_degrees_f32(mRS);
- script_f32_relaxed = new ScriptC_degrees_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_degrees_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_degrees_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_degrees_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_degrees_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_degrees_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_degrees_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_degrees_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_degrees_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- double val = (double)in[idx] * (180.0 / Math.PI);
- ref[idxRef] = (float)val;
- }
- }
- return ref;
- }
-
- /**
- * degrees test for float
- */
- public void testDegreesF32() {
- doF32(0x12345678, 3);
- }
-
- public void testDegreesF32_relaxed() {
- doF32_relaxed(0x12345678, 3);
- }
-
- /**
- * degrees test for float2
- */
- public void testDegreesF32_2() {
- doF32_2(0x12353678, 3);
- }
-
- public void testDegreesF32_2_relaxed() {
- doF32_2_relaxed(0x12353678, 3);
- }
-
- /**
- * degrees test for float3
- */
- public void testDegreesF32_3() {
- doF32_3(0x12312678, 3);
- }
-
- public void testDegreesF32_3_relaxed() {
- doF32_3_relaxed(0x12312678, 3);
- }
-
- /**
- * degrees test for float4
- */
- public void testDegreesF32_4() {
- doF32_4(0x12675678, 3);
-
- }
- public void testDegreesF32_4_relaxed() {
- doF32_4_relaxed(0x12675678, 3);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java
deleted file mode 100644
index 875af18..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class Exp10Test extends RSBaseCompute {
- private ScriptC_exp10_f32 script_f32;
- private ScriptC_exp10_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_exp10_f32(mRS);
- script_f32_relaxed = new ScriptC_exp10_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_exp10_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_exp10_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_exp10_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_exp10_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_exp10_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_exp10_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_exp10_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_exp10_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.pow(10, (double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testExp10F32() {
- doF32(0x81, 3);
- }
-
- public void testExp10F32_relaxed() {
- doF32_relaxed(0x81, 16);
- }
-
- public void testExp10F32_2() {
- doF32_2(0xa42, 3);
- }
-
- public void testExp10F32_2_relaxed() {
- doF32_2_relaxed(0xa42, 16);
- }
-
- public void testExp10F32_3() {
- doF32_3(0xace2, 3);
- }
-
- public void testExp10F32_3_relaxed() {
- doF32_3_relaxed(0xace2, 16);
- }
-
- public void testExp10F32_4() {
- doF32_4(0x918, 3);
-
- }
- public void testExp10F32_4_relaxed() {
- doF32_4_relaxed(0x918, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java
deleted file mode 100644
index ac99b92..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class Exp2Test extends RSBaseCompute {
- private ScriptC_exp2_f32 script_f32;
- private ScriptC_exp2_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_exp2_f32(mRS);
- script_f32_relaxed = new ScriptC_exp2_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_exp2_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_exp2_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_exp2_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_exp2_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_exp2_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_exp2_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_exp2_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_exp2_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.pow(2, (double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testExp2F32() {
- doF32(0xa6, 3);
- }
-
- public void testExp2F32_relaxed() {
- doF32_relaxed(0xa6, 16);
- }
-
- public void testExp2F32_2() {
- doF32_2(0xab2, 3);
- }
-
- public void testExp2F32_2_relaxed() {
- doF32_2_relaxed(0xab2, 16);
- }
-
- public void testExp2F32_3() {
- doF32_3(0x617a, 3);
- }
-
- public void testExp2F32_3_relaxed() {
- doF32_3_relaxed(0x617a, 16);
- }
-
- public void testExp2F32_4() {
- doF32_4(0xabc3, 3);
-
- }
- public void testExp2F32_4_relaxed() {
- doF32_4_relaxed(0xabc3, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java
deleted file mode 100644
index e2f86ca..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class ExpTest extends RSBaseCompute {
- private ScriptC_exp_f32 script_f32;
- private ScriptC_exp_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_exp_f32(mRS);
- script_f32_relaxed = new ScriptC_exp_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_exp_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_exp_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_exp_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_exp_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_exp_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_exp_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_exp_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_exp_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.exp((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testExpF32() {
- doF32(0xa28, 3);
- }
-
- public void testExpF32_relaxed() {
- doF32_relaxed(0xa28, 16);
- }
-
- public void testExpF32_2() {
- doF32_2(0xfeb4, 3);
- }
-
- public void testExpF32_2_relaxed() {
- doF32_2_relaxed(0xfeb4, 16);
- }
-
- public void testExpF32_3() {
- doF32_3(0xab2, 3);
- }
-
- public void testExpF32_3_relaxed() {
- doF32_3_relaxed(0xab2, 16);
- }
-
- public void testExpF32_4() {
- doF32_4(0x7a6, 3);
-
- }
- public void testExpF32_4_relaxed() {
- doF32_4_relaxed(0x7a6, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java
deleted file mode 100644
index 36b65ff..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class Expm1Test extends RSBaseCompute {
- private ScriptC_expm1_f32 script_f32;
- private ScriptC_expm1_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_expm1_f32(mRS);
- script_f32_relaxed = new ScriptC_expm1_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_expm1_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_expm1_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_expm1_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_expm1_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_expm1_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_expm1_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_expm1_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_expm1_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.expm1((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testExpm1F32() {
- doF32(0xa29, 3);
- }
-
- public void testExpm1F32_relaxed() {
- doF32_relaxed(0xa29, 16);
- }
-
- public void testExpm1F32_2() {
- doF32_2(0x8a2, 3);
- }
-
- public void testExpm1F32_2_relaxed() {
- doF32_2_relaxed(0x8a2, 16);
- }
-
- public void testExpm1F32_3() {
- doF32_3(0xa7c, 3);
- }
-
- public void testExpm1F32_3_relaxed() {
- doF32_3_relaxed(0xa7c, 16);
- }
-
- public void testExpm1F32_4() {
- doF32_4(0x81a, 3);
-
- }
- public void testExpm1F32_4_relaxed() {
- doF32_4_relaxed(0x81a, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java
deleted file mode 100644
index e8739d4..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class FabsTest extends RSBaseCompute {
- private ScriptC_fabs_f32 script_f32;
- private ScriptC_fabs_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_fabs_f32(mRS);
- script_f32_relaxed = new ScriptC_fabs_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_fabs_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_fabs_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_fabs_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_fabs_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_fabs_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_fabs_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_fabs_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_fabs_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = Math.abs(in[idx]);
- }
- }
- return ref;
- }
-
- public void testfabsF32() {
- doF32(0xa, 0);
- }
-
- public void testfabsF32_relaxed() {
- doF32_relaxed(0xa, 0);
- }
-
- public void testfabsF32_2() {
- doF32_2(0xb, 0);
- }
-
- public void testfabsF32_2_relaxed() {
- doF32_2_relaxed(0xb, 0);
- }
-
- public void testfabsF32_3() {
- doF32_3(0xc, 0);
- }
-
- public void testfabsF32_3_relaxed() {
- doF32_3_relaxed(0xc, 0);
- }
-
- public void testfabsF32_4() {
- doF32_4(0xd, 0);
-
- }
- public void testfabsF32_4_relaxed() {
- doF32_4_relaxed(0xd, 0);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java
deleted file mode 100644
index 144c258..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class FdimTest extends RSBaseCompute {
- private ScriptC_fdim_f32 script_f32;
- private ScriptC_fdim_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_fdim_f32(mRS);
- script_f32_relaxed = new ScriptC_fdim_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_fdim_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_fdim_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_fdim_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_fdim_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_fdim_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_fdim_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_fdim_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_fdim_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = (float)(Math.max(0.0, (double)in[idx] - (double)in[idx+stride]));
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testfdimF32() {
- ScriptField_fdim_f32_input floatArray = new ScriptField_fdim_f32_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32(0x12678, 0);
- }
-
- public void testfdimF32_relaxed() {
- ScriptField_fdim_f32_input floatArray = new ScriptField_fdim_f32_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_relaxed(0x12678, 0);
- }
-
- public void testfdimF32_2() {
- ScriptField_fdim_f32_2_input floatArray = new ScriptField_fdim_f32_2_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_2(0x1af45, 0);
- }
-
- public void testfdimF32_2_relaxed() {
- ScriptField_fdim_f32_2_input floatArray = new ScriptField_fdim_f32_2_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_2_relaxed(0x1af45, 0);
- }
-
- public void testfdimF32_3() {
- ScriptField_fdim_f32_3_input floatArray = new ScriptField_fdim_f32_3_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_3(0x1cd345, 0);
- }
-
- public void testfdimF32_3_relaxed() {
- ScriptField_fdim_f32_3_input floatArray = new ScriptField_fdim_f32_3_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_3_relaxed(0x1cd345, 0);
- }
-
- public void testfdimF32_4() {
- ScriptField_fdim_f32_4_input floatArray = new ScriptField_fdim_f32_4_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_4(0x1ca45, 0);
- }
-
- public void testfdimF32_4_relaxed() {
- ScriptField_fdim_f32_4_input floatArray = new ScriptField_fdim_f32_4_input(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_4_relaxed(0x1ca45, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java
deleted file mode 100644
index e7494e6..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class FloorTest extends RSBaseCompute {
- private ScriptC_floor_f32 script_f32;
- private ScriptC_floor_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_floor_f32(mRS);
- script_f32_relaxed = new ScriptC_floor_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_floor_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_floor_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_floor_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_floor_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_floor_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_floor_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_floor_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_floor_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.floor((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testfloorF32() {
- doF32(0xa, 0);
- }
-
- public void testfloorF32_relaxed() {
- doF32_relaxed(0xa, 1);
- }
-
- public void testfloorF32_2() {
- doF32_2(0xb, 0);
- }
-
- public void testfloorF32_2_relaxed() {
- doF32_2_relaxed(0xb, 1);
- }
-
- public void testfloorF32_3() {
- doF32_3(0xef1, 0);
- }
-
- public void testfloorF32_3_relaxed() {
- doF32_3_relaxed(0xef1, 1);
- }
-
- public void testfloorF32_4() {
- doF32_4(0xefa12, 0);
-
- }
- public void testfloorF32_4_relaxed() {
- doF32_4_relaxed(0xefa12, 1);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java
deleted file mode 100644
index 40fac7e..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class FmaTest extends RSBaseCompute {
- private ScriptC_fma_f32 script_f32;
- private ScriptC_fma_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_fma_f32(mRS);
- script_f32_relaxed = new ScriptC_fma_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_fma_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_fma_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_fma_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_fma_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_fma_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_fma_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_fma_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_fma_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 3 + j;
- ref[i * (stride - skip) + j] = (float)((double)in[idx] * (double)in[idx+stride] + (double)in[idx+stride*2]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*3];
- }
-
- public void testFmaF32() {
- ScriptField_Floats floatArray = new ScriptField_Floats(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32(0xea1, 0);
- }
-
- public void testFmaF32_relaxed() {
- ScriptField_Floats floatArray = new ScriptField_Floats(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_relaxed(0xea1, 0);
- }
-
- public void testFmaF32_2() {
- ScriptField_Floats2 floatArray = new ScriptField_Floats2(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_2(0x12a, 0);
- }
-
- public void testFmaF32_2_relaxed() {
- ScriptField_Floats2 floatArray = new ScriptField_Floats2(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_2_relaxed(0x12a, 0);
- }
-
- public void testFmaF32_3() {
- ScriptField_Floats3 floatArray = new ScriptField_Floats3(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_3(0xfae, 0);
- }
-
- public void testFmaF32_3_relaxed() {
- ScriptField_Floats3 floatArray = new ScriptField_Floats3(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_3_relaxed(0xfae, 0);
- }
-
- public void testFmaF32_4() {
- ScriptField_Floats4 floatArray = new ScriptField_Floats4(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_4(0x87a, 0);
- }
-
- public void testFmaF32_4_relaxed() {
- ScriptField_Floats4 floatArray = new ScriptField_Floats4(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_4_relaxed(0x87a, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java
deleted file mode 100644
index 99f2b42..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class FmaxTest extends RSBaseCompute {
- private ScriptC_fmax_f32 script_f32;
- private ScriptC_fmax_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_fmax_f32(mRS);
- script_f32_relaxed = new ScriptC_fmax_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation max, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_fmax_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_fmax_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_fmax_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_fmax_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_fmax_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_fmax_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_fmax_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_fmax_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = Math.max(in[idx], in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testfmaxF32() {
- ScriptField_fmax_f32_in in = new ScriptField_fmax_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12678, 0);
- }
-
- public void testfmaxF32_relaxed() {
- ScriptField_fmax_f32_in in = new ScriptField_fmax_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12678, 0);
- }
-
- public void testfmaxF32_2() {
- ScriptField_fmax_f32_2_in in = new ScriptField_fmax_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x12ace, 0);
- }
-
- public void testfmaxF32_2_relaxed() {
- ScriptField_fmax_f32_2_in in = new ScriptField_fmax_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x12ace, 0);
- }
-
- public void testfmaxF32_3() {
- ScriptField_fmax_f32_3_in in = new ScriptField_fmax_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x12e8, 0);
- }
-
- public void testfmaxF32_3_relaxed() {
- ScriptField_fmax_f32_3_in in = new ScriptField_fmax_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x12e8, 0);
- }
-
- public void testfmaxF32_4() {
- ScriptField_fmax_f32_4_in in = new ScriptField_fmax_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0xeac, 0);
- }
-
- public void testfmaxF32_4_relaxed() {
- ScriptField_fmax_f32_4_in in = new ScriptField_fmax_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0xeac, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java
deleted file mode 100644
index b43b828..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class FminTest extends RSBaseCompute {
- private ScriptC_fmin_f32 script_f32;
- private ScriptC_fmin_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_fmin_f32(mRS);
- script_f32_relaxed = new ScriptC_fmin_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_fmin_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_fmin_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_fmin_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_fmin_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_fmin_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_fmin_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_fmin_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_fmin_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = Math.min(in[idx], in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testfminF32() {
- ScriptField_fmin_f32_in in = new ScriptField_fmin_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12678, 0);
- }
-
- public void testfminF32_relaxed() {
- ScriptField_fmin_f32_in in = new ScriptField_fmin_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12678, 0);
- }
-
- public void testfminF32_2() {
- ScriptField_fmin_f32_2_in in = new ScriptField_fmin_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x12ace, 0);
- }
-
- public void testfminF32_2_relaxed() {
- ScriptField_fmin_f32_2_in in = new ScriptField_fmin_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x12ace, 0);
- }
-
- public void testfminF32_3() {
- ScriptField_fmin_f32_3_in in = new ScriptField_fmin_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x12e8, 0);
- }
-
- public void testfminF32_3_relaxed() {
- ScriptField_fmin_f32_3_in in = new ScriptField_fmin_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x12e8, 0);
- }
-
- public void testfminF32_4() {
- ScriptField_fmin_f32_4_in in = new ScriptField_fmin_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0xeac, 0);
- }
-
- public void testfminF32_4_relaxed() {
- ScriptField_fmin_f32_4_in in = new ScriptField_fmin_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0xeac, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java
deleted file mode 100644
index d0d911d..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class FmodTest extends RSBaseCompute {
- private ScriptC_fmod_f32 script_f32;
- private ScriptC_fmod_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_fmod_f32(mRS);
- script_f32_relaxed = new ScriptC_fmod_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_fmod_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_fmod_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_fmod_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_fmod_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_fmod_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_fmod_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_fmod_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_fmod_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = (float)((double)in[idx] % (double)in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- /**
- * This method is used for testing the fmod() function with F32
- */
- public void testfmodF32() {
- ScriptField_fmod_input_f32 floatArray = new ScriptField_fmod_input_f32(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32(0x12345678, 0);
- }
-
- public void testfmodF32_relaxed() {
- ScriptField_fmod_input_f32 floatArray = new ScriptField_fmod_input_f32(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_relaxed(0x12345678, 0);
- }
-
- /**
- * This method is used for testing the fmod() function with F32_2
- */
- public void testfmodF32_2() {
- ScriptField_fmod_input_f32_2 floatArray = new ScriptField_fmod_input_f32_2(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_2(0x12345, 0);
- }
-
- public void testfmodF32_2_relaxed() {
- ScriptField_fmod_input_f32_2 floatArray = new ScriptField_fmod_input_f32_2(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_2_relaxed(0x12345, 0);
- }
-
- /**
- * This method is used for testing the fmod() function with F32_3
- */
- public void testfmodF32_3() {
- ScriptField_fmod_input_f32_3 floatArray = new ScriptField_fmod_input_f32_3(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_3(0x12345, 0);
- }
-
- public void testfmodF32_3_relaxed() {
- ScriptField_fmod_input_f32_3 floatArray = new ScriptField_fmod_input_f32_3(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_3_relaxed(0x12345, 0);
- }
-
- /**
- * This method is used for testing the fmod() function with F32_4
- */
- public void testfmodF32_4() {
- ScriptField_fmod_input_f32_4 floatArray = new ScriptField_fmod_input_f32_4(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_4(0x12345, 0);
- }
-
- public void testfmodF32_4_relaxed() {
- ScriptField_fmod_input_f32_4 floatArray = new ScriptField_fmod_input_f32_4(mRS, INPUTSIZE);
- mIn = floatArray.getAllocation();
- doF32_4_relaxed(0x12345, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java b/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java
deleted file mode 100644
index c5ce887..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class HypotTest extends RSBaseCompute {
- private ScriptC_hypot_f32 script_f32;
- private ScriptC_hypot_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_hypot_f32(mRS);
- script_f32_relaxed = new ScriptC_hypot_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_hypot_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_hypot_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_hypot_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_hypot_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_hypot_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_hypot_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_hypot_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_hypot_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = (float)Math.hypot((double)in[idx], (double)in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testHypotF32() {
- ScriptField_hypot_f32_in in = new ScriptField_hypot_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x123678, 4);
- }
-
- public void testHypotF32_relaxed() {
- ScriptField_hypot_f32_in in = new ScriptField_hypot_f32_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x123678, 4);
- }
-
- public void testHypotF32_2() {
- ScriptField_hypot_f32_2_in in = new ScriptField_hypot_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x1234a5, 4);
- }
-
- public void testHypotF32_2_relaxed() {
- ScriptField_hypot_f32_2_in in = new ScriptField_hypot_f32_2_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x1234a5, 4);
- }
-
- public void testHypotF32_3() {
- ScriptField_hypot_f32_3_in in = new ScriptField_hypot_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1af345, 4);
- }
-
- public void testHypotF32_3_relaxed() {
- ScriptField_hypot_f32_3_in in = new ScriptField_hypot_f32_3_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1af345, 4);
- }
-
- public void testHypotF32_4() {
- ScriptField_hypot_f32_4_in in = new ScriptField_hypot_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x12ce45, 4);
- }
-
- public void testHypotF32_4_relaxed() {
- ScriptField_hypot_f32_4_in in = new ScriptField_hypot_f32_4_in(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x12ce45, 4);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java
deleted file mode 100644
index bc571a3..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class Log10Test extends RSBaseCompute {
- private ScriptC_log10_f32 script_f32;
- private ScriptC_log10_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_log10_f32(mRS);
- script_f32_relaxed = new ScriptC_log10_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_log10_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_log10_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_log10_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_log10_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_log10_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_log10_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_log10_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_log10_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.log10((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testLog10F32() {
- doF32(0x13, 3);
- }
-
- public void testLog10F32_relaxed() {
- doF32_relaxed(0x13, 16);
- }
-
- public void testLog10F32_2() {
- doF32_2(0xf, 3);
- }
-
- public void testLog10F32_2_relaxed() {
- doF32_2_relaxed(0xf, 16);
- }
-
- public void testLog10F32_3() {
- doF32_3(0xa, 3);
- }
-
- public void testLog10F32_3_relaxed() {
- doF32_3_relaxed(0xa, 16);
- }
-
- public void testLog10F32_4() {
- doF32_4(0xf3, 3);
-
- }
- public void testLog10F32_4_relaxed() {
- doF32_4_relaxed(0xf3, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java b/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java
deleted file mode 100644
index a4daf61..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class Log1PTest extends RSBaseCompute {
- private ScriptC_log1p_f32 script_f32;
- private ScriptC_log1p_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_log1p_f32(mRS);
- script_f32_relaxed = new ScriptC_log1p_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_log1p_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_log1p_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_log1p_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_log1p_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_log1p_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_log1p_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_log1p_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_log1p_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.log1p((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testLog1PF32() {
- doF32(0xab, 2);
- }
-
- public void testLog1PF32_relaxed() {
- doF32_relaxed(0xab, 16);
- }
-
- public void testLog1PF32_2() {
- doF32_2(0x12, 2);
- }
-
- public void testLog1PF32_2_relaxed() {
- doF32_2_relaxed(0x12, 16);
- }
-
- public void testLog1PF32_3() {
- doF32_3(0xa1, 2);
- }
-
- public void testLog1PF32_3_relaxed() {
- doF32_3_relaxed(0xa1, 16);
- }
-
- public void testLog1PF32_4() {
- doF32_4(0xbae, 2);
-
- }
- public void testLog1PF32_4_relaxed() {
- doF32_4_relaxed(0xbae, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java
deleted file mode 100644
index dd13d8d..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class Log2Test extends RSBaseCompute {
- private ScriptC_log2_f32 script_f32;
- private ScriptC_log2_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_log2_f32(mRS);
- script_f32_relaxed = new ScriptC_log2_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_log2_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_log2_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_log2_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_log2_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_log2_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_log2_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_log2_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_log2_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.log10((double)in[idx])/Math.log10(2.0));
- }
- }
- return ref;
- }
-
- public void testLog2F32() {
- doF32(0x18a, 3);
- }
-
- public void testLog2F32_relaxed() {
- doF32_relaxed(0x18a, 128);
- }
-
- public void testLog2F32_2() {
- doF32_2(0xfa, 3);
- }
-
- public void testLog2F32_2_relaxed() {
- doF32_2_relaxed(0xfa, 128);
- }
-
- public void testLog2F32_3() {
- doF32_3(0xaef, 3);
- }
-
- public void testLog2F32_3_relaxed() {
- doF32_3_relaxed(0xaef, 128);
- }
-
- public void testLog2F32_4() {
- doF32_4(0xae62, 3);
-
- }
- public void testLog2F32_4_relaxed() {
- doF32_4_relaxed(0xae62, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java b/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java
deleted file mode 100644
index ee03b4e..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class LogTest extends RSBaseCompute {
- private ScriptC_log_f32 script_f32;
- private ScriptC_log_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_log_f32(mRS);
- script_f32_relaxed = new ScriptC_log_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_log_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_log_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_log_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_log_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_log_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_log_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_log_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_log_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.log((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testLogF32() {
- doF32(0xfae, 3);
- }
-
- public void testLogF32_relaxed() {
- doF32_relaxed(0xfae, 16);
- }
-
- public void testLogF32_2() {
- doF32_2(0x123, 3);
- }
-
- public void testLogF32_2_relaxed() {
- doF32_2_relaxed(0x123, 16);
- }
-
- public void testLogF32_3() {
- doF32_3(0xab4, 3);
- }
-
- public void testLogF32_3_relaxed() {
- doF32_3_relaxed(0xab4, 16);
- }
-
- public void testLogF32_4() {
- doF32_4(0xfa3, 3);
-
- }
- public void testLogF32_4_relaxed() {
- doF32_4_relaxed(0xfa3, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java b/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java
deleted file mode 100644
index b42d680..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class LogbTest extends RSBaseCompute {
- private ScriptC_logb_f32 script_f32;
- private ScriptC_logb_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_logb_f32(mRS);
- script_f32_relaxed = new ScriptC_logb_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_logb_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_logb_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_logb_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_logb_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_logb_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_logb_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_logb_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_logb_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = ((Float.floatToIntBits(in[idx]) >> 23) & 0xFF) - 127.0f;
- }
- }
- return ref;
- }
-
- public void testLogbF32() {
- doF32(0xe, 0);
- }
-
- public void testLogbF32_relaxed() {
- doF32_relaxed(0xe, 0);
- }
-
- public void testLogbF32_2() {
- doF32_2(0xa1, 0);
- }
-
- public void testLogbF32_2_relaxed() {
- doF32_2_relaxed(0xa1, 0);
- }
-
- public void testLogbF32_3() {
- doF32_3(0xab2, 0);
- }
-
- public void testLogbF32_3_relaxed() {
- doF32_3_relaxed(0xab2, 0);
- }
-
- public void testLogbF32_4() {
- doF32_4(0xaa2, 0);
-
- }
- public void testLogbF32_4_relaxed() {
- doF32_4_relaxed(0xaa2, 0);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java b/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java
deleted file mode 100644
index 3662035..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class MadTest extends RSBaseCompute {
- private ScriptC_mad_f32 script_f32;
- private ScriptC_mad_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_mad_f32(mRS);
- script_f32_relaxed = new ScriptC_mad_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_mad_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_mad_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_mad_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_mad_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_mad_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_mad_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_mad_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_mad_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 3 + j;
- ref[i * (stride - skip) + j] = (float)((double)in[idx] * (double)in[idx+stride] + (double)in[idx+stride*2]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*3];
- }
-
- public void testMadF32() {
- ScriptField_mad_input_f32 in = new ScriptField_mad_input_f32(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x123678, 4);
- }
-
- public void testMadF32_relaxed() {
- ScriptField_mad_input_f32 in = new ScriptField_mad_input_f32(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x123678, 4);
- }
-
- public void testMadF32_2() {
- ScriptField_mad_input_f32_2 in = new ScriptField_mad_input_f32_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x1234a5, 4);
- }
-
- public void testMadF32_2_relaxed() {
- ScriptField_mad_input_f32_2 in = new ScriptField_mad_input_f32_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x1234a5, 4);
- }
-
- public void testMadF32_3() {
- ScriptField_mad_input_f32_3 in = new ScriptField_mad_input_f32_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1af345, 4);
- }
-
- public void testMadF32_3_relaxed() {
- ScriptField_mad_input_f32_3 in = new ScriptField_mad_input_f32_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1af345, 4);
- }
-
- public void testMadF32_4() {
- ScriptField_mad_input_f32_4 in = new ScriptField_mad_input_f32_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x12ce45, 4);
- }
-
- public void testMadF32_4_relaxed() {
- ScriptField_mad_input_f32_4 in = new ScriptField_mad_input_f32_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x12ce45, 4);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java b/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java
deleted file mode 100644
index 468b341..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class NextafterTest extends RSBaseCompute {
- private ScriptC_nextafter_f32 script_f32;
- private ScriptC_nextafter_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_nextafter_f32(mRS);
- script_f32_relaxed = new ScriptC_nextafter_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_nextafter_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_nextafter_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_nextafter_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_nextafter_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_nextafter_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_nextafter_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_nextafter_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_nextafter_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = Math.nextAfter(in[idx],(double)in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testNextafterF32() {
- ScriptField_InputData inputDataArray = new ScriptField_InputData(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32(0x12678, 0);
- }
-
- public void testNextafterF32_relaxed() {
- ScriptField_InputData inputDataArray = new ScriptField_InputData(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32_relaxed(0x12678, 0);
- }
-
- public void testNextafterF32_2() {
- ScriptField_InputData_2 inputDataArray = new ScriptField_InputData_2(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32_2(0x1af45, 0);
- }
-
- public void testNextafterF32_2_relaxed() {
- ScriptField_InputData_2 inputDataArray = new ScriptField_InputData_2(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32_2_relaxed(0x1af45, 0);
- }
-
- public void testNextafterF32_3() {
- ScriptField_InputData_3 inputDataArray = new ScriptField_InputData_3(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32_3(0x1cd345, 0);
- }
-
- public void testNextafterF32_3_relaxed() {
- ScriptField_InputData_3 inputDataArray = new ScriptField_InputData_3(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32_3_relaxed(0x1cd345, 0);
- }
-
- public void testNextafterF32_4() {
- ScriptField_InputData_4 inputDataArray = new ScriptField_InputData_4(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32_4(0x1ca45, 0);
- }
-
- public void testNextafterF32_4_relaxed() {
- ScriptField_InputData_4 inputDataArray = new ScriptField_InputData_4(mRS, INPUTSIZE);
- mIn = inputDataArray.getAllocation();
- doF32_4_relaxed(0x1ca45, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java
deleted file mode 100644
index 967e52b..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class PowTest extends RSBaseCompute {
- private ScriptC_pow_f32 script_f32;
- private ScriptC_pow_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_pow_f32(mRS);
- script_f32_relaxed = new ScriptC_pow_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_pow_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_pow_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_pow_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_pow_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_pow_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_pow_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_pow_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_pow_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride * 2 + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)Math.pow((double)in[idx], (double)in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- @Override
- protected void fillRandomFloats(long seed, float min, float max, float[] inArray) {
- RSUtils.genRandomFloats(seed, -16.0f, 16.0f, inArray);
- }
-
- public void testPowF32() {
- ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12345678, 16);
- }
-
- public void testPowF32_relaxed() {
- ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12345678, 128);
- }
-
- public void testPowF32_2() {
- ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x12ab78, 16);
- }
-
- public void testPowF32_2_relaxed() {
- ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x12ab78, 128);
- }
-
- public void testPowF32_3() {
- ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1f5678, 16);
- }
-
- public void testPowF32_3_relaxed() {
- ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1f5678, 128);
- }
-
- public void testPowF32_4() {
- ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0xc678, 16);
- }
-
- public void testPowF32_4_relaxed() {
- ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0xc678, 128);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java
deleted file mode 100644
index 6a47d8f..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class PownTest extends RSBaseCompute {
- private ScriptC_pown_f32 script_f32;
- private ScriptC_pown_f32_relaxed script_f32_relaxed;
- private int[] n;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_pown_f32(mRS);
- script_f32_relaxed = new ScriptC_pown_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_pown_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_pown_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_pown_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_pown_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_pown_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_pown_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_pown_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_pown_f32_4(mIn, mOut);
- break;
-
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)Math.pow((double)in[idx], (double)n[idx]);
- }
- }
- return ref;
- }
-
- public void testPownF32() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE];
- RSUtils.genRandomInts(0x12345678, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32.set_n1(nAlloc);
-
- doF32(0x716acd, 16);
- }
-
- public void testPownF32_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE];
- RSUtils.genRandomInts(0x12345678, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n1(nAlloc);
-
- doF32_relaxed(0x716acd, 128);
- }
-
- public void testPownF32_2() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*2];
- RSUtils.genRandomInts(0xacdef1, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32.set_n2(nAlloc);
-
- doF32_2(0xacdef1, 16);
- }
-
- public void testPownF32_2_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*2];
- RSUtils.genRandomInts(0xacdef1, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n2(nAlloc);
-
- doF32_2_relaxed(0xacdef1, 128);
- }
-
- public void testPownF32_3() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0xa123f1, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32.set_n3(nAlloc);
-
- doF32_3(0xaac3f1, 16);
- }
-
- public void testPownF32_3_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0xa123f1, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n3(nAlloc);
-
- doF32_3_relaxed(0xaac3f1, 128);
- }
-
- public void testPownF32_4() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0x4323ca, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32.set_n4(nAlloc);
-
- doF32_4(0xaa12f1, 16);
- }
-
- public void testPownF32_4_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0x4323ca, -16, 15, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n4(nAlloc);
-
- doF32_4_relaxed(0xaa12f1, 128);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java
deleted file mode 100644
index a957418..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class PowrTest extends RSBaseCompute {
- private ScriptC_powr_f32 script_f32;
- private ScriptC_powr_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_powr_f32(mRS);
- script_f32_relaxed = new ScriptC_powr_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_powr_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_powr_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_powr_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_powr_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_powr_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_powr_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_powr_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_powr_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride * 2 + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)Math.pow((double)in[idx], (double)in[idx+stride]);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- @Override
- protected void fillRandomFloats(long seed, float min, float max, float[] inArray) {
- RSUtils.genRandomFloats(seed, 0.0f, 64.0f, inArray);
- }
-
- public void testPowrF32() {
- ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12345678, 16);
- }
-
- public void testPowrF32_relaxed() {
- ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12345678, 128);
- }
-
- public void testPowrF32_2() {
- ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x12ab78, 16);
- }
-
- public void testPowrF32_2_relaxed() {
- ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x12ab78, 128);
- }
-
- public void testPowrF32_3() {
- ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1f5678, 16);
- }
-
- public void testPowrF32_3_relaxed() {
- ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1f5678, 128);
- }
-
- public void testPowrF32_4() {
- ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0xc678, 16);
- }
-
- public void testPowrF32_4_relaxed() {
- ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0xc678, 128);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java b/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
index f2554c4..bbca167 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
@@ -28,15 +28,6 @@
*/
class RSBaseCompute extends RSBase {
RenderScript mRS;
-
- static final int TEST_F32 = 0;
- static final int TEST_F32_2 = 1;
- static final int TEST_F32_3 = 2;
- static final int TEST_F32_4 = 3;
- static final int TEST_RELAXED_F32 = 4;
- static final int TEST_RELAXED_F32_2 = 5;
- static final int TEST_RELAXED_F32_3 = 6;
- static final int TEST_RELAXED_F32_4 = 7;
protected int INPUTSIZE = 512;
@Override
@@ -85,65 +76,280 @@
}
}
- private void baseTestHelper(int testid, Element inElement, Element outElement, long seed, float min,
- float max, int rStride, int rSkip, int refStride, int outStride,
- int inStride, int skip, int ulp) {
- float[] inArray = makeInArray(INPUTSIZE * inStride);
- fillRandomFloats(seed, min, max, inArray);
- float[] refArray = getRefArray(inArray, INPUTSIZE, inStride, skip);
-
- Allocation mAllocationIn = setInAlloc(inElement);
- fillInAlloc(mAllocationIn, inArray);
-
- Allocation mAllocationOut = setOutAlloc(outElement);
- try {
- forEach(testid, mAllocationIn, mAllocationOut);
- } catch (RSRuntimeException e) {
- Log.e("RenderscriptCTS", "Caught RSRuntimeException: " +
- e.getMessage());
+ // TODO Is there a better way to do this
+ protected Element getElement(RenderScript rs, Element.DataType dataType, int size) {
+ Element element = null;
+ if (size == 1) {
+ if (dataType == Element.DataType.FLOAT_64) {
+ element = Element.F64(rs);
+ } else if (dataType == Element.DataType.FLOAT_32) {
+ element = Element.F32(rs);
+ } else if (dataType == Element.DataType.SIGNED_64) {
+ element = Element.I64(rs);
+ } else if (dataType == Element.DataType.UNSIGNED_64) {
+ element = Element.U64(rs);
+ } else if (dataType == Element.DataType.SIGNED_32) {
+ element = Element.I32(rs);
+ } else if (dataType == Element.DataType.UNSIGNED_32) {
+ element = Element.U32(rs);
+ } else if (dataType == Element.DataType.SIGNED_16) {
+ element = Element.I16(rs);
+ } else if (dataType == Element.DataType.UNSIGNED_16) {
+ element = Element.U16(rs);
+ } else if (dataType == Element.DataType.SIGNED_8) {
+ element = Element.I8(rs);
+ } else if (dataType == Element.DataType.UNSIGNED_8) {
+ element = Element.U8(rs);
+ } else {
+ android.util.Log.e("RenderscriptCTS", "Don't know how to create allocation of type" +
+ dataType.toString());
+ }
+ } else {
+ element = Element.createVector(rs, dataType, size);
}
- float[] outArray = makeOutArray(INPUTSIZE * outStride);
- mAllocationOut.copyTo(outArray);
- checkArray(refArray, outArray, INPUTSIZE, refStride, outStride, ulp);
+ return element;
}
- public void baseTest(int testid, long seed, int refStride, int outStride, int inStride, int skip, int ulp) {
- baseTestHelper(testid, null, null, seed, 0.0f, 1.0f, 1, 0, refStride, outStride, inStride, skip, ulp);
+ protected Allocation createRandomAllocation(RenderScript rs, Element.DataType dataType,
+ int size, long seed, boolean includeExtremes) {
+ Element element = getElement(rs, dataType, size);
+ Allocation alloc = Allocation.createSized(rs, element, INPUTSIZE);
+ int width = (size == 3) ? 4 : size;
+ /* TODO copy1DRangeFrom does not work for double
+ if (dataType == Element.DataType.FLOAT_64) {
+ double[] inArray = new double[INPUTSIZE * width];
+ RSUtils.genRandomDoubles(seed, inArray, includeExtremes);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else
+ */
+ if (dataType == Element.DataType.FLOAT_32) {
+ float[] inArray = new float[INPUTSIZE * width];
+ RSUtils.genRandomFloats(seed, inArray, includeExtremes);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ /* TODO copy1DRangFrom does not work for long
+ } else if (dataType == Element.DataType.SIGNED_64) {
+ long[] inArray = new long[INPUTSIZE * width];
+ RSUtils.genRandomLongs(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.UNSIGNED_64) {
+ long[] inArray = new long[INPUTSIZE * width];
+ RSUtils.genRandomLongs(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ */
+ } else if (dataType == Element.DataType.SIGNED_32) {
+ int[] inArray = new int[INPUTSIZE * width];
+ RSUtils.genRandomInts(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.UNSIGNED_32) {
+ int[] inArray = new int[INPUTSIZE * width];
+ RSUtils.genRandomInts(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.SIGNED_16) {
+ short[] inArray = new short[INPUTSIZE * width];
+ RSUtils.genRandomShorts(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.UNSIGNED_16) {
+ short[] inArray = new short[INPUTSIZE * width];
+ RSUtils.genRandomShorts(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.SIGNED_8) {
+ byte[] inArray = new byte[INPUTSIZE * width];
+ RSUtils.genRandomBytes(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.UNSIGNED_8) {
+ byte[] inArray = new byte[INPUTSIZE * width];
+ RSUtils.genRandomBytes(seed, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else {
+ android.util.Log.e("RenderscriptCTS", "Don't know how to create allocation of type" +
+ dataType.toString());
+ }
+ return alloc;
}
- public void doF32(long seed, int ulp) {
- baseTestHelper(TEST_F32, Element.F32(mRS), Element.F32(mRS), seed, 0.0f, 1.0f, 1, 0, 1, 1, 1, 0, ulp);
+ protected Allocation createRandomAllocation(RenderScript rs, Element.DataType dataType,
+ int size, long seed, double minValue, double maxValue) {
+ Element element = getElement(rs, dataType, size);
+ Allocation alloc = Allocation.createSized(rs, element, INPUTSIZE);
+ int width = (size == 3) ? 4 : size;
+ /* TODO copy1DRangeFrom does not work for double
+ if (dataType == Element.DataType.FLOAT_64) {
+ double[] inArray = new double[INPUTSIZE * width];
+ RSUtils.genRandomDoubles(seed, minValue, maxValue, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else */
+ if (dataType == Element.DataType.FLOAT_32) {
+ float[] inArray = new float[INPUTSIZE * width];
+ RSUtils.genRandomFloats(seed, (float) minValue, (float) maxValue, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else {
+ android.util.Log.e("RenderscriptCTS", "Range is only supported fro floats, not for " +
+ dataType.toString());
+ }
+ return alloc;
}
- public void doF32_2(long seed, int ulp) {
- baseTestHelper(TEST_F32_2, Element.F32_2(mRS), Element.F32_2(mRS), seed, 0.0f, 1.0f, 1, 0, 2, 2, 2, 0, ulp);
+ protected <T> void enforceOrdering(/*RenderScript rs,*/ Allocation minAlloc, Allocation maxAlloc) {
+ Element element = minAlloc.getElement();
+ int stride = element.getVectorSize();
+ if (stride == 3) {
+ stride = 4;
+ }
+ int size = INPUTSIZE * stride;
+ Element.DataType dataType = element.getDataType();
+ /* TODO copy1DRangeFrom does not work for double
+ if (dataType == Element.DataType.FLOAT_64) {
+ double[] minArray = new double[size];
+ double[] maxArray = new double[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ if (minArray[i] > maxArray[i]) {
+ double temp = minArray[i];
+ minArray[i] = maxArray[i];
+ maxArray[i] = temp;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else */
+ if (dataType == Element.DataType.FLOAT_32) {
+ float[] minArray = new float[size];
+ float[] maxArray = new float[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ if (minArray[i] > maxArray[i]) {
+ float temp = minArray[i];
+ minArray[i] = maxArray[i];
+ maxArray[i] = temp;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ /* TODO copy1DRangFrom does not work for long
+ } else if (dataType == Element.DataType.SIGNED_64) {
+ long[] minArray = new long[size];
+ long[] maxArray = new long[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ if (minArray[i] > maxArray[i]) {
+ long temp = minArray[i];
+ minArray[i] = maxArray[i];
+ maxArray[i] = temp;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else if (dataType == Element.DataType.UNSIGNED_64) {
+ long[] minArray = new long[size];
+ long[] maxArray = new long[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ if (RSUtils.compareUnsignedLong(minArray[i], maxArray[i]) > 0) {
+ long temp = minArray[i];
+ minArray[i] = maxArray[i];
+ maxArray[i] = temp;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ */
+ } else if (dataType == Element.DataType.SIGNED_32) {
+ int[] minArray = new int[size];
+ int[] maxArray = new int[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ if (minArray[i] > maxArray[i]) {
+ int temp = minArray[i];
+ minArray[i] = maxArray[i];
+ maxArray[i] = temp;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else if (dataType == Element.DataType.UNSIGNED_32) {
+ int[] minArray = new int[size];
+ int[] maxArray = new int[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ long min = minArray[i] &0xffffffffl;
+ long max = maxArray[i] &0xffffffffl;
+ if (min > max) {
+ minArray[i] = (int) max;
+ maxArray[i] = (int) min;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else if (dataType == Element.DataType.SIGNED_16) {
+ short[] minArray = new short[size];
+ short[] maxArray = new short[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ if (minArray[i] > maxArray[i]) {
+ short temp = minArray[i];
+ minArray[i] = maxArray[i];
+ maxArray[i] = temp;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else if (dataType == Element.DataType.UNSIGNED_16) {
+ short[] minArray = new short[size];
+ short[] maxArray = new short[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ int min = minArray[i] &0xffff;
+ int max = maxArray[i] &0xffff;
+ if (min > max) {
+ minArray[i] = (short) max;
+ maxArray[i] = (short) min;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else if (dataType == Element.DataType.SIGNED_8) {
+ byte[] minArray = new byte[size];
+ byte[] maxArray = new byte[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ if (minArray[i] > maxArray[i]) {
+ byte temp = minArray[i];
+ minArray[i] = maxArray[i];
+ maxArray[i] = temp;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else if (dataType == Element.DataType.UNSIGNED_8) {
+ byte[] minArray = new byte[size];
+ byte[] maxArray = new byte[size];
+ minAlloc.copyTo(minArray);
+ maxAlloc.copyTo(maxArray);
+ for (int i = 0; i < size; i++) {
+ int min = minArray[i] &0xff;
+ int max = maxArray[i] &0xff;
+ if (min > max) {
+ minArray[i] = (byte) max;
+ maxArray[i] = (byte) min;
+ }
+ }
+ minAlloc.copyFrom(minArray);
+ maxAlloc.copyFrom(maxArray);
+ } else {
+ android.util.Log.e("RenderscriptCTS", "Ordering not supported for " +
+ dataType.toString());
+ }
}
- public void doF32_3(long seed, int ulp) {
- baseTestHelper(TEST_F32_3, Element.F32_3(mRS), Element.F32_3(mRS), seed, 0.0f, 1.0f, 4, 1, 3, 4, 4, 1, ulp);
- }
-
- public void doF32_4(long seed, int ulp) {
- baseTestHelper(TEST_F32_4, Element.F32_4(mRS), Element.F32_4(mRS), seed, 0.0f, 1.0f, 1, 0, 4, 4, 4, 0, ulp);
- }
-
- public void doF32_relaxed(long seed, int ulp) {
- baseTestHelper(TEST_RELAXED_F32, Element.F32(mRS), Element.F32(mRS), seed, 0.0f, 1.0f, 1, 0, 1, 1, 1, 0, ulp);
- }
-
- public void doF32_2_relaxed(long seed, int ulp) {
- baseTestHelper(TEST_RELAXED_F32_2, Element.F32_2(mRS), Element.F32_2(mRS), seed, 0.0f, 1.0f, 1, 0, 2, 2, 2, 0, ulp);
- }
-
- public void doF32_3_relaxed(long seed, int ulp) {
- baseTestHelper(TEST_RELAXED_F32_3, Element.F32_3(mRS), Element.F32_3(mRS), seed, 0.0f, 1.0f, 4, 1, 3, 4, 4, 1, ulp);
- }
-
- public void doF32_4_relaxed(long seed, int ulp) {
- baseTestHelper(TEST_RELAXED_F32_4, Element.F32_4(mRS), Element.F32_4(mRS), seed, 0.0f, 1.0f, 1, 0, 4, 4, 4, 0, ulp);
- }
-
-
public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
// Intentionally empty... subclass will likely define only one, but not both
}
@@ -151,33 +357,4 @@
public void forEach(int testId, Allocation mIn) throws RSRuntimeException {
// Intentionally empty... subclass will likely define only one, but not both
}
-
- //These are default actions for these functions, specific tests overload them
- protected float[] getRefArray(float[] inArray, int size, int stride, int skip) {
- return null;
- }
-
- protected Allocation setInAlloc(Element e) {
- return Allocation.createSized(mRS, e, INPUTSIZE);
- }
-
- protected Allocation setOutAlloc(Element e) {
- return Allocation.createSized(mRS, e, INPUTSIZE);
- }
-
- protected float[] makeInArray(int size) {
- return new float[size];
- }
-
- protected float[] makeOutArray(int size) {
- return new float[size];
- }
-
- protected void fillRandomFloats(long seed, float min, float max, float[] inArray) {
- RSUtils.genRandomFloats(seed, min, max, inArray);
- }
-
- protected void fillInAlloc(Allocation mIn, float[] inArray) {
- mIn.copy1DRangeFromUnchecked(0, INPUTSIZE, inArray);
- }
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java b/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
index 9165bdb..3c760f0 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
@@ -28,6 +28,17 @@
public class RSUtils {
/**
+ * Fills the array with random doubles. Values will be between min (inclusive) and
+ * max (inclusive).
+ */
+ public static void genRandomDoubles(long seed, double min, double max, double array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = min + r.nextDouble() * (max - min);
+ }
+ }
+
+ /**
* Fills the array with random floats. Values will be between min (inclusive) and
* max (inclusive).
*/
@@ -39,13 +50,160 @@
}
/**
- * Fills the array with random floats. Values will be between min (inclusive) and
+ * Fills the array with random ints. Values will be between min (inclusive) and
* max (inclusive).
*/
public static void genRandomInts(long seed, int min, int max, int array[]) {
Random r = new Random(seed);
for (int i = 0; i < array.length; i++) {
- array[i] = min + r.nextInt(max - min + 1);
+ long range = max - min + 1;
+ array[i] = (int) (min + r.nextLong() % range);
}
}
+
+ /**
+ * Fills the array with random doubles.
+ */
+ public static void genRandomDoubles(long seed, double array[], boolean includeExtremes) {
+ Random r = new Random(seed);
+ // TODO The ranges for float is too small. We need to accept a wider range of values.
+ double min = -4.0 * Math.PI; // TODO
+ double max = 4.0 * Math.PI;
+ for (int i = 0; i < array.length; i++) {
+ array[i] = min + r.nextDouble() * (max - min);
+ }
+ // Seed a few special numbers we want to be sure to test.
+ array[r.nextInt(array.length)] = 0.0;
+ array[r.nextInt(array.length)] = 1.0;
+ array[r.nextInt(array.length)] = Math.E;
+ array[r.nextInt(array.length)] = Math.PI;
+ array[r.nextInt(array.length)] = Math.PI / 2f;
+ array[r.nextInt(array.length)] = Math.PI * 2f;
+ array[r.nextInt(array.length)] = -0.0;
+ array[r.nextInt(array.length)] = -1.0;
+ array[r.nextInt(array.length)] = -Math.E;
+ array[r.nextInt(array.length)] = -Math.PI;
+ array[r.nextInt(array.length)] = -Math.PI / 2.0;
+ array[r.nextInt(array.length)] = -Math.PI * 2.0;
+ if (includeExtremes) {
+ array[r.nextInt(array.length)] = Double.NaN;
+ array[r.nextInt(array.length)] = Double.POSITIVE_INFINITY;
+ array[r.nextInt(array.length)] = Double.NEGATIVE_INFINITY;
+ array[r.nextInt(array.length)] = Double.MIN_VALUE;
+ array[r.nextInt(array.length)] = Double.MIN_NORMAL;
+ array[r.nextInt(array.length)] = Double.MAX_VALUE;
+ }
+ }
+
+ /**
+ * Fills the array with random floats. Values will be between min (inclusive) and
+ * max (inclusive).
+ */
+ public static void genRandomFloats(long seed, float array[], boolean includeExtremes) {
+ Random r = new Random(seed);
+ // TODO The ranges for float is too small. We need to accept a wider range of values.
+ float min = -4.0f * (float) Math.PI;
+ float max = 4.0f * (float) Math.PI;
+ for (int i = 0; i < array.length; i++) {
+ array[i] = min + r.nextFloat() * (max - min);
+ }
+ // Seed a few special numbers we want to be sure to test.
+ array[r.nextInt(array.length)] = 0.0f;
+ array[r.nextInt(array.length)] = 1.0f;
+ array[r.nextInt(array.length)] = (float) Math.E;
+ array[r.nextInt(array.length)] = (float) Math.PI;
+ array[r.nextInt(array.length)] = (float) Math.PI / 2.0f;
+ array[r.nextInt(array.length)] = (float) Math.PI * 2.0f;
+ array[r.nextInt(array.length)] = -0.0f;
+ array[r.nextInt(array.length)] = -1.0f;
+ array[r.nextInt(array.length)] = (float) -Math.E;
+ array[r.nextInt(array.length)] = (float) -Math.PI;
+ array[r.nextInt(array.length)] = (float) -Math.PI / 2.0f;
+ array[r.nextInt(array.length)] = (float) -Math.PI * 2.0f;
+ if (includeExtremes) {
+ array[r.nextInt(array.length)] = Float.NaN;
+ array[r.nextInt(array.length)] = Float.POSITIVE_INFINITY;
+ array[r.nextInt(array.length)] = Float.NEGATIVE_INFINITY;
+ array[r.nextInt(array.length)] = Float.MIN_VALUE;
+ array[r.nextInt(array.length)] = Float.MIN_NORMAL;
+ array[r.nextInt(array.length)] = Float.MAX_VALUE;
+ }
+ }
+
+ /**
+ * Fills the array with random longs.
+ */
+ public static void genRandomLongs(long seed, long array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = r.nextLong();
+ }
+ // Seed a few special numbers we want to be sure to test.
+ array[r.nextInt(array.length)] = (long) 0xffffffffffffffffl;
+ array[r.nextInt(array.length)] = (long) 0x8000000000000000l;
+ array[r.nextInt(array.length)] = (long) 0x7fffffffffffffffl;
+ array[r.nextInt(array.length)] = 1l;
+ array[r.nextInt(array.length)] = 0l;
+ }
+
+ /**
+ * Fills the array with random ints.
+ */
+ public static void genRandomInts(long seed, int array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = r.nextInt();
+ }
+ // Seed a few special numbers we want to be sure to test.
+ array[r.nextInt(array.length)] = (int) 0xffffffff;
+ array[r.nextInt(array.length)] = (int) 0x80000000;
+ array[r.nextInt(array.length)] = (int) 0x7fffffff;
+ array[r.nextInt(array.length)] = (int) 1;
+ array[r.nextInt(array.length)] = (int) 0;
+ }
+
+ /**
+ * Fills the array with random shorts.
+ */
+ public static void genRandomShorts(long seed, short array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = (short) r.nextInt();
+ }
+ // Seed a few special numbers we want to be sure to test.
+ array[r.nextInt(array.length)] = (short) 0xffff;
+ array[r.nextInt(array.length)] = (short) 0x8000;
+ array[r.nextInt(array.length)] = (short) 0x7fff;
+ array[r.nextInt(array.length)] = (short) 1;
+ array[r.nextInt(array.length)] = (short) 0;
+ }
+
+ /**
+ * Fills the array with random bytes.
+ */
+ public static void genRandomBytes(long seed, byte array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = (byte) r.nextInt();
+ }
+ // Seed a few special numbers we want to be sure to test.
+ array[r.nextInt(array.length)] = (byte) 0xff;
+ array[r.nextInt(array.length)] = (byte) 0x80;
+ array[r.nextInt(array.length)] = (byte) 0x7f;
+ array[r.nextInt(array.length)] = (byte) 1;
+ array[r.nextInt(array.length)] = (byte) 0;
+ }
+
+ // Compares two unsigned long. Returns < 0 if a < b, 0 if a == b, > 0 if a > b.
+ public static long compareUnsignedLong(long a, long b) {
+ long aFirstFourBits = a >>> 60;
+ long bFirstFourBits = b >>> 60;
+ long firstFourBitsDiff = aFirstFourBits - bFirstFourBits;
+ if (firstFourBitsDiff != 0) {
+ return firstFourBitsDiff;
+ }
+ long aRest = a & 0x0fffffffffffffffl;
+ long bRest = b & 0x0fffffffffffffffl;
+ return aRest - bRest;
+ }
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java
deleted file mode 100644
index a0c7834..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class RadiansTest extends RSBaseCompute {
- private ScriptC_radians_f32 script_f32;
- private ScriptC_radians_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_radians_f32(mRS);
- script_f32_relaxed = new ScriptC_radians_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_radians_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_radians_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_radians_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_radians_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_radians_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_radians_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_radians_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_radians_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- double val = (double)in[idx] * (Math.PI / 180.0);
- ref[idxRef] = (float)val;
- }
- }
- return ref;
- }
-
- /**
- * radians test for float
- */
- public void testRadiansF32() {
- doF32(0x1234f678, 3);
- }
-
- public void testRadiansF32_relaxed() {
- doF32_relaxed(0x1234f678, 3);
- }
-
- /**
- * radians test for float2
- */
- public void testRadiansF32_2() {
- doF32_2(0x12345678, 3);
- }
-
- public void testRadiansF32_2_relaxed() {
- doF32_2_relaxed(0x12345678, 3);
- }
-
- /**
- * radians test for float3
- */
- public void testRadiansF32_3() {
- doF32_3(0x123d5678, 3);
- }
-
- public void testRadiansF32_3_relaxed() {
- doF32_3_relaxed(0x123d5678, 3);
- }
-
- /**
- * radians test for float4
- */
- public void testRadiansF32_4() {
- doF32_4(0x123a5678, 3);
-
- }
- public void testRadiansF32_4_relaxed() {
- doF32_4_relaxed(0x123a5678, 3);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java
deleted file mode 100644
index edd3320..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class RemainderTest extends RSBaseCompute {
- private ScriptC_remainder_f32 script_f32;
- private ScriptC_remainder_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_remainder_f32(mRS);
- script_f32_relaxed = new ScriptC_remainder_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_remainder_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_remainder_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_remainder_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_remainder_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_remainder_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_remainder_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_remainder_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_remainder_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- double num = (double)in[idx];
- double den = (double)in[idx+stride];
- ref[i * (stride - skip) + j] = (float)(num - Math.round(num / den) * den);
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testRemainderF32() {
- ScriptField_remainder_f32 in = new ScriptField_remainder_f32(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x123678, 0);
- }
-
- public void testRemainderF32_relaxed() {
- ScriptField_remainder_f32 in = new ScriptField_remainder_f32(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x123678, 0);
- }
-
- public void testRemainderF32_2() {
- ScriptField_remainder_f32_2 in = new ScriptField_remainder_f32_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x1234a5, 0);
- }
-
- public void testRemainderF32_2_relaxed() {
- ScriptField_remainder_f32_2 in = new ScriptField_remainder_f32_2(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x1234a5, 0);
- }
-
- public void testRemainderF32_3() {
- ScriptField_remainder_f32_3 in = new ScriptField_remainder_f32_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0x1af345, 0);
- }
-
- public void testRemainderF32_3_relaxed() {
- ScriptField_remainder_f32_3 in = new ScriptField_remainder_f32_3(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0x1af345, 0);
- }
-
- public void testRemainderF32_4() {
- ScriptField_remainder_f32_4 in = new ScriptField_remainder_f32_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x12ce45, 0);
- }
-
- public void testRemainderF32_4_relaxed() {
- ScriptField_remainder_f32_4 in = new ScriptField_remainder_f32_4(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x12ce45, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java
deleted file mode 100644
index 56c0acf..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class RintTest extends RSBaseCompute {
- private ScriptC_rint_f32 script_f32;
- private ScriptC_rint_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_rint_f32(mRS);
- script_f32_relaxed = new ScriptC_rint_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut)
- throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_rint_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_rint_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_rint_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_rint_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_rint_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_rint_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_rint_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_rint_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * (stride - skip)];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idxIn = i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float) Math.rint(inArray[idxIn]);
- }
- }
- return ref;
- }
-
- /**
- * rint test for float
- */
- public void testRintF32() {
- doF32(0x12345678, 0);
- }
-
- public void testRintF32_relaxed() {
- doF32_relaxed(0x12345678, 0);
- }
-
- /**
- * rint test for float2
- */
- public void testRintF32_2() {
- doF32_2(0x12ab5678, 0);
- }
-
- public void testRintF32_2_relaxed() {
- doF32_2_relaxed(0x12ab5678, 0);
- }
-
- /**
- * rint test for float3
- */
- public void testRintF32_3() {
- doF32_3(0x123ac678, 0);
- }
-
- public void testRintF32_3_relaxed() {
- doF32_3_relaxed(0x123ac678, 0);
- }
-
- /**
- * rint test for float4
- */
- public void testRintF32_4() {
- doF32_4(0x1f345678, 0);
-
- }
- public void testRintF32_4_relaxed() {
- doF32_4_relaxed(0x1f345678, 0);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java
deleted file mode 100644
index a253669..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class RootnTest extends RSBaseCompute {
- private ScriptC_rootn_f32 script_f32;
- private ScriptC_rootn_f32_relaxed script_f32_relaxed;
- private int[] n;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_rootn_f32(mRS);
- script_f32_relaxed = new ScriptC_rootn_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_rootn_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_rootn_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_rootn_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_rootn_f32_4(mIn, mOut);
- break;
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_rootn_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_rootn_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_rootn_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_rootn_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)Math.pow((double)in[idx], 1.0/(double)n[idx]);
- }
- }
- return ref;
- }
-
- public void testRootnF32() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE];
- RSUtils.genRandomInts(0x12345678, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32.set_n1(nAlloc);
-
- doF32(0x716acd, 16);
- }
-
- public void testRootnF32_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE];
- RSUtils.genRandomInts(0x12345678, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n1(nAlloc);
-
- doF32_relaxed(0x716acd, 16);
- }
-
-
- public void testRootnF32_2() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*2];
- RSUtils.genRandomInts(0xacdef1, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32.set_n2(nAlloc);
-
- doF32_2(0xacdef1, 16);
- }
-
- public void testRootnF32_2_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*2];
- RSUtils.genRandomInts(0xacdef1, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n2(nAlloc);
-
- doF32_2_relaxed(0xacdef1, 16);
- }
-
-
- public void testRootnF32_3() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0xa123f1, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32.set_n3(nAlloc);
-
- doF32_3(0xaac3f1, 16);
- }
-
- public void testRootnF32_3_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0xa123f1, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n3(nAlloc);
-
- doF32_3_relaxed(0xaac3f1, 16);
- }
-
- public void testRootnF32_4() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0x4323ca, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32.set_n4(nAlloc);
-
- doF32_4(0xaa12f1, 16);
- }
-
- public void testRootnF32_4_relaxed() {
- Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
-
- n = new int[INPUTSIZE*4];
- RSUtils.genRandomInts(0x4323ca, 1, 32, n);
- nAlloc.copyFrom(n);
- script_f32_relaxed.set_n4(nAlloc);
-
- doF32_4_relaxed(0xaa12f1, 16);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java
deleted file mode 100644
index ab85bc1..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class RoundTest extends RSBaseCompute {
- private ScriptC_round_f32 script_f32;
- private ScriptC_round_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_round_f32(mRS);
- script_f32_relaxed = new ScriptC_round_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut)
- throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_round_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_round_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_round_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_round_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_round_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_round_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_round_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_round_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * (stride - skip)];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idxIn = i * stride + j;
- int idxRef = i * (stride - skip) + j;
- int res = ((Float.floatToIntBits(inArray[idxIn]) >> 31) & 0x01);
- float roundValue = (float) Math.round(inArray[idxIn]);
- float expective = roundValue;
- if ((roundValue - inArray[idxIn]) == 0.5f && res == 1)
- expective -= 1;
- if (res == 1 && expective == +0.0f) {
- expective = -0.0f;
- }
- ref[idxRef] = expective;
- }
- }
- return ref;
- }
-
- /**
- * round test for float
- */
- public void testRoundF32() {
- doF32(0x12345678, 0);
- }
-
- public void testRoundF32_relaxed() {
- doF32_relaxed(0x12345678, 0);
- }
-
- /**
- * round test for float2
- */
- public void testRoundF32_2() {
- doF32_2(0x123a5678, 0);
- }
-
- public void testRoundF32_2_relaxed() {
- doF32_2_relaxed(0x123a5678, 0);
- }
-
- /**
- * round test for float3
- */
- public void testRoundF32_3() {
- doF32_3(0x1af45678, 0);
- }
-
- public void testRoundF32_3_relaxed() {
- doF32_3_relaxed(0x1af45678, 0);
- }
-
- /**
- * round test for float4
- */
- public void testRoundF32_4() {
- doF32_4(0x1f345678, 0);
-
- }
- public void testRoundF32_4_relaxed() {
- doF32_4_relaxed(0x1f345678, 0);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java
deleted file mode 100644
index 2185ae2..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright (C) 2012 The Android Open Source Project
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class RsFracTest extends RSBaseCompute {
- private ScriptC_rs_frac_f32 mScript;
- private ScriptC_rs_frac_f32_relaxed mScript_relaxed;
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut)
- throws RSRuntimeException {
- if (testId == TEST_F32) {
- mScript.forEach_root(mIn, mOut);
- } else if (testId == TEST_RELAXED_F32) {
- mScript_relaxed.forEach_root(mIn, mOut);
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = Math.min(in[idx] - (float)Math.floor((double)in[idx]), 0x1.fffffep-1f);
- }
- }
- return ref;
- }
-
- public void testRsFrac() {
- mScript = new ScriptC_rs_frac_f32(mRS, mRes, R.raw.rs_frac_f32);
- doF32(0x12, 0);
- }
- public void testRsFrac_relaxed() {
- mScript_relaxed = new ScriptC_rs_frac_f32_relaxed(mRS, mRes, R.raw.rs_frac_f32);
- doF32_relaxed(0x12, 1);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java
deleted file mode 100644
index 1183886..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class RsqrtTest extends RSBaseCompute {
- private ScriptC_rsqrt_f32 script_f32;
- private ScriptC_rsqrt_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_rsqrt_f32(mRS);
- script_f32_relaxed = new ScriptC_rsqrt_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_Rsqrt_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_Rsqrt_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_Rsqrt_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_Rsqrt_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_Rsqrt_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_Rsqrt_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_Rsqrt_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_Rsqrt_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)Math.pow((double)in[idx], -0.5);
- }
- }
- return ref;
- }
-
- public void testRsqrtF32() {
- doF32(0x12345678, 2);
- }
-
- public void testRsqrtF32_relaxed() {
- doF32_relaxed(0x12345678, 2);
- }
-
- public void testRsqrtF32_2() {
- doF32_2(0x12ae4567, 2);
- }
-
- public void testRsqrtF32_2_relaxed() {
- doF32_2_relaxed(0x12ae4567, 2);
- }
-
- public void testRsqrtF32_3() {
- doF32_3(0x12cf8, 2);
- }
-
- public void testRsqrtF32_3_relaxed() {
- doF32_3_relaxed(0x12cf8, 2);
- }
-
- public void testRsqrtF32_4() {
- doF32_4(0x12abc8, 2);
-
- }
- public void testRsqrtF32_4_relaxed() {
- doF32_4_relaxed(0x12abc8, 2);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java
deleted file mode 100644
index 69e2636..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class SignTest extends RSBaseCompute {
- private ScriptC_sign_f32 script_f32;
- private ScriptC_sign_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_sign_f32(mRS);
- script_f32_relaxed = new ScriptC_sign_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_sign_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_sign_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_sign_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_sign_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_sign_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_sign_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_sign_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_sign_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idxIn = i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = in[idxIn] > 0.f ? 1.f : -1.f;
- }
- }
- return ref;
- }
-
- /**
- * This method is used for sign() function with f32
- */
- public void testSignF32() {
- doF32(0x12345678, 0);
- }
-
- public void testSignF32_relaxed() {
- doF32_relaxed(0x12345678, 0);
- }
-
- public void testSignF32_2() {
- doF32_2(0x12a45678, 0);
- }
-
- public void testSignF32_2_relaxed() {
- doF32_2_relaxed(0x12a45678, 0);
- }
-
- /**
- * This method is used for sign() function with f32_3
- */
- public void testSignF32_3() {
- doF32_3(0x123c5678, 0);
- }
-
- public void testSignF32_3_relaxed() {
- doF32_3_relaxed(0x123c5678, 0);
- }
-
- /**
- * This method is used for sign() function with f32_4
- */
- public void testSignF32_4() {
- doF32_4(0x123d678, 0);
-
- }
- public void testSignF32_4_relaxed() {
- doF32_4_relaxed(0x123d678, 0);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java
deleted file mode 100644
index 5911632..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class SinTest extends RSBaseCompute {
- private ScriptC_sin_f32 script_f32;
- private ScriptC_sin_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_sin_f32(mRS);
- script_f32_relaxed = new ScriptC_sin_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_sin_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_sin_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_sin_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_sin_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_sin_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_sin_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_sin_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_sin_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.sin((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testSinF32() {
- doF32(0xba, 4);
- }
-
- public void testSinF32_relaxed() {
- doF32_relaxed(0xba, 128);
- }
-
- public void testSinF32_2() {
- doF32_2(0xbaa, 4);
- }
-
- public void testSinF32_2_relaxed() {
- doF32_2_relaxed(0xbaa, 128);
- }
-
- public void testSinF32_3() {
- doF32_3(0xca, 4);
- }
-
- public void testSinF32_3_relaxed() {
- doF32_3_relaxed(0xca, 128);
- }
-
- public void testSinF32_4() {
- doF32_4(0xda, 4);
-
- }
- public void testSinF32_4_relaxed() {
- doF32_4_relaxed(0xda, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java
deleted file mode 100644
index a95c574..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class SinhTest extends RSBaseCompute {
- private ScriptC_sinh_f32 script_f32;
- private ScriptC_sinh_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_sinh_f32(mRS);
- script_f32_relaxed = new ScriptC_sinh_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_sinh_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_sinh_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_sinh_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_sinh_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_sinh_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_sinh_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_sinh_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_sinh_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.sinh((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testSinhF32() {
- doF32(0x32a, 4);
- }
-
- public void testSinhF32_relaxed() {
- doF32_relaxed(0x32a, 128);
- }
-
- public void testSinhF32_2() {
- doF32_2(0xba35, 4);
- }
-
- public void testSinhF32_2_relaxed() {
- doF32_2_relaxed(0xba35, 128);
- }
-
- public void testSinhF32_3() {
- doF32_3(0xacc3, 4);
- }
-
- public void testSinhF32_3_relaxed() {
- doF32_3_relaxed(0xacc3, 128);
- }
-
- public void testSinhF32_4() {
- doF32_4(0xaa, 4);
-
- }
- public void testSinhF32_4_relaxed() {
- doF32_4_relaxed(0xaa, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java
deleted file mode 100644
index 02290ca..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class SqrtTest extends RSBaseCompute {
- private ScriptC_sqrt_f32 script_f32;
- private ScriptC_sqrt_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_sqrt_f32(mRS);
- script_f32_relaxed = new ScriptC_sqrt_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_sqrt_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_sqrt_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_sqrt_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_sqrt_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_sqrt_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_sqrt_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_sqrt_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_sqrt_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.sqrt((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testSqrtF32() {
- doF32(0xab3, 3);
- }
-
- public void testSqrtF32_relaxed() {
- doF32_relaxed(0xab3, 3);
- }
-
- public void testSqrtF32_2() {
- doF32_2(0xa1, 3);
- }
-
- public void testSqrtF32_2_relaxed() {
- doF32_2_relaxed(0xa1, 3);
- }
-
- public void testSqrtF32_3() {
- doF32_3(0xbae7, 3);
- }
-
- public void testSqrtF32_3_relaxed() {
- doF32_3_relaxed(0xbae7, 3);
- }
-
- public void testSqrtF32_4() {
- doF32_4(0xbac361, 3);
-
- }
- public void testSqrtF32_4_relaxed() {
- doF32_4_relaxed(0xbac361, 3);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java b/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java
deleted file mode 100644
index 39fb443..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.renderscript.cts;
-
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RSRuntimeException;
-import com.android.cts.stub.R;
-
-public class StepTest extends RSBaseCompute {
- private ScriptC_step_f32 script_f32;
- private ScriptC_step_f32_relaxed script_f32_relaxed;
- private Allocation mIn;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_step_f32(mRS);
- script_f32_relaxed = new ScriptC_step_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_step_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_step_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_step_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_step_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_step_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_step_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_step_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_step_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx = i * stride * 2 + j;
- ref[i * (stride - skip) + j] = in[idx+stride] < in[idx] ? 0.0f : 1.0f;
- }
- }
- return ref;
- }
-
- @Override
- protected Allocation setInAlloc(Element e) {
- return mIn;
- }
-
- @Override
- protected float[] makeInArray(int size) {
- return new float[size*2];
- }
-
- public void testStepF32() {
- ScriptField_step_input in = new ScriptField_step_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32(0x12678, 0);
- }
-
- public void testStepF32_relaxed() {
- ScriptField_step_input in = new ScriptField_step_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_relaxed(0x12678, 0);
- }
-
- public void testStepF32_2() {
- ScriptField_step_2_input in = new ScriptField_step_2_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2(0x1ace8, 0);
- }
-
- public void testStepF32_2_relaxed() {
- ScriptField_step_2_input in = new ScriptField_step_2_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_2_relaxed(0x1ace8, 0);
- }
-
- public void testStepF32_3() {
- ScriptField_step_3_input in = new ScriptField_step_3_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3(0xa2ce8, 0);
- }
-
- public void testStepF32_3_relaxed() {
- ScriptField_step_3_input in = new ScriptField_step_3_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_3_relaxed(0xa2ce8, 0);
- }
-
- public void testStepF32_4() {
- ScriptField_step_4_input in = new ScriptField_step_4_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4(0x1ee8, 0);
- }
-
- public void testStepF32_4_relaxed() {
- ScriptField_step_4_input in = new ScriptField_step_4_input(mRS, INPUTSIZE);
- mIn = in.getAllocation();
- doF32_4_relaxed(0x1ee8, 0);
- }
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java
deleted file mode 100644
index a4e62e9..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class TanTest extends RSBaseCompute {
- private ScriptC_tan_f32 script_f32;
- private ScriptC_tan_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_tan_f32(mRS);
- script_f32_relaxed = new ScriptC_tan_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_tan_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_tan_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_tan_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_tan_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_tan_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_tan_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_tan_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_tan_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.tan((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testTanF32() {
- doF32(0xabe, 5);
- }
-
- public void testTanF32_relaxed() {
- doF32_relaxed(0xabe, 128);
- }
-
- public void testTanF32_2() {
- doF32_2(0x29, 5);
- }
-
- public void testTanF32_2_relaxed() {
- doF32_2_relaxed(0x29, 128);
- }
-
- public void testTanF32_3() {
- doF32_3(0x9a, 5);
- }
-
- public void testTanF32_3_relaxed() {
- doF32_3_relaxed(0x9a, 128);
- }
-
- public void testTanF32_4() {
- doF32_4(0xac3, 5);
-
- }
- public void testTanF32_4_relaxed() {
- doF32_4_relaxed(0xac3, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java
deleted file mode 100644
index 4dc7d15..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class TanhTest extends RSBaseCompute {
- private ScriptC_tanh_f32 script_f32;
- private ScriptC_tanh_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_tanh_f32(mRS);
- script_f32_relaxed = new ScriptC_tanh_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_tanh_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_tanh_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_tanh_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_tanh_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_tanh_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_tanh_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_tanh_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_tanh_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idx= i * stride + j;
- int idxRef = i * (stride - skip) + j;
- ref[idxRef] = (float)(Math.tanh((double)in[idx]));
- }
- }
- return ref;
- }
-
- public void testTanhF32() {
- doF32(0xab61, 5);
- }
-
- public void testTanhF32_relaxed() {
- doF32_relaxed(0xab61, 128);
- }
-
- public void testTanhF32_2() {
- doF32_2(0xa301, 5);
- }
-
- public void testTanhF32_2_relaxed() {
- doF32_2_relaxed(0xa301, 128);
- }
-
- public void testTanhF32_3() {
- doF32_3(0x918, 5);
- }
-
- public void testTanhF32_3_relaxed() {
- doF32_3_relaxed(0x918, 128);
- }
-
- public void testTanhF32_4() {
- doF32_4(0x81, 5);
-
- }
- public void testTanhF32_4_relaxed() {
- doF32_4_relaxed(0x81, 128);
- }
-
-}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAbs.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAbs.java
new file mode 100644
index 0000000..f678af4
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAbs.java
@@ -0,0 +1,771 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAbs extends RSBaseCompute {
+
+ private ScriptC_TestAbs script;
+ private ScriptC_TestAbsRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAbs(mRS);
+ scriptRelaxed = new ScriptC_TestAbsRelaxed(mRS);
+ }
+
+ public class ArgumentsCharUchar {
+ public byte inValue;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAbsCharUchar() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x4c0d03eb0d0c5a91l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ script.forEach_testAbsCharUchar(inValue, out);
+ verifyResultsAbsCharUchar(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsCharUchar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsCharUchar(inValue, out);
+ verifyResultsAbsCharUchar(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsCharUchar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsCharUchar(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharUchar args = new ArgumentsCharUchar();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsCharUchar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsChar2Uchar2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x901d551e7f67bb87l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testAbsChar2Uchar2(inValue, out);
+ verifyResultsAbsChar2Uchar2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsChar2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsChar2Uchar2(inValue, out);
+ verifyResultsAbsChar2Uchar2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsChar2Uchar2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsChar2Uchar2(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharUchar args = new ArgumentsCharUchar();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsChar2Uchar2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsChar3Uchar3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0xb5d1caa5c8a5e105l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testAbsChar3Uchar3(inValue, out);
+ verifyResultsAbsChar3Uchar3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsChar3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsChar3Uchar3(inValue, out);
+ verifyResultsAbsChar3Uchar3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsChar3Uchar3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsChar3Uchar3(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharUchar args = new ArgumentsCharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsChar3Uchar3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsChar4Uchar4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xdb86402d11e40683l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testAbsChar4Uchar4(inValue, out);
+ verifyResultsAbsChar4Uchar4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsChar4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsChar4Uchar4(inValue, out);
+ verifyResultsAbsChar4Uchar4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsChar4Uchar4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsChar4Uchar4(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharUchar args = new ArgumentsCharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsChar4Uchar4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsShortUshort {
+ public short inValue;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAbsShortUshort() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0xaead1a96b6ea02a7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ script.forEach_testAbsShortUshort(inValue, out);
+ verifyResultsAbsShortUshort(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShortUshort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsShortUshort(inValue, out);
+ verifyResultsAbsShortUshort(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShortUshort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsShortUshort(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortUshort args = new ArgumentsShortUshort();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsShortUshort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsShort2Ushort2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x41a1894ff6b0da9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testAbsShort2Ushort2(inValue, out);
+ verifyResultsAbsShort2Ushort2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShort2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsShort2Ushort2(inValue, out);
+ verifyResultsAbsShort2Ushort2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShort2Ushort2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsShort2Ushort2(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortUshort args = new ArgumentsShortUshort();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsShort2Ushort2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsShort3Ushort3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x5969cbec377ba515l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testAbsShort3Ushort3(inValue, out);
+ verifyResultsAbsShort3Ushort3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShort3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsShort3Ushort3(inValue, out);
+ verifyResultsAbsShort3Ushort3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShort3Ushort3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsShort3Ushort3(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortUshort args = new ArgumentsShortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsShort3Ushort3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsShort4Ushort4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0xaeb97f436f8c3c81l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testAbsShort4Ushort4(inValue, out);
+ verifyResultsAbsShort4Ushort4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShort4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsShort4Ushort4(inValue, out);
+ verifyResultsAbsShort4Ushort4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsShort4Ushort4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsShort4Ushort4(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortUshort args = new ArgumentsShortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsShort4Ushort4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsIntUint {
+ public int inValue;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAbsIntUint() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xcda40fd4fa1abbd1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ script.forEach_testAbsIntUint(inValue, out);
+ verifyResultsAbsIntUint(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsIntUint: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsIntUint(inValue, out);
+ verifyResultsAbsIntUint(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsIntUint: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsIntUint(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntUint args = new ArgumentsIntUint();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsIntUint" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsInt2Uint2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x71326739aabbb4a5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testAbsInt2Uint2(inValue, out);
+ verifyResultsAbsInt2Uint2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsInt2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsInt2Uint2(inValue, out);
+ verifyResultsAbsInt2Uint2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsInt2Uint2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsInt2Uint2(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntUint args = new ArgumentsIntUint();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsInt2Uint2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsInt3Uint3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x9bbf87f7a6fae959l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testAbsInt3Uint3(inValue, out);
+ verifyResultsAbsInt3Uint3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsInt3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsInt3Uint3(inValue, out);
+ verifyResultsAbsInt3Uint3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsInt3Uint3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsInt3Uint3(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntUint args = new ArgumentsIntUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsInt3Uint3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAbsInt4Uint4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xc64ca8b5a33a1e0dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testAbsInt4Uint4(inValue, out);
+ verifyResultsAbsInt4Uint4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsInt4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAbsInt4Uint4(inValue, out);
+ verifyResultsAbsInt4Uint4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAbsInt4Uint4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAbsInt4Uint4(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntUint args = new ArgumentsIntUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAbs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAbsInt4Uint4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAbs() {
+ checkAbsCharUchar();
+ checkAbsChar2Uchar2();
+ checkAbsChar3Uchar3();
+ checkAbsChar4Uchar4();
+ checkAbsShortUshort();
+ checkAbsShort2Ushort2();
+ checkAbsShort3Ushort3();
+ checkAbsShort4Ushort4();
+ checkAbsIntUint();
+ checkAbsInt2Uint2();
+ checkAbsInt3Uint3();
+ checkAbsInt4Uint4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAcos.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAcos.java
new file mode 100644
index 0000000..73037d5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAcos.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAcos extends RSBaseCompute {
+
+ private ScriptC_TestAcos script;
+ private ScriptC_TestAcosRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAcos(mRS);
+ scriptRelaxed = new ScriptC_TestAcosRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAcosFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5f0b5cbe4c52251bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAcosFloatFloat(in, out);
+ verifyResultsAcosFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAcosFloatFloat(in, out);
+ verifyResultsAcosFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcosFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcosFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcosFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x790ffc70ee867b1fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAcosFloat2Float2(in, out);
+ verifyResultsAcosFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAcosFloat2Float2(in, out);
+ verifyResultsAcosFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcosFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcosFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcosFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x791007124d8d10b9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAcosFloat3Float3(in, out);
+ verifyResultsAcosFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAcosFloat3Float3(in, out);
+ verifyResultsAcosFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcosFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcosFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcosFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x791011b3ac93a653l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAcosFloat4Float4(in, out);
+ verifyResultsAcosFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAcosFloat4Float4(in, out);
+ verifyResultsAcosFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcosFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcosFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcosFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAcos() {
+ checkAcosFloatFloat();
+ checkAcosFloat2Float2();
+ checkAcosFloat3Float3();
+ checkAcosFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAcosh.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAcosh.java
new file mode 100644
index 0000000..64fb710
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAcosh.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAcosh extends RSBaseCompute {
+
+ private ScriptC_TestAcosh script;
+ private ScriptC_TestAcoshRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAcosh(mRS);
+ scriptRelaxed = new ScriptC_TestAcoshRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAcoshFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb2c74105f8e94ea7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAcoshFloatFloat(in, out);
+ verifyResultsAcoshFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAcoshFloatFloat(in, out);
+ verifyResultsAcoshFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcoshFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcoshFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcoshFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x4123c61e7e518f4bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAcoshFloat2Float2(in, out);
+ verifyResultsAcoshFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAcoshFloat2Float2(in, out);
+ verifyResultsAcoshFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcoshFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcoshFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcoshFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x4123d0bfdd5824e5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAcoshFloat3Float3(in, out);
+ verifyResultsAcoshFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAcoshFloat3Float3(in, out);
+ verifyResultsAcoshFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcoshFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcoshFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcoshFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x4123db613c5eba7fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAcoshFloat4Float4(in, out);
+ verifyResultsAcoshFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAcoshFloat4Float4(in, out);
+ verifyResultsAcoshFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcoshFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcoshFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcoshFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAcosh() {
+ checkAcoshFloatFloat();
+ checkAcoshFloat2Float2();
+ checkAcoshFloat3Float3();
+ checkAcoshFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAcospi.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAcospi.java
new file mode 100644
index 0000000..5cc206d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAcospi.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAcospi extends RSBaseCompute {
+
+ private ScriptC_TestAcospi script;
+ private ScriptC_TestAcospiRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAcospi(mRS);
+ scriptRelaxed = new ScriptC_TestAcospiRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAcospiFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x1b8763cea5a00314l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAcospiFloatFloat(in, out);
+ verifyResultsAcospiFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAcospiFloatFloat(in, out);
+ verifyResultsAcospiFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcospiFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcospiFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcospiFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xd4df0185f1eeb690l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAcospiFloat2Float2(in, out);
+ verifyResultsAcospiFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAcospiFloat2Float2(in, out);
+ verifyResultsAcospiFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcospiFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcospiFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcospiFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd4df0c2750f54c2al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAcospiFloat3Float3(in, out);
+ verifyResultsAcospiFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAcospiFloat3Float3(in, out);
+ verifyResultsAcospiFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcospiFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcospiFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAcospiFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xd4df16c8affbe1c4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAcospiFloat4Float4(in, out);
+ verifyResultsAcospiFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAcospiFloat4Float4(in, out);
+ verifyResultsAcospiFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAcospiFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAcospiFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAcospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAcospiFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAcospi() {
+ checkAcospiFloatFloat();
+ checkAcospiFloat2Float2();
+ checkAcospiFloat3Float3();
+ checkAcospiFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAsin.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAsin.java
new file mode 100644
index 0000000..5b4884b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAsin.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAsin extends RSBaseCompute {
+
+ private ScriptC_TestAsin script;
+ private ScriptC_TestAsinRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAsin(mRS);
+ scriptRelaxed = new ScriptC_TestAsinRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAsinFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfd0a2c13b8687334l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAsinFloatFloat(in, out);
+ verifyResultsAsinFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinFloatFloat(in, out);
+ verifyResultsAsinFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x9e777c6a9ba08db0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAsinFloat2Float2(in, out);
+ verifyResultsAsinFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinFloat2Float2(in, out);
+ verifyResultsAsinFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9e77870bfaa7234al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAsinFloat3Float3(in, out);
+ verifyResultsAsinFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinFloat3Float3(in, out);
+ verifyResultsAsinFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9e7791ad59adb8e4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAsinFloat4Float4(in, out);
+ verifyResultsAsinFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinFloat4Float4(in, out);
+ verifyResultsAsinFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAsin() {
+ checkAsinFloatFloat();
+ checkAsinFloat2Float2();
+ checkAsinFloat3Float3();
+ checkAsinFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAsinh.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAsinh.java
new file mode 100644
index 0000000..a8de94f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAsinh.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAsinh extends RSBaseCompute {
+
+ private ScriptC_TestAsinh script;
+ private ScriptC_TestAsinhRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAsinh(mRS);
+ scriptRelaxed = new ScriptC_TestAsinhRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAsinhFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x3c94145f20a86cdal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAsinhFloatFloat(in, out);
+ verifyResultsAsinhFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinhFloatFloat(in, out);
+ verifyResultsAsinhFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinhFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinhFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinhFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x8986450e91b2ada6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAsinhFloat2Float2(in, out);
+ verifyResultsAsinhFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinhFloat2Float2(in, out);
+ verifyResultsAsinhFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinhFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinhFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinhFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x89864faff0b94340l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAsinhFloat3Float3(in, out);
+ verifyResultsAsinhFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinhFloat3Float3(in, out);
+ verifyResultsAsinhFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinhFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinhFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinhFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x89865a514fbfd8dal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAsinhFloat4Float4(in, out);
+ verifyResultsAsinhFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinhFloat4Float4(in, out);
+ verifyResultsAsinhFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinhFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinhFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinhFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAsinh() {
+ checkAsinhFloatFloat();
+ checkAsinhFloat2Float2();
+ checkAsinhFloat3Float3();
+ checkAsinhFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAsinpi.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAsinpi.java
new file mode 100644
index 0000000..46c8078
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAsinpi.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAsinpi extends RSBaseCompute {
+
+ private ScriptC_TestAsinpi script;
+ private ScriptC_TestAsinpiRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAsinpi(mRS);
+ scriptRelaxed = new ScriptC_TestAsinpiRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAsinpiFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x40eee3c852ba15a5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAsinpiFloatFloat(in, out);
+ verifyResultsAsinpiFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinpiFloatFloat(in, out);
+ verifyResultsAsinpiFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinpiFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinpiFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinpiFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xfd6a53d9333ecfd9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAsinpiFloat2Float2(in, out);
+ verifyResultsAsinpiFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinpiFloat2Float2(in, out);
+ verifyResultsAsinpiFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinpiFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinpiFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinpiFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xfd6a5e7a92456573l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAsinpiFloat3Float3(in, out);
+ verifyResultsAsinpiFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinpiFloat3Float3(in, out);
+ verifyResultsAsinpiFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinpiFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinpiFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAsinpiFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xfd6a691bf14bfb0dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAsinpiFloat4Float4(in, out);
+ verifyResultsAsinpiFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAsinpiFloat4Float4(in, out);
+ verifyResultsAsinpiFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAsinpiFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAsinpiFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAsinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAsinpiFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAsinpi() {
+ checkAsinpiFloatFloat();
+ checkAsinpiFloat2Float2();
+ checkAsinpiFloat3Float3();
+ checkAsinpiFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAtan.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan.java
new file mode 100644
index 0000000..9fcb2a8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAtan extends RSBaseCompute {
+
+ private ScriptC_TestAtan script;
+ private ScriptC_TestAtanRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAtan(mRS);
+ scriptRelaxed = new ScriptC_TestAtanRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAtanFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x24b634ebaa17d225l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAtanFloatFloat(in, out);
+ verifyResultsAtanFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanFloatFloat(in, out);
+ verifyResultsAtanFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x28035c1b37454859l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAtanFloat2Float2(in, out);
+ verifyResultsAtanFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanFloat2Float2(in, out);
+ verifyResultsAtanFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x280366bc964bddf3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAtanFloat3Float3(in, out);
+ verifyResultsAtanFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanFloat3Float3(in, out);
+ verifyResultsAtanFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x2803715df552738dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAtanFloat4Float4(in, out);
+ verifyResultsAtanFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanFloat4Float4(in, out);
+ verifyResultsAtanFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAtan() {
+ checkAtanFloatFloat();
+ checkAtanFloat2Float2();
+ checkAtanFloat3Float3();
+ checkAtanFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2.java
new file mode 100644
index 0000000..06b2282
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAtan2 extends RSBaseCompute {
+
+ private ScriptC_TestAtan2 script;
+ private ScriptC_TestAtan2Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAtan2(mRS);
+ scriptRelaxed = new ScriptC_TestAtan2Relaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inY;
+ public float inX;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAtan2FloatFloatFloat() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x8f58f1f953c03c32l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x8f58f1f953c03c31l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2FloatFloatFloat(inY, out);
+ verifyResultsAtan2FloatFloatFloat(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2FloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2FloatFloatFloat(inY, out);
+ verifyResultsAtan2FloatFloatFloat(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2FloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2FloatFloatFloat(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i];
+ args.inX = arrayInX[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2FloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtan2Float2Float2Float2() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbe78dcdcd414b6c0l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbe78dcdcd414b6bfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2Float2Float2Float2(inY, out);
+ verifyResultsAtan2Float2Float2Float2(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2Float2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2Float2Float2Float2(inY, out);
+ verifyResultsAtan2Float2Float2Float2(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2Float2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2Float2Float2Float2(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i * 2 + j];
+ args.inX = arrayInX[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2Float2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtan2Float3Float3Float3() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x12ddbafcd5f2b861l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x12ddbafcd5f2b860l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2Float3Float3Float3(inY, out);
+ verifyResultsAtan2Float3Float3Float3(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2Float3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2Float3Float3Float3(inY, out);
+ verifyResultsAtan2Float3Float3Float3(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2Float3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2Float3Float3Float3(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i * 4 + j];
+ args.inX = arrayInX[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2Float3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtan2Float4Float4Float4() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6742991cd7d0ba02l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6742991cd7d0ba01l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2Float4Float4Float4(inY, out);
+ verifyResultsAtan2Float4Float4Float4(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2Float4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2Float4Float4Float4(inY, out);
+ verifyResultsAtan2Float4Float4Float4(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2Float4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2Float4Float4Float4(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i * 4 + j];
+ args.inX = arrayInX[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2Float4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAtan2() {
+ checkAtan2FloatFloatFloat();
+ checkAtan2Float2Float2Float2();
+ checkAtan2Float3Float3Float3();
+ checkAtan2Float4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2pi.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2pi.java
new file mode 100644
index 0000000..d602819
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2pi.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAtan2pi extends RSBaseCompute {
+
+ private ScriptC_TestAtan2pi script;
+ private ScriptC_TestAtan2piRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAtan2pi(mRS);
+ scriptRelaxed = new ScriptC_TestAtan2piRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inY;
+ public float inX;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAtan2piFloatFloatFloat() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5a912731bef85233l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5a912731bef85232l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2piFloatFloatFloat(inY, out);
+ verifyResultsAtan2piFloatFloatFloat(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2piFloatFloatFloat(inY, out);
+ verifyResultsAtan2piFloatFloatFloat(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2piFloatFloatFloat(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i];
+ args.inX = arrayInX[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2pi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2piFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtan2piFloat2Float2Float2() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x8031be184fee8f53l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x8031be184fee8f52l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2piFloat2Float2Float2(inY, out);
+ verifyResultsAtan2piFloat2Float2Float2(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2piFloat2Float2Float2(inY, out);
+ verifyResultsAtan2piFloat2Float2Float2(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2piFloat2Float2Float2(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i * 2 + j];
+ args.inX = arrayInX[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2pi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2piFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtan2piFloat3Float3Float3() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd4969c3851cc90f4l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd4969c3851cc90f3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2piFloat3Float3Float3(inY, out);
+ verifyResultsAtan2piFloat3Float3Float3(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2piFloat3Float3Float3(inY, out);
+ verifyResultsAtan2piFloat3Float3Float3(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2piFloat3Float3Float3(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i * 4 + j];
+ args.inX = arrayInX[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2pi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2piFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtan2piFloat4Float4Float4() {
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x28fb7a5853aa9295l, false);
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x28fb7a5853aa9294l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInX(inX);
+ script.forEach_testAtan2piFloat4Float4Float4(inY, out);
+ verifyResultsAtan2piFloat4Float4Float4(inY, inX, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInX(inX);
+ scriptRelaxed.forEach_testAtan2piFloat4Float4Float4(inY, out);
+ verifyResultsAtan2piFloat4Float4Float4(inY, inX, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtan2piFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtan2piFloat4Float4Float4(Allocation inY, Allocation inX, Allocation out, boolean relaxed) {
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inY = arrayInY[i * 4 + j];
+ args.inX = arrayInX[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtan2pi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtan2piFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAtan2pi() {
+ checkAtan2piFloatFloatFloat();
+ checkAtan2piFloat2Float2Float2();
+ checkAtan2piFloat3Float3Float3();
+ checkAtan2piFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAtanh.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAtanh.java
new file mode 100644
index 0000000..1e4581f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtanh.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAtanh extends RSBaseCompute {
+
+ private ScriptC_TestAtanh script;
+ private ScriptC_TestAtanhRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAtanh(mRS);
+ scriptRelaxed = new ScriptC_TestAtanhRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAtanhFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe67990a4b91d5f55l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAtanhFloatFloat(in, out);
+ verifyResultsAtanhFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanhFloatFloat(in, out);
+ verifyResultsAtanhFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanhFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanhFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanhFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa404d7b8b65e0809l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAtanhFloat2Float2(in, out);
+ verifyResultsAtanhFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanhFloat2Float2(in, out);
+ verifyResultsAtanhFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanhFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanhFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanhFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xa404e25a15649da3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAtanhFloat3Float3(in, out);
+ verifyResultsAtanhFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanhFloat3Float3(in, out);
+ verifyResultsAtanhFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanhFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanhFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanhFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa404ecfb746b333dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAtanhFloat4Float4(in, out);
+ verifyResultsAtanhFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanhFloat4Float4(in, out);
+ verifyResultsAtanhFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanhFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanhFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanhFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAtanh() {
+ checkAtanhFloatFloat();
+ checkAtanhFloat2Float2();
+ checkAtanhFloat3Float3();
+ checkAtanhFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestAtanpi.java b/tests/tests/renderscript/src/android/renderscript/cts/TestAtanpi.java
new file mode 100644
index 0000000..a190d78
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtanpi.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestAtanpi extends RSBaseCompute {
+
+ private ScriptC_TestAtanpi script;
+ private ScriptC_TestAtanpiRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestAtanpi(mRS);
+ scriptRelaxed = new ScriptC_TestAtanpiRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkAtanpiFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xca7ac378ee5ed04el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testAtanpiFloatFloat(in, out);
+ verifyResultsAtanpiFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanpiFloatFloat(in, out);
+ verifyResultsAtanpiFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanpiFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanpiFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanpiFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x70acf66d5c06fe7al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testAtanpiFloat2Float2(in, out);
+ verifyResultsAtanpiFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanpiFloat2Float2(in, out);
+ verifyResultsAtanpiFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanpiFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanpiFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanpiFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x70ad010ebb0d9414l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testAtanpiFloat3Float3(in, out);
+ verifyResultsAtanpiFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanpiFloat3Float3(in, out);
+ verifyResultsAtanpiFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanpiFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanpiFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkAtanpiFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x70ad0bb01a1429ael, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testAtanpiFloat4Float4(in, out);
+ verifyResultsAtanpiFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testAtanpiFloat4Float4(in, out);
+ verifyResultsAtanpiFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testAtanpiFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsAtanpiFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeAtanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkAtanpiFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testAtanpi() {
+ checkAtanpiFloatFloat();
+ checkAtanpiFloat2Float2();
+ checkAtanpiFloat3Float3();
+ checkAtanpiFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestCbrt.java b/tests/tests/renderscript/src/android/renderscript/cts/TestCbrt.java
new file mode 100644
index 0000000..cab03f2
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCbrt.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestCbrt extends RSBaseCompute {
+
+ private ScriptC_TestCbrt script;
+ private ScriptC_TestCbrtRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestCbrt(mRS);
+ scriptRelaxed = new ScriptC_TestCbrtRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkCbrtFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4e2c540726cc677al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testCbrtFloatFloat(in, out);
+ verifyResultsCbrtFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testCbrtFloatFloat(in, out);
+ verifyResultsCbrtFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCbrtFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCbrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCbrtFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCbrtFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x9e2a09a2eb8fdb46l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testCbrtFloat2Float2(in, out);
+ verifyResultsCbrtFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testCbrtFloat2Float2(in, out);
+ verifyResultsCbrtFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCbrtFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCbrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCbrtFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCbrtFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9e2a14444a9670e0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testCbrtFloat3Float3(in, out);
+ verifyResultsCbrtFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testCbrtFloat3Float3(in, out);
+ verifyResultsCbrtFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCbrtFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCbrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCbrtFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCbrtFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9e2a1ee5a99d067al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testCbrtFloat4Float4(in, out);
+ verifyResultsCbrtFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testCbrtFloat4Float4(in, out);
+ verifyResultsCbrtFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCbrtFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCbrtFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCbrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCbrtFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testCbrt() {
+ checkCbrtFloatFloat();
+ checkCbrtFloat2Float2();
+ checkCbrtFloat3Float3();
+ checkCbrtFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestCeil.java b/tests/tests/renderscript/src/android/renderscript/cts/TestCeil.java
new file mode 100644
index 0000000..89b0198
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCeil.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestCeil extends RSBaseCompute {
+
+ private ScriptC_TestCeil script;
+ private ScriptC_TestCeilRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestCeil(mRS);
+ scriptRelaxed = new ScriptC_TestCeilRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkCeilFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa65a49d160f51d9al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testCeilFloatFloat(in, out);
+ verifyResultsCeilFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testCeilFloatFloat(in, out);
+ verifyResultsCeilFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCeilFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCeil(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCeilFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCeilFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x821e4b40fb9b4866l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testCeilFloat2Float2(in, out);
+ verifyResultsCeilFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testCeilFloat2Float2(in, out);
+ verifyResultsCeilFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCeilFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCeil(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCeilFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCeilFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x821e55e25aa1de00l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testCeilFloat3Float3(in, out);
+ verifyResultsCeilFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testCeilFloat3Float3(in, out);
+ verifyResultsCeilFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCeilFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCeil(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCeilFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCeilFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x821e6083b9a8739al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testCeilFloat4Float4(in, out);
+ verifyResultsCeilFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testCeilFloat4Float4(in, out);
+ verifyResultsCeilFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCeilFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCeilFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCeil(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCeilFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testCeil() {
+ checkCeilFloatFloat();
+ checkCeilFloat2Float2();
+ checkCeilFloat3Float3();
+ checkCeilFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestClamp.java b/tests/tests/renderscript/src/android/renderscript/cts/TestClamp.java
new file mode 100644
index 0000000..0943ed8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestClamp.java
@@ -0,0 +1,3945 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestClamp extends RSBaseCompute {
+
+ private ScriptC_TestClamp script;
+ private ScriptC_TestClampRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestClamp(mRS);
+ scriptRelaxed = new ScriptC_TestClampRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloatFloat {
+ public float inValue;
+ public float inMinValue;
+ public float inMaxValue;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClampFloatFloatFloatFloat() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x7e886d7cc83c447dl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xdcebf6f230234027l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xdcebf6e6c180322dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampFloatFloatFloatFloat(inValue, out);
+ verifyResultsClampFloatFloatFloatFloat(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloatFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampFloatFloatFloatFloat(inValue, out);
+ verifyResultsClampFloatFloatFloatFloat(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloatFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampFloatFloatFloatFloat(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ float[] arrayInMinValue = new float[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ float[] arrayInMaxValue = new float[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inValue = arrayInValue[i];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %14.8g %8x %15a",
+ args.inMinValue, Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %14.8g %8x %15a",
+ args.inMaxValue, Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampFloatFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampFloat2Float2Float2Float2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa0d28bf142b07a5l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xb4e5c5f6ea8fc01fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xb4e5c5eb7becb225l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampFloat2Float2Float2Float2(inValue, out);
+ verifyResultsClampFloat2Float2Float2Float2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat2Float2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampFloat2Float2Float2Float2(inValue, out);
+ verifyResultsClampFloat2Float2Float2Float2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat2Float2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampFloat2Float2Float2Float2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ float[] arrayInMinValue = new float[INPUTSIZE * 2];
+ inMinValue.copyTo(arrayInMinValue);
+ float[] arrayInMaxValue = new float[INPUTSIZE * 2];
+ inMaxValue.copyTo(arrayInMaxValue);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i * 2 + j];
+ args.inMaxValue = arrayInMaxValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %14.8g %8x %15a",
+ args.inMinValue, Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %14.8g %8x %15a",
+ args.inMaxValue, Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampFloat2Float2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampFloat3Float3Float3Float3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd3716a4730ad7481l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc0d239a53946aa73l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc0d23999caa39c79l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampFloat3Float3Float3Float3(inValue, out);
+ verifyResultsClampFloat3Float3Float3Float3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat3Float3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampFloat3Float3Float3Float3(inValue, out);
+ verifyResultsClampFloat3Float3Float3Float3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat3Float3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampFloat3Float3Float3Float3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayInMinValue = new float[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ float[] arrayInMaxValue = new float[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %14.8g %8x %15a",
+ args.inMinValue, Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %14.8g %8x %15a",
+ args.inMaxValue, Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampFloat3Float3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampFloat4Float4Float4Float4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9cd5abcf4d2fe15dl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xccbead5387fd94c7l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xccbead48195a86cdl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampFloat4Float4Float4Float4(inValue, out);
+ verifyResultsClampFloat4Float4Float4Float4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat4Float4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampFloat4Float4Float4Float4(inValue, out);
+ verifyResultsClampFloat4Float4Float4Float4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat4Float4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampFloat4Float4Float4Float4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayInMinValue = new float[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ float[] arrayInMaxValue = new float[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %14.8g %8x %15a",
+ args.inMinValue, Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %14.8g %8x %15a",
+ args.inMaxValue, Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampFloat4Float4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampFloat2FloatFloatFloat2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x71623fb3f1fca1a1l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x148e792e1a6253d3l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x148e7922abbf45d9l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampFloat2FloatFloatFloat2(inValue, out);
+ verifyResultsClampFloat2FloatFloatFloat2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat2FloatFloatFloat2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampFloat2FloatFloatFloat2(inValue, out);
+ verifyResultsClampFloat2FloatFloatFloat2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat2FloatFloatFloat2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampFloat2FloatFloatFloat2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ float[] arrayInMinValue = new float[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ float[] arrayInMaxValue = new float[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %14.8g %8x %15a",
+ args.inMinValue, Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %14.8g %8x %15a",
+ args.inMaxValue, Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampFloat2FloatFloatFloat2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampFloat3FloatFloatFloat3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc06893ff6ab8cf27l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x1f4444b84d90bbc5l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x1f4444acdeedadcbl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampFloat3FloatFloatFloat3(inValue, out);
+ verifyResultsClampFloat3FloatFloatFloat3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat3FloatFloatFloat3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampFloat3FloatFloatFloat3(inValue, out);
+ verifyResultsClampFloat3FloatFloatFloat3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat3FloatFloatFloat3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampFloat3FloatFloatFloat3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayInMinValue = new float[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ float[] arrayInMaxValue = new float[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %14.8g %8x %15a",
+ args.inMinValue, Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %14.8g %8x %15a",
+ args.inMaxValue, Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampFloat3FloatFloatFloat3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampFloat4FloatFloatFloat4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf6ee84ae374fcadl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x29fa104280bf23b7l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x29fa1037121c15bdl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampFloat4FloatFloatFloat4(inValue, out);
+ verifyResultsClampFloat4FloatFloatFloat4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat4FloatFloatFloat4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampFloat4FloatFloatFloat4(inValue, out);
+ verifyResultsClampFloat4FloatFloatFloat4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampFloat4FloatFloatFloat4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampFloat4FloatFloatFloat4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayInMinValue = new float[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ float[] arrayInMaxValue = new float[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %14.8g %8x %15a",
+ args.inMinValue, Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %14.8g %8x %15a",
+ args.inMaxValue, Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampFloat4FloatFloatFloat4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsCharCharCharChar {
+ public byte inValue;
+ public byte inMinValue;
+ public byte inMaxValue;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClampCharCharCharChar() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xaec8640bb673cf75l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x6379f7c3c505c8fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x6379f70cdad4e95l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampCharCharCharChar(inValue, out);
+ verifyResultsClampCharCharCharChar(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampCharCharCharChar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampCharCharCharChar(inValue, out);
+ verifyResultsClampCharCharCharChar(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampCharCharCharChar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampCharCharCharChar(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharCharChar args = new ArgumentsCharCharCharChar();
+ args.inValue = arrayInValue[i];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampCharCharCharChar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampChar2Char2Char2Char2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xa209cfe6c3feb45dl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xed63d0ab3442bdc7l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xed63d09fc59fafcdl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampChar2Char2Char2Char2(inValue, out);
+ verifyResultsClampChar2Char2Char2Char2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar2Char2Char2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampChar2Char2Char2Char2(inValue, out);
+ verifyResultsClampChar2Char2Char2Char2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar2Char2Char2Char2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampChar2Char2Char2Char2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 2];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 2];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharCharChar args = new ArgumentsCharCharCharChar();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i * 2 + j];
+ args.inMaxValue = arrayInMaxValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampChar2Char2Char2Char2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampChar3Char3Char3Char3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0xfab6edb7b9d3b0a5l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x7ae6f958470ecb1fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x7ae6f94cd86bbd25l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampChar3Char3Char3Char3(inValue, out);
+ verifyResultsClampChar3Char3Char3Char3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar3Char3Char3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampChar3Char3Char3Char3(inValue, out);
+ verifyResultsClampChar3Char3Char3Char3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar3Char3Char3Char3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampChar3Char3Char3Char3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharCharChar args = new ArgumentsCharCharCharChar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampChar3Char3Char3Char3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampChar4Char4Char4Char4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x53640b88afa8acedl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x86a220559dad877l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x86a21f9eb37ca7dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampChar4Char4Char4Char4(inValue, out);
+ verifyResultsClampChar4Char4Char4Char4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar4Char4Char4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampChar4Char4Char4Char4(inValue, out);
+ verifyResultsClampChar4Char4Char4Char4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar4Char4Char4Char4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampChar4Char4Char4Char4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharCharChar args = new ArgumentsCharCharCharChar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampChar4Char4Char4Char4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUcharUcharUcharUchar {
+ public byte inValue;
+ public byte inMinValue;
+ public byte inMaxValue;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClampUcharUcharUcharUchar() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x680c818a4447655l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xae40bae375336f2fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xae40bad806906135l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUcharUcharUcharUchar(inValue, out);
+ verifyResultsClampUcharUcharUcharUchar(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUcharUcharUcharUchar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUcharUcharUcharUchar(inValue, out);
+ verifyResultsClampUcharUcharUcharUchar(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUcharUcharUcharUchar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUcharUcharUcharUchar(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUcharUchar args = new ArgumentsUcharUcharUcharUchar();
+ args.inValue = arrayInValue[i];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUcharUcharUcharUchar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUchar2Uchar2Uchar2Uchar2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0xd69df43245dae301l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x82681747662c1df3l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x8268173bf7890ff9l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUchar2Uchar2Uchar2Uchar2(inValue, out);
+ verifyResultsClampUchar2Uchar2Uchar2Uchar2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar2Uchar2Uchar2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUchar2Uchar2Uchar2Uchar2(inValue, out);
+ verifyResultsClampUchar2Uchar2Uchar2Uchar2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar2Uchar2Uchar2Uchar2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUchar2Uchar2Uchar2Uchar2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 2];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 2];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUcharUchar args = new ArgumentsUcharUcharUcharUchar();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i * 2 + j];
+ args.inMaxValue = arrayInMaxValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUchar2Uchar2Uchar2Uchar2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUchar3Uchar3Uchar3Uchar3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0xa00235ba625d4fddl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x8e548af5b4e30847l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x8e548aea463ffa4dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUchar3Uchar3Uchar3Uchar3(inValue, out);
+ verifyResultsClampUchar3Uchar3Uchar3Uchar3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar3Uchar3Uchar3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUchar3Uchar3Uchar3Uchar3(inValue, out);
+ verifyResultsClampUchar3Uchar3Uchar3Uchar3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar3Uchar3Uchar3Uchar3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUchar3Uchar3Uchar3Uchar3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUcharUchar args = new ArgumentsUcharUcharUcharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUchar3Uchar3Uchar3Uchar3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUchar4Uchar4Uchar4Uchar4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x696677427edfbcb9l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x9a40fea40399f29bl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x9a40fe9894f6e4a1l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUchar4Uchar4Uchar4Uchar4(inValue, out);
+ verifyResultsClampUchar4Uchar4Uchar4Uchar4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar4Uchar4Uchar4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUchar4Uchar4Uchar4Uchar4(inValue, out);
+ verifyResultsClampUchar4Uchar4Uchar4Uchar4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar4Uchar4Uchar4Uchar4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUchar4Uchar4Uchar4Uchar4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUcharUchar args = new ArgumentsUcharUcharUcharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUchar4Uchar4Uchar4Uchar4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsShortShortShortShort {
+ public short inValue;
+ public short inMinValue;
+ public short inMaxValue;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClampShortShortShortShort() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x8035c0627fc993ddl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0xb5d4bd1fb4661447l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0xb5d4bd1445c3064dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampShortShortShortShort(inValue, out);
+ verifyResultsClampShortShortShortShort(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShortShortShortShort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampShortShortShortShort(inValue, out);
+ verifyResultsClampShortShortShortShort(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShortShortShortShort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampShortShortShortShort(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShortShort args = new ArgumentsShortShortShortShort();
+ args.inValue = arrayInValue[i];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampShortShortShortShort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampShort2Short2Short2Short2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x7eab8e9b984e0915l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x7b334b992e67336fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x7b334b8dbfc42575l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampShort2Short2Short2Short2(inValue, out);
+ verifyResultsClampShort2Short2Short2Short2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort2Short2Short2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampShort2Short2Short2Short2(inValue, out);
+ verifyResultsClampShort2Short2Short2Short2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort2Short2Short2Short2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampShort2Short2Short2Short2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 2];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 2];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShortShort args = new ArgumentsShortShortShortShort();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i * 2 + j];
+ args.inMaxValue = arrayInMaxValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampShort2Short2Short2Short2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampShort3Short3Short3Short3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x480fd023b4d075f1l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x871fbf477d1e1dc3l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x871fbf3c0e7b0fc9l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampShort3Short3Short3Short3(inValue, out);
+ verifyResultsClampShort3Short3Short3Short3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort3Short3Short3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampShort3Short3Short3Short3(inValue, out);
+ verifyResultsClampShort3Short3Short3Short3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort3Short3Short3Short3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampShort3Short3Short3Short3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShortShort args = new ArgumentsShortShortShortShort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampShort3Short3Short3Short3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampShort4Short4Short4Short4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x117411abd152e2cdl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x930c32f5cbd50817l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x930c32ea5d31fa1dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampShort4Short4Short4Short4(inValue, out);
+ verifyResultsClampShort4Short4Short4Short4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort4Short4Short4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampShort4Short4Short4Short4(inValue, out);
+ verifyResultsClampShort4Short4Short4Short4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort4Short4Short4Short4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampShort4Short4Short4Short4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShortShort args = new ArgumentsShortShortShortShort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampShort4Short4Short4Short4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUshortUshortUshortUshort {
+ public short inValue;
+ public short inMinValue;
+ public short inMaxValue;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClampUshortUshortUshortUshort() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xf5881eeff74c4341l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xd2a0571394d3e2b3l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xd2a057082630d4b9l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUshortUshortUshortUshort(inValue, out);
+ verifyResultsClampUshortUshortUshortUshort(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshortUshortUshortUshort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUshortUshortUshortUshort(inValue, out);
+ verifyResultsClampUshortUshortUshortUshort(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshortUshortUshortUshort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUshortUshortUshortUshort(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshortUshort args = new ArgumentsUshortUshortUshortUshort();
+ args.inValue = arrayInValue[i];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUshortUshortUshortUshort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUshort2Ushort2Ushort2Ushort2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x6441dbe2fc36b705l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x52161e934fa3b43fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x52161e87e100a645l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUshort2Ushort2Ushort2Ushort2(inValue, out);
+ verifyResultsClampUshort2Ushort2Ushort2Ushort2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort2Ushort2Ushort2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUshort2Ushort2Ushort2Ushort2(inValue, out);
+ verifyResultsClampUshort2Ushort2Ushort2Ushort2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort2Ushort2Ushort2Ushort2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUshort2Ushort2Ushort2Ushort2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 2];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 2];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshortUshort args = new ArgumentsUshortUshortUshortUshort();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i * 2 + j];
+ args.inMaxValue = arrayInMaxValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUshort2Ushort2Ushort2Ushort2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUshort3Ushort3Ushort3Ushort3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x6b244d61fc64ee3dl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x7b8d14b8610b3967l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x7b8d14acf2682b6dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUshort3Ushort3Ushort3Ushort3(inValue, out);
+ verifyResultsClampUshort3Ushort3Ushort3Ushort3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort3Ushort3Ushort3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUshort3Ushort3Ushort3Ushort3(inValue, out);
+ verifyResultsClampUshort3Ushort3Ushort3Ushort3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort3Ushort3Ushort3Ushort3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUshort3Ushort3Ushort3Ushort3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshortUshort args = new ArgumentsUshortUshortUshortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUshort3Ushort3Ushort3Ushort3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUshort4Ushort4Ushort4Ushort4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x7206bee0fc932575l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0xa5040add7272be8fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0xa5040ad203cfb095l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUshort4Ushort4Ushort4Ushort4(inValue, out);
+ verifyResultsClampUshort4Ushort4Ushort4Ushort4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort4Ushort4Ushort4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUshort4Ushort4Ushort4Ushort4(inValue, out);
+ verifyResultsClampUshort4Ushort4Ushort4Ushort4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort4Ushort4Ushort4Ushort4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUshort4Ushort4Ushort4Ushort4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshortUshort args = new ArgumentsUshortUshortUshortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUshort4Ushort4Ushort4Ushort4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsIntIntIntInt {
+ public int inValue;
+ public int inMinValue;
+ public int inMaxValue;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClampIntIntIntInt() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xfeb3aa11be6164c5l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xd11c228c7c8bf97fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xd11c22810de8eb85l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampIntIntIntInt(inValue, out);
+ verifyResultsClampIntIntIntInt(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampIntIntIntInt: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampIntIntIntInt(inValue, out);
+ verifyResultsClampIntIntIntInt(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampIntIntIntInt: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampIntIntIntInt(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntIntInt args = new ArgumentsIntIntIntInt();
+ args.inValue = arrayInValue[i];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampIntIntIntInt" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampInt2Int2Int2Int2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x56252903bd307c01l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x770112109398f8f3l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x7701120524f5eaf9l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampInt2Int2Int2Int2(inValue, out);
+ verifyResultsClampInt2Int2Int2Int2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt2Int2Int2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampInt2Int2Int2Int2(inValue, out);
+ verifyResultsClampInt2Int2Int2Int2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt2Int2Int2Int2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampInt2Int2Int2Int2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 2];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 2];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntIntInt args = new ArgumentsIntIntIntInt();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i * 2 + j];
+ args.inMaxValue = arrayInMaxValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampInt2Int2Int2Int2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampInt3Int3Int3Int3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x966882045600d2edl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xeb73e6749c7caa77l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xeb73e6692dd99c7dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampInt3Int3Int3Int3(inValue, out);
+ verifyResultsClampInt3Int3Int3Int3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt3Int3Int3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampInt3Int3Int3Int3(inValue, out);
+ verifyResultsClampInt3Int3Int3Int3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt3Int3Int3Int3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampInt3Int3Int3Int3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntIntInt args = new ArgumentsIntIntIntInt();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampInt3Int3Int3Int3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampInt4Int4Int4Int4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xd6abdb04eed129d9l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x5fe6bad8a5605bfbl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x5fe6bacd36bd4e01l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampInt4Int4Int4Int4(inValue, out);
+ verifyResultsClampInt4Int4Int4Int4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt4Int4Int4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampInt4Int4Int4Int4(inValue, out);
+ verifyResultsClampInt4Int4Int4Int4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt4Int4Int4Int4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampInt4Int4Int4Int4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntIntInt args = new ArgumentsIntIntIntInt();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampInt4Int4Int4Int4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUintUintUintUint {
+ public int inValue;
+ public int inMinValue;
+ public int inMaxValue;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClampUintUintUintUint() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xd8df32b2efc89475l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xcf8ec8eece8b7b8fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xcf8ec8e35fe86d95l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUintUintUintUint(inValue, out);
+ verifyResultsClampUintUintUintUint(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUintUintUintUint: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUintUintUintUint(inValue, out);
+ verifyResultsClampUintUintUintUint(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUintUintUintUint: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUintUintUintUint(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUintUint args = new ArgumentsUintUintUintUint();
+ args.inValue = arrayInValue[i];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUintUintUintUint" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUint2Uint2Uint2Uint2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xaf28d478873ae5dl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0x5bbd21aa2a4bc7l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0x5bbd163b873dcdl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUint2Uint2Uint2Uint2(inValue, out);
+ verifyResultsClampUint2Uint2Uint2Uint2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint2Uint2Uint2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUint2Uint2Uint2Uint2(inValue, out);
+ verifyResultsClampUint2Uint2Uint2Uint2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint2Uint2Uint2Uint2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUint2Uint2Uint2Uint2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 2];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 2];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUintUint args = new ArgumentsUintUintUintUint();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i * 2 + j];
+ args.inMaxValue = arrayInMaxValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUint2Uint2Uint2Uint2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUint3Uint3Uint3Uint3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x639fab187e48aaa5l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x8ddee5cebcf6591fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x8ddee5c34e534b25l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUint3Uint3Uint3Uint3(inValue, out);
+ verifyResultsClampUint3Uint3Uint3Uint3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint3Uint3Uint3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUint3Uint3Uint3Uint3(inValue, out);
+ verifyResultsClampUint3Uint3Uint3Uint3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint3Uint3Uint3Uint3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUint3Uint3Uint3Uint3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUintUint args = new ArgumentsUintUintUintUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUint3Uint3Uint3Uint3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUint4Uint4Uint4Uint4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0xbc4cc8e9741da6edl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x1b620e7bcfc26677l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x1b620e70611f587dl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUint4Uint4Uint4Uint4(inValue, out);
+ verifyResultsClampUint4Uint4Uint4Uint4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint4Uint4Uint4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUint4Uint4Uint4Uint4(inValue, out);
+ verifyResultsClampUint4Uint4Uint4Uint4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint4Uint4Uint4Uint4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUint4Uint4Uint4Uint4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 4];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 4];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUintUint args = new ArgumentsUintUintUintUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i * 4 + j];
+ args.inMaxValue = arrayInMaxValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUint4Uint4Uint4Uint4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampChar2CharCharChar2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xd6884bbb7c57a5d1l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x3bf8830cc3b7db63l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x3bf883015514cd69l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampChar2CharCharChar2(inValue, out);
+ verifyResultsClampChar2CharCharChar2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar2CharCharChar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampChar2CharCharChar2(inValue, out);
+ verifyResultsClampChar2CharCharChar2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar2CharCharChar2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampChar2CharCharChar2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharCharChar args = new ArgumentsCharCharCharChar();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampChar2CharCharChar2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampChar3CharCharChar3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x4aa68c1b65a26ee5l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x8b4b9ea0492789dfl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x8b4b9e94da847be5l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampChar3CharCharChar3(inValue, out);
+ verifyResultsClampChar3CharCharChar3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar3CharCharChar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampChar3CharCharChar3(inValue, out);
+ verifyResultsClampChar3CharCharChar3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar3CharCharChar3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampChar3CharCharChar3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharCharChar args = new ArgumentsCharCharCharChar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampChar3CharCharChar3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampChar4CharCharChar4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xbec4cc7b4eed37f9l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xda9eba33ce97385bl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xda9eba285ff42a61l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampChar4CharCharChar4(inValue, out);
+ verifyResultsClampChar4CharCharChar4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar4CharCharChar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampChar4CharCharChar4(inValue, out);
+ verifyResultsClampChar4CharCharChar4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampChar4CharCharChar4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampChar4CharCharChar4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharCharChar args = new ArgumentsCharCharCharChar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampChar4CharCharChar4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUchar2UcharUcharUchar2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0xafd4a680f02e0d63l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x78bbbcb3e9402039l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x78bbbca87a9d123fl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUchar2UcharUcharUchar2(inValue, out);
+ verifyResultsClampUchar2UcharUcharUchar2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar2UcharUcharUchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUchar2UcharUcharUchar2(inValue, out);
+ verifyResultsClampUchar2UcharUcharUchar2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar2UcharUcharUchar2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUchar2UcharUcharUchar2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUcharUchar args = new ArgumentsUcharUcharUcharUchar();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUchar2UcharUcharUchar2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUchar3UcharUcharUchar3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0xfedafacc68ea3ae9l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x8371883e1c6e882bl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x83718832adcb7a31l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUchar3UcharUcharUchar3(inValue, out);
+ verifyResultsClampUchar3UcharUcharUchar3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar3UcharUcharUchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUchar3UcharUcharUchar3(inValue, out);
+ verifyResultsClampUchar3UcharUcharUchar3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar3UcharUcharUchar3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUchar3UcharUcharUchar3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUcharUchar args = new ArgumentsUcharUcharUcharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUchar3UcharUcharUchar3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUchar4UcharUcharUchar4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x4de14f17e1a6686fl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x8e2753c84f9cf01dl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x8e2753bce0f9e223l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUchar4UcharUcharUchar4(inValue, out);
+ verifyResultsClampUchar4UcharUcharUchar4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar4UcharUcharUchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUchar4UcharUcharUchar4(inValue, out);
+ verifyResultsClampUchar4UcharUcharUchar4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUchar4UcharUcharUchar4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUchar4UcharUcharUchar4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayInMinValue = new byte[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ byte[] arrayInMaxValue = new byte[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUcharUchar args = new ArgumentsUcharUcharUcharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUchar4UcharUcharUchar4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampShort2ShortShortShort2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x89e3627eae2d6a9l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x886d6d2ccaca776bl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x886d6d215c276971l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampShort2ShortShortShort2(inValue, out);
+ verifyResultsClampShort2ShortShortShort2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort2ShortShortShort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampShort2ShortShortShort2(inValue, out);
+ verifyResultsClampShort2ShortShortShort2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort2ShortShortShort2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampShort2ShortShortShort2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShortShort args = new ArgumentsShortShortShortShort();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampShort2ShortShortShort2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampShort3ShortShortShort3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x57a48a73639f042fl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x932338b6fdf8df5dl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x932338ab8f55d163l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampShort3ShortShortShort3(inValue, out);
+ verifyResultsClampShort3ShortShortShort3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort3ShortShortShort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampShort3ShortShortShort3(inValue, out);
+ verifyResultsClampShort3ShortShortShort3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort3ShortShortShort3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampShort3ShortShortShort3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShortShort args = new ArgumentsShortShortShortShort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampShort3ShortShortShort3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampShort4ShortShortShort4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0xa6aadebedc5b31b5l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x9dd904413127474fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x9dd90435c2843955l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampShort4ShortShortShort4(inValue, out);
+ verifyResultsClampShort4ShortShortShort4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort4ShortShortShort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampShort4ShortShortShort4(inValue, out);
+ verifyResultsClampShort4ShortShortShort4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampShort4ShortShortShort4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampShort4ShortShortShort4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShortShort args = new ArgumentsShortShortShortShort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampShort4ShortShortShort4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUshort2UshortUshortUshort2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x2ece6d045621ef07l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xd88bd79cc7874965l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xd88bd79158e43b6bl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUshort2UshortUshortUshort2(inValue, out);
+ verifyResultsClampUshort2UshortUshortUshort2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort2UshortUshortUshort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUshort2UshortUshortUshort2(inValue, out);
+ verifyResultsClampUshort2UshortUshortUshort2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort2UshortUshortUshort2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUshort2UshortUshortUshort2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshortUshort args = new ArgumentsUshortUshortUshortUshort();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUshort2UshortUshortUshort2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUshort3UshortUshortUshort3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x393771467c9cd603l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xfe016431b3cf1419l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xfe016426452c061fl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUshort3UshortUshortUshort3(inValue, out);
+ verifyResultsClampUshort3UshortUshortUshort3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort3UshortUshortUshort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUshort3UshortUshortUshort3(inValue, out);
+ verifyResultsClampUshort3UshortUshortUshort3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort3UshortUshortUshort3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUshort3UshortUshortUshort3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshortUshort args = new ArgumentsUshortUshortUshortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUshort3UshortUshortUshort3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUshort4UshortUshortUshort4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x43a07588a317bcffl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x2376f0c6a016decdl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x2376f0bb3173d0d3l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUshort4UshortUshortUshort4(inValue, out);
+ verifyResultsClampUshort4UshortUshortUshort4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort4UshortUshortUshort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUshort4UshortUshortUshort4(inValue, out);
+ verifyResultsClampUshort4UshortUshortUshort4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUshort4UshortUshortUshort4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUshort4UshortUshortUshort4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayInMinValue = new short[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ short[] arrayInMaxValue = new short[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshortUshort args = new ArgumentsUshortUshortUshortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUshort4UshortUshortUshort4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampInt2IntIntInt2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xbb55c0997906d1dbl, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x69776e80fba24121l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x69776e758cff3327l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampInt2IntIntInt2(inValue, out);
+ verifyResultsClampInt2IntIntInt2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt2IntIntInt2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampInt2IntIntInt2(inValue, out);
+ verifyResultsClampInt2IntIntInt2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt2IntIntInt2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampInt2IntIntInt2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntIntInt args = new ArgumentsIntIntIntInt();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampInt2IntIntInt2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampInt3IntIntInt3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x3af8924ab5370be9l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xdde27628f1a08b2bl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xdde2761d82fd7d31l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampInt3IntIntInt3(inValue, out);
+ verifyResultsClampInt3IntIntInt3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt3IntIntInt3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampInt3IntIntInt3(inValue, out);
+ verifyResultsClampInt3IntIntInt3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt3IntIntInt3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampInt3IntIntInt3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntIntInt args = new ArgumentsIntIntIntInt();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampInt3IntIntInt3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampInt4IntIntInt4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xba9b63fbf16745f7l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x524d7dd0e79ed535l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x524d7dc578fbc73bl, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampInt4IntIntInt4(inValue, out);
+ verifyResultsClampInt4IntIntInt4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt4IntIntInt4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampInt4IntIntInt4(inValue, out);
+ verifyResultsClampInt4IntIntInt4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampInt4IntIntInt4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampInt4IntIntInt4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntIntInt args = new ArgumentsIntIntIntInt();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %d",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %d",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampInt4IntIntInt4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUint2UintUintUint2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0x4fd098dd770d5a51l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x6de3f327c2a180e3l, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x6de3f31c53fe72e9l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUint2UintUintUint2(inValue, out);
+ verifyResultsClampUint2UintUintUint2(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint2UintUintUint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUint2UintUintUint2(inValue, out);
+ verifyResultsClampUint2UintUintUint2(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint2UintUintUint2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUint2UintUintUint2(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUintUint args = new ArgumentsUintUintUintUint();
+ args.inValue = arrayInValue[i * 2 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUint2UintUintUint2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUint3UintUintUint3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xc3eed93d60582365l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xbd370ebb48112f5fl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xbd370eafd96e2165l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUint3UintUintUint3(inValue, out);
+ verifyResultsClampUint3UintUintUint3(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint3UintUintUint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUint3UintUintUint3(inValue, out);
+ verifyResultsClampUint3UintUintUint3(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint3UintUintUint3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUint3UintUintUint3(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUintUint args = new ArgumentsUintUintUintUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUint3UintUintUint3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClampUint4UintUintUint4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x380d199d49a2ec79l, false);
+ Allocation inMinValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xc8a2a4ecd80dddbl, false);
+ Allocation inMaxValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xc8a2a435eddcfe1l, false);
+ enforceOrdering(inMinValue, inMaxValue);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInMinValue(inMinValue);
+ script.set_gAllocInMaxValue(inMaxValue);
+ script.forEach_testClampUint4UintUintUint4(inValue, out);
+ verifyResultsClampUint4UintUintUint4(inValue, inMinValue, inMaxValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint4UintUintUint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInMinValue(inMinValue);
+ scriptRelaxed.set_gAllocInMaxValue(inMaxValue);
+ scriptRelaxed.forEach_testClampUint4UintUintUint4(inValue, out);
+ verifyResultsClampUint4UintUintUint4(inValue, inMinValue, inMaxValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClampUint4UintUintUint4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClampUint4UintUintUint4(Allocation inValue, Allocation inMinValue, Allocation inMaxValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayInMinValue = new int[INPUTSIZE * 1];
+ inMinValue.copyTo(arrayInMinValue);
+ int[] arrayInMaxValue = new int[INPUTSIZE * 1];
+ inMaxValue.copyTo(arrayInMaxValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUintUint args = new ArgumentsUintUintUintUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ args.inMinValue = arrayInMinValue[i];
+ args.inMaxValue = arrayInMaxValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClamp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: 0x%x",
+ args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: 0x%x",
+ args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClampUint4UintUintUint4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testClamp() {
+ checkClampFloatFloatFloatFloat();
+ checkClampFloat2Float2Float2Float2();
+ checkClampFloat3Float3Float3Float3();
+ checkClampFloat4Float4Float4Float4();
+ checkClampFloat2FloatFloatFloat2();
+ checkClampFloat3FloatFloatFloat3();
+ checkClampFloat4FloatFloatFloat4();
+ checkClampCharCharCharChar();
+ checkClampChar2Char2Char2Char2();
+ checkClampChar3Char3Char3Char3();
+ checkClampChar4Char4Char4Char4();
+ checkClampUcharUcharUcharUchar();
+ checkClampUchar2Uchar2Uchar2Uchar2();
+ checkClampUchar3Uchar3Uchar3Uchar3();
+ checkClampUchar4Uchar4Uchar4Uchar4();
+ checkClampShortShortShortShort();
+ checkClampShort2Short2Short2Short2();
+ checkClampShort3Short3Short3Short3();
+ checkClampShort4Short4Short4Short4();
+ checkClampUshortUshortUshortUshort();
+ checkClampUshort2Ushort2Ushort2Ushort2();
+ checkClampUshort3Ushort3Ushort3Ushort3();
+ checkClampUshort4Ushort4Ushort4Ushort4();
+ checkClampIntIntIntInt();
+ checkClampInt2Int2Int2Int2();
+ checkClampInt3Int3Int3Int3();
+ checkClampInt4Int4Int4Int4();
+ checkClampUintUintUintUint();
+ checkClampUint2Uint2Uint2Uint2();
+ checkClampUint3Uint3Uint3Uint3();
+ checkClampUint4Uint4Uint4Uint4();
+ checkClampChar2CharCharChar2();
+ checkClampChar3CharCharChar3();
+ checkClampChar4CharCharChar4();
+ checkClampUchar2UcharUcharUchar2();
+ checkClampUchar3UcharUcharUchar3();
+ checkClampUchar4UcharUcharUchar4();
+ checkClampShort2ShortShortShort2();
+ checkClampShort3ShortShortShort3();
+ checkClampShort4ShortShortShort4();
+ checkClampUshort2UshortUshortUshort2();
+ checkClampUshort3UshortUshortUshort3();
+ checkClampUshort4UshortUshortUshort4();
+ checkClampInt2IntIntInt2();
+ checkClampInt3IntIntInt3();
+ checkClampInt4IntIntInt4();
+ checkClampUint2UintUintUint2();
+ checkClampUint3UintUintUint3();
+ checkClampUint4UintUintUint4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestClz.java b/tests/tests/renderscript/src/android/renderscript/cts/TestClz.java
new file mode 100644
index 0000000..8ecf992
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestClz.java
@@ -0,0 +1,1503 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestClz extends RSBaseCompute {
+
+ private ScriptC_TestClz script;
+ private ScriptC_TestClzRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestClz(mRS);
+ scriptRelaxed = new ScriptC_TestClzRelaxed(mRS);
+ }
+
+ public class ArgumentsCharChar {
+ public byte inValue;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClzCharChar() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xf6f3a15e2f7765afl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ script.forEach_testClzCharChar(inValue, out);
+ verifyResultsClzCharChar(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzCharChar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testClzCharChar(inValue, out);
+ verifyResultsClzCharChar(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzCharChar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzCharChar(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharChar args = new ArgumentsCharChar();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzCharChar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzChar2Char2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xf718b99dcaca5e93l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testClzChar2Char2(inValue, out);
+ verifyResultsClzChar2Char2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzChar2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testClzChar2Char2(inValue, out);
+ verifyResultsClzChar2Char2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzChar2Char2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzChar2Char2(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharChar args = new ArgumentsCharChar();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzChar2Char2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzChar3Char3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x21a5da5bc7099347l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testClzChar3Char3(inValue, out);
+ verifyResultsClzChar3Char3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzChar3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testClzChar3Char3(inValue, out);
+ verifyResultsClzChar3Char3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzChar3Char3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzChar3Char3(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharChar args = new ArgumentsCharChar();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzChar3Char3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzChar4Char4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x4c32fb19c348c7fbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testClzChar4Char4(inValue, out);
+ verifyResultsClzChar4Char4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzChar4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testClzChar4Char4(inValue, out);
+ verifyResultsClzChar4Char4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzChar4Char4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzChar4Char4(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharChar args = new ArgumentsCharChar();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzChar4Char4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUcharUchar {
+ public byte inValue;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClzUcharUchar() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xd2e451b48b84f57fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ script.forEach_testClzUcharUchar(inValue, out);
+ verifyResultsClzUcharUchar(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUcharUchar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUcharUchar(inValue, out);
+ verifyResultsClzUcharUchar(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUcharUchar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUcharUchar(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUchar args = new ArgumentsUcharUchar();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUcharUchar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUchar2Uchar2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x792e2970f47ebc85l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testClzUchar2Uchar2(inValue, out);
+ verifyResultsClzUchar2Uchar2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUchar2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUchar2Uchar2(inValue, out);
+ verifyResultsClzUchar2Uchar2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUchar2Uchar2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUchar2Uchar2(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUchar args = new ArgumentsUcharUchar();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUchar2Uchar2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUchar3Uchar3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x9ee29ef83dbce203l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testClzUchar3Uchar3(inValue, out);
+ verifyResultsClzUchar3Uchar3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUchar3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUchar3Uchar3(inValue, out);
+ verifyResultsClzUchar3Uchar3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUchar3Uchar3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUchar3Uchar3(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUchar args = new ArgumentsUcharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUchar3Uchar3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUchar4Uchar4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0xc497147f86fb0781l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testClzUchar4Uchar4(inValue, out);
+ verifyResultsClzUchar4Uchar4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUchar4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUchar4Uchar4(inValue, out);
+ verifyResultsClzUchar4Uchar4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUchar4Uchar4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUchar4Uchar4(Allocation inValue, Allocation out, boolean relaxed) {
+ byte[] arrayInValue = new byte[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUchar args = new ArgumentsUcharUchar();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUchar4Uchar4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsShortShort {
+ public short inValue;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClzShortShort() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x3290aea900d8ad53l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ script.forEach_testClzShortShort(inValue, out);
+ verifyResultsClzShortShort(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShortShort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testClzShortShort(inValue, out);
+ verifyResultsClzShortShort(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShortShort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzShortShort(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShort args = new ArgumentsShortShort();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzShortShort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzShort2Short2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x81f69d4442dd6ebfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testClzShort2Short2(inValue, out);
+ verifyResultsClzShort2Short2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShort2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testClzShort2Short2(inValue, out);
+ verifyResultsClzShort2Short2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShort2Short2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzShort2Short2(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShort args = new ArgumentsShortShort();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzShort2Short2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzShort3Short3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0xa7ab12cb8c1b943dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testClzShort3Short3(inValue, out);
+ verifyResultsClzShort3Short3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShort3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testClzShort3Short3(inValue, out);
+ verifyResultsClzShort3Short3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShort3Short3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzShort3Short3(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShort args = new ArgumentsShortShort();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzShort3Short3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzShort4Short4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0xcd5f8852d559b9bbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testClzShort4Short4(inValue, out);
+ verifyResultsClzShort4Short4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShort4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testClzShort4Short4(inValue, out);
+ verifyResultsClzShort4Short4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzShort4Short4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzShort4Short4(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShort args = new ArgumentsShortShort();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzShort4Short4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUshortUshort {
+ public short inValue;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClzUshortUshort() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x97bdeee92c0103a5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ script.forEach_testClzUshortUshort(inValue, out);
+ verifyResultsClzUshortUshort(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshortUshort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUshortUshort(inValue, out);
+ verifyResultsClzUshortUshort(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshortUshort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUshortUshort(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshort args = new ArgumentsUshortUshort();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUshortUshort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUshort2Ushort2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x5ea7a024b2913837l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testClzUshort2Ushort2(inValue, out);
+ verifyResultsClzUshort2Ushort2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshort2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUshort2Ushort2(inValue, out);
+ verifyResultsClzUshort2Ushort2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshort2Ushort2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUshort2Ushort2(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshort args = new ArgumentsUshortUshort();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUshort2Ushort2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUshort3Ushort3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0xb3f7537beaa1cfa3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testClzUshort3Ushort3(inValue, out);
+ verifyResultsClzUshort3Ushort3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshort3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUshort3Ushort3(inValue, out);
+ verifyResultsClzUshort3Ushort3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshort3Ushort3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUshort3Ushort3(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshort args = new ArgumentsUshortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUshort3Ushort3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUshort4Ushort4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x94706d322b2670fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testClzUshort4Ushort4(inValue, out);
+ verifyResultsClzUshort4Ushort4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshort4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUshort4Ushort4(inValue, out);
+ verifyResultsClzUshort4Ushort4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUshort4Ushort4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUshort4Ushort4(Allocation inValue, Allocation out, boolean relaxed) {
+ short[] arrayInValue = new short[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshort args = new ArgumentsUshortUshort();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUshort4Ushort4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsIntInt {
+ public int inValue;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClzIntInt() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xb13809da3142eb97l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ script.forEach_testClzIntInt(inValue, out);
+ verifyResultsClzIntInt(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzIntInt: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testClzIntInt(inValue, out);
+ verifyResultsClzIntInt(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzIntInt: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzIntInt(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntInt args = new ArgumentsIntInt();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzIntInt" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzInt2Int2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xc9fd2c1a27fe3ad5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testClzInt2Int2(inValue, out);
+ verifyResultsClzInt2Int2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzInt2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testClzInt2Int2(inValue, out);
+ verifyResultsClzInt2Int2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzInt2Int2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzInt2Int2(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntInt args = new ArgumentsIntInt();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzInt2Int2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzInt3Int3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xd6e2b014f2d24c2bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testClzInt3Int3(inValue, out);
+ verifyResultsClzInt3Int3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzInt3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testClzInt3Int3(inValue, out);
+ verifyResultsClzInt3Int3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzInt3Int3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzInt3Int3(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntInt args = new ArgumentsIntInt();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzInt3Int3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzInt4Int4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xe3c8340fbda65d81l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testClzInt4Int4(inValue, out);
+ verifyResultsClzInt4Int4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzInt4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testClzInt4Int4(inValue, out);
+ verifyResultsClzInt4Int4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzInt4Int4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzInt4Int4(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntInt args = new ArgumentsIntInt();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %d",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzInt4Int4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUintUint {
+ public int inValue;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkClzUintUint() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x64a0b78a75ac502fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ script.forEach_testClzUintUint(inValue, out);
+ verifyResultsClzUintUint(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUintUint: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUintUint(inValue, out);
+ verifyResultsClzUintUint(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUintUint: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUintUint(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUint args = new ArgumentsUintUint();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUintUint" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUint2Uint2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xf809b50329344f93l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testClzUint2Uint2(inValue, out);
+ verifyResultsClzUint2Uint2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUint2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUint2Uint2(inValue, out);
+ verifyResultsClzUint2Uint2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUint2Uint2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUint2Uint2(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUint args = new ArgumentsUintUint();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUint2Uint2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUint3Uint3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x2296d5c125738447l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testClzUint3Uint3(inValue, out);
+ verifyResultsClzUint3Uint3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUint3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUint3Uint3(inValue, out);
+ verifyResultsClzUint3Uint3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUint3Uint3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUint3Uint3(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUint args = new ArgumentsUintUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUint3Uint3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkClzUint4Uint4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x4d23f67f21b2b8fbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testClzUint4Uint4(inValue, out);
+ verifyResultsClzUint4Uint4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUint4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testClzUint4Uint4(inValue, out);
+ verifyResultsClzUint4Uint4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testClzUint4Uint4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsClzUint4Uint4(Allocation inValue, Allocation out, boolean relaxed) {
+ int[] arrayInValue = new int[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUint args = new ArgumentsUintUint();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeClz(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: 0x%x",
+ args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkClzUint4Uint4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testClz() {
+ checkClzCharChar();
+ checkClzChar2Char2();
+ checkClzChar3Char3();
+ checkClzChar4Char4();
+ checkClzUcharUchar();
+ checkClzUchar2Uchar2();
+ checkClzUchar3Uchar3();
+ checkClzUchar4Uchar4();
+ checkClzShortShort();
+ checkClzShort2Short2();
+ checkClzShort3Short3();
+ checkClzShort4Short4();
+ checkClzUshortUshort();
+ checkClzUshort2Ushort2();
+ checkClzUshort3Ushort3();
+ checkClzUshort4Ushort4();
+ checkClzIntInt();
+ checkClzInt2Int2();
+ checkClzInt3Int3();
+ checkClzInt4Int4();
+ checkClzUintUint();
+ checkClzUint2Uint2();
+ checkClzUint3Uint3();
+ checkClzUint4Uint4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestConvert.java b/tests/tests/renderscript/src/android/renderscript/cts/TestConvert.java
new file mode 100644
index 0000000..95490cc
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestConvert.java
@@ -0,0 +1,2538 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestConvert extends RSBaseCompute {
+
+ private ScriptC_TestConvert script;
+ private ScriptC_TestConvertRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestConvert(mRS);
+ scriptRelaxed = new ScriptC_TestConvertRelaxed(mRS);
+ }
+
+ private void checkConvertFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x239cb31c61129750l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testConvertFloat2Float2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat2Float2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x239cbdbdc0192ceal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testConvertFloat3Float3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat3Float3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x239cc85f1f1fc284l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testConvertFloat4Float4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat4Float4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xd861883c0ca26e90l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testConvertFloat2Char2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Char2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat2Char2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Char2Float2: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0xd86192dd6ba9042al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testConvertFloat3Char3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Char3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat3Char3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Char3Float3: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xd8619d7ecaaf99c4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testConvertFloat4Char4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Char4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat4Char4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Char4Float4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x7fef41899f247b11l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testConvertFloat2Uchar2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Uchar2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat2Uchar2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Uchar2Float2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x7fef4c2afe2b10abl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testConvertFloat3Uchar3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Uchar3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat3Uchar3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Uchar3Float3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x7fef56cc5d31a645l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testConvertFloat4Uchar4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Uchar4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat4Uchar4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Uchar4Float4: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x68ab65c64d600954l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testConvertFloat2Short2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Short2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat2Short2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Short2Float2: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x68ab7067ac669eeel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testConvertFloat3Short3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Short3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat3Short3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Short3Float3: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x68ab7b090b6d3488l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testConvertFloat4Short4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Short4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat4Short4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Short4Float4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x8d7985cde93822ffl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testConvertFloat2Ushort2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Ushort2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat2Ushort2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Ushort2Float2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x8d79906f483eb899l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testConvertFloat3Ushort3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Ushort3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat3Ushort3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Ushort3Float3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x8d799b10a7454e33l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testConvertFloat4Ushort4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Ushort4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat4Ushort4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Ushort4Float4: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xd74f520b6ddc57cdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testConvertFloat2Int2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Int2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat2Int2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xd74f5caccce2ed67l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testConvertFloat3Int3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Int3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat3Int3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xd74f674e2be98301l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testConvertFloat4Int4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Int4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat4Int4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Int4Float4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xe71d08f56b507bd0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testConvertFloat2Uint2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Uint2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat2Uint2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat2Uint2Float2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xe71d1396ca57116al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testConvertFloat3Uint3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Uint3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat3Uint3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat3Uint3Float3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0xe71d1e38295da704l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testConvertFloat4Uint4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Uint4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertFloat4Uint4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertFloat4Uint4Float4: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat2Char2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x8fb63faeb391b024l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertChar2Float2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Float2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar2Float2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Float2Char2: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat3Char3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x8fb63fedfd389100l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertChar3Float3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Float3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar3Float3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Float3Char3: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat4Char4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x8fb6402d46df71dcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertChar4Float4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Float4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar4Float4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Float4Char4: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar2Char2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x880244a387ee55e4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertChar2Char2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Char2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar2Char2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Char2Char2: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar3Char3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x880244e2d19536c0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertChar3Char3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Char3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar3Char3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Char3Char3: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar4Char4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x880245221b3c179cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertChar4Char4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Char4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar4Char4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Char4Char4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar2Char2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x97cffb8d856279e7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertChar2Uchar2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Uchar2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar2Uchar2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Uchar2Char2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar3Char3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x97cffbcccf095ac3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertChar3Uchar3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Uchar3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar3Uchar3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Uchar3Char3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar4Char4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x97cffc0c18b03b9fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertChar4Uchar4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Uchar4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar4Uchar4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Uchar4Char4: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort2Char2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x856931fa18520030l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertChar2Short2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Short2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar2Short2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Short2Char2: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort3Char3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x8569323961f8e10cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertChar3Short3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Short3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar3Short3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Short3Char3: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort4Char4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x85693278ab9fc1e8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertChar4Short4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Short4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar4Short4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Short4Char4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort2Char2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x2cf6eb47aad40cb1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertChar2Ushort2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Ushort2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar2Ushort2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Ushort2Char2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort3Char3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x2cf6eb86f47aed8dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertChar3Ushort3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Ushort3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar3Ushort3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Ushort3Char3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort4Char4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x2cf6ebc63e21ce69l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertChar4Ushort4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Ushort4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar4Ushort4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Ushort4Char4: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt2Char2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x501d8373ccbf61bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertChar2Int2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Int2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar2Int2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Int2Char2: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt3Char3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x501d8768672d6f7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertChar3Int3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Int3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar3Int3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Int3Char3: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt4Char4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x501d8b5d019b7d3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertChar4Int4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Int4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar4Int4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Int4Char4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint2Char2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0x70899afb30d49da4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertChar2Uint2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Uint2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar2Uint2Char2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar2Uint2Char2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint3Char3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x70899b3a7a7b7e80l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertChar3Uint3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Uint3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar3Uint3Char3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar3Uint3Char3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint4Char4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x70899b79c4225f5cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertChar4Uint4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Uint4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertChar4Uint4Char4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertChar4Uint4Char4: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat2Uchar2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x239cb6c435759ce9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertUchar2Float2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Float2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar2Float2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Float2Uchar2: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat3Uchar3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x239cc165947c3283l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertUchar3Float3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Float3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar3Float3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Float3Uchar3: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat4Uchar4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x239ccc06f382c81dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertUchar4Float4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Float4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar4Float4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Float4Uchar4: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar2Uchar2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xd8618be3e1057429l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertUchar2Char2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Char2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar2Char2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Char2Uchar2: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar3Uchar3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0xd8619685400c09c3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertUchar3Char3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Char3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar3Char3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Char3Uchar3: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar4Uchar4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xd861a1269f129f5dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertUchar4Char4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Char4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar4Char4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Char4Uchar4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar2Uchar2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x7fef4531738780aal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertUchar2Uchar2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Uchar2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar2Uchar2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Uchar2Uchar2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar3Uchar3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x7fef4fd2d28e1644l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertUchar3Uchar3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Uchar3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar3Uchar3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Uchar3Uchar3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar4Uchar4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x7fef5a743194abdel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertUchar4Uchar4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Uchar4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar4Uchar4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Uchar4Uchar4: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort2Uchar2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x68ab696e21c30eedl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertUchar2Short2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Short2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar2Short2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Short2Uchar2: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort3Uchar3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x68ab740f80c9a487l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertUchar3Short3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Short3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar3Short3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Short3Uchar3: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort4Uchar4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x68ab7eb0dfd03a21l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertUchar4Short4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Short4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar4Short4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Short4Uchar4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort2Uchar2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x8d798975bd9b2898l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertUchar2Ushort2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Ushort2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar2Ushort2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Ushort2Uchar2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort3Uchar3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x8d7994171ca1be32l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertUchar3Ushort3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Ushort3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar3Ushort3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Ushort3Uchar3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort4Uchar4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x8d799eb87ba853ccl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertUchar4Ushort4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Ushort4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar4Ushort4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Ushort4Uchar4: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt2Uchar2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xd74f55b3423f5d66l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertUchar2Int2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Int2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar2Int2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Int2Uchar2: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt3Uchar3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xd74f6054a145f300l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertUchar3Int3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Int3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar3Int3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Int3Uchar3: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt4Uchar4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xd74f6af6004c889al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertUchar4Int4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Int4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar4Int4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Int4Uchar4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint2Uchar2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xe71d0c9d3fb38169l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.forEach_testConvertUchar2Uint2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Uint2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar2Uint2Uchar2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar2Uint2Uchar2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint3Uchar3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xe71d173e9eba1703l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.forEach_testConvertUchar3Uint3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Uint3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar3Uint3Uchar3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar3Uint3Uchar3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint4Uchar4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0xe71d21dffdc0ac9dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.forEach_testConvertUchar4Uint4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Uint4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUchar4Uint4Uchar4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUchar4Uint4Uchar4: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat2Short2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x239cb64d3ee118b4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertShort2Float2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Float2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort2Float2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Float2Short2: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat3Short3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x239cc0ee9de7ae4el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertShort3Float3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Float3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort3Float3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Float3Short3: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat4Short4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x239ccb8ffcee43e8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertShort4Float4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Float4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort4Float4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Float4Short4: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar2Short2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xd8618b6cea70eff4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertShort2Char2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Char2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort2Char2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Char2Short2: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar3Short3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0xd861960e4977858el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertShort3Char3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Char3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort3Char3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Char3Short3: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar4Short4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xd861a0afa87e1b28l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertShort4Char4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Char4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort4Char4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Char4Short4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar2Short2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x7fef44ba7cf2fc75l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertShort2Uchar2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Uchar2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort2Uchar2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Uchar2Short2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar3Short3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x7fef4f5bdbf9920fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertShort3Uchar3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Uchar3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort3Uchar3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Uchar3Short3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar4Short4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x7fef59fd3b0027a9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertShort4Uchar4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Uchar4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort4Uchar4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Uchar4Short4: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort2Short2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x68ab68f72b2e8ab8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertShort2Short2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Short2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort2Short2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Short2Short2: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort3Short3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x68ab73988a352052l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertShort3Short3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Short3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort3Short3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Short3Short3: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort4Short4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x68ab7e39e93bb5ecl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertShort4Short4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Short4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort4Short4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Short4Short4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort2Short2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x8d7988fec706a463l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertShort2Ushort2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Ushort2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort2Ushort2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Ushort2Short2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort3Short3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x8d7993a0260d39fdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertShort3Ushort3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Ushort3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort3Ushort3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Ushort3Short3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort4Short4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x8d799e418513cf97l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertShort4Ushort4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Ushort4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort4Ushort4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Ushort4Short4: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt2Short2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xd74f553c4baad931l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertShort2Int2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Int2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort2Int2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Int2Short2: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt3Short3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xd74f5fddaab16ecbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertShort3Int3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Int3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort3Int3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Int3Short3: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt4Short4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xd74f6a7f09b80465l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertShort4Int4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Int4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort4Int4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Int4Short4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint2Short2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xe71d0c26491efd34l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertShort2Uint2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Uint2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort2Uint2Short2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort2Uint2Short2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint3Short3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xe71d16c7a82592cel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertShort3Uint3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Uint3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort3Uint3Short3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort3Uint3Short3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint4Short4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0xe71d2169072c2868l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertShort4Uint4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Uint4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertShort4Uint4Short4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertShort4Uint4Short4: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat2Ushort2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xfb52b6ea1029ddcbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertUshort2Float2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Float2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort2Float2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Float2Ushort2: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat3Ushort3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xfb5480050643cf4fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertUshort3Float3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Float3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort3Float3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Float3Ushort3: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat4Ushort4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xfb56491ffc5dc0d3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertUshort4Float4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Float4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort4Float4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Float4Ushort4: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar2Ushort2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x5862833be153058bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertUshort2Char2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Char2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort2Char2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Char2Ushort2: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar3Ushort3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x58644c56d76cf70fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertUshort3Char3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Char3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort3Char3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Char3Ushort3: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar4Ushort4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x58661571cd86e893l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertUshort4Char4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Char4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort4Char4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Char4Ushort4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar2Ushort2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x7d30a3437d2b1f36l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertUshort2Uchar2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Uchar2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort2Uchar2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Uchar2Ushort2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar3Ushort3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x7d326c5e734510bal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertUshort3Uchar3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Uchar3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort3Uchar3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Uchar3Ushort3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar4Ushort4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x7d343579695f023el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertUshort4Uchar4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Uchar4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort4Uchar4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Uchar4Ushort4: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort2Ushort2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x94cab974c12c0477l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertUshort2Short2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Short2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort2Short2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Short2Ushort2: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort3Ushort3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x94cc828fb745f5fbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertUshort3Short3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Short3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort3Short3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Short3Ushort3: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort4Ushort4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x94ce4baaad5fe77fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertUshort4Short4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Short4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort4Short4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Short4Ushort4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort2Ushort2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0xc36a1abbee785430l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertUshort2Ushort2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Ushort2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort2Ushort2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Ushort2Ushort2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort3Ushort3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0xc36be3d6e49245b4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertUshort3Ushort3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Ushort3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort3Ushort3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Ushort3Ushort3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort4Ushort4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0xc36dacf1daac3738l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertUshort4Ushort4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Ushort4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort4Ushort4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Ushort4Ushort4: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt2Ushort2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x2a536911360d32cal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertUshort2Int2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Int2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort2Int2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Int2Ushort2: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt3Ushort3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x2a55322c2c27244el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertUshort3Int3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Int3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort3Int3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Int3Ushort3: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt4Ushort4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x2a56fb47224115d2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertUshort4Int4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Int4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort4Int4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Int4Ushort4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint2Ushort2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xd1e1225ec88f3f4bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.forEach_testConvertUshort2Uint2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Uint2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort2Uint2Ushort2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort2Uint2Ushort2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint3Ushort3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xd1e2eb79bea930cfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.forEach_testConvertUshort3Uint3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Uint3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort3Uint3Ushort3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort3Uint3Ushort3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint4Ushort4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0xd1e4b494b4c32253l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.forEach_testConvertUshort4Uint4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Uint4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUshort4Uint4Ushort4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUshort4Uint4Ushort4: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xaffe48ec75974c95l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertInt2Float2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Float2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt2Float2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Float2Int2: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xaffe48edee5fac37l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertInt3Float3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Float3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt3Float3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Float3Int3: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xaffe48ef67280bd9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertInt4Float4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Float4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt4Float4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Float4Int4: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x329ba27bc049dd5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertInt2Char2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Char2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt2Char2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Char2Int2: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x329ba2934ccfd77l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertInt3Char3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Char3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt3Char3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Char3Int3: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x329ba2aad955d19l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertInt4Char4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Char4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt4Char4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Char4Int4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x6eb17cebb00d455el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertInt2Uchar2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Uchar2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt2Uchar2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Uchar2Int2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x6eb17ced28d5a500l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertInt3Uchar3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Uchar3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt3Uchar3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Uchar3Int3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x6eb17ceea19e04a2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertInt4Uchar4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Uchar4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt4Uchar4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Uchar4Int4: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x5673900bfae92ab9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertInt2Short2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Short2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt2Short2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Short2Int2: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x5673900d73b18a5bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertInt3Short3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Short3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt3Short3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Short3Int3: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x5673900eec79e9fdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertInt4Short4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Short4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt4Short4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Short4Int4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x664146f5f85d4ebcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertInt2Ushort2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Ushort2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt2Ushort2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Ushort2Int2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x664146f77125ae5el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertInt3Ushort3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Ushort3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt3Ushort3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Ushort3Int3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x664146f8e9ee0e00l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertInt4Ushort4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Ushort4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt4Ushort4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Ushort4Int4: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xd67128c001b66bfal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertInt2Int2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Int2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt2Int2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Int2Int2: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xd67128c17a7ecb9cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertInt3Int3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Int3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt3Int3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Int3Int3: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xd67128c2f3472b3el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertInt4Int4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Int4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt4Int4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Int4Int4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0x89215772b1bd515l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertInt2Uint2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Uint2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt2Uint2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt2Uint2Int2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x8921578a3e434b7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertInt3Uint3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Uint3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt3Uint3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt3Uint3Int3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x892157a1cac9459l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertInt4Uint4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Uint4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertInt4Uint4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertInt4Uint4Int4: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat2Uint2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x8fb63fc93d13ab64l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertUint2Float2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Float2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint2Float2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Float2Uint2: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat3Uint3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x8fb6400886ba8c40l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertUint3Float3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Float3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint3Float3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Float3Uint3: " + e.toString());
+ }
+ }
+
+ private void checkConvertFloat4Uint4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x8fb64047d0616d1cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertUint4Float4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Float4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint4Float4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Float4Uint4: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar2Uint2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x880244be11705124l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertUint2Char2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Char2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint2Char2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Char2Uint2: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar3Uint3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x880244fd5b173200l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertUint3Char3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Char3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint3Char3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Char3Uint3: " + e.toString());
+ }
+ }
+
+ private void checkConvertChar4Uint4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x8802453ca4be12dcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertUint4Char4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Char4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint4Char4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Char4Uint4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar2Uint2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x97cffba80ee47527l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertUint2Uchar2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Uchar2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint2Uchar2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Uchar2Uint2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar3Uint3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x97cffbe7588b5603l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertUint3Uchar3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Uchar3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint3Uchar3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Uchar3Uint3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUchar4Uint4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x97cffc26a23236dfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertUint4Uchar4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Uchar4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint4Uchar4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Uchar4Uint4: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort2Uint2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x85693214a1d3fb70l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertUint2Short2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Short2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint2Short2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Short2Uint2: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort3Uint3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x85693253eb7adc4cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertUint3Short3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Short3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint3Short3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Short3Uint3: " + e.toString());
+ }
+ }
+
+ private void checkConvertShort4Uint4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x856932933521bd28l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertUint4Short4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Short4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint4Short4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Short4Uint4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort2Uint2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x2cf6eb62345607f1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertUint2Ushort2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Ushort2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint2Ushort2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Ushort2Uint2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort3Uint3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x2cf6eba17dfce8cdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertUint3Ushort3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Ushort3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint3Ushort3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Ushort3Uint3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUshort4Uint4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x2cf6ebe0c7a3c9a9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertUint4Ushort4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Ushort4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint4Ushort4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Ushort4Uint4: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt2Uint2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x501d851c64df15bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertUint2Int2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Int2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint2Int2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Int2Uint2: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt3Uint3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x501d8910ff4d237l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertUint3Int3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Int3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint3Int3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Int3Uint3: " + e.toString());
+ }
+ }
+
+ private void checkConvertInt4Uint4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x501d8d0599bb313l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertUint4Int4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Int4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint4Int4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Int4Uint4: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint2Uint2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0x70899b15ba5698e4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.forEach_testConvertUint2Uint2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Uint2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint2Uint2Uint2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint2Uint2Uint2: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint3Uint3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x70899b5503fd79c0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.forEach_testConvertUint3Uint3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Uint3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint3Uint3Uint3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint3Uint3Uint3: " + e.toString());
+ }
+ }
+
+ private void checkConvertUint4Uint4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x70899b944da45a9cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.forEach_testConvertUint4Uint4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Uint4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testConvertUint4Uint4Uint4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testConvertUint4Uint4Uint4: " + e.toString());
+ }
+ }
+
+ public void testConvert() {
+ checkConvertFloat2Float2();
+ checkConvertFloat3Float3();
+ checkConvertFloat4Float4();
+ checkConvertChar2Float2();
+ checkConvertChar3Float3();
+ checkConvertChar4Float4();
+ checkConvertUchar2Float2();
+ checkConvertUchar3Float3();
+ checkConvertUchar4Float4();
+ checkConvertShort2Float2();
+ checkConvertShort3Float3();
+ checkConvertShort4Float4();
+ checkConvertUshort2Float2();
+ checkConvertUshort3Float3();
+ checkConvertUshort4Float4();
+ checkConvertInt2Float2();
+ checkConvertInt3Float3();
+ checkConvertInt4Float4();
+ checkConvertUint2Float2();
+ checkConvertUint3Float3();
+ checkConvertUint4Float4();
+ checkConvertFloat2Char2();
+ checkConvertFloat3Char3();
+ checkConvertFloat4Char4();
+ checkConvertChar2Char2();
+ checkConvertChar3Char3();
+ checkConvertChar4Char4();
+ checkConvertUchar2Char2();
+ checkConvertUchar3Char3();
+ checkConvertUchar4Char4();
+ checkConvertShort2Char2();
+ checkConvertShort3Char3();
+ checkConvertShort4Char4();
+ checkConvertUshort2Char2();
+ checkConvertUshort3Char3();
+ checkConvertUshort4Char4();
+ checkConvertInt2Char2();
+ checkConvertInt3Char3();
+ checkConvertInt4Char4();
+ checkConvertUint2Char2();
+ checkConvertUint3Char3();
+ checkConvertUint4Char4();
+ checkConvertFloat2Uchar2();
+ checkConvertFloat3Uchar3();
+ checkConvertFloat4Uchar4();
+ checkConvertChar2Uchar2();
+ checkConvertChar3Uchar3();
+ checkConvertChar4Uchar4();
+ checkConvertUchar2Uchar2();
+ checkConvertUchar3Uchar3();
+ checkConvertUchar4Uchar4();
+ checkConvertShort2Uchar2();
+ checkConvertShort3Uchar3();
+ checkConvertShort4Uchar4();
+ checkConvertUshort2Uchar2();
+ checkConvertUshort3Uchar3();
+ checkConvertUshort4Uchar4();
+ checkConvertInt2Uchar2();
+ checkConvertInt3Uchar3();
+ checkConvertInt4Uchar4();
+ checkConvertUint2Uchar2();
+ checkConvertUint3Uchar3();
+ checkConvertUint4Uchar4();
+ checkConvertFloat2Short2();
+ checkConvertFloat3Short3();
+ checkConvertFloat4Short4();
+ checkConvertChar2Short2();
+ checkConvertChar3Short3();
+ checkConvertChar4Short4();
+ checkConvertUchar2Short2();
+ checkConvertUchar3Short3();
+ checkConvertUchar4Short4();
+ checkConvertShort2Short2();
+ checkConvertShort3Short3();
+ checkConvertShort4Short4();
+ checkConvertUshort2Short2();
+ checkConvertUshort3Short3();
+ checkConvertUshort4Short4();
+ checkConvertInt2Short2();
+ checkConvertInt3Short3();
+ checkConvertInt4Short4();
+ checkConvertUint2Short2();
+ checkConvertUint3Short3();
+ checkConvertUint4Short4();
+ checkConvertFloat2Ushort2();
+ checkConvertFloat3Ushort3();
+ checkConvertFloat4Ushort4();
+ checkConvertChar2Ushort2();
+ checkConvertChar3Ushort3();
+ checkConvertChar4Ushort4();
+ checkConvertUchar2Ushort2();
+ checkConvertUchar3Ushort3();
+ checkConvertUchar4Ushort4();
+ checkConvertShort2Ushort2();
+ checkConvertShort3Ushort3();
+ checkConvertShort4Ushort4();
+ checkConvertUshort2Ushort2();
+ checkConvertUshort3Ushort3();
+ checkConvertUshort4Ushort4();
+ checkConvertInt2Ushort2();
+ checkConvertInt3Ushort3();
+ checkConvertInt4Ushort4();
+ checkConvertUint2Ushort2();
+ checkConvertUint3Ushort3();
+ checkConvertUint4Ushort4();
+ checkConvertFloat2Int2();
+ checkConvertFloat3Int3();
+ checkConvertFloat4Int4();
+ checkConvertChar2Int2();
+ checkConvertChar3Int3();
+ checkConvertChar4Int4();
+ checkConvertUchar2Int2();
+ checkConvertUchar3Int3();
+ checkConvertUchar4Int4();
+ checkConvertShort2Int2();
+ checkConvertShort3Int3();
+ checkConvertShort4Int4();
+ checkConvertUshort2Int2();
+ checkConvertUshort3Int3();
+ checkConvertUshort4Int4();
+ checkConvertInt2Int2();
+ checkConvertInt3Int3();
+ checkConvertInt4Int4();
+ checkConvertUint2Int2();
+ checkConvertUint3Int3();
+ checkConvertUint4Int4();
+ checkConvertFloat2Uint2();
+ checkConvertFloat3Uint3();
+ checkConvertFloat4Uint4();
+ checkConvertChar2Uint2();
+ checkConvertChar3Uint3();
+ checkConvertChar4Uint4();
+ checkConvertUchar2Uint2();
+ checkConvertUchar3Uint3();
+ checkConvertUchar4Uint4();
+ checkConvertShort2Uint2();
+ checkConvertShort3Uint3();
+ checkConvertShort4Uint4();
+ checkConvertUshort2Uint2();
+ checkConvertUshort3Uint3();
+ checkConvertUshort4Uint4();
+ checkConvertInt2Uint2();
+ checkConvertInt3Uint3();
+ checkConvertInt4Uint4();
+ checkConvertUint2Uint2();
+ checkConvertUint3Uint3();
+ checkConvertUint4Uint4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestCopysign.java b/tests/tests/renderscript/src/android/renderscript/cts/TestCopysign.java
new file mode 100644
index 0000000..02ba8a4
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCopysign.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestCopysign extends RSBaseCompute {
+
+ private ScriptC_TestCopysign script;
+ private ScriptC_TestCopysignRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestCopysign(mRS);
+ scriptRelaxed = new ScriptC_TestCopysignRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkCopysignFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xeebba96e8c48145l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xeebba96e8c48146l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testCopysignFloatFloatFloat(inX, out);
+ verifyResultsCopysignFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testCopysignFloatFloatFloat(inX, out);
+ verifyResultsCopysignFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCopysignFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCopysign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCopysignFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCopysignFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbeb0e1cc912e993bl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbeb0e1cc912e993cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testCopysignFloat2Float2Float2(inX, out);
+ verifyResultsCopysignFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testCopysignFloat2Float2Float2(inX, out);
+ verifyResultsCopysignFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCopysignFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCopysign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCopysignFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCopysignFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1315bfec930c9adcl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1315bfec930c9addl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testCopysignFloat3Float3Float3(inX, out);
+ verifyResultsCopysignFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testCopysignFloat3Float3Float3(inX, out);
+ verifyResultsCopysignFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCopysignFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCopysign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCopysignFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCopysignFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x677a9e0c94ea9c7dl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x677a9e0c94ea9c7el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testCopysignFloat4Float4Float4(inX, out);
+ verifyResultsCopysignFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testCopysignFloat4Float4Float4(inX, out);
+ verifyResultsCopysignFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCopysignFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCopysignFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCopysign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCopysignFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testCopysign() {
+ checkCopysignFloatFloatFloat();
+ checkCopysignFloat2Float2Float2();
+ checkCopysignFloat3Float3Float3();
+ checkCopysignFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestCos.java b/tests/tests/renderscript/src/android/renderscript/cts/TestCos.java
new file mode 100644
index 0000000..4a6e4ad
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCos.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestCos extends RSBaseCompute {
+
+ private ScriptC_TestCos script;
+ private ScriptC_TestCosRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestCos(mRS);
+ scriptRelaxed = new ScriptC_TestCosRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkCosFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x35eace7a33fd0be0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testCosFloatFloat(in, out);
+ verifyResultsCosFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testCosFloatFloat(in, out);
+ verifyResultsCosFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCosFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCosFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCosFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6cec729d2fe33ffcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testCosFloat2Float2(in, out);
+ verifyResultsCosFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testCosFloat2Float2(in, out);
+ verifyResultsCosFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCosFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCosFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCosFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6cec7d3e8ee9d596l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testCosFloat3Float3(in, out);
+ verifyResultsCosFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testCosFloat3Float3(in, out);
+ verifyResultsCosFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCosFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCosFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCosFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6cec87dfedf06b30l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testCosFloat4Float4(in, out);
+ verifyResultsCosFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testCosFloat4Float4(in, out);
+ verifyResultsCosFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCosFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCosFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCosFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testCos() {
+ checkCosFloatFloat();
+ checkCosFloat2Float2();
+ checkCosFloat3Float3();
+ checkCosFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestCosh.java b/tests/tests/renderscript/src/android/renderscript/cts/TestCosh.java
new file mode 100644
index 0000000..3056e39
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCosh.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestCosh extends RSBaseCompute {
+
+ private ScriptC_TestCosh script;
+ private ScriptC_TestCoshRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestCosh(mRS);
+ scriptRelaxed = new ScriptC_TestCoshRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkCoshFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xca4f5b95e29e11bel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testCoshFloatFloat(in, out);
+ verifyResultsCoshFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testCoshFloatFloat(in, out);
+ verifyResultsCoshFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCoshFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCoshFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCoshFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x372b9f8d78e6a06al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testCoshFloat2Float2(in, out);
+ verifyResultsCoshFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testCoshFloat2Float2(in, out);
+ verifyResultsCoshFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCoshFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCoshFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCoshFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x372baa2ed7ed3604l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testCoshFloat3Float3(in, out);
+ verifyResultsCoshFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testCoshFloat3Float3(in, out);
+ verifyResultsCoshFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCoshFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCoshFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCoshFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x372bb4d036f3cb9el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testCoshFloat4Float4(in, out);
+ verifyResultsCoshFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testCoshFloat4Float4(in, out);
+ verifyResultsCoshFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCoshFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCoshFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCosh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCoshFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testCosh() {
+ checkCoshFloatFloat();
+ checkCoshFloat2Float2();
+ checkCoshFloat3Float3();
+ checkCoshFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestCospi.java b/tests/tests/renderscript/src/android/renderscript/cts/TestCospi.java
new file mode 100644
index 0000000..9d665ea
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCospi.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestCospi extends RSBaseCompute {
+
+ private ScriptC_TestCospi script;
+ private ScriptC_TestCospiRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestCospi(mRS);
+ scriptRelaxed = new ScriptC_TestCospiRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkCospiFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf63d9fae6fcc7f1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testCospiFloatFloat(in, out);
+ verifyResultsCospiFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testCospiFloatFloat(in, out);
+ verifyResultsCospiFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCospiFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCospiFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCospiFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2830872a08f896c5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testCospiFloat2Float2(in, out);
+ verifyResultsCospiFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testCospiFloat2Float2(in, out);
+ verifyResultsCospiFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCospiFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCospiFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCospiFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x283091cb67ff2c5fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testCospiFloat3Float3(in, out);
+ verifyResultsCospiFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testCospiFloat3Float3(in, out);
+ verifyResultsCospiFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCospiFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCospiFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkCospiFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x28309c6cc705c1f9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testCospiFloat4Float4(in, out);
+ verifyResultsCospiFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testCospiFloat4Float4(in, out);
+ verifyResultsCospiFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCospiFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsCospiFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeCospi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkCospiFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testCospi() {
+ checkCospiFloatFloat();
+ checkCospiFloat2Float2();
+ checkCospiFloat3Float3();
+ checkCospiFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestCross.java b/tests/tests/renderscript/src/android/renderscript/cts/TestCross.java
new file mode 100644
index 0000000..61b38ee
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCross.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestCross extends RSBaseCompute {
+
+ private ScriptC_TestCross script;
+ private ScriptC_TestCrossRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestCross(mRS);
+ scriptRelaxed = new ScriptC_TestCrossRelaxed(mRS);
+ }
+
+ private void checkCrossFloat3Float3Float3() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xdec3726a2995edb5l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xdec3726a2996190bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testCrossFloat3Float3Float3(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCrossFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testCrossFloat3Float3Float3(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCrossFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkCrossFloat4Float4Float4() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6b4bc797a60fb18el, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6b4bc797a60fdce4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testCrossFloat4Float4Float4(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCrossFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testCrossFloat4Float4Float4(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testCrossFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ public void testCross() {
+ checkCrossFloat3Float3Float3();
+ checkCrossFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestDegrees.java b/tests/tests/renderscript/src/android/renderscript/cts/TestDegrees.java
new file mode 100644
index 0000000..726be15
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestDegrees.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestDegrees extends RSBaseCompute {
+
+ private ScriptC_TestDegrees script;
+ private ScriptC_TestDegreesRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestDegrees(mRS);
+ scriptRelaxed = new ScriptC_TestDegreesRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float inValue;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkDegreesFloatFloat() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x3325fa58542a6bb5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testDegreesFloatFloat(inValue, out);
+ verifyResultsDegreesFloatFloat(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testDegreesFloatFloat(inValue, out);
+ verifyResultsDegreesFloatFloat(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsDegreesFloatFloat(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeDegrees(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkDegreesFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkDegreesFloat2Float2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x7a202f393d2a289l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testDegreesFloat2Float2(inValue, out);
+ verifyResultsDegreesFloat2Float2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testDegreesFloat2Float2(inValue, out);
+ verifyResultsDegreesFloat2Float2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsDegreesFloat2Float2(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeDegrees(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkDegreesFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkDegreesFloat3Float3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2d56787add10c807l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testDegreesFloat3Float3(inValue, out);
+ verifyResultsDegreesFloat3Float3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testDegreesFloat3Float3(inValue, out);
+ verifyResultsDegreesFloat3Float3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsDegreesFloat3Float3(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeDegrees(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkDegreesFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkDegreesFloat4Float4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x530aee02264eed85l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testDegreesFloat4Float4(inValue, out);
+ verifyResultsDegreesFloat4Float4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testDegreesFloat4Float4(inValue, out);
+ verifyResultsDegreesFloat4Float4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDegreesFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsDegreesFloat4Float4(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeDegrees(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkDegreesFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testDegrees() {
+ checkDegreesFloatFloat();
+ checkDegreesFloat2Float2();
+ checkDegreesFloat3Float3();
+ checkDegreesFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestDistance.java b/tests/tests/renderscript/src/android/renderscript/cts/TestDistance.java
new file mode 100644
index 0000000..2c55a76
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestDistance.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestDistance extends RSBaseCompute {
+
+ private ScriptC_TestDistance script;
+ private ScriptC_TestDistanceRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestDistance(mRS);
+ scriptRelaxed = new ScriptC_TestDistanceRelaxed(mRS);
+ }
+
+ private void checkDistanceFloatFloatFloat() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf62f685ebafc5b67l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf62f685ebafc86bdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDistanceFloatFloatFloat(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDistanceFloatFloatFloat(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkDistanceFloat2Float2Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x3fdeb51f89981593l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x3fdeb51f899840e9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDistanceFloat2Float2Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloat2Float2Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDistanceFloat2Float2Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloat2Float2Float: " + e.toString());
+ }
+ }
+
+ private void checkDistanceFloat3Float3Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6cd0047fd9ae30edl, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6cd0047fd9ae5c43l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDistanceFloat3Float3Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloat3Float3Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDistanceFloat3Float3Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloat3Float3Float: " + e.toString());
+ }
+ }
+
+ private void checkDistanceFloat4Float4Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x99c153e029c44c47l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x99c153e029c4779dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDistanceFloat4Float4Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloat4Float4Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDistanceFloat4Float4Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDistanceFloat4Float4Float: " + e.toString());
+ }
+ }
+
+ public void testDistance() {
+ checkDistanceFloatFloatFloat();
+ checkDistanceFloat2Float2Float();
+ checkDistanceFloat3Float3Float();
+ checkDistanceFloat4Float4Float();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestDot.java b/tests/tests/renderscript/src/android/renderscript/cts/TestDot.java
new file mode 100644
index 0000000..cd0d116
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestDot.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestDot extends RSBaseCompute {
+
+ private ScriptC_TestDot script;
+ private ScriptC_TestDotRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestDot(mRS);
+ scriptRelaxed = new ScriptC_TestDotRelaxed(mRS);
+ }
+
+ private void checkDotFloatFloatFloat() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x93a0502d7b6ecc43l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x93a0502d7b6ef799l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDotFloatFloatFloat(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDotFloatFloatFloat(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkDotFloat2Float2Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6458f96b84293a8fl, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6458f96b842965e5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDotFloat2Float2Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloat2Float2Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDotFloat2Float2Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloat2Float2Float: " + e.toString());
+ }
+ }
+
+ private void checkDotFloat3Float3Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x914a48cbd43f55e9l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x914a48cbd43f813fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDotFloat3Float3Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloat3Float3Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDotFloat3Float3Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloat3Float3Float: " + e.toString());
+ }
+ }
+
+ private void checkDotFloat4Float4Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbe3b982c24557143l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbe3b982c24559c99l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testDotFloat4Float4Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloat4Float4Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testDotFloat4Float4Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testDotFloat4Float4Float: " + e.toString());
+ }
+ }
+
+ public void testDot() {
+ checkDotFloatFloatFloat();
+ checkDotFloat2Float2Float();
+ checkDotFloat3Float3Float();
+ checkDotFloat4Float4Float();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestErf.java b/tests/tests/renderscript/src/android/renderscript/cts/TestErf.java
new file mode 100644
index 0000000..518f968
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestErf.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestErf extends RSBaseCompute {
+
+ private ScriptC_TestErf script;
+ private ScriptC_TestErfRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestErf(mRS);
+ scriptRelaxed = new ScriptC_TestErfRelaxed(mRS);
+ }
+
+ private void checkErfFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x287cee12fdd9cb26l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testErfFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testErfFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkErfFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6e52a9272b44c092l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testErfFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testErfFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkErfFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6e52b3c88a4b562cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testErfFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testErfFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkErfFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6e52be69e951ebc6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testErfFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testErfFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testErf() {
+ checkErfFloatFloat();
+ checkErfFloat2Float2();
+ checkErfFloat3Float3();
+ checkErfFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestErfc.java b/tests/tests/renderscript/src/android/renderscript/cts/TestErfc.java
new file mode 100644
index 0000000..63287e2
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestErfc.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestErfc extends RSBaseCompute {
+
+ private ScriptC_TestErfc script;
+ private ScriptC_TestErfcRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestErfc(mRS);
+ scriptRelaxed = new ScriptC_TestErfcRelaxed(mRS);
+ }
+
+ private void checkErfcFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb41907c64db86b2bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testErfcFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testErfcFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkErfcFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc8c849430a3684afl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testErfcFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testErfcFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkErfcFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc8c853e4693d1a49l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testErfcFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testErfcFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkErfcFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc8c85e85c843afe3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testErfcFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testErfcFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testErfcFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testErfc() {
+ checkErfcFloatFloat();
+ checkErfcFloat2Float2();
+ checkErfcFloat3Float3();
+ checkErfcFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestExp.java b/tests/tests/renderscript/src/android/renderscript/cts/TestExp.java
new file mode 100644
index 0000000..2bd545b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExp.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestExp extends RSBaseCompute {
+
+ private ScriptC_TestExp script;
+ private ScriptC_TestExpRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestExp(mRS);
+ scriptRelaxed = new ScriptC_TestExpRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkExpFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb43af2b5f55920f2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testExpFloatFloat(in, out);
+ verifyResultsExpFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testExpFloatFloat(in, out);
+ verifyResultsExpFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExpFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbdc22634c1f76efel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testExpFloat2Float2(in, out);
+ verifyResultsExpFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testExpFloat2Float2(in, out);
+ verifyResultsExpFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExpFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xbdc230d620fe0498l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testExpFloat3Float3(in, out);
+ verifyResultsExpFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testExpFloat3Float3(in, out);
+ verifyResultsExpFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExpFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbdc23b7780049a32l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testExpFloat4Float4(in, out);
+ verifyResultsExpFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testExpFloat4Float4(in, out);
+ verifyResultsExpFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testExp() {
+ checkExpFloatFloat();
+ checkExpFloat2Float2();
+ checkExpFloat3Float3();
+ checkExpFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestExp10.java b/tests/tests/renderscript/src/android/renderscript/cts/TestExp10.java
new file mode 100644
index 0000000..90450d5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExp10.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestExp10 extends RSBaseCompute {
+
+ private ScriptC_TestExp10 script;
+ private ScriptC_TestExp10Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestExp10(mRS);
+ scriptRelaxed = new ScriptC_TestExp10Relaxed(mRS);
+ }
+
+ private void checkExp10FloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x9f6474a4cee90545l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testExp10FloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testExp10FloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10FloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkExp10Float2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x3c8d9c56223f8a79l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testExp10Float2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testExp10Float2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float2Float2: " + e.toString());
+ }
+ }
+
+ private void checkExp10Float3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x3c8da6f781462013l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testExp10Float3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testExp10Float3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkExp10Float4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x3c8db198e04cb5adl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testExp10Float4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testExp10Float4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float4Float4: " + e.toString());
+ }
+ }
+
+ public void testExp10() {
+ checkExp10FloatFloat();
+ checkExp10Float2Float2();
+ checkExp10Float3Float3();
+ checkExp10Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestExp2.java b/tests/tests/renderscript/src/android/renderscript/cts/TestExp2.java
new file mode 100644
index 0000000..71fd879
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExp2.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestExp2 extends RSBaseCompute {
+
+ private ScriptC_TestExp2 script;
+ private ScriptC_TestExp2Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestExp2(mRS);
+ scriptRelaxed = new ScriptC_TestExp2Relaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkExp2FloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x80096e5b0f2662el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testExp2FloatFloat(in, out);
+ verifyResultsExp2FloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testExp2FloatFloat(in, out);
+ verifyResultsExp2FloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2FloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp2FloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExp2FloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExp2Float2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xcc4102f6b7fc7d5al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testExp2Float2Float2(in, out);
+ verifyResultsExp2Float2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testExp2Float2Float2(in, out);
+ verifyResultsExp2Float2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp2Float2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExp2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExp2Float3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xcc410d98170312f4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testExp2Float3Float3(in, out);
+ verifyResultsExp2Float3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testExp2Float3Float3(in, out);
+ verifyResultsExp2Float3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp2Float3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExp2Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExp2Float4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xcc4118397609a88el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testExp2Float4Float4(in, out);
+ verifyResultsExp2Float4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testExp2Float4Float4(in, out);
+ verifyResultsExp2Float4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp2Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp2Float4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExp2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExp2Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testExp2() {
+ checkExp2FloatFloat();
+ checkExp2Float2Float2();
+ checkExp2Float3Float3();
+ checkExp2Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestExpm1.java b/tests/tests/renderscript/src/android/renderscript/cts/TestExpm1.java
new file mode 100644
index 0000000..1763a58
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExpm1.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestExpm1 extends RSBaseCompute {
+
+ private ScriptC_TestExpm1 script;
+ private ScriptC_TestExpm1Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestExpm1(mRS);
+ scriptRelaxed = new ScriptC_TestExpm1Relaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkExpm1FloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa03d120368f727aal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testExpm1FloatFloat(in, out);
+ verifyResultsExpm1FloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testExpm1FloatFloat(in, out);
+ verifyResultsExpm1FloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1FloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpm1FloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExpm1(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpm1FloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExpm1Float2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x59163c9cd255f5f6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testExpm1Float2Float2(in, out);
+ verifyResultsExpm1Float2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testExpm1Float2Float2(in, out);
+ verifyResultsExpm1Float2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpm1Float2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExpm1(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpm1Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExpm1Float3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x5916473e315c8b90l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testExpm1Float3Float3(in, out);
+ verifyResultsExpm1Float3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testExpm1Float3Float3(in, out);
+ verifyResultsExpm1Float3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpm1Float3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExpm1(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpm1Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExpm1Float4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x591651df9063212al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testExpm1Float4Float4(in, out);
+ verifyResultsExpm1Float4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testExpm1Float4Float4(in, out);
+ verifyResultsExpm1Float4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExpm1Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExpm1Float4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeExpm1(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkExpm1Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testExpm1() {
+ checkExpm1FloatFloat();
+ checkExpm1Float2Float2();
+ checkExpm1Float3Float3();
+ checkExpm1Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFabs.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFabs.java
new file mode 100644
index 0000000..e2cf1f1
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFabs.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFabs extends RSBaseCompute {
+
+ private ScriptC_TestFabs script;
+ private ScriptC_TestFabsRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFabs(mRS);
+ scriptRelaxed = new ScriptC_TestFabsRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFabsFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x70316affaf9e3339l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFabsFloatFloat(in, out);
+ verifyResultsFabsFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFabsFloatFloat(in, out);
+ verifyResultsFabsFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFabsFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFabs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFabsFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFabsFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x54ecf2b71ed871cdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testFabsFloat2Float2(in, out);
+ verifyResultsFabsFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testFabsFloat2Float2(in, out);
+ verifyResultsFabsFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFabsFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFabs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFabsFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFabsFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x54ecfd587ddf0767l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testFabsFloat3Float3(in, out);
+ verifyResultsFabsFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testFabsFloat3Float3(in, out);
+ verifyResultsFabsFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFabsFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFabs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFabsFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFabsFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x54ed07f9dce59d01l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testFabsFloat4Float4(in, out);
+ verifyResultsFabsFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testFabsFloat4Float4(in, out);
+ verifyResultsFabsFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFabsFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFabsFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFabs(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFabsFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFabs() {
+ checkFabsFloatFloat();
+ checkFabsFloat2Float2();
+ checkFabsFloat3Float3();
+ checkFabsFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFastDistance.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFastDistance.java
new file mode 100644
index 0000000..1a10b55
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFastDistance.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFastDistance extends RSBaseCompute {
+
+ private ScriptC_TestFastDistance script;
+ private ScriptC_TestFastDistanceRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFastDistance(mRS);
+ scriptRelaxed = new ScriptC_TestFastDistanceRelaxed(mRS);
+ }
+
+ private void checkFastDistanceFloatFloatFloat() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfe7e5e843bff0cb7l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfe7e5e843bff380dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testFastDistanceFloatFloatFloat(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testFastDistanceFloatFloatFloat(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkFastDistanceFloat2Float2Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x422e8a00560ac063l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x422e8a00560aebb9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testFastDistanceFloat2Float2Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloat2Float2Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testFastDistanceFloat2Float2Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloat2Float2Float: " + e.toString());
+ }
+ }
+
+ private void checkFastDistanceFloat3Float3Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6f1fd960a620dbbdl, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6f1fd960a6210713l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testFastDistanceFloat3Float3Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloat3Float3Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testFastDistanceFloat3Float3Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloat3Float3Float: " + e.toString());
+ }
+ }
+
+ private void checkFastDistanceFloat4Float4Float() {
+ Allocation inLhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9c1128c0f636f717l, false);
+ Allocation inRhs = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9c1128c0f637226dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInRhs(inRhs);
+ script.forEach_testFastDistanceFloat4Float4Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloat4Float4Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInRhs(inRhs);
+ scriptRelaxed.forEach_testFastDistanceFloat4Float4Float(inLhs, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastDistanceFloat4Float4Float: " + e.toString());
+ }
+ }
+
+ public void testFastDistance() {
+ checkFastDistanceFloatFloatFloat();
+ checkFastDistanceFloat2Float2Float();
+ checkFastDistanceFloat3Float3Float();
+ checkFastDistanceFloat4Float4Float();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFastLength.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFastLength.java
new file mode 100644
index 0000000..bcde700
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFastLength.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFastLength extends RSBaseCompute {
+
+ private ScriptC_TestFastLength script;
+ private ScriptC_TestFastLengthRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFastLength(mRS);
+ scriptRelaxed = new ScriptC_TestFastLengthRelaxed(mRS);
+ }
+
+ private void checkFastLengthFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xebac65aea2660e8fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFastLengthFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFastLengthFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkFastLengthFloat2Float() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x95f43650f85e6cadl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFastLengthFloat2Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloat2Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFastLengthFloat2Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloat2Float: " + e.toString());
+ }
+ }
+
+ private void checkFastLengthFloat3Float() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x95f440f25764fb0el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFastLengthFloat3Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloat3Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFastLengthFloat3Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloat3Float: " + e.toString());
+ }
+ }
+
+ private void checkFastLengthFloat4Float() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x95f44b93b66b896fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFastLengthFloat4Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloat4Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFastLengthFloat4Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastLengthFloat4Float: " + e.toString());
+ }
+ }
+
+ public void testFastLength() {
+ checkFastLengthFloatFloat();
+ checkFastLengthFloat2Float();
+ checkFastLengthFloat3Float();
+ checkFastLengthFloat4Float();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFastNormalize.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFastNormalize.java
new file mode 100644
index 0000000..23ef475
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFastNormalize.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFastNormalize extends RSBaseCompute {
+
+ private ScriptC_TestFastNormalize script;
+ private ScriptC_TestFastNormalizeRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFastNormalize(mRS);
+ scriptRelaxed = new ScriptC_TestFastNormalizeRelaxed(mRS);
+ }
+
+ private void checkFastNormalizeFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xdcfb9adc9f8882ecl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFastNormalizeFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFastNormalizeFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkFastNormalizeFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x151c38c30573db70l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testFastNormalizeFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testFastNormalizeFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkFastNormalizeFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x151e01ddfb8efc4el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testFastNormalizeFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testFastNormalizeFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkFastNormalizeFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x151fcaf8f1aa1d2cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testFastNormalizeFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testFastNormalizeFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFastNormalizeFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testFastNormalize() {
+ checkFastNormalizeFloatFloat();
+ checkFastNormalizeFloat2Float2();
+ checkFastNormalizeFloat3Float3();
+ checkFastNormalizeFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFdim.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFdim.java
new file mode 100644
index 0000000..311e8a1
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFdim.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFdim extends RSBaseCompute {
+
+ private ScriptC_TestFdim script;
+ private ScriptC_TestFdimRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFdim(mRS);
+ scriptRelaxed = new ScriptC_TestFdimRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inA;
+ public float inB;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFdimFloatFloatFloat() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf5dd38fbc3a47366l, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf5dd38fbc3a47367l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.forEach_testFdimFloatFloatFloat(inA, out);
+ verifyResultsFdimFloatFloatFloat(inA, inB, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.forEach_testFdimFloatFloatFloat(inA, out);
+ verifyResultsFdimFloatFloatFloat(inA, inB, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFdimFloatFloatFloat(Allocation inA, Allocation inB, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 1];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 1];
+ inB.copyTo(arrayInB);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inA = arrayInA[i];
+ args.inB = arrayInB[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFdim(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFdimFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFdimFloat2Float2Float2() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xca6a96c16f167f4cl, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xca6a96c16f167f4dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.forEach_testFdimFloat2Float2Float2(inA, out);
+ verifyResultsFdimFloat2Float2Float2(inA, inB, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.forEach_testFdimFloat2Float2Float2(inA, out);
+ verifyResultsFdimFloat2Float2Float2(inA, inB, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFdimFloat2Float2Float2(Allocation inA, Allocation inB, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 2];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 2];
+ inB.copyTo(arrayInB);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inA = arrayInA[i * 2 + j];
+ args.inB = arrayInB[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFdim(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFdimFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFdimFloat3Float3Float3() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1ecf74e170f480edl, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1ecf74e170f480eel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.forEach_testFdimFloat3Float3Float3(inA, out);
+ verifyResultsFdimFloat3Float3Float3(inA, inB, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.forEach_testFdimFloat3Float3Float3(inA, out);
+ verifyResultsFdimFloat3Float3Float3(inA, inB, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFdimFloat3Float3Float3(Allocation inA, Allocation inB, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 4];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 4];
+ inB.copyTo(arrayInB);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inA = arrayInA[i * 4 + j];
+ args.inB = arrayInB[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFdim(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFdimFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFdimFloat4Float4Float4() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7334530172d2828el, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7334530172d2828fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.forEach_testFdimFloat4Float4Float4(inA, out);
+ verifyResultsFdimFloat4Float4Float4(inA, inB, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.forEach_testFdimFloat4Float4Float4(inA, out);
+ verifyResultsFdimFloat4Float4Float4(inA, inB, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFdimFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFdimFloat4Float4Float4(Allocation inA, Allocation inB, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 4];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 4];
+ inB.copyTo(arrayInB);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inA = arrayInA[i * 4 + j];
+ args.inB = arrayInB[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFdim(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFdimFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFdim() {
+ checkFdimFloatFloatFloat();
+ checkFdimFloat2Float2Float2();
+ checkFdimFloat3Float3Float3();
+ checkFdimFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFloor.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFloor.java
new file mode 100644
index 0000000..878b7ae
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFloor.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFloor extends RSBaseCompute {
+
+ private ScriptC_TestFloor script;
+ private ScriptC_TestFloorRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFloor(mRS);
+ scriptRelaxed = new ScriptC_TestFloorRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFloorFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x9c2b15433f045885l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFloorFloatFloat(in, out);
+ verifyResultsFloorFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFloorFloatFloat(in, out);
+ verifyResultsFloorFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFloorFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFloor(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFloorFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFloorFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xf32bb4add79bd3b9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testFloorFloat2Float2(in, out);
+ verifyResultsFloorFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testFloorFloat2Float2(in, out);
+ verifyResultsFloorFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFloorFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFloor(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFloorFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFloorFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xf32bbf4f36a26953l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testFloorFloat3Float3(in, out);
+ verifyResultsFloorFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testFloorFloat3Float3(in, out);
+ verifyResultsFloorFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFloorFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFloor(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFloorFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFloorFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf32bc9f095a8feedl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testFloorFloat4Float4(in, out);
+ verifyResultsFloorFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testFloorFloat4Float4(in, out);
+ verifyResultsFloorFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFloorFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFloorFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFloor(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFloorFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFloor() {
+ checkFloorFloatFloat();
+ checkFloorFloat2Float2();
+ checkFloorFloat3Float3();
+ checkFloorFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFma.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFma.java
new file mode 100644
index 0000000..3e05667
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFma.java
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFma extends RSBaseCompute {
+
+ private ScriptC_TestFma script;
+ private ScriptC_TestFmaRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFma(mRS);
+ scriptRelaxed = new ScriptC_TestFmaRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloatFloat {
+ public float inA;
+ public float inB;
+ public float inC;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFmaFloatFloatFloatFloat() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5f6b3ee0c3466c2l, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5f6b3ee0c3466c3l, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5f6b3ee0c3466c4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testFmaFloatFloatFloatFloat(inA, out);
+ verifyResultsFmaFloatFloatFloatFloat(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloatFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testFmaFloatFloatFloatFloat(inA, out);
+ verifyResultsFmaFloatFloatFloatFloat(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloatFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaFloatFloatFloatFloat(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 1];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 1];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 1];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i];
+ args.inB = arrayInB[i];
+ args.inC = arrayInC[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFma(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaFloatFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaFloat2Float2Float2Float2() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x47b62b8849bc43dal, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x47b62b8849bc43dbl, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x47b62b8849bc43dcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testFmaFloat2Float2Float2Float2(inA, out);
+ verifyResultsFmaFloat2Float2Float2Float2(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloat2Float2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testFmaFloat2Float2Float2Float2(inA, out);
+ verifyResultsFmaFloat2Float2Float2Float2(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloat2Float2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaFloat2Float2Float2Float2(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 2];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 2];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 2];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i * 2 + j];
+ args.inB = arrayInB[i * 2 + j];
+ args.inC = arrayInC[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFma(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaFloat2Float2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaFloat3Float3Float3Float3() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1d2fcf231c237d76l, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1d2fcf231c237d77l, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1d2fcf231c237d78l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testFmaFloat3Float3Float3Float3(inA, out);
+ verifyResultsFmaFloat3Float3Float3Float3(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloat3Float3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testFmaFloat3Float3Float3Float3(inA, out);
+ verifyResultsFmaFloat3Float3Float3Float3(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloat3Float3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaFloat3Float3Float3Float3(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 4];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 4];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 4];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i * 4 + j];
+ args.inB = arrayInB[i * 4 + j];
+ args.inC = arrayInC[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFma(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaFloat3Float3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaFloat4Float4Float4Float4() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf2a972bdee8ab712l, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf2a972bdee8ab713l, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf2a972bdee8ab714l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testFmaFloat4Float4Float4Float4(inA, out);
+ verifyResultsFmaFloat4Float4Float4Float4(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloat4Float4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testFmaFloat4Float4Float4Float4(inA, out);
+ verifyResultsFmaFloat4Float4Float4Float4(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaFloat4Float4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaFloat4Float4Float4Float4(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 4];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 4];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 4];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i * 4 + j];
+ args.inB = arrayInB[i * 4 + j];
+ args.inC = arrayInC[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFma(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaFloat4Float4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFma() {
+ checkFmaFloatFloatFloatFloat();
+ checkFmaFloat2Float2Float2Float2();
+ checkFmaFloat3Float3Float3Float3();
+ checkFmaFloat4Float4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFmax.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFmax.java
new file mode 100644
index 0000000..93819bc
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFmax.java
@@ -0,0 +1,538 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFmax extends RSBaseCompute {
+
+ private ScriptC_TestFmax script;
+ private ScriptC_TestFmaxRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFmax(mRS);
+ scriptRelaxed = new ScriptC_TestFmaxRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFmaxFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe6ec75a46e6fdd91l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe6ec75a46e6fdd92l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmaxFloatFloatFloat(inX, out);
+ verifyResultsFmaxFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmaxFloatFloatFloat(inX, out);
+ verifyResultsFmaxFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaxFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaxFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaxFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa99eaa6dd458a0dfl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa99eaa6dd458a0e0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmaxFloat2Float2Float2(inX, out);
+ verifyResultsFmaxFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmaxFloat2Float2Float2(inX, out);
+ verifyResultsFmaxFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaxFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaxFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaxFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xfe03888dd636a280l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xfe03888dd636a281l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmaxFloat3Float3Float3(inX, out);
+ verifyResultsFmaxFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmaxFloat3Float3Float3(inX, out);
+ verifyResultsFmaxFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaxFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaxFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaxFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x526866add814a421l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x526866add814a422l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmaxFloat4Float4Float4(inX, out);
+ verifyResultsFmaxFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmaxFloat4Float4Float4(inX, out);
+ verifyResultsFmaxFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaxFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaxFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaxFloat2FloatFloat2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xce5ddc06dc631119l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xce5ddc06dc63111al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmaxFloat2FloatFloat2(inX, out);
+ verifyResultsFmaxFloat2FloatFloat2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat2FloatFloat2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmaxFloat2FloatFloat2(inX, out);
+ verifyResultsFmaxFloat2FloatFloat2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat2FloatFloat2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaxFloat2FloatFloat2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaxFloat2FloatFloat2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaxFloat3FloatFloat3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x23ad8f1ecace0575l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x23ad8f1ecace0576l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmaxFloat3FloatFloat3(inX, out);
+ verifyResultsFmaxFloat3FloatFloat3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat3FloatFloat3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmaxFloat3FloatFloat3(inX, out);
+ verifyResultsFmaxFloat3FloatFloat3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat3FloatFloat3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaxFloat3FloatFloat3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaxFloat3FloatFloat3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmaxFloat4FloatFloat4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x78fd4236b938f9d1l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x78fd4236b938f9d2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmaxFloat4FloatFloat4(inX, out);
+ verifyResultsFmaxFloat4FloatFloat4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat4FloatFloat4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmaxFloat4FloatFloat4(inX, out);
+ verifyResultsFmaxFloat4FloatFloat4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmaxFloat4FloatFloat4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmaxFloat4FloatFloat4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmaxFloat4FloatFloat4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFmax() {
+ checkFmaxFloatFloatFloat();
+ checkFmaxFloat2Float2Float2();
+ checkFmaxFloat3Float3Float3();
+ checkFmaxFloat4Float4Float4();
+ checkFmaxFloat2FloatFloat2();
+ checkFmaxFloat3FloatFloat3();
+ checkFmaxFloat4FloatFloat4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFmin.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFmin.java
new file mode 100644
index 0000000..5c3eafe
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFmin.java
@@ -0,0 +1,538 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFmin extends RSBaseCompute {
+
+ private ScriptC_TestFmin script;
+ private ScriptC_TestFminRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFmin(mRS);
+ scriptRelaxed = new ScriptC_TestFminRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFminFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x7b46a8451d7b106fl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x7b46a8451d7b1070l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFminFloatFloatFloat(inX, out);
+ verifyResultsFminFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFminFloatFloatFloat(inX, out);
+ verifyResultsFminFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFminFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFminFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFminFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x12b850a9e75faa59l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x12b850a9e75faa5al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFminFloat2Float2Float2(inX, out);
+ verifyResultsFminFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFminFloat2Float2Float2(inX, out);
+ verifyResultsFminFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFminFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFminFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFminFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x671d2ec9e93dabfal, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x671d2ec9e93dabfbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFminFloat3Float3Float3(inX, out);
+ verifyResultsFminFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFminFloat3Float3Float3(inX, out);
+ verifyResultsFminFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFminFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFminFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFminFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbb820ce9eb1bad9bl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbb820ce9eb1bad9cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFminFloat4Float4Float4(inX, out);
+ verifyResultsFminFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFminFloat4Float4Float4(inX, out);
+ verifyResultsFminFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFminFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFminFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFminFloat2FloatFloat2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x4dd5869724457687l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4dd5869724457688l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFminFloat2FloatFloat2(inX, out);
+ verifyResultsFminFloat2FloatFloat2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2FloatFloat2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFminFloat2FloatFloat2(inX, out);
+ verifyResultsFminFloat2FloatFloat2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat2FloatFloat2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFminFloat2FloatFloat2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFminFloat2FloatFloat2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFminFloat3FloatFloat3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xa32539af12b06ae3l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa32539af12b06ae4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFminFloat3FloatFloat3(inX, out);
+ verifyResultsFminFloat3FloatFloat3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3FloatFloat3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFminFloat3FloatFloat3(inX, out);
+ verifyResultsFminFloat3FloatFloat3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat3FloatFloat3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFminFloat3FloatFloat3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFminFloat3FloatFloat3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFminFloat4FloatFloat4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf874ecc7011b5f3fl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf874ecc7011b5f40l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFminFloat4FloatFloat4(inX, out);
+ verifyResultsFminFloat4FloatFloat4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4FloatFloat4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFminFloat4FloatFloat4(inX, out);
+ verifyResultsFminFloat4FloatFloat4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFminFloat4FloatFloat4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFminFloat4FloatFloat4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFminFloat4FloatFloat4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFmin() {
+ checkFminFloatFloatFloat();
+ checkFminFloat2Float2Float2();
+ checkFminFloat3Float3Float3();
+ checkFminFloat4Float4Float4();
+ checkFminFloat2FloatFloat2();
+ checkFminFloat3FloatFloat3();
+ checkFminFloat4FloatFloat4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFmod.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFmod.java
new file mode 100644
index 0000000..00c4718
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFmod.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFmod extends RSBaseCompute {
+
+ private ScriptC_TestFmod script;
+ private ScriptC_TestFmodRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFmod(mRS);
+ scriptRelaxed = new ScriptC_TestFmodRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFmodFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x51ab5ae4481379a7l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x51ab5ae4481379a8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmodFloatFloatFloat(inX, out);
+ verifyResultsFmodFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmodFloatFloatFloat(inX, out);
+ verifyResultsFmodFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmodFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmod(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmodFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmodFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x1ed79fa3ec4de581l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x1ed79fa3ec4de582l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmodFloat2Float2Float2(inX, out);
+ verifyResultsFmodFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmodFloat2Float2Float2(inX, out);
+ verifyResultsFmodFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmodFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmod(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmodFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmodFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x733c7dc3ee2be722l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x733c7dc3ee2be723l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmodFloat3Float3Float3(inX, out);
+ verifyResultsFmodFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmodFloat3Float3Float3(inX, out);
+ verifyResultsFmodFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmodFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmod(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmodFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFmodFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc7a15be3f009e8c3l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc7a15be3f009e8c4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testFmodFloat4Float4Float4(inX, out);
+ verifyResultsFmodFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testFmodFloat4Float4Float4(inX, out);
+ verifyResultsFmodFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFmodFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFmodFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFmod(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFmodFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFmod() {
+ checkFmodFloatFloatFloat();
+ checkFmodFloat2Float2Float2();
+ checkFmodFloat3Float3Float3();
+ checkFmodFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFract.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFract.java
new file mode 100644
index 0000000..a93a986
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFract.java
@@ -0,0 +1,624 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFract extends RSBaseCompute {
+
+ private ScriptC_TestFract script;
+ private ScriptC_TestFractRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFract(mRS);
+ scriptRelaxed = new ScriptC_TestFractRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inV;
+ public float outFloor;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFractFloatFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x57d8e6573c675d27l, false);
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocOutFloor(outFloor);
+ script.forEach_testFractFloatFloatFloat(inV, out);
+ verifyResultsFractFloatFloatFloat(inV, outFloor, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutFloor(outFloor);
+ scriptRelaxed.forEach_testFractFloatFloatFloat(inV, out);
+ verifyResultsFractFloatFloatFloat(inV, outFloor, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloatFloatFloat(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOutFloor = new float[INPUTSIZE * 1];
+ outFloor.copyTo(arrayOutFloor);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 1 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %14.8g %8x %15a",
+ args.outFloor, Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %14.8g %8x %15a",
+ arrayOutFloor[i * 1 + j], Float.floatToRawIntBits(arrayOutFloor[i * 1 + j]), arrayOutFloor[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 1 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFractFloat2Float2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xd1dbe683cdf8f525l, false);
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocOutFloor(outFloor);
+ script.forEach_testFractFloat2Float2Float2(inV, out);
+ verifyResultsFractFloat2Float2Float2(inV, outFloor, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutFloor(outFloor);
+ scriptRelaxed.forEach_testFractFloat2Float2Float2(inV, out);
+ verifyResultsFractFloat2Float2Float2(inV, outFloor, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloat2Float2Float2(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ float[] arrayOutFloor = new float[INPUTSIZE * 2];
+ outFloor.copyTo(arrayOutFloor);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 2 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %14.8g %8x %15a",
+ args.outFloor, Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %14.8g %8x %15a",
+ arrayOutFloor[i * 2 + j], Float.floatToRawIntBits(arrayOutFloor[i * 2 + j]), arrayOutFloor[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 2 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFractFloat3Float3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2640c4a3cfd6f6c6l, false);
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocOutFloor(outFloor);
+ script.forEach_testFractFloat3Float3Float3(inV, out);
+ verifyResultsFractFloat3Float3Float3(inV, outFloor, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutFloor(outFloor);
+ scriptRelaxed.forEach_testFractFloat3Float3Float3(inV, out);
+ verifyResultsFractFloat3Float3Float3(inV, outFloor, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloat3Float3Float3(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOutFloor = new float[INPUTSIZE * 4];
+ outFloor.copyTo(arrayOutFloor);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 4 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %14.8g %8x %15a",
+ args.outFloor, Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %14.8g %8x %15a",
+ arrayOutFloor[i * 4 + j], Float.floatToRawIntBits(arrayOutFloor[i * 4 + j]), arrayOutFloor[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 4 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFractFloat4Float4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7aa5a2c3d1b4f867l, false);
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocOutFloor(outFloor);
+ script.forEach_testFractFloat4Float4Float4(inV, out);
+ verifyResultsFractFloat4Float4Float4(inV, outFloor, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation outFloor = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutFloor(outFloor);
+ scriptRelaxed.forEach_testFractFloat4Float4Float4(inV, out);
+ verifyResultsFractFloat4Float4Float4(inV, outFloor, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloat4Float4Float4(Allocation inV, Allocation outFloor, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOutFloor = new float[INPUTSIZE * 4];
+ outFloor.copyTo(arrayOutFloor);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 4 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %14.8g %8x %15a",
+ args.outFloor, Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %14.8g %8x %15a",
+ arrayOutFloor[i * 4 + j], Float.floatToRawIntBits(arrayOutFloor[i * 4 + j]), arrayOutFloor[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.outFloor - arrayOutFloor[i * 4 + j]) / Math.ulp(args.outFloor) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsFloatFloat {
+ public float inV;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkFractFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf559208b9db2cad3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testFractFloatFloat(inV, out);
+ verifyResultsFractFloatFloat(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testFractFloatFloat(inV, out);
+ verifyResultsFractFloatFloat(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloatFloat(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFractFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x1096c5acc4d52edfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testFractFloat2Float2(inV, out);
+ verifyResultsFractFloat2Float2(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testFractFloat2Float2(inV, out);
+ verifyResultsFractFloat2Float2(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloat2Float2(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFractFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x10988ec7baf04fbdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testFractFloat3Float3(inV, out);
+ verifyResultsFractFloat3Float3(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testFractFloat3Float3(inV, out);
+ verifyResultsFractFloat3Float3(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloat3Float3(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkFractFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x109a57e2b10b709bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testFractFloat4Float4(inV, out);
+ verifyResultsFractFloat4Float4(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testFractFloat4Float4(inV, out);
+ verifyResultsFractFloat4Float4(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFractFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsFractFloat4Float4(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeFract(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkFractFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testFract() {
+ checkFractFloatFloatFloat();
+ checkFractFloat2Float2Float2();
+ checkFractFloat3Float3Float3();
+ checkFractFloat4Float4Float4();
+ checkFractFloatFloat();
+ checkFractFloat2Float2();
+ checkFractFloat3Float3();
+ checkFractFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestFrexp.java b/tests/tests/renderscript/src/android/renderscript/cts/TestFrexp.java
new file mode 100644
index 0000000..1ea82a6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFrexp.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestFrexp extends RSBaseCompute {
+
+ private ScriptC_TestFrexp script;
+ private ScriptC_TestFrexpRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestFrexp(mRS);
+ scriptRelaxed = new ScriptC_TestFrexpRelaxed(mRS);
+ }
+
+ private void checkFrexpFloatIntFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x57ae9fe07384e56dl, false);
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocOutIptr(outIptr);
+ script.forEach_testFrexpFloatIntFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloatIntFloat: " + e.toString());
+ }
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIptr(outIptr);
+ scriptRelaxed.forEach_testFrexpFloatIntFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloatIntFloat: " + e.toString());
+ }
+ }
+
+ private void checkFrexpFloat2Int2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x544e0a688fe7701l, false);
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocOutIptr(outIptr);
+ script.forEach_testFrexpFloat2Int2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloat2Int2Float2: " + e.toString());
+ }
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIptr(outIptr);
+ scriptRelaxed.forEach_testFrexpFloat2Int2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloat2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void checkFrexpFloat3Int3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2afb1f097eb0e3bal, false);
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocOutIptr(outIptr);
+ script.forEach_testFrexpFloat3Int3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloat3Int3Float3: " + e.toString());
+ }
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIptr(outIptr);
+ scriptRelaxed.forEach_testFrexpFloat3Int3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloat3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void checkFrexpFloat4Int4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x50b15d6c74635073l, false);
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocOutIptr(outIptr);
+ script.forEach_testFrexpFloat4Int4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloat4Int4Float4: " + e.toString());
+ }
+ try {
+ Allocation outIptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIptr(outIptr);
+ scriptRelaxed.forEach_testFrexpFloat4Int4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testFrexpFloat4Int4Float4: " + e.toString());
+ }
+ }
+
+ public void testFrexp() {
+ checkFrexpFloatIntFloat();
+ checkFrexpFloat2Int2Float2();
+ checkFrexpFloat3Int3Float3();
+ checkFrexpFloat4Int4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestHalfRecip.java b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfRecip.java
new file mode 100644
index 0000000..9a27480
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfRecip.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestHalfRecip extends RSBaseCompute {
+
+ private ScriptC_TestHalfRecip script;
+ private ScriptC_TestHalfRecipRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestHalfRecip(mRS);
+ scriptRelaxed = new ScriptC_TestHalfRecipRelaxed(mRS);
+ }
+
+ private void checkHalfRecipFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x854e263130d5b3dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testHalfRecipFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRecipFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkHalfRecipFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2cf1d2db5ff23c79l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testHalfRecipFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRecipFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkHalfRecipFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2cf39bf6560d5d57l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testHalfRecipFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRecipFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkHalfRecipFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x2cf565114c287e35l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testHalfRecipFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRecipFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRecipFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testHalfRecip() {
+ checkHalfRecipFloatFloat();
+ checkHalfRecipFloat2Float2();
+ checkHalfRecipFloat3Float3();
+ checkHalfRecipFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestHalfRsqrt.java b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfRsqrt.java
new file mode 100644
index 0000000..b5f93b6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfRsqrt.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestHalfRsqrt extends RSBaseCompute {
+
+ private ScriptC_TestHalfRsqrt script;
+ private ScriptC_TestHalfRsqrtRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestHalfRsqrt(mRS);
+ scriptRelaxed = new ScriptC_TestHalfRsqrtRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float inV;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkHalfRsqrtFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xad5e977ec00f0bf2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testHalfRsqrtFloatFloat(inV, out);
+ verifyResultsHalfRsqrtFloatFloat(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRsqrtFloatFloat(inV, out);
+ verifyResultsHalfRsqrtFloatFloat(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfRsqrtFloatFloat(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfRsqrtFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHalfRsqrtFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x300ee7bff12787c6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testHalfRsqrtFloat2Float2(inV, out);
+ verifyResultsHalfRsqrtFloat2Float2(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRsqrtFloat2Float2(inV, out);
+ verifyResultsHalfRsqrtFloat2Float2(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfRsqrtFloat2Float2(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfRsqrtFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHalfRsqrtFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x3010b0dae742a8a4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testHalfRsqrtFloat3Float3(inV, out);
+ verifyResultsHalfRsqrtFloat3Float3(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRsqrtFloat3Float3(inV, out);
+ verifyResultsHalfRsqrtFloat3Float3(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfRsqrtFloat3Float3(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfRsqrtFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHalfRsqrtFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x301279f5dd5dc982l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testHalfRsqrtFloat4Float4(inV, out);
+ verifyResultsHalfRsqrtFloat4Float4(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfRsqrtFloat4Float4(inV, out);
+ verifyResultsHalfRsqrtFloat4Float4(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfRsqrtFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfRsqrtFloat4Float4(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfRsqrtFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testHalfRsqrt() {
+ checkHalfRsqrtFloatFloat();
+ checkHalfRsqrtFloat2Float2();
+ checkHalfRsqrtFloat3Float3();
+ checkHalfRsqrtFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestHalfSqrt.java b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfSqrt.java
new file mode 100644
index 0000000..722a983
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfSqrt.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestHalfSqrt extends RSBaseCompute {
+
+ private ScriptC_TestHalfSqrt script;
+ private ScriptC_TestHalfSqrtRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestHalfSqrt(mRS);
+ scriptRelaxed = new ScriptC_TestHalfSqrtRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float inV;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkHalfSqrtFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x8be766c7a15db5fal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testHalfSqrtFloatFloat(inV, out);
+ verifyResultsHalfSqrtFloatFloat(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfSqrtFloatFloat(inV, out);
+ verifyResultsHalfSqrtFloatFloat(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfSqrtFloatFloat(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfSqrtFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHalfSqrtFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x7a300d2342519b8el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testHalfSqrtFloat2Float2(inV, out);
+ verifyResultsHalfSqrtFloat2Float2(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfSqrtFloat2Float2(inV, out);
+ verifyResultsHalfSqrtFloat2Float2(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfSqrtFloat2Float2(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfSqrtFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHalfSqrtFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x7a31d63e386cbc6cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testHalfSqrtFloat3Float3(inV, out);
+ verifyResultsHalfSqrtFloat3Float3(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfSqrtFloat3Float3(inV, out);
+ verifyResultsHalfSqrtFloat3Float3(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfSqrtFloat3Float3(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfSqrtFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHalfSqrtFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7a339f592e87dd4al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testHalfSqrtFloat4Float4(inV, out);
+ verifyResultsHalfSqrtFloat4Float4(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testHalfSqrtFloat4Float4(inV, out);
+ verifyResultsHalfSqrtFloat4Float4(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHalfSqrtFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHalfSqrtFloat4Float4(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHalfSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHalfSqrtFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testHalfSqrt() {
+ checkHalfSqrtFloatFloat();
+ checkHalfSqrtFloat2Float2();
+ checkHalfSqrtFloat3Float3();
+ checkHalfSqrtFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestHypot.java b/tests/tests/renderscript/src/android/renderscript/cts/TestHypot.java
new file mode 100644
index 0000000..ac94296
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestHypot.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestHypot extends RSBaseCompute {
+
+ private ScriptC_TestHypot script;
+ private ScriptC_TestHypotRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestHypot(mRS);
+ scriptRelaxed = new ScriptC_TestHypotRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkHypotFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x7deb65e7738c74dbl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x7deb65e7738c74dcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testHypotFloatFloatFloat(inX, out);
+ verifyResultsHypotFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testHypotFloatFloatFloat(inX, out);
+ verifyResultsHypotFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHypotFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHypot(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHypotFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHypotFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x14f3c91a62f71c5dl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x14f3c91a62f71c5el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testHypotFloat2Float2Float2(inX, out);
+ verifyResultsHypotFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testHypotFloat2Float2Float2(inX, out);
+ verifyResultsHypotFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHypotFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHypot(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHypotFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHypotFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6958a73a64d51dfel, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6958a73a64d51dffl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testHypotFloat3Float3Float3(inX, out);
+ verifyResultsHypotFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testHypotFloat3Float3Float3(inX, out);
+ verifyResultsHypotFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHypotFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHypot(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHypotFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkHypotFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbdbd855a66b31f9fl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbdbd855a66b31fa0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testHypotFloat4Float4Float4(inX, out);
+ verifyResultsHypotFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testHypotFloat4Float4Float4(inX, out);
+ verifyResultsHypotFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testHypotFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsHypotFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeHypot(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkHypotFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testHypot() {
+ checkHypotFloatFloatFloat();
+ checkHypotFloat2Float2Float2();
+ checkHypotFloat3Float3Float3();
+ checkHypotFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestIlogb.java b/tests/tests/renderscript/src/android/renderscript/cts/TestIlogb.java
new file mode 100644
index 0000000..ebe795f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestIlogb.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestIlogb extends RSBaseCompute {
+
+ private ScriptC_TestIlogb script;
+ private ScriptC_TestIlogbRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestIlogb(mRS);
+ scriptRelaxed = new ScriptC_TestIlogbRelaxed(mRS);
+ }
+
+ private void checkIlogbFloatInt() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xc0c48da27f084aefl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ script.forEach_testIlogbFloatInt(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloatInt: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testIlogbFloatInt(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloatInt: " + e.toString());
+ }
+ }
+
+ private void checkIlogbFloat2Int2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x4ba2fa846382ada1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testIlogbFloat2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testIlogbFloat2Int2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat2Int2: " + e.toString());
+ }
+ }
+
+ private void checkIlogbFloat3Int3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x4ba2fa85dc4b0d43l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testIlogbFloat3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testIlogbFloat3Int3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat3Int3: " + e.toString());
+ }
+ }
+
+ private void checkIlogbFloat4Int4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x4ba2fa8755136ce5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testIlogbFloat4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testIlogbFloat4Int4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat4Int4: " + e.toString());
+ }
+ }
+
+ public void testIlogb() {
+ checkIlogbFloatInt();
+ checkIlogbFloat2Int2();
+ checkIlogbFloat3Int3();
+ checkIlogbFloat4Int4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLdexp.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLdexp.java
new file mode 100644
index 0000000..51c9876
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLdexp.java
@@ -0,0 +1,538 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLdexp extends RSBaseCompute {
+
+ private ScriptC_TestLdexp script;
+ private ScriptC_TestLdexpRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLdexp(mRS);
+ scriptRelaxed = new ScriptC_TestLdexpRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatIntFloat {
+ public float inX;
+ public int inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkLdexpFloatIntFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xdeada0999238fe8bl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xdeada0999238fe8cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testLdexpFloatIntFloat(inX, out);
+ verifyResultsLdexpFloatIntFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloatIntFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testLdexpFloatIntFloat(inX, out);
+ verifyResultsLdexpFloatIntFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloatIntFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLdexpFloatIntFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ int[] arrayInY = new int[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLdexp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %d",
+ args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLdexpFloatIntFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLdexpFloat2Int2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x5492762140d0ca17l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x5492762140d0ca18l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testLdexpFloat2Int2Float2(inX, out);
+ verifyResultsLdexpFloat2Int2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat2Int2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testLdexpFloat2Int2Float2(inX, out);
+ verifyResultsLdexpFloat2Int2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLdexpFloat2Int2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ int[] arrayInY = new int[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLdexp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %d",
+ args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLdexpFloat2Int2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLdexpFloat3Int3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x7a48b484368336d0l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x7a48b484368336d1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testLdexpFloat3Int3Float3(inX, out);
+ verifyResultsLdexpFloat3Int3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat3Int3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testLdexpFloat3Int3Float3(inX, out);
+ verifyResultsLdexpFloat3Int3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLdexpFloat3Int3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ int[] arrayInY = new int[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLdexp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %d",
+ args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLdexpFloat3Int3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLdexpFloat4Int4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9ffef2e72c35a389l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x9ffef2e72c35a38al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testLdexpFloat4Int4Float4(inX, out);
+ verifyResultsLdexpFloat4Int4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat4Int4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testLdexpFloat4Int4Float4(inX, out);
+ verifyResultsLdexpFloat4Int4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat4Int4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLdexpFloat4Int4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ int[] arrayInY = new int[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLdexp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %d",
+ args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLdexpFloat4Int4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLdexpFloat2IntFloat2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa2b6e0c39777b8c1l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xa2b6e0c39777b8c2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testLdexpFloat2IntFloat2(inX, out);
+ verifyResultsLdexpFloat2IntFloat2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat2IntFloat2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testLdexpFloat2IntFloat2(inX, out);
+ verifyResultsLdexpFloat2IntFloat2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat2IntFloat2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLdexpFloat2IntFloat2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ int[] arrayInY = new int[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLdexp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %d",
+ args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLdexpFloat2IntFloat2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLdexpFloat3IntFloat3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xcd4401424a114a65l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xcd4401424a114a66l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testLdexpFloat3IntFloat3(inX, out);
+ verifyResultsLdexpFloat3IntFloat3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat3IntFloat3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testLdexpFloat3IntFloat3(inX, out);
+ verifyResultsLdexpFloat3IntFloat3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat3IntFloat3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLdexpFloat3IntFloat3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ int[] arrayInY = new int[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLdexp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %d",
+ args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLdexpFloat3IntFloat3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLdexpFloat4IntFloat4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf7d121c0fcaadc09l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xf7d121c0fcaadc0al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testLdexpFloat4IntFloat4(inX, out);
+ verifyResultsLdexpFloat4IntFloat4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat4IntFloat4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testLdexpFloat4IntFloat4(inX, out);
+ verifyResultsLdexpFloat4IntFloat4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLdexpFloat4IntFloat4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLdexpFloat4IntFloat4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ int[] arrayInY = new int[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLdexp(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %d",
+ args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLdexpFloat4IntFloat4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testLdexp() {
+ checkLdexpFloatIntFloat();
+ checkLdexpFloat2Int2Float2();
+ checkLdexpFloat3Int3Float3();
+ checkLdexpFloat4Int4Float4();
+ checkLdexpFloat2IntFloat2();
+ checkLdexpFloat3IntFloat3();
+ checkLdexpFloat4IntFloat4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLength.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLength.java
new file mode 100644
index 0000000..08bcf22
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLength.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLength extends RSBaseCompute {
+
+ private ScriptC_TestLength script;
+ private ScriptC_TestLengthRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLength(mRS);
+ scriptRelaxed = new ScriptC_TestLengthRelaxed(mRS);
+ }
+
+ private void checkLengthFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x8119352509f7cc9fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLengthFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLengthFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkLengthFloat2Float() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xaf3b0f345dd9595dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLengthFloat2Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloat2Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLengthFloat2Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloat2Float: " + e.toString());
+ }
+ }
+
+ private void checkLengthFloat3Float() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xaf3b19d5bcdfe7bel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLengthFloat3Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloat3Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLengthFloat3Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloat3Float: " + e.toString());
+ }
+ }
+
+ private void checkLengthFloat4Float() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xaf3b24771be6761fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLengthFloat4Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloat4Float: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLengthFloat4Float(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLengthFloat4Float: " + e.toString());
+ }
+ }
+
+ public void testLength() {
+ checkLengthFloatFloat();
+ checkLengthFloat2Float();
+ checkLengthFloat3Float();
+ checkLengthFloat4Float();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLgamma.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLgamma.java
new file mode 100644
index 0000000..cc6b652
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLgamma.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLgamma extends RSBaseCompute {
+
+ private ScriptC_TestLgamma script;
+ private ScriptC_TestLgammaRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLgamma(mRS);
+ scriptRelaxed = new ScriptC_TestLgammaRelaxed(mRS);
+ }
+
+ private void checkLgammaFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe748c67429cab138l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLgammaFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLgammaFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkLgammaFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x7ca07efd8a327894l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testLgammaFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testLgammaFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkLgammaFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x7ca0899ee9390e2el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testLgammaFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testLgammaFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkLgammaFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7ca09440483fa3c8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testLgammaFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testLgammaFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void checkLgammaFloatIntFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x2a62d992979c4bb9l, false);
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocOutY(outY);
+ script.forEach_testLgammaFloatIntFloat(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloatIntFloat: " + e.toString());
+ }
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutY(outY);
+ scriptRelaxed.forEach_testLgammaFloatIntFloat(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloatIntFloat: " + e.toString());
+ }
+ }
+
+ private void checkLgammaFloat2Int2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x409fb9a5984bcf81l, false);
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocOutY(outY);
+ script.forEach_testLgammaFloat2Int2Float2(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat2Int2Float2: " + e.toString());
+ }
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutY(outY);
+ scriptRelaxed.forEach_testLgammaFloat2Int2Float2(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void checkLgammaFloat3Int3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6655f8088dfe3c3al, false);
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocOutY(outY);
+ script.forEach_testLgammaFloat3Int3Float3(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat3Int3Float3: " + e.toString());
+ }
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutY(outY);
+ scriptRelaxed.forEach_testLgammaFloat3Int3Float3(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void checkLgammaFloat4Int4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x8c0c366b83b0a8f3l, false);
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocOutY(outY);
+ script.forEach_testLgammaFloat4Int4Float4(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat4Int4Float4: " + e.toString());
+ }
+ try {
+ Allocation outY = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutY(outY);
+ scriptRelaxed.forEach_testLgammaFloat4Int4Float4(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLgammaFloat4Int4Float4: " + e.toString());
+ }
+ }
+
+ public void testLgamma() {
+ checkLgammaFloatFloat();
+ checkLgammaFloat2Float2();
+ checkLgammaFloat3Float3();
+ checkLgammaFloat4Float4();
+ checkLgammaFloatIntFloat();
+ checkLgammaFloat2Int2Float2();
+ checkLgammaFloat3Int3Float3();
+ checkLgammaFloat4Int4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLog.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLog.java
new file mode 100644
index 0000000..4f3db41
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLog extends RSBaseCompute {
+
+ private ScriptC_TestLog script;
+ private ScriptC_TestLogRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLog(mRS);
+ scriptRelaxed = new ScriptC_TestLogRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkLogFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x371a946136907325l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLogFloatFloat(in, out);
+ verifyResultsLogFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLogFloatFloat(in, out);
+ verifyResultsLogFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLogFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLogFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xfef8d41eca882159l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testLogFloat2Float2(in, out);
+ verifyResultsLogFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testLogFloat2Float2(in, out);
+ verifyResultsLogFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLogFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLogFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xfef8dec0298eb6f3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testLogFloat3Float3(in, out);
+ verifyResultsLogFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testLogFloat3Float3(in, out);
+ verifyResultsLogFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLogFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLogFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xfef8e96188954c8dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testLogFloat4Float4(in, out);
+ verifyResultsLogFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testLogFloat4Float4(in, out);
+ verifyResultsLogFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLogFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testLog() {
+ checkLogFloatFloat();
+ checkLogFloat2Float2();
+ checkLogFloat3Float3();
+ checkLogFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLog10.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLog10.java
new file mode 100644
index 0000000..2972a61
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog10.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLog10 extends RSBaseCompute {
+
+ private ScriptC_TestLog10 script;
+ private ScriptC_TestLog10Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLog10(mRS);
+ scriptRelaxed = new ScriptC_TestLog10Relaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkLog10FloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe09b228ed779b7a0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLog10FloatFloat(in, out);
+ verifyResultsLog10FloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLog10FloatFloat(in, out);
+ verifyResultsLog10FloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10FloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog10FloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog10(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog10FloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog10Float2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x407bbbadff57bdbcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testLog10Float2Float2(in, out);
+ verifyResultsLog10Float2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testLog10Float2Float2(in, out);
+ verifyResultsLog10Float2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog10Float2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog10(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog10Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog10Float3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x407bc64f5e5e5356l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testLog10Float3Float3(in, out);
+ verifyResultsLog10Float3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testLog10Float3Float3(in, out);
+ verifyResultsLog10Float3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog10Float3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog10(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog10Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog10Float4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x407bd0f0bd64e8f0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testLog10Float4Float4(in, out);
+ verifyResultsLog10Float4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testLog10Float4Float4(in, out);
+ verifyResultsLog10Float4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog10Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog10Float4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog10(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog10Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testLog10() {
+ checkLog10FloatFloat();
+ checkLog10Float2Float2();
+ checkLog10Float3Float3();
+ checkLog10Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLog1p.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLog1p.java
new file mode 100644
index 0000000..fe10a13
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog1p.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLog1p extends RSBaseCompute {
+
+ private ScriptC_TestLog1p script;
+ private ScriptC_TestLog1pRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLog1p(mRS);
+ scriptRelaxed = new ScriptC_TestLog1pRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkLog1pFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x83e3423b7d907be0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLog1pFloatFloat(in, out);
+ verifyResultsLog1pFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLog1pFloatFloat(in, out);
+ verifyResultsLog1pFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog1pFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog1p(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog1pFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog1pFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x946881a999c72ffcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testLog1pFloat2Float2(in, out);
+ verifyResultsLog1pFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testLog1pFloat2Float2(in, out);
+ verifyResultsLog1pFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog1pFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog1p(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog1pFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog1pFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x94688c4af8cdc596l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testLog1pFloat3Float3(in, out);
+ verifyResultsLog1pFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testLog1pFloat3Float3(in, out);
+ verifyResultsLog1pFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog1pFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog1p(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog1pFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog1pFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x946896ec57d45b30l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testLog1pFloat4Float4(in, out);
+ verifyResultsLog1pFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testLog1pFloat4Float4(in, out);
+ verifyResultsLog1pFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog1pFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog1pFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog1p(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog1pFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testLog1p() {
+ checkLog1pFloatFloat();
+ checkLog1pFloat2Float2();
+ checkLog1pFloat3Float3();
+ checkLog1pFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLog2.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLog2.java
new file mode 100644
index 0000000..228d6b3
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog2.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLog2 extends RSBaseCompute {
+
+ private ScriptC_TestLog2 script;
+ private ScriptC_TestLog2Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLog2(mRS);
+ scriptRelaxed = new ScriptC_TestLog2Relaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkLog2FloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x390bea9a53d34bfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLog2FloatFloat(in, out);
+ verifyResultsLog2FloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLog2FloatFloat(in, out);
+ verifyResultsLog2FloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2FloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog2FloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog2FloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog2Float2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc0703946284a72a3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testLog2Float2Float2(in, out);
+ verifyResultsLog2Float2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testLog2Float2Float2(in, out);
+ verifyResultsLog2Float2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog2Float2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog2Float3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc07043e78751083dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testLog2Float3Float3(in, out);
+ verifyResultsLog2Float3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testLog2Float3Float3(in, out);
+ verifyResultsLog2Float3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog2Float3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog2Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLog2Float4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc0704e88e6579dd7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testLog2Float4Float4(in, out);
+ verifyResultsLog2Float4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testLog2Float4Float4(in, out);
+ verifyResultsLog2Float4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLog2Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLog2Float4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeLog2(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkLog2Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testLog2() {
+ checkLog2FloatFloat();
+ checkLog2Float2Float2();
+ checkLog2Float3Float3();
+ checkLog2Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestLogb.java b/tests/tests/renderscript/src/android/renderscript/cts/TestLogb.java
new file mode 100644
index 0000000..0d51794
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLogb.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestLogb extends RSBaseCompute {
+
+ private ScriptC_TestLogb script;
+ private ScriptC_TestLogbRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestLogb(mRS);
+ scriptRelaxed = new ScriptC_TestLogbRelaxed(mRS);
+ }
+
+ private void checkLogbFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfe06d66b21ce47efl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLogbFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testLogbFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkLogbFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbf61cdc2dc1e0853l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testLogbFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testLogbFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkLogbFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xbf61d8643b249dedl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testLogbFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testLogbFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkLogbFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbf61e3059a2b3387l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testLogbFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testLogbFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testLogb() {
+ checkLogbFloatFloat();
+ checkLogbFloat2Float2();
+ checkLogbFloat3Float3();
+ checkLogbFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestMad.java b/tests/tests/renderscript/src/android/renderscript/cts/TestMad.java
new file mode 100644
index 0000000..8079377
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMad.java
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestMad extends RSBaseCompute {
+
+ private ScriptC_TestMad script;
+ private ScriptC_TestMadRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestMad(mRS);
+ scriptRelaxed = new ScriptC_TestMadRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloatFloat {
+ public float inA;
+ public float inB;
+ public float inC;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMadFloatFloatFloatFloat() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb3b9b8429c37eacl, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb3b9b8429c37eadl, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb3b9b8429c37eael, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testMadFloatFloatFloatFloat(inA, out);
+ verifyResultsMadFloatFloatFloatFloat(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloatFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testMadFloatFloatFloatFloat(inA, out);
+ verifyResultsMadFloatFloatFloatFloat(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloatFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMadFloatFloatFloatFloat(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 1];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 1];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 1];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i];
+ args.inB = arrayInB[i];
+ args.inC = arrayInC[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMad(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMadFloatFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMadFloat2Float2Float2Float2() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x44d6ec3d0f2030a4l, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x44d6ec3d0f2030a5l, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x44d6ec3d0f2030a6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testMadFloat2Float2Float2Float2(inA, out);
+ verifyResultsMadFloat2Float2Float2Float2(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloat2Float2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testMadFloat2Float2Float2Float2(inA, out);
+ verifyResultsMadFloat2Float2Float2Float2(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloat2Float2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMadFloat2Float2Float2Float2(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 2];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 2];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 2];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i * 2 + j];
+ args.inB = arrayInB[i * 2 + j];
+ args.inC = arrayInC[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMad(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMadFloat2Float2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMadFloat3Float3Float3Float3() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1a508fd7e1876a40l, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1a508fd7e1876a41l, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1a508fd7e1876a42l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testMadFloat3Float3Float3Float3(inA, out);
+ verifyResultsMadFloat3Float3Float3Float3(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloat3Float3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testMadFloat3Float3Float3Float3(inA, out);
+ verifyResultsMadFloat3Float3Float3Float3(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloat3Float3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMadFloat3Float3Float3Float3(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 4];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 4];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 4];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i * 4 + j];
+ args.inB = arrayInB[i * 4 + j];
+ args.inC = arrayInC[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMad(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMadFloat3Float3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMadFloat4Float4Float4Float4() {
+ Allocation inA = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xefca3372b3eea3dcl, false);
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xefca3372b3eea3ddl, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xefca3372b3eea3del, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInB(inB);
+ script.set_gAllocInC(inC);
+ script.forEach_testMadFloat4Float4Float4Float4(inA, out);
+ verifyResultsMadFloat4Float4Float4Float4(inA, inB, inC, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloat4Float4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInB(inB);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.forEach_testMadFloat4Float4Float4Float4(inA, out);
+ verifyResultsMadFloat4Float4Float4Float4(inA, inB, inC, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMadFloat4Float4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMadFloat4Float4Float4Float4(Allocation inA, Allocation inB, Allocation inC, Allocation out, boolean relaxed) {
+ float[] arrayInA = new float[INPUTSIZE * 4];
+ inA.copyTo(arrayInA);
+ float[] arrayInB = new float[INPUTSIZE * 4];
+ inB.copyTo(arrayInB);
+ float[] arrayInC = new float[INPUTSIZE * 4];
+ inC.copyTo(arrayInC);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inA = arrayInA[i * 4 + j];
+ args.inB = arrayInB[i * 4 + j];
+ args.inC = arrayInC[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMad(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inA: %14.8g %8x %15a",
+ args.inA, Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %14.8g %8x %15a",
+ args.inB, Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %14.8g %8x %15a",
+ args.inC, Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMadFloat4Float4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testMad() {
+ checkMadFloatFloatFloatFloat();
+ checkMadFloat2Float2Float2Float2();
+ checkMadFloat3Float3Float3Float3();
+ checkMadFloat4Float4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestMax.java b/tests/tests/renderscript/src/android/renderscript/cts/TestMax.java
new file mode 100644
index 0000000..9c760c3
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMax.java
@@ -0,0 +1,2014 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestMax extends RSBaseCompute {
+
+ private ScriptC_TestMax script;
+ private ScriptC_TestMaxRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestMax(mRS);
+ scriptRelaxed = new ScriptC_TestMaxRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float in;
+ public float in1;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMaxFloatFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfb01ed3804837dddl, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x2952d868c2162450l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMaxFloatFloatFloat(in, out);
+ verifyResultsMaxFloatFloatFloat(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMaxFloatFloatFloat(in, out);
+ verifyResultsMaxFloatFloatFloat(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxFloatFloatFloat(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 1];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i];
+ args.in1 = arrayIn1[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxFloat2Float2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x63dc5a02b9d46a4bl, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc6031e7536addacal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMaxFloat2Float2Float2(in, out);
+ verifyResultsMaxFloat2Float2Float2(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMaxFloat2Float2Float2(in, out);
+ verifyResultsMaxFloat2Float2Float2(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxFloat2Float2Float2(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 2];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ args.in1 = arrayIn1[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxFloat3Float3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xb92c17bc0744bdael, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1a67fc95388bdc6bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMaxFloat3Float3Float3(in, out);
+ verifyResultsMaxFloat3Float3Float3(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMaxFloat3Float3Float3(in, out);
+ verifyResultsMaxFloat3Float3Float3(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxFloat3Float3Float3(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 4];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ args.in1 = arrayIn1[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxFloat4Float4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xe7bd57554b51111l, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6eccdab53a69de0cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMaxFloat4Float4Float4(in, out);
+ verifyResultsMaxFloat4Float4Float4(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMaxFloat4Float4Float4(in, out);
+ verifyResultsMaxFloat4Float4Float4(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxFloat4Float4Float4(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 4];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ args.in1 = arrayIn1[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsCharCharChar {
+ public byte inV1;
+ public byte inV2;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMaxCharCharChar() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x91fcf329ccedf8al, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x91fcf329ccedf8bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxCharCharChar(inV1, out);
+ verifyResultsMaxCharCharChar(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxCharCharChar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxCharCharChar(inV1, out);
+ verifyResultsMaxCharCharChar(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxCharCharChar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxCharCharChar(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxCharCharChar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUcharUcharUchar {
+ public byte inV1;
+ public byte inV2;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMaxUcharUcharUchar() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x829ebf2e60c1bd47l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x829ebf2e60c1bd48l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUcharUcharUchar(inV1, out);
+ verifyResultsMaxUcharUcharUchar(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUcharUcharUchar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUcharUcharUchar(inV1, out);
+ verifyResultsMaxUcharUcharUchar(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUcharUcharUchar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUcharUcharUchar(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUcharUcharUchar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsShortShortShort {
+ public short inV1;
+ public short inV2;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMaxShortShortShort() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x868a0cd65f7a4294l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x868a0cd65f7a4295l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxShortShortShort(inV1, out);
+ verifyResultsMaxShortShortShort(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShortShortShort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxShortShortShort(inV1, out);
+ verifyResultsMaxShortShortShort(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShortShortShort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxShortShortShort(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxShortShortShort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUshortUshortUshort {
+ public short inV1;
+ public short inV2;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMaxUshortUshortUshort() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x1b9c47701effe051l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x1b9c47701effe052l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUshortUshortUshort(inV1, out);
+ verifyResultsMaxUshortUshortUshort(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshortUshortUshort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUshortUshortUshort(inV1, out);
+ verifyResultsMaxUshortUshortUshort(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshortUshortUshort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUshortUshortUshort(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUshortUshortUshort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsIntIntInt {
+ public int inV1;
+ public int inV2;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMaxIntIntInt() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x7413f465641a51bl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x7413f465641a51cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxIntIntInt(inV1, out);
+ verifyResultsMaxIntIntInt(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxIntIntInt: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxIntIntInt(inV1, out);
+ verifyResultsMaxIntIntInt(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxIntIntInt: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxIntIntInt(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxIntIntInt" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUintUintUint {
+ public int inV1;
+ public int inV2;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMaxUintUintUint() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x75328d17808776cal, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x75328d17808776cbl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUintUintUint(inV1, out);
+ verifyResultsMaxUintUintUint(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUintUintUint: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUintUintUint(inV1, out);
+ verifyResultsMaxUintUintUint(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUintUintUint: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUintUintUint(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUintUintUint" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxChar2Char2Char2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x12084b25952bc64l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x12084b25952bc65l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxChar2Char2Char2(inV1, out);
+ verifyResultsMaxChar2Char2Char2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxChar2Char2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxChar2Char2Char2(inV1, out);
+ verifyResultsMaxChar2Char2Char2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxChar2Char2Char2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxChar2Char2Char2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxChar2Char2Char2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUchar2Uchar2Uchar2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x75eda605e43f8b81l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x75eda605e43f8b82l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUchar2Uchar2Uchar2(inV1, out);
+ verifyResultsMaxUchar2Uchar2Uchar2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUchar2Uchar2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUchar2Uchar2Uchar2(inV1, out);
+ verifyResultsMaxUchar2Uchar2Uchar2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUchar2Uchar2Uchar2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUchar2Uchar2Uchar2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUchar2Uchar2Uchar2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxShort2Short2Short2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x3d46ae0799c33c02l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x3d46ae0799c33c03l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxShort2Short2Short2(inV1, out);
+ verifyResultsMaxShort2Short2Short2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShort2Short2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxShort2Short2Short2(inV1, out);
+ verifyResultsMaxShort2Short2Short2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShort2Short2Short2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxShort2Short2Short2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxShort2Short2Short2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUshort2Ushort2Ushort2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0xf42196a588de51bfl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0xf42196a588de51c0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUshort2Ushort2Ushort2(inV1, out);
+ verifyResultsMaxUshort2Ushort2Ushort2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshort2Ushort2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUshort2Ushort2Ushort2(inV1, out);
+ verifyResultsMaxUshort2Ushort2Ushort2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshort2Ushort2Ushort2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUshort2Ushort2Ushort2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUshort2Ushort2Ushort2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxInt2Int2Int2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x7bba1e4a83816bd5l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x7bba1e4a83816bd6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxInt2Int2Int2(inV1, out);
+ verifyResultsMaxInt2Int2Int2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxInt2Int2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxInt2Int2Int2(inV1, out);
+ verifyResultsMaxInt2Int2Int2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxInt2Int2Int2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxInt2Int2Int2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxInt2Int2Int2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUint2Uint2Uint2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xcda90384705016a4l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xcda90384705016a5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUint2Uint2Uint2(inV1, out);
+ verifyResultsMaxUint2Uint2Uint2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUint2Uint2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUint2Uint2Uint2(inV1, out);
+ verifyResultsMaxUint2Uint2Uint2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUint2Uint2Uint2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUint2Uint2Uint2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUint2Uint2Uint2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxChar3Char3Char3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x567200e53e0a8f29l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x567200e53e0a8f2al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxChar3Char3Char3(inV1, out);
+ verifyResultsMaxChar3Char3Char3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxChar3Char3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxChar3Char3Char3(inV1, out);
+ verifyResultsMaxChar3Char3Char3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxChar3Char3Char3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxChar3Char3Char3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxChar3Char3Char3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUchar3Uchar3Uchar3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0xa2def5663489d18cl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0xa2def5663489d18dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUchar3Uchar3Uchar3(inV1, out);
+ verifyResultsMaxUchar3Uchar3Uchar3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUchar3Uchar3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUchar3Uchar3Uchar3(inV1, out);
+ verifyResultsMaxUchar3Uchar3Uchar3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUchar3Uchar3Uchar3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUchar3Uchar3Uchar3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUchar3Uchar3Uchar3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxShort3Short3Short3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x6a37fd67ea0d820dl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x6a37fd67ea0d820el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxShort3Short3Short3(inV1, out);
+ verifyResultsMaxShort3Short3Short3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShort3Short3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxShort3Short3Short3(inV1, out);
+ verifyResultsMaxShort3Short3Short3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShort3Short3Short3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxShort3Short3Short3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxShort3Short3Short3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUshort3Ushort3Ushort3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x71604884c752e61cl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x71604884c752e61dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUshort3Ushort3Ushort3(inV1, out);
+ verifyResultsMaxUshort3Ushort3Ushort3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshort3Ushort3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUshort3Ushort3Ushort3(inV1, out);
+ verifyResultsMaxUshort3Ushort3Ushort3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshort3Ushort3Ushort3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUshort3Ushort3Ushort3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUshort3Ushort3Ushort3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxInt3Int3Int3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xa647496a95547ff8l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xa647496a95547ff9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxInt3Int3Int3(inV1, out);
+ verifyResultsMaxInt3Int3Int3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxInt3Int3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxInt3Int3Int3(inV1, out);
+ verifyResultsMaxInt3Int3Int3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxInt3Int3Int3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxInt3Int3Int3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxInt3Int3Int3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUint3Uint3Uint3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x22fa7fb75507e969l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x22fa7fb75507e96al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUint3Uint3Uint3(inV1, out);
+ verifyResultsMaxUint3Uint3Uint3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUint3Uint3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUint3Uint3Uint3(inV1, out);
+ verifyResultsMaxUint3Uint3Uint3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUint3Uint3Uint3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUint3Uint3Uint3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUint3Uint3Uint3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxChar4Char4Char4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xabc37d1822c261eel, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xabc37d1822c261efl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxChar4Char4Char4(inV1, out);
+ verifyResultsMaxChar4Char4Char4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxChar4Char4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxChar4Char4Char4(inV1, out);
+ verifyResultsMaxChar4Char4Char4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxChar4Char4Char4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxChar4Char4Char4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxChar4Char4Char4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUchar4Uchar4Uchar4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0xcfd044c684d41797l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0xcfd044c684d41798l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUchar4Uchar4Uchar4(inV1, out);
+ verifyResultsMaxUchar4Uchar4Uchar4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUchar4Uchar4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUchar4Uchar4Uchar4(inV1, out);
+ verifyResultsMaxUchar4Uchar4Uchar4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUchar4Uchar4Uchar4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUchar4Uchar4Uchar4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUchar4Uchar4Uchar4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxShort4Short4Short4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x97294cc83a57c818l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x97294cc83a57c819l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxShort4Short4Short4(inV1, out);
+ verifyResultsMaxShort4Short4Short4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShort4Short4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxShort4Short4Short4(inV1, out);
+ verifyResultsMaxShort4Short4Short4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxShort4Short4Short4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxShort4Short4Short4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxShort4Short4Short4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUshort4Ushort4Ushort4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0xee9efa6405c77a79l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0xee9efa6405c77a7al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUshort4Ushort4Ushort4(inV1, out);
+ verifyResultsMaxUshort4Ushort4Ushort4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshort4Ushort4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUshort4Ushort4Ushort4(inV1, out);
+ verifyResultsMaxUshort4Ushort4Ushort4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUshort4Ushort4Ushort4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUshort4Ushort4Ushort4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUshort4Ushort4Ushort4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxInt4Int4Int4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xd0d4748aa727941bl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xd0d4748aa727941cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxInt4Int4Int4(inV1, out);
+ verifyResultsMaxInt4Int4Int4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxInt4Int4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxInt4Int4Int4(inV1, out);
+ verifyResultsMaxInt4Int4Int4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxInt4Int4Int4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxInt4Int4Int4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxInt4Int4Int4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMaxUint4Uint4Uint4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x784bfbea39bfbc2el, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x784bfbea39bfbc2fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMaxUint4Uint4Uint4(inV1, out);
+ verifyResultsMaxUint4Uint4Uint4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUint4Uint4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMaxUint4Uint4Uint4(inV1, out);
+ verifyResultsMaxUint4Uint4Uint4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMaxUint4Uint4Uint4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMaxUint4Uint4Uint4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMax(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMaxUint4Uint4Uint4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testMax() {
+ checkMaxFloatFloatFloat();
+ checkMaxFloat2Float2Float2();
+ checkMaxFloat3Float3Float3();
+ checkMaxFloat4Float4Float4();
+ checkMaxCharCharChar();
+ checkMaxUcharUcharUchar();
+ checkMaxShortShortShort();
+ checkMaxUshortUshortUshort();
+ checkMaxIntIntInt();
+ checkMaxUintUintUint();
+ checkMaxChar2Char2Char2();
+ checkMaxUchar2Uchar2Uchar2();
+ checkMaxShort2Short2Short2();
+ checkMaxUshort2Ushort2Ushort2();
+ checkMaxInt2Int2Int2();
+ checkMaxUint2Uint2Uint2();
+ checkMaxChar3Char3Char3();
+ checkMaxUchar3Uchar3Uchar3();
+ checkMaxShort3Short3Short3();
+ checkMaxUshort3Ushort3Ushort3();
+ checkMaxInt3Int3Int3();
+ checkMaxUint3Uint3Uint3();
+ checkMaxChar4Char4Char4();
+ checkMaxUchar4Uchar4Uchar4();
+ checkMaxShort4Short4Short4();
+ checkMaxUshort4Ushort4Ushort4();
+ checkMaxInt4Int4Int4();
+ checkMaxUint4Uint4Uint4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestMin.java b/tests/tests/renderscript/src/android/renderscript/cts/TestMin.java
new file mode 100644
index 0000000..ac01c28
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMin.java
@@ -0,0 +1,2014 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestMin extends RSBaseCompute {
+
+ private ScriptC_TestMin script;
+ private ScriptC_TestMinRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestMin(mRS);
+ scriptRelaxed = new ScriptC_TestMinRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float in;
+ public float in1;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMinFloatFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x816f2fe273bf4977l, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xbdad0b097121572el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMinFloatFloatFloat(in, out);
+ verifyResultsMinFloatFloatFloat(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMinFloatFloatFloat(in, out);
+ verifyResultsMinFloatFloatFloat(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinFloatFloatFloat(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 1];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i];
+ args.in1 = arrayIn1[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinFloat2Float2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xe354049301b6cfb9l, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2f1cc4b149b4e444l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMinFloat2Float2Float2(in, out);
+ verifyResultsMinFloat2Float2Float2(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMinFloat2Float2Float2(in, out);
+ verifyResultsMinFloat2Float2Float2(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinFloat2Float2Float2(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 2];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ args.in1 = arrayIn1[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinFloat3Float3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x38a3c24c4f27231cl, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x8381a2d14b92e5e5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMinFloat3Float3Float3(in, out);
+ verifyResultsMinFloat3Float3Float3(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMinFloat3Float3Float3(in, out);
+ verifyResultsMinFloat3Float3Float3(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinFloat3Float3Float3(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 4];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ args.in1 = arrayIn1[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinFloat4Float4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x8df380059c97767fl, false);
+ Allocation in1 = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xd7e680f14d70e786l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocIn1(in1);
+ script.forEach_testMinFloat4Float4Float4(in, out);
+ verifyResultsMinFloat4Float4Float4(in, in1, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocIn1(in1);
+ scriptRelaxed.forEach_testMinFloat4Float4Float4(in, out);
+ verifyResultsMinFloat4Float4Float4(in, in1, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinFloat4Float4Float4(Allocation in, Allocation in1, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayIn1 = new float[INPUTSIZE * 4];
+ in1.copyTo(arrayIn1);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ args.in1 = arrayIn1[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %14.8g %8x %15a",
+ args.in1, Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsCharCharChar {
+ public byte inV1;
+ public byte inV2;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMinCharCharChar() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x47c90c486fc45b58l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x47c90c486fc45b59l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinCharCharChar(inV1, out);
+ verifyResultsMinCharCharChar(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinCharCharChar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinCharCharChar(inV1, out);
+ verifyResultsMinCharCharChar(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinCharCharChar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinCharCharChar(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinCharCharChar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUcharUcharUchar {
+ public byte inV1;
+ public byte inV2;
+ public byte out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMinUcharUcharUchar() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x6dc5402bc7a34891l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x6dc5402bc7a34892l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUcharUcharUchar(inV1, out);
+ verifyResultsMinUcharUcharUchar(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUcharUcharUchar: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUcharUcharUchar(inV1, out);
+ verifyResultsMinUcharUcharUchar(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUcharUcharUchar: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUcharUcharUchar(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUcharUcharUchar" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsShortShortShort {
+ public short inV1;
+ public short inV2;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMinShortShortShort() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x71b08dd3c65bcddel, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x71b08dd3c65bcddfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinShortShortShort(inV1, out);
+ verifyResultsMinShortShortShort(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShortShortShort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinShortShortShort(inV1, out);
+ verifyResultsMinShortShortShort(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShortShortShort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinShortShortShort(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinShortShortShort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUshortUshortUshort {
+ public short inV1;
+ public short inV2;
+ public short out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMinUshortUshortUshort() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xc2eb3387512e77cfl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xc2eb3387512e77d0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUshortUshortUshort(inV1, out);
+ verifyResultsMinUshortUshortUshort(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshortUshortUshort: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUshortUshortUshort(inV1, out);
+ verifyResultsMinUshortUshortUshort(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshortUshortUshort: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUshortUshortUshort(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUshortUshortUshort" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsIntIntInt {
+ public int inV1;
+ public int inV2;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMinIntIntInt() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x38b24335cda69cd5l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x38b24335cda69cd6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinIntIntInt(inV1, out);
+ verifyResultsMinIntIntInt(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinIntIntInt: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinIntIntInt(inV1, out);
+ verifyResultsMinIntIntInt(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinIntIntInt: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinIntIntInt(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinIntIntInt" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public class ArgumentsUintUintUint {
+ public int inV1;
+ public int inV2;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMinUintUintUint() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xb3dbca2d537cf298l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xb3dbca2d537cf299l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUintUintUint(inV1, out);
+ verifyResultsMinUintUintUint(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUintUintUint: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUintUintUint(inV1, out);
+ verifyResultsMinUintUintUint(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUintUintUint: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUintUintUint(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 1];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 1];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i];
+ args.inV2 = arrayInV2[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 1 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 1 + j]));
+ if (args.out != arrayOut[i * 1 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUintUintUint" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinChar2Char2Char2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xec4705afc03447ael, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0xec4705afc03447afl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinChar2Char2Char2(inV1, out);
+ verifyResultsMinChar2Char2Char2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinChar2Char2Char2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinChar2Char2Char2(inV1, out);
+ verifyResultsMinChar2Char2Char2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinChar2Char2Char2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinChar2Char2Char2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinChar2Char2Char2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUchar2Uchar2Uchar2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x1d3c921d166e22ffl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x1d3c921d166e2300l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUchar2Uchar2Uchar2(inV1, out);
+ verifyResultsMinUchar2Uchar2Uchar2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUchar2Uchar2Uchar2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUchar2Uchar2Uchar2(inV1, out);
+ verifyResultsMinUchar2Uchar2Uchar2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUchar2Uchar2Uchar2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUchar2Uchar2Uchar2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUchar2Uchar2Uchar2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinShort2Short2Short2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0xe4959a1ecbf1d380l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0xe4959a1ecbf1d381l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinShort2Short2Short2(inV1, out);
+ verifyResultsMinShort2Short2Short2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShort2Short2Short2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinShort2Short2Short2(inV1, out);
+ verifyResultsMinShort2Short2Short2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShort2Short2Short2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinShort2Short2Short2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinShort2Short2Short2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUshort2Ushort2Ushort2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x98573ebbc511e319l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x98573ebbc511e31al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUshort2Ushort2Ushort2(inV1, out);
+ verifyResultsMinUshort2Ushort2Ushort2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshort2Ushort2Ushort2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUshort2Ushort2Ushort2(inV1, out);
+ verifyResultsMinUshort2Ushort2Ushort2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshort2Ushort2Ushort2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUshort2Ushort2Ushort2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUshort2Ushort2Ushort2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinInt2Int2Int2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xba635b605676e7a3l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xba635b605676e7a4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinInt2Int2Int2(inV1, out);
+ verifyResultsMinInt2Int2Int2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinInt2Int2Int2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinInt2Int2Int2(inV1, out);
+ verifyResultsMinInt2Int2Int2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinInt2Int2Int2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinInt2Int2Int2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinInt2Int2Int2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUint2Uint2Uint2() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xb8cf8481d731a1eel, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xb8cf8481d731a1efl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUint2Uint2Uint2(inV1, out);
+ verifyResultsMinUint2Uint2Uint2(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUint2Uint2Uint2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUint2Uint2Uint2(inV1, out);
+ verifyResultsMinUint2Uint2Uint2(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUint2Uint2Uint2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUint2Uint2Uint2(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 2];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 2];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i * 2 + j];
+ args.inV2 = arrayInV2[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 2 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 2 + j]));
+ if (args.out != arrayOut[i * 2 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUint2Uint2Uint2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinChar3Char3Char3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x419881e2a4ec1a73l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x419881e2a4ec1a74l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinChar3Char3Char3(inV1, out);
+ verifyResultsMinChar3Char3Char3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinChar3Char3Char3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinChar3Char3Char3(inV1, out);
+ verifyResultsMinChar3Char3Char3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinChar3Char3Char3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinChar3Char3Char3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinChar3Char3Char3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUchar3Uchar3Uchar3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x4a2de17d66b8690al, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x4a2de17d66b8690bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUchar3Uchar3Uchar3(inV1, out);
+ verifyResultsMinUchar3Uchar3Uchar3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUchar3Uchar3Uchar3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUchar3Uchar3Uchar3(inV1, out);
+ verifyResultsMinUchar3Uchar3Uchar3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUchar3Uchar3Uchar3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUchar3Uchar3Uchar3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUchar3Uchar3Uchar3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinShort3Short3Short3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x1186e97f1c3c198bl, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x1186e97f1c3c198cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinShort3Short3Short3(inV1, out);
+ verifyResultsMinShort3Short3Short3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShort3Short3Short3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinShort3Short3Short3(inV1, out);
+ verifyResultsMinShort3Short3Short3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShort3Short3Short3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinShort3Short3Short3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinShort3Short3Short3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUshort3Ushort3Ushort3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x1595f09b03867776l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x1595f09b03867777l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUshort3Ushort3Ushort3(inV1, out);
+ verifyResultsMinUshort3Ushort3Ushort3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshort3Ushort3Ushort3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUshort3Ushort3Ushort3(inV1, out);
+ verifyResultsMinUshort3Ushort3Ushort3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshort3Ushort3Ushort3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUshort3Ushort3Ushort3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUshort3Ushort3Ushort3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinInt3Int3Int3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xe4f086806849fbc6l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0xe4f086806849fbc7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinInt3Int3Int3(inV1, out);
+ verifyResultsMinInt3Int3Int3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinInt3Int3Int3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinInt3Int3Int3(inV1, out);
+ verifyResultsMinInt3Int3Int3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinInt3Int3Int3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinInt3Int3Int3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinInt3Int3Int3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUint3Uint3Uint3() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xe2100b4bbe974b3l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xe2100b4bbe974b4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUint3Uint3Uint3(inV1, out);
+ verifyResultsMinUint3Uint3Uint3(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUint3Uint3Uint3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUint3Uint3Uint3(inV1, out);
+ verifyResultsMinUint3Uint3Uint3(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUint3Uint3Uint3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUint3Uint3Uint3(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUint3Uint3Uint3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinChar4Char4Char4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x96e9fe1589a3ed38l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x96e9fe1589a3ed39l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinChar4Char4Char4(inV1, out);
+ verifyResultsMinChar4Char4Char4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinChar4Char4Char4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinChar4Char4Char4(inV1, out);
+ verifyResultsMinChar4Char4Char4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinChar4Char4Char4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinChar4Char4Char4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsCharCharChar args = new ArgumentsCharCharChar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinChar4Char4Char4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUchar4Uchar4Uchar4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x771f30ddb702af15l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x771f30ddb702af16l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUchar4Uchar4Uchar4(inV1, out);
+ verifyResultsMinUchar4Uchar4Uchar4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUchar4Uchar4Uchar4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_8, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUchar4Uchar4Uchar4(inV1, out);
+ verifyResultsMinUchar4Uchar4Uchar4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUchar4Uchar4Uchar4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUchar4Uchar4Uchar4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ byte[] arrayInV1 = new byte[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ byte[] arrayInV2 = new byte[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ byte[] arrayOut = new byte[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUcharUcharUchar args = new ArgumentsUcharUcharUchar();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUchar4Uchar4Uchar4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinShort4Short4Short4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x3e7838df6c865f96l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x3e7838df6c865f97l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinShort4Short4Short4(inV1, out);
+ verifyResultsMinShort4Short4Short4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShort4Short4Short4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinShort4Short4Short4(inV1, out);
+ verifyResultsMinShort4Short4Short4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinShort4Short4Short4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinShort4Short4Short4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsShortShortShort args = new ArgumentsShortShortShort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinShort4Short4Short4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUshort4Ushort4Ushort4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x92d4a27a41fb0bd3l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x92d4a27a41fb0bd4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUshort4Ushort4Ushort4(inV1, out);
+ verifyResultsMinUshort4Ushort4Ushort4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshort4Ushort4Ushort4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_16, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUshort4Ushort4Ushort4(inV1, out);
+ verifyResultsMinUshort4Ushort4Ushort4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUshort4Ushort4Ushort4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUshort4Ushort4Ushort4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ short[] arrayInV1 = new short[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ short[] arrayInV2 = new short[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ short[] arrayOut = new short[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUshortUshortUshort args = new ArgumentsUshortUshortUshort();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUshort4Ushort4Ushort4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinInt4Int4Int4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xf7db1a07a1d0fe9l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0xf7db1a07a1d0feal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinInt4Int4Int4(inV1, out);
+ verifyResultsMinInt4Int4Int4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinInt4Int4Int4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinInt4Int4Int4(inV1, out);
+ verifyResultsMinInt4Int4Int4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinInt4Int4Int4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinInt4Int4Int4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsIntIntInt args = new ArgumentsIntIntInt();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: %d",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %d",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %d",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %d",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinInt4Int4Int4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMinUint4Uint4Uint4() {
+ Allocation inV1 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x63727ce7a0a14778l, false);
+ Allocation inV2 = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x63727ce7a0a14779l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ script.set_gAllocInV2(inV2);
+ script.forEach_testMinUint4Uint4Uint4(inV1, out);
+ verifyResultsMinUint4Uint4Uint4(inV1, inV2, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUint4Uint4Uint4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.UNSIGNED_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV2(inV2);
+ scriptRelaxed.forEach_testMinUint4Uint4Uint4(inV1, out);
+ verifyResultsMinUint4Uint4Uint4(inV1, inV2, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMinUint4Uint4Uint4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMinUint4Uint4Uint4(Allocation inV1, Allocation inV2, Allocation out, boolean relaxed) {
+ int[] arrayInV1 = new int[INPUTSIZE * 4];
+ inV1.copyTo(arrayInV1);
+ int[] arrayInV2 = new int[INPUTSIZE * 4];
+ inV2.copyTo(arrayInV2);
+ int[] arrayOut = new int[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsUintUintUint args = new ArgumentsUintUintUint();
+ args.inV1 = arrayInV1[i * 4 + j];
+ args.inV2 = arrayInV2[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ if (args.out != arrayOut[i * 4 + j]) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV1: 0x%x",
+ args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: 0x%x",
+ args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: 0x%x",
+ args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: 0x%x",
+ arrayOut[i * 4 + j]));
+ if (args.out != arrayOut[i * 4 + j]) {
+ message.append(" FAIL");
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMinUint4Uint4Uint4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testMin() {
+ checkMinFloatFloatFloat();
+ checkMinFloat2Float2Float2();
+ checkMinFloat3Float3Float3();
+ checkMinFloat4Float4Float4();
+ checkMinCharCharChar();
+ checkMinUcharUcharUchar();
+ checkMinShortShortShort();
+ checkMinUshortUshortUshort();
+ checkMinIntIntInt();
+ checkMinUintUintUint();
+ checkMinChar2Char2Char2();
+ checkMinUchar2Uchar2Uchar2();
+ checkMinShort2Short2Short2();
+ checkMinUshort2Ushort2Ushort2();
+ checkMinInt2Int2Int2();
+ checkMinUint2Uint2Uint2();
+ checkMinChar3Char3Char3();
+ checkMinUchar3Uchar3Uchar3();
+ checkMinShort3Short3Short3();
+ checkMinUshort3Ushort3Ushort3();
+ checkMinInt3Int3Int3();
+ checkMinUint3Uint3Uint3();
+ checkMinChar4Char4Char4();
+ checkMinUchar4Uchar4Uchar4();
+ checkMinShort4Short4Short4();
+ checkMinUshort4Ushort4Ushort4();
+ checkMinInt4Int4Int4();
+ checkMinUint4Uint4Uint4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestMix.java b/tests/tests/renderscript/src/android/renderscript/cts/TestMix.java
new file mode 100644
index 0000000..f8246db
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMix.java
@@ -0,0 +1,602 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestMix extends RSBaseCompute {
+
+ private ScriptC_TestMix script;
+ private ScriptC_TestMixRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestMix(mRS);
+ scriptRelaxed = new ScriptC_TestMixRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloatFloat {
+ public float inStart;
+ public float inStop;
+ public float inAmount;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkMixFloatFloatFloatFloat() {
+ Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x9f4beff6471d6db1l, false);
+ Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x6ede0b88b4422e8fl, false);
+ Allocation inAmount = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xc1c14e5d52dc3fe5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInStop(inStop);
+ script.set_gAllocInAmount(inAmount);
+ script.forEach_testMixFloatFloatFloatFloat(inStart, out);
+ verifyResultsMixFloatFloatFloatFloat(inStart, inStop, inAmount, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloatFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInStop(inStop);
+ scriptRelaxed.set_gAllocInAmount(inAmount);
+ scriptRelaxed.forEach_testMixFloatFloatFloatFloat(inStart, out);
+ verifyResultsMixFloatFloatFloatFloat(inStart, inStop, inAmount, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloatFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMixFloatFloatFloatFloat(Allocation inStart, Allocation inStop, Allocation inAmount, Allocation out, boolean relaxed) {
+ float[] arrayInStart = new float[INPUTSIZE * 1];
+ inStart.copyTo(arrayInStart);
+ float[] arrayInStop = new float[INPUTSIZE * 1];
+ inStop.copyTo(arrayInStop);
+ float[] arrayInAmount = new float[INPUTSIZE * 1];
+ inAmount.copyTo(arrayInAmount);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inStart = arrayInStart[i];
+ args.inStop = arrayInStop[i];
+ args.inAmount = arrayInAmount[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMix(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inStart: %14.8g %8x %15a",
+ args.inStart, Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %14.8g %8x %15a",
+ args.inStop, Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %14.8g %8x %15a",
+ args.inAmount, Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMixFloatFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMixFloat2Float2Float2Float2() {
+ Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x45502e8f0a2d9ce9l, false);
+ Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xba2b8a035395e837l, false);
+ Allocation inAmount = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa477d20616942e4dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInStop(inStop);
+ script.set_gAllocInAmount(inAmount);
+ script.forEach_testMixFloat2Float2Float2Float2(inStart, out);
+ verifyResultsMixFloat2Float2Float2Float2(inStart, inStop, inAmount, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInStop(inStop);
+ scriptRelaxed.set_gAllocInAmount(inAmount);
+ scriptRelaxed.forEach_testMixFloat2Float2Float2Float2(inStart, out);
+ verifyResultsMixFloat2Float2Float2Float2(inStart, inStop, inAmount, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMixFloat2Float2Float2Float2(Allocation inStart, Allocation inStop, Allocation inAmount, Allocation out, boolean relaxed) {
+ float[] arrayInStart = new float[INPUTSIZE * 2];
+ inStart.copyTo(arrayInStart);
+ float[] arrayInStop = new float[INPUTSIZE * 2];
+ inStop.copyTo(arrayInStop);
+ float[] arrayInAmount = new float[INPUTSIZE * 2];
+ inAmount.copyTo(arrayInAmount);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inStart = arrayInStart[i * 2 + j];
+ args.inStop = arrayInStop[i * 2 + j];
+ args.inAmount = arrayInAmount[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMix(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inStart: %14.8g %8x %15a",
+ args.inStart, Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %14.8g %8x %15a",
+ args.inStop, Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %14.8g %8x %15a",
+ args.inAmount, Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMixFloat2Float2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMixFloat3Float3Float3Float3() {
+ Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xeb4701726b009c5l, false);
+ Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9b21f6b3249ee4cbl, false);
+ Allocation inAmount = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x784ed3e2e07c7741l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInStop(inStop);
+ script.set_gAllocInAmount(inAmount);
+ script.forEach_testMixFloat3Float3Float3Float3(inStart, out);
+ verifyResultsMixFloat3Float3Float3Float3(inStart, inStop, inAmount, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInStop(inStop);
+ scriptRelaxed.set_gAllocInAmount(inAmount);
+ scriptRelaxed.forEach_testMixFloat3Float3Float3Float3(inStart, out);
+ verifyResultsMixFloat3Float3Float3Float3(inStart, inStop, inAmount, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMixFloat3Float3Float3Float3(Allocation inStart, Allocation inStop, Allocation inAmount, Allocation out, boolean relaxed) {
+ float[] arrayInStart = new float[INPUTSIZE * 4];
+ inStart.copyTo(arrayInStart);
+ float[] arrayInStop = new float[INPUTSIZE * 4];
+ inStop.copyTo(arrayInStop);
+ float[] arrayInAmount = new float[INPUTSIZE * 4];
+ inAmount.copyTo(arrayInAmount);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inStart = arrayInStart[i * 4 + j];
+ args.inStop = arrayInStop[i * 4 + j];
+ args.inAmount = arrayInAmount[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMix(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inStart: %14.8g %8x %15a",
+ args.inStart, Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %14.8g %8x %15a",
+ args.inStop, Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %14.8g %8x %15a",
+ args.inAmount, Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMixFloat3Float3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMixFloat4Float4Float4Float4() {
+ Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xd818b19f433276a1l, false);
+ Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7c186362f5a7e15fl, false);
+ Allocation inAmount = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x4c25d5bfaa64c035l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInStop(inStop);
+ script.set_gAllocInAmount(inAmount);
+ script.forEach_testMixFloat4Float4Float4Float4(inStart, out);
+ verifyResultsMixFloat4Float4Float4Float4(inStart, inStop, inAmount, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInStop(inStop);
+ scriptRelaxed.set_gAllocInAmount(inAmount);
+ scriptRelaxed.forEach_testMixFloat4Float4Float4Float4(inStart, out);
+ verifyResultsMixFloat4Float4Float4Float4(inStart, inStop, inAmount, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMixFloat4Float4Float4Float4(Allocation inStart, Allocation inStop, Allocation inAmount, Allocation out, boolean relaxed) {
+ float[] arrayInStart = new float[INPUTSIZE * 4];
+ inStart.copyTo(arrayInStart);
+ float[] arrayInStop = new float[INPUTSIZE * 4];
+ inStop.copyTo(arrayInStop);
+ float[] arrayInAmount = new float[INPUTSIZE * 4];
+ inAmount.copyTo(arrayInAmount);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inStart = arrayInStart[i * 4 + j];
+ args.inStop = arrayInStop[i * 4 + j];
+ args.inAmount = arrayInAmount[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMix(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inStart: %14.8g %8x %15a",
+ args.inStart, Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %14.8g %8x %15a",
+ args.inStop, Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %14.8g %8x %15a",
+ args.inAmount, Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMixFloat4Float4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMixFloat2Float2FloatFloat2() {
+ Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xf811b2d52bd1d7c3l, false);
+ Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x17a127e13c8dd1c5l, false);
+ Allocation inAmount = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xaaf909cdbd2a10ebl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInStop(inStop);
+ script.set_gAllocInAmount(inAmount);
+ script.forEach_testMixFloat2Float2FloatFloat2(inStart, out);
+ verifyResultsMixFloat2Float2FloatFloat2(inStart, inStop, inAmount, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2FloatFloat2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInStop(inStop);
+ scriptRelaxed.set_gAllocInAmount(inAmount);
+ scriptRelaxed.forEach_testMixFloat2Float2FloatFloat2(inStart, out);
+ verifyResultsMixFloat2Float2FloatFloat2(inStart, inStop, inAmount, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat2Float2FloatFloat2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMixFloat2Float2FloatFloat2(Allocation inStart, Allocation inStop, Allocation inAmount, Allocation out, boolean relaxed) {
+ float[] arrayInStart = new float[INPUTSIZE * 2];
+ inStart.copyTo(arrayInStart);
+ float[] arrayInStop = new float[INPUTSIZE * 2];
+ inStop.copyTo(arrayInStop);
+ float[] arrayInAmount = new float[INPUTSIZE * 1];
+ inAmount.copyTo(arrayInAmount);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inStart = arrayInStart[i * 2 + j];
+ args.inStop = arrayInStop[i * 2 + j];
+ args.inAmount = arrayInAmount[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMix(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inStart: %14.8g %8x %15a",
+ args.inStart, Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %14.8g %8x %15a",
+ args.inStop, Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %14.8g %8x %15a",
+ args.inAmount, Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMixFloat2Float2FloatFloat2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMixFloat3Float3FloatFloat3() {
+ Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xae7aff441b20fa80l, false);
+ Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xe64a4d60d6f4de7cl, false);
+ Allocation inAmount = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4ea8e06fef74e6aal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInStop(inStop);
+ script.set_gAllocInAmount(inAmount);
+ script.forEach_testMixFloat3Float3FloatFloat3(inStart, out);
+ verifyResultsMixFloat3Float3FloatFloat3(inStart, inStop, inAmount, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3FloatFloat3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInStop(inStop);
+ scriptRelaxed.set_gAllocInAmount(inAmount);
+ scriptRelaxed.forEach_testMixFloat3Float3FloatFloat3(inStart, out);
+ verifyResultsMixFloat3Float3FloatFloat3(inStart, inStop, inAmount, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat3Float3FloatFloat3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMixFloat3Float3FloatFloat3(Allocation inStart, Allocation inStop, Allocation inAmount, Allocation out, boolean relaxed) {
+ float[] arrayInStart = new float[INPUTSIZE * 4];
+ inStart.copyTo(arrayInStart);
+ float[] arrayInStop = new float[INPUTSIZE * 4];
+ inStop.copyTo(arrayInStop);
+ float[] arrayInAmount = new float[INPUTSIZE * 1];
+ inAmount.copyTo(arrayInAmount);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inStart = arrayInStart[i * 4 + j];
+ args.inStop = arrayInStop[i * 4 + j];
+ args.inAmount = arrayInAmount[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMix(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inStart: %14.8g %8x %15a",
+ args.inStart, Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %14.8g %8x %15a",
+ args.inStop, Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %14.8g %8x %15a",
+ args.inAmount, Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMixFloat3Float3FloatFloat3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkMixFloat4Float4FloatFloat4() {
+ Allocation inStart = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x64e44bb30a701d3dl, false);
+ Allocation inStop = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xb4f372e0715beb33l, false);
+ Allocation inAmount = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xf258b71221bfbc69l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInStop(inStop);
+ script.set_gAllocInAmount(inAmount);
+ script.forEach_testMixFloat4Float4FloatFloat4(inStart, out);
+ verifyResultsMixFloat4Float4FloatFloat4(inStart, inStop, inAmount, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4FloatFloat4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInStop(inStop);
+ scriptRelaxed.set_gAllocInAmount(inAmount);
+ scriptRelaxed.forEach_testMixFloat4Float4FloatFloat4(inStart, out);
+ verifyResultsMixFloat4Float4FloatFloat4(inStart, inStop, inAmount, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testMixFloat4Float4FloatFloat4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsMixFloat4Float4FloatFloat4(Allocation inStart, Allocation inStop, Allocation inAmount, Allocation out, boolean relaxed) {
+ float[] arrayInStart = new float[INPUTSIZE * 4];
+ inStart.copyTo(arrayInStart);
+ float[] arrayInStop = new float[INPUTSIZE * 4];
+ inStop.copyTo(arrayInStop);
+ float[] arrayInAmount = new float[INPUTSIZE * 1];
+ inAmount.copyTo(arrayInAmount);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloatFloat args = new ArgumentsFloatFloatFloatFloat();
+ args.inStart = arrayInStart[i * 4 + j];
+ args.inStop = arrayInStop[i * 4 + j];
+ args.inAmount = arrayInAmount[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeMix(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inStart: %14.8g %8x %15a",
+ args.inStart, Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %14.8g %8x %15a",
+ args.inStop, Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %14.8g %8x %15a",
+ args.inAmount, Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkMixFloat4Float4FloatFloat4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testMix() {
+ checkMixFloatFloatFloatFloat();
+ checkMixFloat2Float2Float2Float2();
+ checkMixFloat3Float3Float3Float3();
+ checkMixFloat4Float4Float4Float4();
+ checkMixFloat2Float2FloatFloat2();
+ checkMixFloat3Float3FloatFloat3();
+ checkMixFloat4Float4FloatFloat4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestModf.java b/tests/tests/renderscript/src/android/renderscript/cts/TestModf.java
new file mode 100644
index 0000000..a282ff8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestModf.java
@@ -0,0 +1,372 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestModf extends RSBaseCompute {
+
+ private ScriptC_TestModf script;
+ private ScriptC_TestModfRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestModf(mRS);
+ scriptRelaxed = new ScriptC_TestModfRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float outIret;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkModfFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xd655dc05ccaef47l, false);
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocOutIret(outIret);
+ script.forEach_testModfFloatFloatFloat(inX, out);
+ verifyResultsModfFloatFloatFloat(inX, outIret, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIret(outIret);
+ scriptRelaxed.forEach_testModfFloatFloatFloat(inX, out);
+ verifyResultsModfFloatFloatFloat(inX, outIret, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsModfFloatFloatFloat(Allocation inX, Allocation outIret, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayOutIret = new float[INPUTSIZE * 1];
+ outIret.copyTo(arrayOutIret);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeModf(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 1 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %14.8g %8x %15a",
+ args.outIret, Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %14.8g %8x %15a",
+ arrayOutIret[i * 1 + j], Float.floatToRawIntBits(arrayOutIret[i * 1 + j]), arrayOutIret[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 1 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkModfFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkModfFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2a1dc519fa163061l, false);
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocOutIret(outIret);
+ script.forEach_testModfFloat2Float2Float2(inX, out);
+ verifyResultsModfFloat2Float2Float2(inX, outIret, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIret(outIret);
+ scriptRelaxed.forEach_testModfFloat2Float2Float2(inX, out);
+ verifyResultsModfFloat2Float2Float2(inX, outIret, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsModfFloat2Float2Float2(Allocation inX, Allocation outIret, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayOutIret = new float[INPUTSIZE * 2];
+ outIret.copyTo(arrayOutIret);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeModf(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 2 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %14.8g %8x %15a",
+ args.outIret, Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %14.8g %8x %15a",
+ arrayOutIret[i * 2 + j], Float.floatToRawIntBits(arrayOutIret[i * 2 + j]), arrayOutIret[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 2 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkModfFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkModfFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x7e82a339fbf43202l, false);
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocOutIret(outIret);
+ script.forEach_testModfFloat3Float3Float3(inX, out);
+ verifyResultsModfFloat3Float3Float3(inX, outIret, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIret(outIret);
+ scriptRelaxed.forEach_testModfFloat3Float3Float3(inX, out);
+ verifyResultsModfFloat3Float3Float3(inX, outIret, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsModfFloat3Float3Float3(Allocation inX, Allocation outIret, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayOutIret = new float[INPUTSIZE * 4];
+ outIret.copyTo(arrayOutIret);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeModf(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 4 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %14.8g %8x %15a",
+ args.outIret, Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %14.8g %8x %15a",
+ arrayOutIret[i * 4 + j], Float.floatToRawIntBits(arrayOutIret[i * 4 + j]), arrayOutIret[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 4 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkModfFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkModfFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xd2e78159fdd233a3l, false);
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocOutIret(outIret);
+ script.forEach_testModfFloat4Float4Float4(inX, out);
+ verifyResultsModfFloat4Float4Float4(inX, outIret, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation outIret = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutIret(outIret);
+ scriptRelaxed.forEach_testModfFloat4Float4Float4(inX, out);
+ verifyResultsModfFloat4Float4Float4(inX, outIret, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testModfFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsModfFloat4Float4Float4(Allocation inX, Allocation outIret, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayOutIret = new float[INPUTSIZE * 4];
+ outIret.copyTo(arrayOutIret);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeModf(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 4 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %14.8g %8x %15a",
+ args.outIret, Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %14.8g %8x %15a",
+ arrayOutIret[i * 4 + j], Float.floatToRawIntBits(arrayOutIret[i * 4 + j]), arrayOutIret[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.outIret - arrayOutIret[i * 4 + j]) / Math.ulp(args.outIret) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkModfFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testModf() {
+ checkModfFloatFloatFloat();
+ checkModfFloat2Float2Float2();
+ checkModfFloat3Float3Float3();
+ checkModfFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNan.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNan.java
new file mode 100644
index 0000000..1e42623
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNan.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNan extends RSBaseCompute {
+
+ private ScriptC_TestNan script;
+ private ScriptC_TestNanRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNan(mRS);
+ scriptRelaxed = new ScriptC_TestNanRelaxed(mRS);
+ }
+
+ private void checkNanUintFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x757e939c0e627774l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNanUintFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNanUintFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNanUintFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNanUintFloat: " + e.toString());
+ }
+ }
+
+ public void testNan() {
+ checkNanUintFloat();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp.java
new file mode 100644
index 0000000..9483737
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNativeExp extends RSBaseCompute {
+
+ private ScriptC_TestNativeExp script;
+ private ScriptC_TestNativeExpRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNativeExp(mRS);
+ scriptRelaxed = new ScriptC_TestNativeExpRelaxed(mRS);
+ }
+
+ private void checkNativeExpFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x66a7898af1f6be9bl, -86, 86);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNativeExpFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExpFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNativeExpFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6feb21d463a0ee67l, -86, 86);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testNativeExpFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExpFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNativeExpFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6feceaef59bc0f45l, -86, 86);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testNativeExpFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExpFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNativeExpFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6feeb40a4fd73023l, -86, 86);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testNativeExpFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExpFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExpFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testNativeExp() {
+ checkNativeExpFloatFloat();
+ checkNativeExpFloat2Float2();
+ checkNativeExpFloat3Float3();
+ checkNativeExpFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp10.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp10.java
new file mode 100644
index 0000000..7e2cd97
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp10.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNativeExp10 extends RSBaseCompute {
+
+ private ScriptC_TestNativeExp10 script;
+ private ScriptC_TestNativeExp10Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNativeExp10(mRS);
+ scriptRelaxed = new ScriptC_TestNativeExp10Relaxed(mRS);
+ }
+
+ private void checkNativeExp10FloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x562e4ea690352c54l, -37, 37);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNativeExp10FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp10FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10FloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNativeExp10Float2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x7450c64e54876b98l, -37, 37);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testNativeExp10Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp10Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10Float2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNativeExp10Float3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x74528f694aa28c76l, -37, 37);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testNativeExp10Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp10Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNativeExp10Float4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7454588440bdad54l, -37, 37);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testNativeExp10Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp10Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp10Float4Float4: " + e.toString());
+ }
+ }
+
+ public void testNativeExp10() {
+ checkNativeExp10FloatFloat();
+ checkNativeExp10Float2Float2();
+ checkNativeExp10Float3Float3();
+ checkNativeExp10Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp2.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp2.java
new file mode 100644
index 0000000..cb64bc1
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeExp2.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNativeExp2 extends RSBaseCompute {
+
+ private ScriptC_TestNativeExp2 script;
+ private ScriptC_TestNativeExp2Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNativeExp2(mRS);
+ scriptRelaxed = new ScriptC_TestNativeExp2Relaxed(mRS);
+ }
+
+ private void checkNativeExp2FloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xd87a6eb24c6a2bc5l, -125, 125);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNativeExp2FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp2FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2FloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNativeExp2Float2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x8c243b10af5062c1l, -125, 125);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testNativeExp2Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp2Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNativeExp2Float3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x8c26042ba56b839fl, -125, 125);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testNativeExp2Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp2Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNativeExp2Float4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x8c27cd469b86a47dl, -125, 125);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testNativeExp2Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeExp2Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeExp2Float4Float4: " + e.toString());
+ }
+ }
+
+ public void testNativeExp2() {
+ checkNativeExp2FloatFloat();
+ checkNativeExp2Float2Float2();
+ checkNativeExp2Float3Float3();
+ checkNativeExp2Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog.java
new file mode 100644
index 0000000..6a669e3
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNativeLog extends RSBaseCompute {
+
+ private ScriptC_TestNativeLog script;
+ private ScriptC_TestNativeLogRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNativeLog(mRS);
+ scriptRelaxed = new ScriptC_TestNativeLogRelaxed(mRS);
+ }
+
+ private void checkNativeLogFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x6237b14ee6418d2cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNativeLogFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLogFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNativeLogFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x641a5823d3eee3b0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testNativeLogFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLogFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNativeLogFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x641c213eca0a048el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testNativeLogFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLogFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNativeLogFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x641dea59c025256cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testNativeLogFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLogFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLogFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testNativeLog() {
+ checkNativeLogFloatFloat();
+ checkNativeLogFloat2Float2();
+ checkNativeLogFloat3Float3();
+ checkNativeLogFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog10.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog10.java
new file mode 100644
index 0000000..6ab2a16
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog10.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNativeLog10 extends RSBaseCompute {
+
+ private ScriptC_TestNativeLog10 script;
+ private ScriptC_TestNativeLog10Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNativeLog10(mRS);
+ scriptRelaxed = new ScriptC_TestNativeLog10Relaxed(mRS);
+ }
+
+ private void checkNativeLog10FloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4a5d84f60083219dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNativeLog10FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog10FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10FloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNativeLog10Float2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x1d500a10779807d9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testNativeLog10Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog10Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10Float2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNativeLog10Float3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1d51d32b6db328b7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testNativeLog10Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog10Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNativeLog10Float4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x1d539c4663ce4995l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testNativeLog10Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog10Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog10Float4Float4: " + e.toString());
+ }
+ }
+
+ public void testNativeLog10() {
+ checkNativeLog10FloatFloat();
+ checkNativeLog10Float2Float2();
+ checkNativeLog10Float3Float3();
+ checkNativeLog10Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog2.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog2.java
new file mode 100644
index 0000000..b2d4bed
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNativeLog2.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNativeLog2 extends RSBaseCompute {
+
+ private ScriptC_TestNativeLog2 script;
+ private ScriptC_TestNativeLog2Relaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNativeLog2(mRS);
+ scriptRelaxed = new ScriptC_TestNativeLog2Relaxed(mRS);
+ }
+
+ private void checkNativeLog2FloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x19b11c9c54fade20l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNativeLog2FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2FloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog2FloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2FloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNativeLog2Float2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x90125a688c689604l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testNativeLog2Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog2Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNativeLog2Float3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x901423838283b6e2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testNativeLog2Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog2Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNativeLog2Float4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9015ec9e789ed7c0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testNativeLog2Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testNativeLog2Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativeLog2Float4Float4: " + e.toString());
+ }
+ }
+
+ public void testNativeLog2() {
+ checkNativeLog2FloatFloat();
+ checkNativeLog2Float2Float2();
+ checkNativeLog2Float3Float3();
+ checkNativeLog2Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNativePowr.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNativePowr.java
new file mode 100644
index 0000000..f3e4dcb
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNativePowr.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNativePowr extends RSBaseCompute {
+
+ private ScriptC_TestNativePowr script;
+ private ScriptC_TestNativePowrRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNativePowr(mRS);
+ scriptRelaxed = new ScriptC_TestNativePowrRelaxed(mRS);
+ }
+
+ private void checkNativePowrFloatFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x3c3550bdff7a10c2l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x3c3550bdff7a10c5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNativePowrFloatFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNativePowrFloatFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNativePowrFloat2Float2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xdbc56fbe7733c926l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xdbc56fbe7733c929l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNativePowrFloat2Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNativePowrFloat2Float2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNativePowrFloat3Float3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x302a4dde7911cac7l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x302a4dde7911cacal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNativePowrFloat3Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNativePowrFloat3Float3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNativePowrFloat4Float4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x848f2bfe7aefcc68l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x848f2bfe7aefcc6bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNativePowrFloat4Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNativePowrFloat4Float4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNativePowrFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ public void testNativePowr() {
+ checkNativePowrFloatFloatFloat();
+ checkNativePowrFloat2Float2Float2();
+ checkNativePowrFloat3Float3Float3();
+ checkNativePowrFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNextafter.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNextafter.java
new file mode 100644
index 0000000..a85b5e6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNextafter.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNextafter extends RSBaseCompute {
+
+ private ScriptC_TestNextafter script;
+ private ScriptC_TestNextafterRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNextafter(mRS);
+ scriptRelaxed = new ScriptC_TestNextafterRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkNextafterFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa3b02393ad412958l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa3b02393ad412959l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNextafterFloatFloatFloat(inX, out);
+ verifyResultsNextafterFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNextafterFloatFloatFloat(inX, out);
+ verifyResultsNextafterFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsNextafterFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeNextafter(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkNextafterFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkNextafterFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x29b40e0584a1e24l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x29b40e0584a1e25l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNextafterFloat2Float2Float2(inX, out);
+ verifyResultsNextafterFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNextafterFloat2Float2Float2(inX, out);
+ verifyResultsNextafterFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsNextafterFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeNextafter(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkNextafterFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkNextafterFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x57001f005a281fc5l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x57001f005a281fc6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNextafterFloat3Float3Float3(inX, out);
+ verifyResultsNextafterFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNextafterFloat3Float3Float3(inX, out);
+ verifyResultsNextafterFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsNextafterFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeNextafter(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkNextafterFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkNextafterFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xab64fd205c062166l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xab64fd205c062167l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testNextafterFloat4Float4Float4(inX, out);
+ verifyResultsNextafterFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testNextafterFloat4Float4Float4(inX, out);
+ verifyResultsNextafterFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNextafterFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsNextafterFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeNextafter(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkNextafterFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testNextafter() {
+ checkNextafterFloatFloatFloat();
+ checkNextafterFloat2Float2Float2();
+ checkNextafterFloat3Float3Float3();
+ checkNextafterFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestNormalize.java b/tests/tests/renderscript/src/android/renderscript/cts/TestNormalize.java
new file mode 100644
index 0000000..f19a537
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNormalize.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestNormalize extends RSBaseCompute {
+
+ private ScriptC_TestNormalize script;
+ private ScriptC_TestNormalizeRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestNormalize(mRS);
+ scriptRelaxed = new ScriptC_TestNormalizeRelaxed(mRS);
+ }
+
+ private void checkNormalizeFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x6db01d449460061cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testNormalizeFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testNormalizeFloatFloat(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkNormalizeFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x3cde199a6e066120l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testNormalizeFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testNormalizeFloat2Float2(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkNormalizeFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x3cdfe2b5642181fel, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testNormalizeFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testNormalizeFloat3Float3(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkNormalizeFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x3ce1abd05a3ca2dcl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testNormalizeFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testNormalizeFloat4Float4(inV, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testNormalizeFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testNormalize() {
+ checkNormalizeFloatFloat();
+ checkNormalizeFloat2Float2();
+ checkNormalizeFloat3Float3();
+ checkNormalizeFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestPow.java b/tests/tests/renderscript/src/android/renderscript/cts/TestPow.java
new file mode 100644
index 0000000..a895e16
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestPow.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestPow extends RSBaseCompute {
+
+ private ScriptC_TestPow script;
+ private ScriptC_TestPowRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestPow(mRS);
+ scriptRelaxed = new ScriptC_TestPowRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkPowFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x470aeab18312445bl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x470aeab18312445cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowFloatFloatFloat(inX, out);
+ verifyResultsPowFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowFloatFloatFloat(inX, out);
+ verifyResultsPowFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePow(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPowFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbcd9b7ed561242ddl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbcd9b7ed561242del, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowFloat2Float2Float2(inX, out);
+ verifyResultsPowFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowFloat2Float2Float2(inX, out);
+ verifyResultsPowFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePow(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPowFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x113e960d57f0447el, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x113e960d57f0447fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowFloat3Float3Float3(inX, out);
+ verifyResultsPowFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowFloat3Float3Float3(inX, out);
+ verifyResultsPowFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePow(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPowFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x65a3742d59ce461fl, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x65a3742d59ce4620l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowFloat4Float4Float4(inX, out);
+ verifyResultsPowFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowFloat4Float4Float4(inX, out);
+ verifyResultsPowFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePow(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testPow() {
+ checkPowFloatFloatFloat();
+ checkPowFloat2Float2Float2();
+ checkPowFloat3Float3Float3();
+ checkPowFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestPown.java b/tests/tests/renderscript/src/android/renderscript/cts/TestPown.java
new file mode 100644
index 0000000..1c05435
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestPown.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestPown extends RSBaseCompute {
+
+ private ScriptC_TestPown script;
+ private ScriptC_TestPownRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestPown(mRS);
+ scriptRelaxed = new ScriptC_TestPownRelaxed(mRS);
+ }
+
+ private void checkPownFloatIntFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xde633e0d2c462948l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xde633e0d2c462949l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloatIntFloat(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloatIntFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPownFloatIntFloat(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloatIntFloat: " + e.toString());
+ }
+ }
+
+ private void checkPownFloat2Int2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x1685dc0ea821329el, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x1685dc0ea821329fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloat2Int2Float2(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat2Int2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPownFloat2Int2Float2(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void checkPownFloat3Int3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x3c3c1a719dd39f57l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x3c3c1a719dd39f58l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloat3Int3Float3(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat3Int3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPownFloat3Int3Float3(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void checkPownFloat4Int4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x61f258d493860c10l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x61f258d493860c11l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloat4Int4Float4(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat4Int4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPownFloat4Int4Float4(inX, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat4Int4Float4: " + e.toString());
+ }
+ }
+
+ public void testPown() {
+ checkPownFloatIntFloat();
+ checkPownFloat2Int2Float2();
+ checkPownFloat3Int3Float3();
+ checkPownFloat4Int4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestPowr.java b/tests/tests/renderscript/src/android/renderscript/cts/TestPowr.java
new file mode 100644
index 0000000..98bad5b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestPowr.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestPowr extends RSBaseCompute {
+
+ private ScriptC_TestPowr script;
+ private ScriptC_TestPowrRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestPowr(mRS);
+ scriptRelaxed = new ScriptC_TestPowrRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkPowrFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x616e17ec158f6a8dl, 0, 200);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x616e17ec158f6a8el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowrFloatFloatFloat(inX, out);
+ verifyResultsPowrFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowrFloatFloatFloat(inX, out);
+ verifyResultsPowrFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowrFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePowr(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowrFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPowrFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xfc919df3002fbd93l, 0, 200);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xfc919df3002fbd94l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowrFloat2Float2Float2(inX, out);
+ verifyResultsPowrFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowrFloat2Float2Float2(inX, out);
+ verifyResultsPowrFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowrFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePowr(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowrFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPowrFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x50f67c13020dbf34l, 0, 200);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x50f67c13020dbf35l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowrFloat3Float3Float3(inX, out);
+ verifyResultsPowrFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowrFloat3Float3Float3(inX, out);
+ verifyResultsPowrFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowrFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePowr(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowrFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPowrFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa55b5a3303ebc0d5l, 0, 200);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa55b5a3303ebc0d6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPowrFloat4Float4Float4(inX, out);
+ verifyResultsPowrFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testPowrFloat4Float4Float4(inX, out);
+ verifyResultsPowrFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPowrFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPowrFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computePowr(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkPowrFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testPowr() {
+ checkPowrFloatFloatFloat();
+ checkPowrFloat2Float2Float2();
+ checkPowrFloat3Float3Float3();
+ checkPowrFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestRadians.java b/tests/tests/renderscript/src/android/renderscript/cts/TestRadians.java
new file mode 100644
index 0000000..73e723b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRadians.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestRadians extends RSBaseCompute {
+
+ private ScriptC_TestRadians script;
+ private ScriptC_TestRadiansRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestRadians(mRS);
+ scriptRelaxed = new ScriptC_TestRadiansRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float inValue;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkRadiansFloatFloat() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xaa72f227598b8106l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testRadiansFloatFloat(inValue, out);
+ verifyResultsRadiansFloatFloat(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testRadiansFloatFloat(inValue, out);
+ verifyResultsRadiansFloatFloat(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRadiansFloatFloat(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 1];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRadians(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRadiansFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRadiansFloat2Float2() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xb28bd9316e059892l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testRadiansFloat2Float2(inValue, out);
+ verifyResultsRadiansFloat2Float2(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testRadiansFloat2Float2(inValue, out);
+ verifyResultsRadiansFloat2Float2(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRadiansFloat2Float2(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 2];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRadians(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRadiansFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRadiansFloat3Float3() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd8404eb8b743be10l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testRadiansFloat3Float3(inValue, out);
+ verifyResultsRadiansFloat3Float3(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testRadiansFloat3Float3(inValue, out);
+ verifyResultsRadiansFloat3Float3(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRadiansFloat3Float3(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRadians(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRadiansFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRadiansFloat4Float4() {
+ Allocation inValue = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xfdf4c4400081e38el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testRadiansFloat4Float4(inValue, out);
+ verifyResultsRadiansFloat4Float4(inValue, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testRadiansFloat4Float4(inValue, out);
+ verifyResultsRadiansFloat4Float4(inValue, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRadiansFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRadiansFloat4Float4(Allocation inValue, Allocation out, boolean relaxed) {
+ float[] arrayInValue = new float[INPUTSIZE * 4];
+ inValue.copyTo(arrayInValue);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inValue = arrayInValue[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRadians(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inValue: %14.8g %8x %15a",
+ args.inValue, Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRadiansFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testRadians() {
+ checkRadiansFloatFloat();
+ checkRadiansFloat2Float2();
+ checkRadiansFloat3Float3();
+ checkRadiansFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestRemainder.java b/tests/tests/renderscript/src/android/renderscript/cts/TestRemainder.java
new file mode 100644
index 0000000..d5d01e5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRemainder.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestRemainder extends RSBaseCompute {
+
+ private ScriptC_TestRemainder script;
+ private ScriptC_TestRemainderRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestRemainder(mRS);
+ scriptRelaxed = new ScriptC_TestRemainderRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inX;
+ public float inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkRemainderFloatFloatFloat() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x27d6330966022888l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x27d6330966022889l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testRemainderFloatFloatFloat(inX, out);
+ verifyResultsRemainderFloatFloatFloat(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testRemainderFloatFloatFloat(inX, out);
+ verifyResultsRemainderFloatFloatFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRemainderFloatFloatFloat(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 1];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 1];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i];
+ args.inY = arrayInY[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRemainder(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRemainderFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRemainderFloat2Float2Float2() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xfb2eaf332420c6b4l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xfb2eaf332420c6b5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testRemainderFloat2Float2Float2(inX, out);
+ verifyResultsRemainderFloat2Float2Float2(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testRemainderFloat2Float2Float2(inX, out);
+ verifyResultsRemainderFloat2Float2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRemainderFloat2Float2Float2(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 2];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 2];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 2 + j];
+ args.inY = arrayInY[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRemainder(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRemainderFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRemainderFloat3Float3Float3() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x4f938d5325fec855l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x4f938d5325fec856l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testRemainderFloat3Float3Float3(inX, out);
+ verifyResultsRemainderFloat3Float3Float3(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testRemainderFloat3Float3Float3(inX, out);
+ verifyResultsRemainderFloat3Float3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRemainderFloat3Float3Float3(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRemainder(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRemainderFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRemainderFloat4Float4Float4() {
+ Allocation inX = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa3f86b7327dcc9f6l, false);
+ Allocation inY = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa3f86b7327dcc9f7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testRemainderFloat4Float4Float4(inX, out);
+ verifyResultsRemainderFloat4Float4Float4(inX, inY, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInY(inY);
+ scriptRelaxed.forEach_testRemainderFloat4Float4Float4(inX, out);
+ verifyResultsRemainderFloat4Float4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemainderFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRemainderFloat4Float4Float4(Allocation inX, Allocation inY, Allocation out, boolean relaxed) {
+ float[] arrayInX = new float[INPUTSIZE * 4];
+ inX.copyTo(arrayInX);
+ float[] arrayInY = new float[INPUTSIZE * 4];
+ inY.copyTo(arrayInY);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inX = arrayInX[i * 4 + j];
+ args.inY = arrayInY[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRemainder(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inX: %14.8g %8x %15a",
+ args.inX, Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %14.8g %8x %15a",
+ args.inY, Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRemainderFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testRemainder() {
+ checkRemainderFloatFloatFloat();
+ checkRemainderFloat2Float2Float2();
+ checkRemainderFloat3Float3Float3();
+ checkRemainderFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestRemquo.java b/tests/tests/renderscript/src/android/renderscript/cts/TestRemquo.java
new file mode 100644
index 0000000..e917f63
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRemquo.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestRemquo extends RSBaseCompute {
+
+ private ScriptC_TestRemquo script;
+ private ScriptC_TestRemquoRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestRemquo(mRS);
+ scriptRelaxed = new ScriptC_TestRemquoRelaxed(mRS);
+ }
+
+ private void checkRemquoFloatFloatIntFloat() {
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x118af9b82db63b13l, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x118af9b82db63b14l, false);
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInC(inC);
+ script.set_gAllocOutD(outD);
+ script.forEach_testRemquoFloatFloatIntFloat(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloatFloatIntFloat: " + e.toString());
+ }
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.set_gAllocOutD(outD);
+ scriptRelaxed.forEach_testRemquoFloatFloatIntFloat(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloatFloatIntFloat: " + e.toString());
+ }
+ }
+
+ private void checkRemquoFloat2Float2Int2Float2() {
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x9b98a1a6b125f903l, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x9b98a1a6b125f904l, false);
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInC(inC);
+ script.set_gAllocOutD(outD);
+ script.forEach_testRemquoFloat2Float2Int2Float2(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloat2Float2Int2Float2: " + e.toString());
+ }
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.set_gAllocOutD(outD);
+ scriptRelaxed.forEach_testRemquoFloat2Float2Int2Float2(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloat2Float2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void checkRemquoFloat3Float3Int3Float3() {
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xa049a00a6911ca8fl, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xa049a00a6911ca90l, false);
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInC(inC);
+ script.set_gAllocOutD(outD);
+ script.forEach_testRemquoFloat3Float3Int3Float3(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloat3Float3Int3Float3: " + e.toString());
+ }
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.set_gAllocOutD(outD);
+ scriptRelaxed.forEach_testRemquoFloat3Float3Int3Float3(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloat3Float3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void checkRemquoFloat4Float4Int4Float4() {
+ Allocation inB = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa4fa9e6e20fd9c1bl, false);
+ Allocation inC = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa4fa9e6e20fd9c1cl, false);
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInC(inC);
+ script.set_gAllocOutD(outD);
+ script.forEach_testRemquoFloat4Float4Int4Float4(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloat4Float4Int4Float4: " + e.toString());
+ }
+ try {
+ Allocation outD = Allocation.createSized(mRS, getElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInC(inC);
+ scriptRelaxed.set_gAllocOutD(outD);
+ scriptRelaxed.forEach_testRemquoFloat4Float4Int4Float4(inB, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRemquoFloat4Float4Int4Float4: " + e.toString());
+ }
+ }
+
+ public void testRemquo() {
+ checkRemquoFloatFloatIntFloat();
+ checkRemquoFloat2Float2Int2Float2();
+ checkRemquoFloat3Float3Int3Float3();
+ checkRemquoFloat4Float4Int4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestRint.java b/tests/tests/renderscript/src/android/renderscript/cts/TestRint.java
new file mode 100644
index 0000000..df9a631
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRint.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestRint extends RSBaseCompute {
+
+ private ScriptC_TestRint script;
+ private ScriptC_TestRintRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestRint(mRS);
+ scriptRelaxed = new ScriptC_TestRintRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkRintFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfe569fda5dbe93fal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testRintFloatFloat(in, out);
+ verifyResultsRintFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testRintFloatFloat(in, out);
+ verifyResultsRintFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRintFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRint(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRintFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRintFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xffa7b22ac6b343c6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testRintFloat2Float2(in, out);
+ verifyResultsRintFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testRintFloat2Float2(in, out);
+ verifyResultsRintFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRintFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRint(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRintFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRintFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xffa7bccc25b9d960l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testRintFloat3Float3(in, out);
+ verifyResultsRintFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testRintFloat3Float3(in, out);
+ verifyResultsRintFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRintFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRint(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRintFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRintFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xffa7c76d84c06efal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testRintFloat4Float4(in, out);
+ verifyResultsRintFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testRintFloat4Float4(in, out);
+ verifyResultsRintFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRintFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRintFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRint(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRintFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testRint() {
+ checkRintFloatFloat();
+ checkRintFloat2Float2();
+ checkRintFloat3Float3();
+ checkRintFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestRootn.java b/tests/tests/renderscript/src/android/renderscript/cts/TestRootn.java
new file mode 100644
index 0000000..dfad841
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRootn.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestRootn extends RSBaseCompute {
+
+ private ScriptC_TestRootn script;
+ private ScriptC_TestRootnRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestRootn(mRS);
+ scriptRelaxed = new ScriptC_TestRootnRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatIntFloat {
+ public float inV;
+ public int inN;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkRootnFloatIntFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x37d0d9514daae0ccl, false);
+ Allocation inN = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x37d0d9514daae0c4l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInN(inN);
+ script.forEach_testRootnFloatIntFloat(inV, out);
+ verifyResultsRootnFloatIntFloat(inV, inN, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloatIntFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInN(inN);
+ scriptRelaxed.forEach_testRootnFloatIntFloat(inV, out);
+ verifyResultsRootnFloatIntFloat(inV, inN, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloatIntFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRootnFloatIntFloat(Allocation inV, Allocation inN, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ int[] arrayInN = new int[INPUTSIZE * 1];
+ inN.copyTo(arrayInN);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inV = arrayInV[i];
+ args.inN = arrayInN[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRootn(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Input inN: %d",
+ args.inN));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRootnFloatIntFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRootnFloat2Int2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2a7a849dcb32d88el, false);
+ Allocation inN = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x2a7a849dcb32d886l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInN(inN);
+ script.forEach_testRootnFloat2Int2Float2(inV, out);
+ verifyResultsRootnFloat2Int2Float2(inV, inN, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloat2Int2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInN(inN);
+ scriptRelaxed.forEach_testRootnFloat2Int2Float2(inV, out);
+ verifyResultsRootnFloat2Int2Float2(inV, inN, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloat2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRootnFloat2Int2Float2(Allocation inV, Allocation inN, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ int[] arrayInN = new int[INPUTSIZE * 2];
+ inN.copyTo(arrayInN);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inV = arrayInV[i * 2 + j];
+ args.inN = arrayInN[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRootn(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Input inN: %d",
+ args.inN));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRootnFloat2Int2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRootnFloat3Int3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x5030c300c0e54547l, false);
+ Allocation inN = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x5030c300c0e5453fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInN(inN);
+ script.forEach_testRootnFloat3Int3Float3(inV, out);
+ verifyResultsRootnFloat3Int3Float3(inV, inN, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloat3Int3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInN(inN);
+ scriptRelaxed.forEach_testRootnFloat3Int3Float3(inV, out);
+ verifyResultsRootnFloat3Int3Float3(inV, inN, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloat3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRootnFloat3Int3Float3(Allocation inV, Allocation inN, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ int[] arrayInN = new int[INPUTSIZE * 4];
+ inN.copyTo(arrayInN);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inV = arrayInV[i * 4 + j];
+ args.inN = arrayInN[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRootn(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Input inN: %d",
+ args.inN));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRootnFloat3Int3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRootnFloat4Int4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x75e70163b697b200l, false);
+ Allocation inN = createRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x75e70163b697b1f8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInN(inN);
+ script.forEach_testRootnFloat4Int4Float4(inV, out);
+ verifyResultsRootnFloat4Int4Float4(inV, inN, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloat4Int4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInN(inN);
+ scriptRelaxed.forEach_testRootnFloat4Int4Float4(inV, out);
+ verifyResultsRootnFloat4Int4Float4(inV, inN, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRootnFloat4Int4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRootnFloat4Int4Float4(Allocation inV, Allocation inN, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ int[] arrayInN = new int[INPUTSIZE * 4];
+ inN.copyTo(arrayInN);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatIntFloat args = new ArgumentsFloatIntFloat();
+ args.inV = arrayInV[i * 4 + j];
+ args.inN = arrayInN[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRootn(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Input inN: %d",
+ args.inN));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRootnFloat4Int4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testRootn() {
+ checkRootnFloatIntFloat();
+ checkRootnFloat2Int2Float2();
+ checkRootnFloat3Int3Float3();
+ checkRootnFloat4Int4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestRound.java b/tests/tests/renderscript/src/android/renderscript/cts/TestRound.java
new file mode 100644
index 0000000..198fbbe
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRound.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestRound extends RSBaseCompute {
+
+ private ScriptC_TestRound script;
+ private ScriptC_TestRoundRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestRound(mRS);
+ scriptRelaxed = new ScriptC_TestRoundRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkRoundFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x377ca8d7e9a82fc7l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testRoundFloatFloat(in, out);
+ verifyResultsRoundFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testRoundFloatFloat(in, out);
+ verifyResultsRoundFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRoundFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRound(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRoundFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRoundFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc35ea17250f98f6bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testRoundFloat2Float2(in, out);
+ verifyResultsRoundFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testRoundFloat2Float2(in, out);
+ verifyResultsRoundFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRoundFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRound(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRoundFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRoundFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc35eac13b0002505l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testRoundFloat3Float3(in, out);
+ verifyResultsRoundFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testRoundFloat3Float3(in, out);
+ verifyResultsRoundFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRoundFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRound(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRoundFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRoundFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc35eb6b50f06ba9fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testRoundFloat4Float4(in, out);
+ verifyResultsRoundFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testRoundFloat4Float4(in, out);
+ verifyResultsRoundFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRoundFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRound(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRoundFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testRound() {
+ checkRoundFloatFloat();
+ checkRoundFloat2Float2();
+ checkRoundFloat3Float3();
+ checkRoundFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestRsqrt.java b/tests/tests/renderscript/src/android/renderscript/cts/TestRsqrt.java
new file mode 100644
index 0000000..1a173d6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRsqrt.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestRsqrt extends RSBaseCompute {
+
+ private ScriptC_TestRsqrt script;
+ private ScriptC_TestRsqrtRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestRsqrt(mRS);
+ scriptRelaxed = new ScriptC_TestRsqrtRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkRsqrtFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x736e0d9786ef9c2bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testRsqrtFloatFloat(in, out);
+ verifyResultsRsqrtFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testRsqrtFloatFloat(in, out);
+ verifyResultsRsqrtFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRsqrtFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRsqrtFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRsqrtFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xb5df4d6949d76dafl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testRsqrtFloat2Float2(in, out);
+ verifyResultsRsqrtFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testRsqrtFloat2Float2(in, out);
+ verifyResultsRsqrtFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRsqrtFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRsqrtFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRsqrtFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xb5df580aa8de0349l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testRsqrtFloat3Float3(in, out);
+ verifyResultsRsqrtFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testRsqrtFloat3Float3(in, out);
+ verifyResultsRsqrtFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRsqrtFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRsqrtFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkRsqrtFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xb5df62ac07e498e3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testRsqrtFloat4Float4(in, out);
+ verifyResultsRsqrtFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testRsqrtFloat4Float4(in, out);
+ verifyResultsRsqrtFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRsqrtFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsRsqrtFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeRsqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkRsqrtFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testRsqrt() {
+ checkRsqrtFloatFloat();
+ checkRsqrtFloat2Float2();
+ checkRsqrtFloat3Float3();
+ checkRsqrtFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestSign.java b/tests/tests/renderscript/src/android/renderscript/cts/TestSign.java
new file mode 100644
index 0000000..3234cf6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSign.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestSign extends RSBaseCompute {
+
+ private ScriptC_TestSign script;
+ private ScriptC_TestSignRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestSign(mRS);
+ scriptRelaxed = new ScriptC_TestSignRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float inV;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkSignFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xadc8bc2f364ea474l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testSignFloatFloat(inV, out);
+ verifyResultsSignFloatFloat(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testSignFloatFloat(inV, out);
+ verifyResultsSignFloatFloat(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSignFloatFloat(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSignFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSignFloat2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2eb1e646027c0ab8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testSignFloat2Float2(inV, out);
+ verifyResultsSignFloat2Float2(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testSignFloat2Float2(inV, out);
+ verifyResultsSignFloat2Float2(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSignFloat2Float2(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSignFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSignFloat3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2eb3af60f8972b96l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testSignFloat3Float3(inV, out);
+ verifyResultsSignFloat3Float3(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testSignFloat3Float3(inV, out);
+ verifyResultsSignFloat3Float3(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSignFloat3Float3(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSignFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSignFloat4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x2eb5787beeb24c74l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testSignFloat4Float4(inV, out);
+ verifyResultsSignFloat4Float4(inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testSignFloat4Float4(inV, out);
+ verifyResultsSignFloat4Float4(inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSignFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSignFloat4Float4(Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSign(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSignFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testSign() {
+ checkSignFloatFloat();
+ checkSignFloat2Float2();
+ checkSignFloat3Float3();
+ checkSignFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestSin.java b/tests/tests/renderscript/src/android/renderscript/cts/TestSin.java
new file mode 100644
index 0000000..d324600
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSin.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestSin extends RSBaseCompute {
+
+ private ScriptC_TestSin script;
+ private ScriptC_TestSinRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestSin(mRS);
+ scriptRelaxed = new ScriptC_TestSinRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkSinFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xd3e99dcfa01359f9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testSinFloatFloat(in, out);
+ verifyResultsSinFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testSinFloatFloat(in, out);
+ verifyResultsSinFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x9253f296dcfd528dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testSinFloat2Float2(in, out);
+ verifyResultsSinFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testSinFloat2Float2(in, out);
+ verifyResultsSinFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9253fd383c03e827l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testSinFloat3Float3(in, out);
+ verifyResultsSinFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testSinFloat3Float3(in, out);
+ verifyResultsSinFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x925407d99b0a7dc1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testSinFloat4Float4(in, out);
+ verifyResultsSinFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testSinFloat4Float4(in, out);
+ verifyResultsSinFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSin(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testSin() {
+ checkSinFloatFloat();
+ checkSinFloat2Float2();
+ checkSinFloat3Float3();
+ checkSinFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestSincos.java b/tests/tests/renderscript/src/android/renderscript/cts/TestSincos.java
new file mode 100644
index 0000000..d43b89b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSincos.java
@@ -0,0 +1,372 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestSincos extends RSBaseCompute {
+
+ private ScriptC_TestSincos script;
+ private ScriptC_TestSincosRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestSincos(mRS);
+ scriptRelaxed = new ScriptC_TestSincosRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inV;
+ public float outCosptr;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkSincosFloatFloatFloat() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb8748e13e46c48d4l, false);
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocOutCosptr(outCosptr);
+ script.forEach_testSincosFloatFloatFloat(inV, out);
+ verifyResultsSincosFloatFloatFloat(inV, outCosptr, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutCosptr(outCosptr);
+ scriptRelaxed.forEach_testSincosFloatFloatFloat(inV, out);
+ verifyResultsSincosFloatFloatFloat(inV, outCosptr, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSincosFloatFloatFloat(Allocation inV, Allocation outCosptr, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOutCosptr = new float[INPUTSIZE * 1];
+ outCosptr.copyTo(arrayOutCosptr);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSincos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 1 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %14.8g %8x %15a",
+ args.outCosptr, Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %14.8g %8x %15a",
+ arrayOutCosptr[i * 1 + j], Float.floatToRawIntBits(arrayOutCosptr[i * 1 + j]), arrayOutCosptr[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 1 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSincosFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSincosFloat2Float2Float2() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc85bab4e3e2fc77cl, false);
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocOutCosptr(outCosptr);
+ script.forEach_testSincosFloat2Float2Float2(inV, out);
+ verifyResultsSincosFloat2Float2Float2(inV, outCosptr, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutCosptr(outCosptr);
+ scriptRelaxed.forEach_testSincosFloat2Float2Float2(inV, out);
+ verifyResultsSincosFloat2Float2Float2(inV, outCosptr, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSincosFloat2Float2Float2(Allocation inV, Allocation outCosptr, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ float[] arrayOutCosptr = new float[INPUTSIZE * 2];
+ outCosptr.copyTo(arrayOutCosptr);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSincos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 2 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %14.8g %8x %15a",
+ args.outCosptr, Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %14.8g %8x %15a",
+ arrayOutCosptr[i * 2 + j], Float.floatToRawIntBits(arrayOutCosptr[i * 2 + j]), arrayOutCosptr[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 2 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSincosFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSincosFloat3Float3Float3() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1cc0896e400dc91dl, false);
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocOutCosptr(outCosptr);
+ script.forEach_testSincosFloat3Float3Float3(inV, out);
+ verifyResultsSincosFloat3Float3Float3(inV, outCosptr, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutCosptr(outCosptr);
+ scriptRelaxed.forEach_testSincosFloat3Float3Float3(inV, out);
+ verifyResultsSincosFloat3Float3Float3(inV, outCosptr, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSincosFloat3Float3Float3(Allocation inV, Allocation outCosptr, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOutCosptr = new float[INPUTSIZE * 4];
+ outCosptr.copyTo(arrayOutCosptr);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSincos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 4 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %14.8g %8x %15a",
+ args.outCosptr, Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %14.8g %8x %15a",
+ arrayOutCosptr[i * 4 + j], Float.floatToRawIntBits(arrayOutCosptr[i * 4 + j]), arrayOutCosptr[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 4 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSincosFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSincosFloat4Float4Float4() {
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7125678e41ebcabel, false);
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocOutCosptr(outCosptr);
+ script.forEach_testSincosFloat4Float4Float4(inV, out);
+ verifyResultsSincosFloat4Float4Float4(inV, outCosptr, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation outCosptr = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocOutCosptr(outCosptr);
+ scriptRelaxed.forEach_testSincosFloat4Float4Float4(inV, out);
+ verifyResultsSincosFloat4Float4Float4(inV, outCosptr, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSincosFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSincosFloat4Float4Float4(Allocation inV, Allocation outCosptr, Allocation out, boolean relaxed) {
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOutCosptr = new float[INPUTSIZE * 4];
+ outCosptr.copyTo(arrayOutCosptr);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSincos(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 4 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %14.8g %8x %15a",
+ args.outCosptr, Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %14.8g %8x %15a",
+ arrayOutCosptr[i * 4 + j], Float.floatToRawIntBits(arrayOutCosptr[i * 4 + j]), arrayOutCosptr[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.outCosptr - arrayOutCosptr[i * 4 + j]) / Math.ulp(args.outCosptr) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSincosFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testSincos() {
+ checkSincosFloatFloatFloat();
+ checkSincosFloat2Float2Float2();
+ checkSincosFloat3Float3Float3();
+ checkSincosFloat4Float4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestSinh.java b/tests/tests/renderscript/src/android/renderscript/cts/TestSinh.java
new file mode 100644
index 0000000..cd91d2f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSinh.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestSinh extends RSBaseCompute {
+
+ private ScriptC_TestSinh script;
+ private ScriptC_TestSinhRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestSinh(mRS);
+ scriptRelaxed = new ScriptC_TestSinhRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkSinhFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x541c2eef0a5d2ff1l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testSinhFloatFloat(in, out);
+ verifyResultsSinhFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testSinhFloatFloat(in, out);
+ verifyResultsSinhFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinhFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinhFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinhFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x7f8e1e7d8c47bec5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testSinhFloat2Float2(in, out);
+ verifyResultsSinhFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testSinhFloat2Float2(in, out);
+ verifyResultsSinhFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinhFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinhFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinhFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x7f8e291eeb4e545fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testSinhFloat3Float3(in, out);
+ verifyResultsSinhFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testSinhFloat3Float3(in, out);
+ verifyResultsSinhFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinhFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinhFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinhFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7f8e33c04a54e9f9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testSinhFloat4Float4(in, out);
+ verifyResultsSinhFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testSinhFloat4Float4(in, out);
+ verifyResultsSinhFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinhFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinhFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinhFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testSinh() {
+ checkSinhFloatFloat();
+ checkSinhFloat2Float2();
+ checkSinhFloat3Float3();
+ checkSinhFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestSinpi.java b/tests/tests/renderscript/src/android/renderscript/cts/TestSinpi.java
new file mode 100644
index 0000000..d9be0ae
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSinpi.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestSinpi extends RSBaseCompute {
+
+ private ScriptC_TestSinpi script;
+ private ScriptC_TestSinpiRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestSinpi(mRS);
+ scriptRelaxed = new ScriptC_TestSinpiRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkSinpiFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x34cb59f49416da82l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testSinpiFloatFloat(in, out);
+ verifyResultsSinpiFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testSinpiFloatFloat(in, out);
+ verifyResultsSinpiFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinpiFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinpiFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinpiFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x50bbd97d4a48b00el, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testSinpiFloat2Float2(in, out);
+ verifyResultsSinpiFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testSinpiFloat2Float2(in, out);
+ verifyResultsSinpiFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinpiFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinpiFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinpiFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x50bbe41ea94f45a8l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testSinpiFloat3Float3(in, out);
+ verifyResultsSinpiFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testSinpiFloat3Float3(in, out);
+ verifyResultsSinpiFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinpiFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinpiFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSinpiFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x50bbeec00855db42l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testSinpiFloat4Float4(in, out);
+ verifyResultsSinpiFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testSinpiFloat4Float4(in, out);
+ verifyResultsSinpiFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSinpiFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSinpiFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSinpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSinpiFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testSinpi() {
+ checkSinpiFloatFloat();
+ checkSinpiFloat2Float2();
+ checkSinpiFloat3Float3();
+ checkSinpiFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestSqrt.java b/tests/tests/renderscript/src/android/renderscript/cts/TestSqrt.java
new file mode 100644
index 0000000..1425d65
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSqrt.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestSqrt extends RSBaseCompute {
+
+ private ScriptC_TestSqrt script;
+ private ScriptC_TestSqrtRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestSqrt(mRS);
+ scriptRelaxed = new ScriptC_TestSqrtRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkSqrtFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x940922bedb2c9271l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testSqrtFloatFloat(in, out);
+ verifyResultsSqrtFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testSqrtFloatFloat(in, out);
+ verifyResultsSqrtFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSqrtFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSqrtFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSqrtFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x35fb1678b6262d45l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testSqrtFloat2Float2(in, out);
+ verifyResultsSqrtFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testSqrtFloat2Float2(in, out);
+ verifyResultsSqrtFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSqrtFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSqrtFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSqrtFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x35fb211a152cc2dfl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testSqrtFloat3Float3(in, out);
+ verifyResultsSqrtFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testSqrtFloat3Float3(in, out);
+ verifyResultsSqrtFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSqrtFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSqrtFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkSqrtFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x35fb2bbb74335879l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testSqrtFloat4Float4(in, out);
+ verifyResultsSqrtFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testSqrtFloat4Float4(in, out);
+ verifyResultsSqrtFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testSqrtFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsSqrtFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeSqrt(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkSqrtFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testSqrt() {
+ checkSqrtFloatFloat();
+ checkSqrtFloat2Float2();
+ checkSqrtFloat3Float3();
+ checkSqrtFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestStep.java b/tests/tests/renderscript/src/android/renderscript/cts/TestStep.java
new file mode 100644
index 0000000..552af0f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestStep.java
@@ -0,0 +1,538 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestStep extends RSBaseCompute {
+
+ private ScriptC_TestStep script;
+ private ScriptC_TestStepRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestStep(mRS);
+ scriptRelaxed = new ScriptC_TestStepRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloatFloat {
+ public float inEdge;
+ public float inV;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkStepFloatFloatFloat() {
+ Allocation inEdge = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x598900c49184fbfel, false);
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x9aefccaa832f44e9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInV(inV);
+ script.forEach_testStepFloatFloatFloat(inEdge, out);
+ verifyResultsStepFloatFloatFloat(inEdge, inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloatFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV(inV);
+ scriptRelaxed.forEach_testStepFloatFloatFloat(inEdge, out);
+ verifyResultsStepFloatFloatFloat(inEdge, inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloatFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsStepFloatFloatFloat(Allocation inEdge, Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInEdge = new float[INPUTSIZE * 1];
+ inEdge.copyTo(arrayInEdge);
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inEdge = arrayInEdge[i];
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeStep(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inEdge: %14.8g %8x %15a",
+ args.inEdge, Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkStepFloatFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkStepFloat2Float2Float2() {
+ Allocation inEdge = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6efefa297df69504l, false);
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x12eb000b8567f58bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInV(inV);
+ script.forEach_testStepFloat2Float2Float2(inEdge, out);
+ verifyResultsStepFloat2Float2Float2(inEdge, inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat2Float2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV(inV);
+ scriptRelaxed.forEach_testStepFloat2Float2Float2(inEdge, out);
+ verifyResultsStepFloat2Float2Float2(inEdge, inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat2Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsStepFloat2Float2Float2(Allocation inEdge, Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInEdge = new float[INPUTSIZE * 2];
+ inEdge.copyTo(arrayInEdge);
+ float[] arrayInV = new float[INPUTSIZE * 2];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inEdge = arrayInEdge[i * 2 + j];
+ args.inV = arrayInV[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeStep(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inEdge: %14.8g %8x %15a",
+ args.inEdge, Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkStepFloat2Float2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkStepFloat3Float3Float3() {
+ Allocation inEdge = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9e548cd666a7a77l, false);
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x674fde2b8745f72cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInV(inV);
+ script.forEach_testStepFloat3Float3Float3(inEdge, out);
+ verifyResultsStepFloat3Float3Float3(inEdge, inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat3Float3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV(inV);
+ scriptRelaxed.forEach_testStepFloat3Float3Float3(inEdge, out);
+ verifyResultsStepFloat3Float3Float3(inEdge, inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat3Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsStepFloat3Float3Float3(Allocation inEdge, Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInEdge = new float[INPUTSIZE * 4];
+ inEdge.copyTo(arrayInEdge);
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inEdge = arrayInEdge[i * 4 + j];
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeStep(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inEdge: %14.8g %8x %15a",
+ args.inEdge, Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkStepFloat3Float3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkStepFloat4Float4Float4() {
+ Allocation inEdge = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xa4cb97714ede5feal, false);
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xbbb4bc4b8923f8cdl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInV(inV);
+ script.forEach_testStepFloat4Float4Float4(inEdge, out);
+ verifyResultsStepFloat4Float4Float4(inEdge, inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat4Float4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV(inV);
+ scriptRelaxed.forEach_testStepFloat4Float4Float4(inEdge, out);
+ verifyResultsStepFloat4Float4Float4(inEdge, inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat4Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsStepFloat4Float4Float4(Allocation inEdge, Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInEdge = new float[INPUTSIZE * 4];
+ inEdge.copyTo(arrayInEdge);
+ float[] arrayInV = new float[INPUTSIZE * 4];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inEdge = arrayInEdge[i * 4 + j];
+ args.inV = arrayInV[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeStep(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inEdge: %14.8g %8x %15a",
+ args.inEdge, Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkStepFloat4Float4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkStepFloat2FloatFloat2() {
+ Allocation inEdge = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xb0ac06c45b3d8b26l, false);
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfa7d66f2b6d48a21l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInV(inV);
+ script.forEach_testStepFloat2FloatFloat2(inEdge, out);
+ verifyResultsStepFloat2FloatFloat2(inEdge, inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat2FloatFloat2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV(inV);
+ scriptRelaxed.forEach_testStepFloat2FloatFloat2(inEdge, out);
+ verifyResultsStepFloat2FloatFloat2(inEdge, inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat2FloatFloat2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsStepFloat2FloatFloat2(Allocation inEdge, Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInEdge = new float[INPUTSIZE * 2];
+ inEdge.copyTo(arrayInEdge);
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inEdge = arrayInEdge[i * 2 + j];
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeStep(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inEdge: %14.8g %8x %15a",
+ args.inEdge, Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkStepFloat2FloatFloat2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkStepFloat3FloatFloat3() {
+ Allocation inEdge = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x304ed837c68f43fal, false);
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4fcd1a0aa53f7e7dl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInV(inV);
+ script.forEach_testStepFloat3FloatFloat3(inEdge, out);
+ verifyResultsStepFloat3FloatFloat3(inEdge, inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat3FloatFloat3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV(inV);
+ scriptRelaxed.forEach_testStepFloat3FloatFloat3(inEdge, out);
+ verifyResultsStepFloat3FloatFloat3(inEdge, inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat3FloatFloat3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsStepFloat3FloatFloat3(Allocation inEdge, Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInEdge = new float[INPUTSIZE * 4];
+ inEdge.copyTo(arrayInEdge);
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inEdge = arrayInEdge[i * 4 + j];
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeStep(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inEdge: %14.8g %8x %15a",
+ args.inEdge, Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkStepFloat3FloatFloat3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkStepFloat4FloatFloat4() {
+ Allocation inEdge = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xaff1a9ab31e0fccel, false);
+ Allocation inV = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa51ccd2293aa72d9l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInV(inV);
+ script.forEach_testStepFloat4FloatFloat4(inEdge, out);
+ verifyResultsStepFloat4FloatFloat4(inEdge, inV, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat4FloatFloat4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.set_gAllocInV(inV);
+ scriptRelaxed.forEach_testStepFloat4FloatFloat4(inEdge, out);
+ verifyResultsStepFloat4FloatFloat4(inEdge, inV, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testStepFloat4FloatFloat4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsStepFloat4FloatFloat4(Allocation inEdge, Allocation inV, Allocation out, boolean relaxed) {
+ float[] arrayInEdge = new float[INPUTSIZE * 4];
+ inEdge.copyTo(arrayInEdge);
+ float[] arrayInV = new float[INPUTSIZE * 1];
+ inV.copyTo(arrayInV);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloatFloat args = new ArgumentsFloatFloatFloat();
+ args.inEdge = arrayInEdge[i * 4 + j];
+ args.inV = arrayInV[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeStep(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input inEdge: %14.8g %8x %15a",
+ args.inEdge, Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %14.8g %8x %15a",
+ args.inV, Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkStepFloat4FloatFloat4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testStep() {
+ checkStepFloatFloatFloat();
+ checkStepFloat2Float2Float2();
+ checkStepFloat3Float3Float3();
+ checkStepFloat4Float4Float4();
+ checkStepFloat2FloatFloat2();
+ checkStepFloat3FloatFloat3();
+ checkStepFloat4FloatFloat4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestTan.java b/tests/tests/renderscript/src/android/renderscript/cts/TestTan.java
new file mode 100644
index 0000000..18242e3
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTan.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestTan extends RSBaseCompute {
+
+ private ScriptC_TestTan script;
+ private ScriptC_TestTanRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestTan(mRS);
+ scriptRelaxed = new ScriptC_TestTanRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkTanFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfb95a6a791c2b8eal, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testTanFloatFloat(in, out);
+ verifyResultsTanFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testTanFloatFloat(in, out);
+ verifyResultsTanFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x1bdfd24778a20d36l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testTanFloat2Float2(in, out);
+ verifyResultsTanFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testTanFloat2Float2(in, out);
+ verifyResultsTanFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1bdfdce8d7a8a2d0l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testTanFloat3Float3(in, out);
+ verifyResultsTanFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testTanFloat3Float3(in, out);
+ verifyResultsTanFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x1bdfe78a36af386al, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testTanFloat4Float4(in, out);
+ verifyResultsTanFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testTanFloat4Float4(in, out);
+ verifyResultsTanFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTan(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testTan() {
+ checkTanFloatFloat();
+ checkTanFloat2Float2();
+ checkTanFloat3Float3();
+ checkTanFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestTanh.java b/tests/tests/renderscript/src/android/renderscript/cts/TestTanh.java
new file mode 100644
index 0000000..3810cf0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTanh.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestTanh extends RSBaseCompute {
+
+ private ScriptC_TestTanh script;
+ private ScriptC_TestTanhRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestTanh(mRS);
+ scriptRelaxed = new ScriptC_TestTanhRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkTanhFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfe01ab34a2d2226cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testTanhFloatFloat(in, out);
+ verifyResultsTanhFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testTanhFloatFloat(in, out);
+ verifyResultsTanhFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanhFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanhFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanhFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x9a0cb127b0f31928l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testTanhFloat2Float2(in, out);
+ verifyResultsTanhFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testTanhFloat2Float2(in, out);
+ verifyResultsTanhFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanhFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanhFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanhFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9a0cbbc90ff9aec2l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testTanhFloat3Float3(in, out);
+ verifyResultsTanhFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testTanhFloat3Float3(in, out);
+ verifyResultsTanhFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanhFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanhFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanhFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x9a0cc66a6f00445cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testTanhFloat4Float4(in, out);
+ verifyResultsTanhFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testTanhFloat4Float4(in, out);
+ verifyResultsTanhFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanhFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanhFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanh(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanhFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testTanh() {
+ checkTanhFloatFloat();
+ checkTanhFloat2Float2();
+ checkTanhFloat3Float3();
+ checkTanhFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestTanpi.java b/tests/tests/renderscript/src/android/renderscript/cts/TestTanpi.java
new file mode 100644
index 0000000..d52d99f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTanpi.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestTanpi extends RSBaseCompute {
+
+ private ScriptC_TestTanpi script;
+ private ScriptC_TestTanpiRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestTanpi(mRS);
+ scriptRelaxed = new ScriptC_TestTanpiRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkTanpiFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xbe5739a52fbb952bl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testTanpiFloatFloat(in, out);
+ verifyResultsTanpiFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testTanpiFloatFloat(in, out);
+ verifyResultsTanpiFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanpiFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanpiFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanpiFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc3fe7c117310deafl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testTanpiFloat2Float2(in, out);
+ verifyResultsTanpiFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testTanpiFloat2Float2(in, out);
+ verifyResultsTanpiFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanpiFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanpiFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanpiFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc3fe86b2d2177449l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testTanpiFloat3Float3(in, out);
+ verifyResultsTanpiFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testTanpiFloat3Float3(in, out);
+ verifyResultsTanpiFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanpiFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanpiFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTanpiFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc3fe9154311e09e3l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testTanpiFloat4Float4(in, out);
+ verifyResultsTanpiFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testTanpiFloat4Float4(in, out);
+ verifyResultsTanpiFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTanpiFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTanpiFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTanpi(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTanpiFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testTanpi() {
+ checkTanpiFloatFloat();
+ checkTanpiFloat2Float2();
+ checkTanpiFloat3Float3();
+ checkTanpiFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestTgamma.java b/tests/tests/renderscript/src/android/renderscript/cts/TestTgamma.java
new file mode 100644
index 0000000..47f99b4
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTgamma.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestTgamma extends RSBaseCompute {
+
+ private ScriptC_TestTgamma script;
+ private ScriptC_TestTgammaRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestTgamma(mRS);
+ scriptRelaxed = new ScriptC_TestTgammaRelaxed(mRS);
+ }
+
+ private void checkTgammaFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe45f5203be15b490l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testTgammaFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testTgammaFloatFloat(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkTgammaFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x74767f039bfd9f2cl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testTgammaFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testTgammaFloat2Float2(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkTgammaFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x747689a4fb0434c6l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testTgammaFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testTgammaFloat3Float3(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkTgammaFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x747694465a0aca60l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testTgammaFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testTgammaFloat4Float4(in, out);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTgammaFloat4Float4: " + e.toString());
+ }
+ }
+
+ public void testTgamma() {
+ checkTgammaFloatFloat();
+ checkTgammaFloat2Float2();
+ checkTgammaFloat3Float3();
+ checkTgammaFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TestTrunc.java b/tests/tests/renderscript/src/android/renderscript/cts/TestTrunc.java
new file mode 100644
index 0000000..49ee364
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTrunc.java
@@ -0,0 +1,291 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/gen_runtime.
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class TestTrunc extends RSBaseCompute {
+
+ private ScriptC_TestTrunc script;
+ private ScriptC_TestTruncRelaxed scriptRelaxed;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ script = new ScriptC_TestTrunc(mRS);
+ scriptRelaxed = new ScriptC_TestTruncRelaxed(mRS);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkTruncFloatFloat() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x6361d71a4dcff881l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testTruncFloatFloat(in, out);
+ verifyResultsTruncFloatFloat(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloatFloat: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ scriptRelaxed.forEach_testTruncFloatFloat(in, out);
+ verifyResultsTruncFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTruncFloatFloat(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 1];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 1 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTrunc(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 1 + j], Float.floatToRawIntBits(arrayOut[i * 1 + j]), arrayOut[i * 1 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 1 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTruncFloatFloat" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTruncFloat2Float2() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xcda9bef7b45256d5l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testTruncFloat2Float2(in, out);
+ verifyResultsTruncFloat2Float2(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloat2Float2: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ scriptRelaxed.forEach_testTruncFloat2Float2(in, out);
+ verifyResultsTruncFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTruncFloat2Float2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 2];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 2 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTrunc(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 2 + j], Float.floatToRawIntBits(arrayOut[i * 2 + j]), arrayOut[i * 2 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 2 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTruncFloat2Float2" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTruncFloat3Float3() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xcda9c9991358ec6fl, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testTruncFloat3Float3(in, out);
+ verifyResultsTruncFloat3Float3(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloat3Float3: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ scriptRelaxed.forEach_testTruncFloat3Float3(in, out);
+ verifyResultsTruncFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTruncFloat3Float3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 3 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTrunc(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTruncFloat3Float3" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkTruncFloat4Float4() {
+ Allocation in = createRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xcda9d43a725f8209l, false);
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testTruncFloat4Float4(in, out);
+ verifyResultsTruncFloat4Float4(in, out, false);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloat4Float4: " + e.toString());
+ }
+ try {
+ Allocation out = Allocation.createSized(mRS, getElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ scriptRelaxed.forEach_testTruncFloat4Float4(in, out);
+ verifyResultsTruncFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testTruncFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsTruncFloat4Float4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ float[] arrayOut = new float[INPUTSIZE * 4];
+ out.copyTo(arrayOut);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ // Extract the inputs.
+ ArgumentsFloatFloat args = new ArgumentsFloatFloat();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeTrunc(args);
+ int ulf = relaxed ? args.ulfRelaxed : args.ulf;
+ // Figure out what the outputs should have been.
+ boolean valid = true;
+ int neededUlf = 0;
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ valid = false;
+ }
+ if (!valid) {
+ StringBuilder message = new StringBuilder();
+ message.append(String.format("Input in: %14.8g %8x %15a",
+ args.in, Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %14.8g %8x %15a",
+ args.out, Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %14.8g %8x %15a",
+ arrayOut[i * 4 + j], Float.floatToRawIntBits(arrayOut[i * 4 + j]), arrayOut[i * 4 + j]));
+ neededUlf = (int) (Math.abs(args.out - arrayOut[i * 4 + j]) / Math.ulp(args.out) + 0.5);
+ if (neededUlf > ulf) {
+ message.append(String.format(" FAILED, ulf needed %d, specified %d", neededUlf, ulf));
+ }
+ message.append("\n");
+ assertTrue("Incorrect output for checkTruncFloat4Float4" +
+ (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ public void testTrunc() {
+ checkTruncFloatFloat();
+ checkTruncFloat2Float2();
+ checkTruncFloat3Float3();
+ checkTruncFloat4Float4();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java
deleted file mode 100644
index f2a3e11..0000000
--- a/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.renderscript.cts;
-
-import com.android.cts.stub.R;
-import android.renderscript.Allocation;
-import android.renderscript.RSRuntimeException;
-
-public class TruncTest extends RSBaseCompute {
- private ScriptC_trunc_f32 script_f32;
- private ScriptC_trunc_f32_relaxed script_f32_relaxed;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- script_f32 = new ScriptC_trunc_f32(mRS);
- script_f32_relaxed = new ScriptC_trunc_f32_relaxed(mRS);
- }
-
- @Override
- public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
- switch (testId) {
- case TEST_F32:
- script_f32.forEach_trunc_f32_1(mIn, mOut);
- break;
- case TEST_F32_2:
- script_f32.forEach_trunc_f32_2(mIn, mOut);
- break;
- case TEST_F32_3:
- script_f32.forEach_trunc_f32_3(mIn, mOut);
- break;
- case TEST_F32_4:
- script_f32.forEach_trunc_f32_4(mIn, mOut);
- break;
-
- case TEST_RELAXED_F32:
- script_f32_relaxed.forEach_trunc_f32_1(mIn, mOut);
- break;
- case TEST_RELAXED_F32_2:
- script_f32_relaxed.forEach_trunc_f32_2(mIn, mOut);
- break;
- case TEST_RELAXED_F32_3:
- script_f32_relaxed.forEach_trunc_f32_3(mIn, mOut);
- break;
- case TEST_RELAXED_F32_4:
- script_f32_relaxed.forEach_trunc_f32_4(mIn, mOut);
- break;
- }
- }
-
- @Override
- protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
- float[] ref = new float[input_size * stride];
- for (int i = 0; i < input_size; i++) {
- for (int j = 0; j < stride - skip; j++) {
- int idxSrc = i * stride + j;
- int idxDst = i * (stride - skip) + j;
- int sign = ((Float.floatToIntBits(inArray[idxSrc]) >> 31) & 0x01);
- float trunc = (int)inArray[idxSrc];
- if (sign == 1 && trunc == +0.0f) {
- trunc = -0.0f;
- }
- ref[idxDst] = trunc;
- }
- }
- return ref;
- }
-
- /**
- * trunc test for float
- */
- public void testTruncF32() {
- doF32(0x12345678, 0);
- }
-
- public void testTruncF32_relaxed() {
- doF32_relaxed(0x12345678, 0);
- }
-
- /**
- * trunc test for float2
- */
- public void testTruncF32_2() {
- doF32_2(0x12345a78, 0);
- }
-
- public void testTruncF32_2_relaxed() {
- doF32_2_relaxed(0x12345a78, 0);
- }
-
- /**
- * trunc test for float3
- */
- public void testTruncF32_3() {
- doF32_3(0x12f45678, 0);
- }
-
- public void testTruncF32_3_relaxed() {
- doF32_3_relaxed(0x12f45678, 0);
- }
-
- /**
- * trunc test for float4
- */
- public void testTruncF32_4() {
- doF32_4(0x123c5678, 0);
- }
-
- public void testTruncF32_4_relaxed() {
- doF32_4_relaxed(0x123c5678, 0);
- }
-
-}
diff --git a/tests/tests/security/src/android/security/cts/BannedFilesTest.java b/tests/tests/security/src/android/security/cts/BannedFilesTest.java
index 44bea35..ce0b48c 100644
--- a/tests/tests/security/src/android/security/cts/BannedFilesTest.java
+++ b/tests/tests/security/src/android/security/cts/BannedFilesTest.java
@@ -44,8 +44,18 @@
assertNotSetugid("/system/bin/sync_agent");
}
- public void testNoInitRunIt() {
+ /**
+ * Detect devices allowing shell commands to be executed as root
+ * through sockets.
+ *
+ * References:
+ *
+ * https://plus.google.com/+JustinCaseAndroid/posts/e1r6c9Z9jgg
+ * https://plus.google.com/+JustinCaseAndroid/posts/5ofgPNrSu3J
+ */
+ public void testNoRootCmdSocket() {
assertFalse("/dev/socket/init_runit", new File("/dev/socket/init_runit").exists());
+ assertFalse("/dev/socket/fotabinder", new File("/dev/socket/fotabinder").exists());
}
public void testNoSu() {
diff --git a/tests/tests/security/src/android/security/cts/SELinuxTest.java b/tests/tests/security/src/android/security/cts/SELinuxTest.java
index 838eb8a..000664a 100644
--- a/tests/tests/security/src/android/security/cts/SELinuxTest.java
+++ b/tests/tests/security/src/android/security/cts/SELinuxTest.java
@@ -17,6 +17,7 @@
package android.security.cts;
import junit.framework.TestCase;
+import java.io.File;
/**
* Verify that the SELinux configuration is sane.
@@ -51,5 +52,11 @@
assertTrue(checkSELinuxAccess("u:r:init:s0", "u:object_r:runas_exec:s0", "file", "getattr", "/system/bin/run-as"));
}
+ public void testNoBooleans() throws Exception {
+ // Intentionally not using JNI bindings to keep things simple
+ File[] files = new File("/sys/fs/selinux/booleans/").listFiles();
+ assertEquals(0, files.length);
+ }
+
private static native boolean checkSELinuxAccess(String scon, String tcon, String tclass, String perm, String extra);
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
index bf328b7..ac1acfb 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
@@ -65,6 +65,7 @@
"45006", // LGT
"311660", // MetroPCS
"310120", // Sprint
+ "44050", // KDDI
"44053", // KDDI
"44054", // KDDI
"44070", // KDDI
diff --git a/tests/tests/textureview/src/android/textureview/cts/TextureViewTestActivity.java b/tests/tests/textureview/src/android/textureview/cts/TextureViewTestActivity.java
index 92d9f89..6567387 100644
--- a/tests/tests/textureview/src/android/textureview/cts/TextureViewTestActivity.java
+++ b/tests/tests/textureview/src/android/textureview/cts/TextureViewTestActivity.java
@@ -20,7 +20,9 @@
import android.app.Activity;
import android.graphics.SurfaceTexture;
import android.os.Bundle;
+import android.view.Display;
import android.view.TextureView;
+import android.view.WindowManager;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
@@ -52,11 +54,32 @@
animSet.start();
}
+ private static int addMargin(int a) {
+ /* Worst case is 2 * actual refresh rate, in case when the delay pushes the frame off
+ * VSYNC every frame.
+ */
+ return 2 * a;
+ }
+
+ private static int roundUpFrame(int a, int b) {
+ /* Need to give time based on (frame duration limited by refresh rate + delay given
+ * from the test)
+ */
+ return (a + b + 1);
+ }
+
+
public Boolean waitForCompletion() {
Boolean success = false;
- int timeout = mFrames * mDelayMs * 4;
+ int oneframeMs;
+
+ WindowManager wm = (WindowManager)getSystemService(WINDOW_SERVICE);
+ Display display = wm.getDefaultDisplay();
+ float rate = display.getRefreshRate();
+ oneframeMs = roundUpFrame(mDelayMs, (int)(1000.0f / rate));
try {
- success = mSemaphore.tryAcquire(timeout, TimeUnit.MILLISECONDS);
+ success = mSemaphore.tryAcquire(addMargin(oneframeMs * mFrames),
+ TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
Assert.fail();
}
diff --git a/tests/tests/util/src/android/util/cts/JsonReaderTest.java b/tests/tests/util/src/android/util/cts/JsonReaderTest.java
new file mode 100644
index 0000000..5a9b336
--- /dev/null
+++ b/tests/tests/util/src/android/util/cts/JsonReaderTest.java
@@ -0,0 +1,955 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.util.cts;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Arrays;
+import junit.framework.TestCase;
+
+import android.util.MalformedJsonException;
+import android.util.JsonReader;
+import android.util.JsonToken;
+
+public final class JsonReaderTest extends TestCase {
+
+ private static final int READER_BUFFER_SIZE = 1024;
+
+ public void testReadArray() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[true, true]"));
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ assertEquals(true, reader.nextBoolean());
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testReadEmptyArray() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[]"));
+ reader.beginArray();
+ assertFalse(reader.hasNext());
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testReadObject() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader(
+ "{\"a\": \"android\", \"b\": \"banana\"}"));
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ assertEquals("android", reader.nextString());
+ assertEquals("b", reader.nextName());
+ assertEquals("banana", reader.nextString());
+ reader.endObject();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testReadEmptyObject() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{}"));
+ reader.beginObject();
+ assertFalse(reader.hasNext());
+ reader.endObject();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testSkipObject() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader(
+ "{\"a\": { \"c\": [], \"d\": [true, true, {}] }, \"b\": \"banana\"}"));
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ reader.skipValue();
+ assertEquals("b", reader.nextName());
+ reader.skipValue();
+ reader.endObject();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testSkipBeforeEndOfObject() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{}"));
+ reader.beginObject();
+ try {
+ reader.skipValue();
+ fail("Should not be possible to skip without elements.");
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testSkipBeforeEndOfArray() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[]"));
+ reader.beginArray();
+ try {
+ reader.skipValue();
+ fail("Should not be possible to skip without elements.");
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testSkipAfterEndOfDocument() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{}"));
+ reader.beginObject();
+ reader.endObject();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ try {
+ reader.skipValue();
+ fail("Should not be possible to skip without elements.");
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testHelloWorld() throws IOException {
+ String json = "{\n" +
+ " \"hello\": true,\n" +
+ " \"foo\": [\"world\"]\n" +
+ "}";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginObject();
+ assertEquals("hello", reader.nextName());
+ assertEquals(true, reader.nextBoolean());
+ assertEquals("foo", reader.nextName());
+ reader.beginArray();
+ assertEquals("world", reader.nextString());
+ reader.endArray();
+ reader.endObject();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testNulls() {
+ try {
+ new JsonReader(null);
+ fail();
+ } catch (NullPointerException expected) {
+ }
+ }
+
+ public void testEmptyString() throws IOException {
+ try {
+ new JsonReader(new StringReader("")).beginArray();
+ } catch (IOException expected) {
+ }
+ try {
+ new JsonReader(new StringReader("")).beginObject();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testNoTopLevelObject() throws IOException {
+ try {
+ new JsonReader(new StringReader("true")).nextBoolean();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testCharacterUnescaping() throws IOException {
+ String json = "[\"a\","
+ + "\"a\\\"\","
+ + "\"\\\"\","
+ + "\":\","
+ + "\",\","
+ + "\"\\b\","
+ + "\"\\f\","
+ + "\"\\n\","
+ + "\"\\r\","
+ + "\"\\t\","
+ + "\" \","
+ + "\"\\\\\","
+ + "\"{\","
+ + "\"}\","
+ + "\"[\","
+ + "\"]\","
+ + "\"\\u0000\","
+ + "\"\\u0019\","
+ + "\"\\u20AC\""
+ + "]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ assertEquals("a", reader.nextString());
+ assertEquals("a\"", reader.nextString());
+ assertEquals("\"", reader.nextString());
+ assertEquals(":", reader.nextString());
+ assertEquals(",", reader.nextString());
+ assertEquals("\b", reader.nextString());
+ assertEquals("\f", reader.nextString());
+ assertEquals("\n", reader.nextString());
+ assertEquals("\r", reader.nextString());
+ assertEquals("\t", reader.nextString());
+ assertEquals(" ", reader.nextString());
+ assertEquals("\\", reader.nextString());
+ assertEquals("{", reader.nextString());
+ assertEquals("}", reader.nextString());
+ assertEquals("[", reader.nextString());
+ assertEquals("]", reader.nextString());
+ assertEquals("\0", reader.nextString());
+ assertEquals("\u0019", reader.nextString());
+ assertEquals("\u20AC", reader.nextString());
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testIntegersWithFractionalPartSpecified() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[1.0,1.0,1.0]"));
+ reader.beginArray();
+ assertEquals(1.0, reader.nextDouble());
+ assertEquals(1, reader.nextInt());
+ assertEquals(1L, reader.nextLong());
+ }
+
+ public void testDoubles() throws IOException {
+ String json = "[-0.0,"
+ + "1.0,"
+ + "1.7976931348623157E308,"
+ + "4.9E-324,"
+ + "0.0,"
+ + "-0.5,"
+ + "2.2250738585072014E-308,"
+ + "3.141592653589793,"
+ + "2.718281828459045,"
+ + "\"1.0\","
+ + "\"011.0\","
+ + "\"NaN\","
+ + "\"Infinity\","
+ + "\"-Infinity\""
+ + "]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ assertEquals(-0.0, reader.nextDouble());
+ assertEquals(1.0, reader.nextDouble());
+ assertEquals(1.7976931348623157E308, reader.nextDouble());
+ assertEquals(4.9E-324, reader.nextDouble());
+ assertEquals(0.0, reader.nextDouble());
+ assertEquals(-0.5, reader.nextDouble());
+ assertEquals(2.2250738585072014E-308, reader.nextDouble());
+ assertEquals(3.141592653589793, reader.nextDouble());
+ assertEquals(2.718281828459045, reader.nextDouble());
+ assertEquals(1,0, reader.nextDouble());
+ assertEquals(11.0, reader.nextDouble());
+ assertTrue(Double.isNaN(reader.nextDouble()));
+ assertEquals(Double.POSITIVE_INFINITY, reader.nextDouble());
+ assertEquals(Double.NEGATIVE_INFINITY, reader.nextDouble());
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testLenientDoubles() throws IOException {
+ String json = "["
+ + "011.0,"
+ + "NaN,"
+ + "NAN,"
+ + "Infinity,"
+ + "INFINITY,"
+ + "-Infinity"
+ + "]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(11.0, reader.nextDouble());
+ assertTrue(Double.isNaN(reader.nextDouble()));
+ try {
+ reader.nextDouble();
+ fail();
+ } catch (NumberFormatException expected) {
+ }
+ assertEquals("NAN", reader.nextString());
+ assertEquals(Double.POSITIVE_INFINITY, reader.nextDouble());
+ try {
+ reader.nextDouble();
+ fail();
+ } catch (NumberFormatException expected) {
+ }
+ assertEquals("INFINITY", reader.nextString());
+ assertEquals(Double.NEGATIVE_INFINITY, reader.nextDouble());
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testBufferBoundary() throws IOException {
+ char[] pad = new char[READER_BUFFER_SIZE - 8];
+ Arrays.fill(pad, '5');
+ String json = "[\"" + new String(pad) + "\",33333]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ assertEquals(JsonToken.STRING, reader.peek());
+ assertEquals(new String(pad), reader.nextString());
+ assertEquals(JsonToken.NUMBER, reader.peek());
+ assertEquals(33333, reader.nextInt());
+ }
+
+ public void testTruncatedBufferBoundary() throws IOException {
+ char[] pad = new char[READER_BUFFER_SIZE - 8];
+ Arrays.fill(pad, '5');
+ String json = "[\"" + new String(pad) + "\",33333";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(JsonToken.STRING, reader.peek());
+ assertEquals(new String(pad), reader.nextString());
+ assertEquals(JsonToken.NUMBER, reader.peek());
+ assertEquals(33333, reader.nextInt());
+ try {
+ reader.endArray();
+ fail();
+ } catch (IOException e) {
+ }
+ }
+
+ public void testLongestSupportedNumericLiterals() throws IOException {
+ testLongNumericLiterals(READER_BUFFER_SIZE - 1, JsonToken.NUMBER);
+ }
+
+ public void testLongerNumericLiterals() throws IOException {
+ testLongNumericLiterals(READER_BUFFER_SIZE, JsonToken.STRING);
+ }
+
+ private void testLongNumericLiterals(int length, JsonToken expectedToken) throws IOException {
+ char[] longNumber = new char[length];
+ Arrays.fill(longNumber, '9');
+ longNumber[0] = '1';
+ longNumber[1] = '.';
+
+ String json = "[" + new String(longNumber) + "]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(expectedToken, reader.peek());
+ assertEquals(2.0d, reader.nextDouble());
+ reader.endArray();
+ }
+
+ public void testLongs() throws IOException {
+ String json = "[0,0,0,"
+ + "1,1,1,"
+ + "-1,-1,-1,"
+ + "-9223372036854775808,"
+ + "9223372036854775807,"
+ + "5.0,"
+ + "1.0e2,"
+ + "\"011\","
+ + "\"5.0\","
+ + "\"1.0e2\""
+ + "]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ assertEquals(0L, reader.nextLong());
+ assertEquals(0, reader.nextInt());
+ assertEquals(0.0, reader.nextDouble());
+ assertEquals(1L, reader.nextLong());
+ assertEquals(1, reader.nextInt());
+ assertEquals(1.0, reader.nextDouble());
+ assertEquals(-1L, reader.nextLong());
+ assertEquals(-1, reader.nextInt());
+ assertEquals(-1.0, reader.nextDouble());
+ try {
+ reader.nextInt();
+ fail();
+ } catch (NumberFormatException expected) {
+ }
+ assertEquals(Long.MIN_VALUE, reader.nextLong());
+ try {
+ reader.nextInt();
+ fail();
+ } catch (NumberFormatException expected) {
+ }
+ assertEquals(Long.MAX_VALUE, reader.nextLong());
+ assertEquals(5, reader.nextLong());
+ assertEquals(100, reader.nextLong());
+ assertEquals(11, reader.nextLong());
+ assertEquals(5, reader.nextLong());
+ assertEquals(100, reader.nextLong());
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testHighPrecisionDouble_losesPrecision() throws IOException {
+ // The presence of a fractional part forces us to use Double.parseDouble
+ // instead of Long.parseLong (even though the fractional part is 0).
+ //
+ // A 52 bit mantissa isn't sufficient to precisely represent any of these
+ // values, so we will lose some precision, thereby storing it as
+ // ~(9.223372036854776E18). This value is then implicitly converted into
+ // a long and is required by the JLS to be clamped to Long.MAX_VALUE since
+ // it's larger than the largest long.
+ String json = "["
+ + "9223372036854775806.000," // Long.MAX_VALUE - 1
+ + "9223372036854775807.000," // Long.MAX_VALUE
+ + "9223372036854775808.000" // Long.MAX_VALUE + 1
+ + "]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ assertEquals(Long.MAX_VALUE, reader.nextLong());
+ assertEquals(Long.MAX_VALUE, reader.nextLong());
+ assertEquals(Long.MAX_VALUE, reader.nextLong());
+ reader.endArray();
+ }
+
+ public void testMatchingValidNumbers() throws IOException {
+ String json = "[-1,99,-0,0,0e1,0e+1,0e-1,0E1,0E+1,0E-1,0.0,1.0,-1.0,1.0e0,1.0e+1,1.0e-1]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ for (int i = 0; i < 16; i++) {
+ assertEquals(JsonToken.NUMBER, reader.peek());
+ reader.nextDouble();
+ }
+ reader.endArray();
+ }
+
+ public void testRecognizingInvalidNumbers() throws IOException {
+ String json = "[-00,00,001,+1,1f,0x,0xf,0x0,0f1,0ee1,1..0,1e0.1,1.-01,1.+1,1.0x,1.0+]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.setLenient(true);
+ reader.beginArray();
+ for (int i = 0; i < 16; i++) {
+ assertEquals(JsonToken.STRING, reader.peek());
+ reader.nextString();
+ }
+ reader.endArray();
+ }
+
+ public void testNonFiniteDouble() throws IOException {
+ String json = "[NaN]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ try {
+ reader.nextDouble();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testNumberWithHexPrefix() throws IOException {
+ String json = "[0x11]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ try {
+ reader.nextLong();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testNumberWithOctalPrefix() throws IOException {
+ String json = "[01]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ try {
+ reader.nextInt();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testBooleans() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[true,false]"));
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ assertEquals(false, reader.nextBoolean());
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testMixedCaseLiterals() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[True,TruE,False,FALSE,NULL,nulL]"));
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ assertEquals(true, reader.nextBoolean());
+ assertEquals(false, reader.nextBoolean());
+ assertEquals(false, reader.nextBoolean());
+ reader.nextNull();
+ reader.nextNull();
+ reader.endArray();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testMissingValue() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":}"));
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ try {
+ reader.nextString();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testPrematureEndOfInput() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":true,"));
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ assertEquals(true, reader.nextBoolean());
+ try {
+ reader.nextName();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testPrematurelyClosed() throws IOException {
+ try {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":[]}"));
+ reader.beginObject();
+ reader.close();
+ reader.nextName();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+
+ try {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":[]}"));
+ reader.close();
+ reader.beginObject();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+
+ try {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":true}"));
+ reader.beginObject();
+ reader.nextName();
+ reader.peek();
+ reader.close();
+ reader.nextBoolean();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testNextFailuresDoNotAdvance() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":true}"));
+ reader.beginObject();
+ try {
+ reader.nextString();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ assertEquals("a", reader.nextName());
+ try {
+ reader.nextName();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ try {
+ reader.beginArray();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ try {
+ reader.endArray();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ try {
+ reader.beginObject();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ try {
+ reader.endObject();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ assertEquals(true, reader.nextBoolean());
+ try {
+ reader.nextString();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ try {
+ reader.nextName();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ try {
+ reader.beginArray();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ try {
+ reader.endArray();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ reader.endObject();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ reader.close();
+ }
+
+ public void testStringNullIsNotNull() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[\"null\"]"));
+ reader.beginArray();
+ try {
+ reader.nextNull();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testNullLiteralIsNotAString() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[null]"));
+ reader.beginArray();
+ try {
+ reader.nextString();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testStrictNameValueSeparator() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\"=true}"));
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ try {
+ reader.nextBoolean();
+ fail();
+ } catch (IOException expected) {
+ }
+
+ reader = new JsonReader(new StringReader("{\"a\"=>true}"));
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ try {
+ reader.nextBoolean();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientNameValueSeparator() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\"=true}"));
+ reader.setLenient(true);
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ assertEquals(true, reader.nextBoolean());
+
+ reader = new JsonReader(new StringReader("{\"a\"=>true}"));
+ reader.setLenient(true);
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ assertEquals(true, reader.nextBoolean());
+ }
+
+ public void testStrictComments() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[// comment \n true]"));
+ reader.beginArray();
+ try {
+ reader.nextBoolean();
+ fail();
+ } catch (IOException expected) {
+ }
+
+ reader = new JsonReader(new StringReader("[# comment \n true]"));
+ reader.beginArray();
+ try {
+ reader.nextBoolean();
+ fail();
+ } catch (IOException expected) {
+ }
+
+ reader = new JsonReader(new StringReader("[/* comment */ true]"));
+ reader.beginArray();
+ try {
+ reader.nextBoolean();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientComments() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[// comment \n true]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+
+ reader = new JsonReader(new StringReader("[# comment \n true]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+
+ reader = new JsonReader(new StringReader("[/* comment */ true]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ }
+
+ public void testStrictUnquotedNames() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{a:true}"));
+ reader.beginObject();
+ try {
+ reader.nextName();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientUnquotedNames() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{a:true}"));
+ reader.setLenient(true);
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ }
+
+ public void testStrictSingleQuotedNames() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{'a':true}"));
+ reader.beginObject();
+ try {
+ reader.nextName();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientSingleQuotedNames() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{'a':true}"));
+ reader.setLenient(true);
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ }
+
+ public void testStrictUnquotedStrings() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[a]"));
+ reader.beginArray();
+ try {
+ reader.nextString();
+ fail();
+ } catch (MalformedJsonException expected) {
+ }
+ }
+
+ public void testLenientUnquotedStrings() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[a]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals("a", reader.nextString());
+ }
+
+ public void testStrictSingleQuotedStrings() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("['a']"));
+ reader.beginArray();
+ try {
+ reader.nextString();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientSingleQuotedStrings() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("['a']"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals("a", reader.nextString());
+ }
+
+ public void testStrictSemicolonDelimitedArray() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[true;true]"));
+ reader.beginArray();
+ try {
+ reader.nextBoolean();
+ reader.nextBoolean();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientSemicolonDelimitedArray() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[true;true]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ assertEquals(true, reader.nextBoolean());
+ }
+
+ public void testStrictSemicolonDelimitedNameValuePair() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":true;\"b\":true}"));
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ try {
+ reader.nextBoolean();
+ reader.nextName();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientSemicolonDelimitedNameValuePair() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("{\"a\":true;\"b\":true}"));
+ reader.setLenient(true);
+ reader.beginObject();
+ assertEquals("a", reader.nextName());
+ assertEquals(true, reader.nextBoolean());
+ assertEquals("b", reader.nextName());
+ }
+
+ public void testStrictUnnecessaryArraySeparators() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[true,,true]"));
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ try {
+ reader.nextNull();
+ fail();
+ } catch (IOException expected) {
+ }
+
+ reader = new JsonReader(new StringReader("[,true]"));
+ reader.beginArray();
+ try {
+ reader.nextNull();
+ fail();
+ } catch (IOException expected) {
+ }
+
+ reader = new JsonReader(new StringReader("[true,]"));
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ try {
+ reader.nextNull();
+ fail();
+ } catch (IOException expected) {
+ }
+
+ reader = new JsonReader(new StringReader("[,]"));
+ reader.beginArray();
+ try {
+ reader.nextNull();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientUnnecessaryArraySeparators() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[true,,true]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ reader.nextNull();
+ assertEquals(true, reader.nextBoolean());
+ reader.endArray();
+
+ reader = new JsonReader(new StringReader("[,true]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ reader.nextNull();
+ assertEquals(true, reader.nextBoolean());
+ reader.endArray();
+
+ reader = new JsonReader(new StringReader("[true,]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ assertEquals(true, reader.nextBoolean());
+ reader.nextNull();
+ reader.endArray();
+
+ reader = new JsonReader(new StringReader("[,]"));
+ reader.setLenient(true);
+ reader.beginArray();
+ reader.nextNull();
+ reader.nextNull();
+ reader.endArray();
+ }
+
+ public void testStrictMultipleTopLevelValues() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[] []"));
+ reader.beginArray();
+ reader.endArray();
+ try {
+ reader.peek();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientMultipleTopLevelValues() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[] true {}"));
+ reader.setLenient(true);
+ reader.beginArray();
+ reader.endArray();
+ assertEquals(true, reader.nextBoolean());
+ reader.beginObject();
+ reader.endObject();
+ assertEquals(JsonToken.END_DOCUMENT, reader.peek());
+ }
+
+ public void testStrictTopLevelValueType() {
+ JsonReader reader = new JsonReader(new StringReader("true"));
+ try {
+ reader.nextBoolean();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testLenientTopLevelValueType() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("true"));
+ reader.setLenient(true);
+ assertEquals(true, reader.nextBoolean());
+ }
+
+ public void testStrictNonExecutePrefix() {
+ JsonReader reader = new JsonReader(new StringReader(")]}'\n []"));
+ try {
+ reader.beginArray();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testBomIgnoredAsFirstCharacterOfDocument() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("\ufeff[]"));
+ reader.beginArray();
+ reader.endArray();
+ }
+
+ public void testBomForbiddenAsOtherCharacterInDocument() throws IOException {
+ JsonReader reader = new JsonReader(new StringReader("[\ufeff]"));
+ reader.beginArray();
+ try {
+ reader.endArray();
+ fail();
+ } catch (IOException expected) {
+ }
+ }
+
+ public void testFailWithPosition() throws IOException {
+ testFailWithPosition("Expected literal value at line 6 column 3",
+ "[\n\n\n\n\n0,}]");
+ }
+
+ public void testFailWithPositionIsOffsetByBom() throws IOException {
+ testFailWithPosition("Expected literal value at line 1 column 4",
+ "\ufeff[0,}]");
+ }
+
+ public void testFailWithPositionGreaterThanBufferSize() throws IOException {
+ String spaces = repeat(' ', 8192);
+ testFailWithPosition("Expected literal value at line 6 column 3",
+ "[\n\n" + spaces + "\n\n\n0,}]");
+ }
+
+ private void testFailWithPosition(String message, String json) throws IOException {
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ reader.nextInt();
+ try {
+ reader.peek();
+ fail();
+ } catch (IOException expected) {
+ assertEquals(message, expected.getMessage());
+ }
+ }
+
+ private String repeat(char c, int count) {
+ char[] array = new char[count];
+ Arrays.fill(array, c);
+ return new String(array);
+ }
+}
diff --git a/tests/tests/util/src/android/util/cts/JsonWriterTest.java b/tests/tests/util/src/android/util/cts/JsonWriterTest.java
new file mode 100644
index 0000000..d0207d2
--- /dev/null
+++ b/tests/tests/util/src/android/util/cts/JsonWriterTest.java
@@ -0,0 +1,468 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.util.cts;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import junit.framework.TestCase;
+
+import android.util.JsonWriter;
+
+public final class JsonWriterTest extends TestCase {
+
+ public void testWrongTopLevelType() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ try {
+ jsonWriter.value("a");
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testTwoNames() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ jsonWriter.name("a");
+ try {
+ jsonWriter.name("a");
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testNameWithoutValue() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ jsonWriter.name("a");
+ try {
+ jsonWriter.endObject();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testValueWithoutName() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ try {
+ jsonWriter.value(true);
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testMultipleTopLevelValues() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray().endArray();
+ try {
+ jsonWriter.beginArray();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testBadNestingObject() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.beginObject();
+ try {
+ jsonWriter.endArray();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testBadNestingArray() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.beginArray();
+ try {
+ jsonWriter.endObject();
+ fail();
+ } catch (IllegalStateException expected) {
+ }
+ }
+
+ public void testNullName() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ try {
+ jsonWriter.name(null);
+ fail();
+ } catch (NullPointerException expected) {
+ }
+ }
+
+ public void testNullStringValue() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ jsonWriter.name("a");
+ jsonWriter.value((String) null);
+ jsonWriter.endObject();
+ assertEquals("{\"a\":null}", stringWriter.toString());
+ }
+
+ public void testNonFiniteDoubles() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ try {
+ jsonWriter.value(Double.NaN);
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ try {
+ jsonWriter.value(Double.NEGATIVE_INFINITY);
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ try {
+ jsonWriter.value(Double.POSITIVE_INFINITY);
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ }
+
+ public void testNonFiniteBoxedDoubles() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ try {
+ jsonWriter.value(new Double(Double.NaN));
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ try {
+ jsonWriter.value(new Double(Double.NEGATIVE_INFINITY));
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ try {
+ jsonWriter.value(new Double(Double.POSITIVE_INFINITY));
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ }
+
+ public void testDoubles() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.value(-0.0);
+ jsonWriter.value(1.0);
+ jsonWriter.value(Double.MAX_VALUE);
+ jsonWriter.value(Double.MIN_VALUE);
+ jsonWriter.value(0.0);
+ jsonWriter.value(-0.5);
+ jsonWriter.value(Double.MIN_NORMAL);
+ jsonWriter.value(Math.PI);
+ jsonWriter.value(Math.E);
+ jsonWriter.endArray();
+ jsonWriter.close();
+ assertEquals("[-0.0,"
+ + "1.0,"
+ + "1.7976931348623157E308,"
+ + "4.9E-324,"
+ + "0.0,"
+ + "-0.5,"
+ + "2.2250738585072014E-308,"
+ + "3.141592653589793,"
+ + "2.718281828459045]", stringWriter.toString());
+ }
+
+ public void testLongs() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.value(0);
+ jsonWriter.value(1);
+ jsonWriter.value(-1);
+ jsonWriter.value(Long.MIN_VALUE);
+ jsonWriter.value(Long.MAX_VALUE);
+ jsonWriter.endArray();
+ jsonWriter.close();
+ assertEquals("[0,"
+ + "1,"
+ + "-1,"
+ + "-9223372036854775808,"
+ + "9223372036854775807]", stringWriter.toString());
+ }
+
+ public void testNumbers() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.value(new BigInteger("0"));
+ jsonWriter.value(new BigInteger("9223372036854775808"));
+ jsonWriter.value(new BigInteger("-9223372036854775809"));
+ jsonWriter.value(new BigDecimal("3.141592653589793238462643383"));
+ jsonWriter.endArray();
+ jsonWriter.close();
+ assertEquals("[0,"
+ + "9223372036854775808,"
+ + "-9223372036854775809,"
+ + "3.141592653589793238462643383]", stringWriter.toString());
+ }
+
+ public void testBooleans() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.value(true);
+ jsonWriter.value(false);
+ jsonWriter.endArray();
+ assertEquals("[true,false]", stringWriter.toString());
+ }
+
+ public void testNulls() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.nullValue();
+ jsonWriter.endArray();
+ assertEquals("[null]", stringWriter.toString());
+ }
+
+ public void testStrings() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.value("a");
+ jsonWriter.value("a\"");
+ jsonWriter.value("\"");
+ jsonWriter.value(":");
+ jsonWriter.value(",");
+ jsonWriter.value("\b");
+ jsonWriter.value("\f");
+ jsonWriter.value("\n");
+ jsonWriter.value("\r");
+ jsonWriter.value("\t");
+ jsonWriter.value(" ");
+ jsonWriter.value("\\");
+ jsonWriter.value("{");
+ jsonWriter.value("}");
+ jsonWriter.value("[");
+ jsonWriter.value("]");
+ jsonWriter.value("\0");
+ jsonWriter.value("\u0019");
+ jsonWriter.endArray();
+ assertEquals("[\"a\","
+ + "\"a\\\"\","
+ + "\"\\\"\","
+ + "\":\","
+ + "\",\","
+ + "\"\\b\","
+ + "\"\\f\","
+ + "\"\\n\","
+ + "\"\\r\","
+ + "\"\\t\","
+ + "\" \","
+ + "\"\\\\\","
+ + "\"{\","
+ + "\"}\","
+ + "\"[\","
+ + "\"]\","
+ + "\"\\u0000\","
+ + "\"\\u0019\"]", stringWriter.toString());
+ }
+
+ public void testUnicodeLineBreaksEscaped() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.value("\u2028 \u2029");
+ jsonWriter.endArray();
+ assertEquals("[\"\\u2028 \\u2029\"]", stringWriter.toString());
+ }
+
+ public void testEmptyArray() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.endArray();
+ assertEquals("[]", stringWriter.toString());
+ }
+
+ public void testEmptyObject() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ jsonWriter.endObject();
+ assertEquals("{}", stringWriter.toString());
+ }
+
+ public void testObjectsInArrays() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginArray();
+ jsonWriter.beginObject();
+ jsonWriter.name("a").value(5);
+ jsonWriter.name("b").value(false);
+ jsonWriter.endObject();
+ jsonWriter.beginObject();
+ jsonWriter.name("c").value(6);
+ jsonWriter.name("d").value(true);
+ jsonWriter.endObject();
+ jsonWriter.endArray();
+ assertEquals("[{\"a\":5,\"b\":false},"
+ + "{\"c\":6,\"d\":true}]", stringWriter.toString());
+ }
+
+ public void testArraysInObjects() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ jsonWriter.name("a");
+ jsonWriter.beginArray();
+ jsonWriter.value(5);
+ jsonWriter.value(false);
+ jsonWriter.endArray();
+ jsonWriter.name("b");
+ jsonWriter.beginArray();
+ jsonWriter.value(6);
+ jsonWriter.value(true);
+ jsonWriter.endArray();
+ jsonWriter.endObject();
+ assertEquals("{\"a\":[5,false],"
+ + "\"b\":[6,true]}", stringWriter.toString());
+ }
+
+ public void testDeepNestingArrays() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ for (int i = 0; i < 20; i++) {
+ jsonWriter.beginArray();
+ }
+ for (int i = 0; i < 20; i++) {
+ jsonWriter.endArray();
+ }
+ assertEquals("[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]", stringWriter.toString());
+ }
+
+ public void testDeepNestingObjects() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ for (int i = 0; i < 20; i++) {
+ jsonWriter.name("a");
+ jsonWriter.beginObject();
+ }
+ for (int i = 0; i < 20; i++) {
+ jsonWriter.endObject();
+ }
+ jsonWriter.endObject();
+ assertEquals("{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":"
+ + "{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{\"a\":{"
+ + "}}}}}}}}}}}}}}}}}}}}}", stringWriter.toString());
+ }
+
+ public void testRepeatedName() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.beginObject();
+ jsonWriter.name("a").value(true);
+ jsonWriter.name("a").value(false);
+ jsonWriter.endObject();
+ // JsonWriter doesn't attempt to detect duplicate names
+ assertEquals("{\"a\":true,\"a\":false}", stringWriter.toString());
+ }
+
+ public void testPrettyPrintObject() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.setIndent(" ");
+
+ jsonWriter.beginObject();
+ jsonWriter.name("a").value(true);
+ jsonWriter.name("b").value(false);
+ jsonWriter.name("c").value(5.0);
+ jsonWriter.name("e").nullValue();
+ jsonWriter.name("f").beginArray();
+ jsonWriter.value(6.0);
+ jsonWriter.value(7.0);
+ jsonWriter.endArray();
+ jsonWriter.name("g").beginObject();
+ jsonWriter.name("h").value(8.0);
+ jsonWriter.name("i").value(9.0);
+ jsonWriter.endObject();
+ jsonWriter.endObject();
+
+ String expected = "{\n"
+ + " \"a\": true,\n"
+ + " \"b\": false,\n"
+ + " \"c\": 5.0,\n"
+ + " \"e\": null,\n"
+ + " \"f\": [\n"
+ + " 6.0,\n"
+ + " 7.0\n"
+ + " ],\n"
+ + " \"g\": {\n"
+ + " \"h\": 8.0,\n"
+ + " \"i\": 9.0\n"
+ + " }\n"
+ + "}";
+ assertEquals(expected, stringWriter.toString());
+ }
+
+ public void testPrettyPrintArray() throws IOException {
+ StringWriter stringWriter = new StringWriter();
+ JsonWriter jsonWriter = new JsonWriter(stringWriter);
+ jsonWriter.setIndent(" ");
+
+ jsonWriter.beginArray();
+ jsonWriter.value(true);
+ jsonWriter.value(false);
+ jsonWriter.value(5.0);
+ jsonWriter.nullValue();
+ jsonWriter.beginObject();
+ jsonWriter.name("a").value(6.0);
+ jsonWriter.name("b").value(7.0);
+ jsonWriter.endObject();
+ jsonWriter.beginArray();
+ jsonWriter.value(8.0);
+ jsonWriter.value(9.0);
+ jsonWriter.endArray();
+ jsonWriter.endArray();
+
+ String expected = "[\n"
+ + " true,\n"
+ + " false,\n"
+ + " 5.0,\n"
+ + " null,\n"
+ + " {\n"
+ + " \"a\": 6.0,\n"
+ + " \"b\": 7.0\n"
+ + " },\n"
+ + " [\n"
+ + " 8.0,\n"
+ + " 9.0\n"
+ + " ]\n"
+ + "]";
+ assertEquals(expected, stringWriter.toString());
+ }
+}
diff --git a/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java b/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
index 731d1ce..252e237 100644
--- a/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
@@ -300,7 +300,7 @@
state = compoundButton.onSaveInstanceState();
assertNotNull(state);
- assertTrue(compoundButton.getFreezesText());
+ assertFalse(compoundButton.getFreezesText());
compoundButton.setChecked(true);
diff --git a/tools/cts-native-scanner/src/com/android/cts/nativescanner/CtsNativeScanner.java b/tools/cts-native-scanner/src/com/android/cts/nativescanner/CtsNativeScanner.java
index a7599b0..2414138 100644
--- a/tools/cts-native-scanner/src/com/android/cts/nativescanner/CtsNativeScanner.java
+++ b/tools/cts-native-scanner/src/com/android/cts/nativescanner/CtsNativeScanner.java
@@ -15,7 +15,8 @@
*/
package com.android.cts.nativescanner;
-import java.io.File;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
@@ -27,18 +28,18 @@
private static void usage(String[] args) {
System.err.println("Arguments: " + Arrays.asList(args));
- System.err.println("Usage: cts-native-scanner -s SOURCE_DIR -t TEST_SUITE");
+ System.err.println("Usage: cts-native-scanner -t TEST_SUITE");
+ System.err.println(" This code reads from stdin the list of tests.");
+ System.err.println(" The format expected:");
+ System.err.println(" TEST_CASE_NAME.");
+ System.err.println(" TEST_NAME");
System.exit(1);
}
public static void main(String[] args) throws Exception {
- File sourceDir = null;
String testSuite = null;
-
for (int i = 0; i < args.length; i++) {
- if ("-s".equals(args[i])) {
- sourceDir = new File(getArg(args, ++i, "Missing value for source directory"));
- } else if ("-t".equals(args[i])) {
+ if ("-t".equals(args[i])) {
testSuite = getArg(args, ++i, "Missing value for test suite");
} else {
System.err.println("Unsupported flag: " + args[i]);
@@ -46,19 +47,14 @@
}
}
- if (sourceDir == null) {
- System.out.println("Source directory is required");
- usage(args);
- }
-
if (testSuite == null) {
System.out.println("Test suite is required");
usage(args);
}
- TestScanner scanner = new TestScanner(sourceDir, testSuite);
- List<String> testNames = scanner.getTestNames();
- for (String name : testNames) {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
+ TestScanner scanner = new TestScanner(reader, testSuite);
+ for (String name : scanner.getTestNames()) {
System.out.println(name);
}
}
diff --git a/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java b/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java
index 370b509..6fcb353 100644
--- a/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java
+++ b/tools/cts-native-scanner/src/com/android/cts/nativescanner/TestScanner.java
@@ -16,100 +16,60 @@
package com.android.cts.nativescanner;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
-import java.util.Scanner;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
- * Scanner of C++ gTest source files.
+ * Read from the BufferedReader a list of test case names and test cases.
*
- * It looks for test declarations and outputs a file following this format:
- * suite:TestSuite
- * case:TestCase1
- * test:Test1
- * test:Test2
- * suite:TestSuite
- * case:TestCase2
- * test:Test1
- * test:Test2
+ * The expected format of the incoming test list:
+ * TEST_CASE_NAME.
+ * TEST_NAME1
+ * TEST_NAME2
*
+ * The output:
+ * suite:TestSuite
+ * case:TEST_CASE_NAME
+ * test:TEST_NAME1
+ * test:TEST_NAME2
*/
class TestScanner {
- /** Directory to recursively scan for gTest test declarations. */
- private final File mSourceDir;
-
private final String mTestSuite;
- TestScanner(File sourceDir, String testSuite) {
- mSourceDir = sourceDir;
+ private final BufferedReader mReader;
+
+ TestScanner(BufferedReader reader, String testSuite) {
mTestSuite = testSuite;
+ mReader = reader;
}
public List<String> getTestNames() throws IOException {
List<String> testNames = new ArrayList<String>();
- scanDir(mSourceDir, testNames);
- return testNames;
- }
- private void scanDir(File dir, List<String> testNames) throws FileNotFoundException {
- // Find both C++ files to find tests and directories to look for more tests!
- File[] files = dir.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String filename) {
- return filename.endsWith(".cpp") || filename.endsWith(".cc")
- || new File(dir, filename).isDirectory();
- }
- });
-
- for (int i = 0; i < files.length; i++) {
- File file = files[i];
- if (file.isDirectory()) {
- scanDir(file, testNames);
+ String testCaseName = null;
+ String line;
+ while ((line = mReader.readLine()) != null) {
+ if (line.length() > 0) {
+ if (line.charAt(0) == ' ') {
+ if (testCaseName != null) {
+ testNames.add("test:" + line.trim());
+ } else {
+ throw new IOException("TEST_CASE_NAME not defined before first test.");
+ }
} else {
- scanFile(new Scanner(file), testNames);
+ testCaseName = line.trim();
+ if (testCaseName.endsWith(".")) {
+ testCaseName = testCaseName.substring(0, testCaseName.length()-1);
+ }
+ testNames.add("suite:" + mTestSuite);
+ testNames.add("case:" + testCaseName);
}
+ }
}
- }
-
- // We want to find lines like TEST_F(SLObjectCreationTest, testAudioPlayerFromFdCreation)
- // or TEST(stdio, printf) { ...
- // and extract the "SLObjectCreationTest" as group #1,
- // "testAudioPlayerFromFdCreation" as group #2
- // TODO: It would be better to concatenate the two parts.
- private static final Pattern METHOD_REGEX =
- Pattern.compile("\\s*TEST(?:_F)?\\((\\w+),\\s*(\\w+)\\).*");
-
- public void scanFile(Scanner scanner, List<String> testNames) {
- try {
- String lastCase = "";
- while (scanner.hasNextLine()) {
- String line = scanner.nextLine();
-
- Matcher matcher = METHOD_REGEX.matcher(line);
-
- if (!matcher.matches()) {
- continue;
- }
-
- if (!lastCase.equals(matcher.group(1))) {
- testNames.add("suite:" + mTestSuite);
- testNames.add("case:" + matcher.group(1));
- lastCase = matcher.group(1);
- }
-
- testNames.add("test:" + matcher.group(2));
- }
- } finally {
- if (scanner != null) {
- scanner.close();
- }
- }
+ return testNames;
}
}
diff --git a/tools/cts-native-scanner/tests/src/com/android/cts/nativescanner/TestScannerTest.java b/tools/cts-native-scanner/tests/src/com/android/cts/nativescanner/TestScannerTest.java
index 18732fd..b00c7dc 100644
--- a/tools/cts-native-scanner/tests/src/com/android/cts/nativescanner/TestScannerTest.java
+++ b/tools/cts-native-scanner/tests/src/com/android/cts/nativescanner/TestScannerTest.java
@@ -19,12 +19,10 @@
import junit.framework.TestCase;
-import java.io.File;
+import java.io.BufferedReader;
+import java.io.IOException;
import java.io.StringReader;
-import java.lang.StringBuilder;
-import java.util.Scanner;
import java.util.List;
-import java.util.ArrayList;
import java.util.Iterator;
/**
@@ -32,31 +30,49 @@
*/
public class TestScannerTest extends TestCase {
- public void testScanFile() {
- TestScanner testScanner = new TestScanner(new File("unused"), "TestSuite");
+ public void testSingleTestNamesCase() throws Exception {
+ StringReader singleTestString = new StringReader("FakeTestCase.\n FakeTestName\n");
+ BufferedReader reader = new BufferedReader(singleTestString);
- String newLine = System.getProperty("line.separator");
- StringBuilder sb = new StringBuilder();
- sb.append("foobar" + newLine); // ignored
- sb.append("TEST_F(TestCase1, TestName1)" + newLine); // valid
- sb.append("TEST_F(TestCase1, TestName2)" + newLine); // valid
- sb.append("TEST_F(TestCase2, TestName1) foo" + newLine); // valid
- sb.append("TEST_F(TestCase2, TestName1 foo)" + newLine); // ignored
- sb.append("foo TEST_F(TestCase2, TestName1)" + newLine); // ignored
+ TestScanner testScanner = new TestScanner(reader, "TestSuite");
- List<String> names = new ArrayList<String>();
- Scanner scanner = new Scanner(new StringReader(sb.toString()));
- testScanner.scanFile(scanner, names);
+ List<String> names = testScanner.getTestNames();
Iterator it = names.iterator();
-
assertEquals("suite:TestSuite", it.next());
- assertEquals("case:TestCase1", it.next());
- assertEquals("test:TestName1", it.next());
- assertEquals("test:TestName2", it.next());
- assertEquals("suite:TestSuite", it.next());
- assertEquals("case:TestCase2", it.next());
- assertEquals("test:TestName1", it.next());
+ assertEquals("case:FakeTestCase", it.next());
+ assertEquals("test:FakeTestName", it.next());
assertFalse(it.hasNext());
- scanner.close();
+ }
+
+ public void testMultipleTestNamesCase() throws Exception {
+ StringReader singleTestString = new StringReader(
+ "Case1.\n Test1\n Test2\nCase2.\n Test3\n Test4\n");
+ BufferedReader reader = new BufferedReader(singleTestString);
+
+ TestScanner testScanner = new TestScanner(reader, "TestSuite");
+
+ List<String> names = testScanner.getTestNames();
+ Iterator it = names.iterator();
+ assertEquals("suite:TestSuite", it.next());
+ assertEquals("case:Case1", it.next());
+ assertEquals("test:Test1", it.next());
+ assertEquals("test:Test2", it.next());
+ assertEquals("case:Case2", it.next());
+ assertEquals("test:Test3", it.next());
+ assertEquals("test:Test4", it.next());
+ assertFalse(it.hasNext());
+ }
+
+ public void testMissingTestCaseNameCase() {
+ StringReader singleTestString = new StringReader(" Test1\n");
+ BufferedReader reader = new BufferedReader(singleTestString);
+
+ TestScanner testScanner = new TestScanner(reader, "TestSuite");
+
+ try {
+ List<String> names = testScanner.getTestNames();
+ fail();
+ } catch (IOException expected) {
+ }
}
}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/command/CtsConsole.java b/tools/tradefed-host/src/com/android/cts/tradefed/command/CtsConsole.java
index 40145dd..24190c5 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/command/CtsConsole.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/command/CtsConsole.java
@@ -151,7 +151,7 @@
helpBuilder.append("method\n");
helpBuilder.append(" run cts --continue-session session_ID: run all not executed ");
helpBuilder.append("tests from a previous CTS session\n");
- helpBuilder.append(" run cts [options] --serial/s device_ID: run CTS on specified ");
+ helpBuilder.append(" run cts [options] --serial/-s device_ID: run CTS on specified ");
helpBuilder.append("device\n");
helpBuilder.append(" run cts [options] --shards number_of_shards: shard a CTS run into ");
helpBuilder.append("given number of independent chunks, to run on multiple devices in");
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
index 5cfafc6..035b4a2 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/GeeTest.java
@@ -40,6 +40,8 @@
public class GeeTest implements IBuildReceiver, IDeviceTest, IRemoteTest {
private static final String NATIVE_TESTS_DIRECTORY = "/data/local/tmp/cts-native-tests";
+ private static final String NATIVE_TESTS_DIRECTORY_TMP = "/data/local/tmp";
+ private static final String ANDROID_PATH_SEPARATOR = "/";
private int mMaxTestTimeMs = 1 * 60 * 1000;
@@ -75,8 +77,8 @@
return false;
}
- File devicePath = new File(NATIVE_TESTS_DIRECTORY, mExeName);
- if (!mDevice.pushFile(nativeExe, devicePath.toString())) {
+ String devicePath = NATIVE_TESTS_DIRECTORY + ANDROID_PATH_SEPARATOR + mExeName;
+ if (!mDevice.pushFile(nativeExe, devicePath)) {
CLog.e("Failed to push native test to device");
return false;
}
@@ -87,13 +89,11 @@
if (mDevice.doesFileExist(remoteFilePath)) {
return true;
}
- File remoteFile = new File(remoteFilePath);
- String parentPath = remoteFile.getParent();
- if (parentPath != null) {
- if (!createRemoteDir(parentPath)) {
- return false;
- }
+ if (!(mDevice.doesFileExist(NATIVE_TESTS_DIRECTORY_TMP))) {
+ CLog.e("Could not find the /data/local/tmp directory");
+ return false;
}
+
mDevice.executeShellCommand(String.format("mkdir %s", remoteFilePath));
return mDevice.doesFileExist(remoteFilePath);
}
@@ -102,7 +102,7 @@
GeeTestResultParser resultParser = new GeeTestResultParser(mPackageName, listener);
resultParser.setFakePackagePrefix(mPackageName + ".");
- String fullPath = NATIVE_TESTS_DIRECTORY + File.separator + mExeName;
+ String fullPath = NATIVE_TESTS_DIRECTORY + ANDROID_PATH_SEPARATOR + mExeName;
String flags = "";
CLog.v("Running gtest %s %s on %s", fullPath, flags, mDevice.getSerialNumber());
// force file to be executable
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index b269be8..cb70c54 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -126,8 +126,14 @@
plan = tools.TestPlan(packages)
plan.Include(r'android\.core\.tests.*')
+ plan.Exclude(r'android\.core\.tests\.libcore.\package.\harmony*')
self.__WritePlan(plan, 'Java')
+ # TODO: remove this once the tests are fixed and merged into Java plan above.
+ plan = tools.TestPlan(packages)
+ plan.Include(r'android\.core\.tests\.libcore.\package.\harmony*')
+ self.__WritePlan(plan, 'Harmony')
+
plan = tools.TestPlan(packages)
plan.Include(r'android\.core\.vm-tests-tf')
self.__WritePlan(plan, 'VM-TF')