am f43b24be: am 313a30bc: am d68382c3: am e350b3b0: DO NOT MERGE Add opengl extensions to cts device info report output.
* commit 'f43b24be2d9d5910b1d0179491e3996376c3b6e9':
DO NOT MERGE Add opengl extensions to cts device info report output.
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index b98c4e6..3c34174 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -141,7 +141,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
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
index 7856591..d68d1da 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
@@ -402,9 +402,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);
@@ -720,4 +726,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/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/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/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..92fd9e87
--- /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/foreach.rs b/tests/src/android/renderscript/cts/foreach.rs
index 8747961..08e6bed 100644
--- a/tests/src/android/renderscript/cts/foreach.rs
+++ b/tests/src/android/renderscript/cts/foreach.rs
@@ -1,6 +1,5 @@
#include "shared.rsh"
-int *a;
rs_allocation aRaw;
int dimX;
int dimY;
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/sample.rs b/tests/src/android/renderscript/cts/sample.rs
index 7a8d5bb..64fb262 100644
--- a/tests/src/android/renderscript/cts/sample.rs
+++ b/tests/src/android/renderscript/cts/sample.rs
@@ -8,46 +8,11 @@
rs_sampler gMipNearest;
rs_sampler gMipLinear;
-uint8_t *gAllocPtr;
-
static uchar4 lod0Color = {255, 255, 0, 0};
static uchar4 lod1Color = {255, 0, 255, 0};
static uchar4 lod2Color = {0, 255, 255, 0};
static uchar4 lod3Color = {255, 255, 255, 0};
-// Allocation has been bound to gAllocPtr
-void init_RGBA(rs_allocation a) {
- // Fill base level with one color, mips with something else
- uchar4 *allocPtr = (uchar4*)gAllocPtr;
- uint32_t dimX = rsAllocationGetDimX(a);
- uint32_t dimY = rsAllocationGetDimY(a);
- uint32_t minSize = 1;
- dimX = max(dimX, minSize);
- dimY = max(dimY, minSize);
-
- uint32_t numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod0Color;
- }
- dimX = max(dimX >> 1, minSize);
- dimY = max(dimY >> 1, minSize);
- numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod1Color;
- }
- dimX = max(dimX >> 1, minSize);
- dimY = max(dimY >> 1, minSize);
- numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod2Color;
- }
- dimX = max(dimX >> 1, minSize);
- dimY = max(dimY >> 1, minSize);
- numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod3Color;
- }
-}
static bool compare(float4 expected, float4 value) {
float allowedDelta = 10.0f;
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 f9edb908..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/keystore/src/android/keystore/cts/AndroidKeyPairGeneratorTest.java b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyPairGeneratorTest.java
index cbfa34a..284ac83 100644
--- a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyPairGeneratorTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyPairGeneratorTest.java
@@ -406,6 +406,8 @@
final PublicKey pubKey = pair.getPublic();
assertNotNull("The PublicKey for the KeyPair should be not null", pubKey);
assertEquals(keyType, pubKey.getAlgorithm());
+ assertEquals("Public keys should be in X.509 format", "X.509", pubKey.getFormat());
+ assertNotNull("Public keys should be encodable", pubKey.getEncoded());
if ("DSA".equalsIgnoreCase(keyType)) {
DSAPublicKey dsaPubKey = (DSAPublicKey) pubKey;
@@ -434,6 +436,8 @@
final PrivateKey privKey = pair.getPrivate();
assertNotNull("The PrivateKey for the KeyPair should be not null", privKey);
assertEquals(keyType, privKey.getAlgorithm());
+ assertNull("getFormat() should return null", privKey.getFormat());
+ assertNull("getEncoded() should return null", privKey.getEncoded());
KeyStore.Entry entry = mKeyStore.getEntry(alias, null);
assertNotNull("Entry should exist", entry);
@@ -471,6 +475,9 @@
chain.length);
assertUsableInSSLConnection(privKey, x509userCert);
+
+ assertEquals("Retrieved key and generated key should be equal", privKey,
+ privEntry.getPrivateKey());
}
private static void assertUsableInSSLConnection(final PrivateKey privKey,
diff --git a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
index 4f8715e..2c926a8 100644
--- a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
@@ -1468,20 +1468,29 @@
private void assertPrivateKeyEntryEquals(PrivateKeyEntry keyEntry, PrivateKey expectedKey,
Certificate expectedCert, Collection<Certificate> expectedChain) throws Exception {
+ final PrivateKey privKey = keyEntry.getPrivateKey();
+ final PublicKey pubKey = keyEntry.getCertificate().getPublicKey();
+
if (expectedKey instanceof DSAPrivateKey) {
assertEquals("Returned PrivateKey should be what we inserted",
((DSAPrivateKey) expectedKey).getParams(),
- ((DSAPublicKey) keyEntry.getCertificate().getPublicKey()).getParams());
+ ((DSAPublicKey) pubKey).getParams());
} else if (expectedKey instanceof ECPrivateKey) {
assertEquals("Returned PrivateKey should be what we inserted",
((ECPrivateKey) expectedKey).getParams().getCurve(),
- ((ECPublicKey) keyEntry.getCertificate().getPublicKey()).getParams().getCurve());
+ ((ECPublicKey) pubKey).getParams().getCurve());
} else if (expectedKey instanceof RSAPrivateKey) {
assertEquals("Returned PrivateKey should be what we inserted",
((RSAPrivateKey) expectedKey).getModulus(),
- ((RSAPrivateKey) keyEntry.getPrivateKey()).getModulus());
+ ((RSAPrivateKey) privKey).getModulus());
}
+ assertNull("getFormat() should return null", privKey.getFormat());
+ assertNull("getEncoded() should return null", privKey.getEncoded());
+
+ assertEquals("Public keys should be in X.509 format", "X.509", pubKey.getFormat());
+ assertNotNull("Public keys should be encodable", pubKey.getEncoded());
+
assertEquals("Returned Certificate should be what we inserted", expectedCert,
keyEntry.getCertificate());
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/StreamingMediaPlayerTest.java b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
index 5dd2c4f..f51273d 100644
--- a/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
@@ -195,4 +195,27 @@
mServer.shutdown();
}
}
+
+ public void testPlayHlsStream() throws Throwable {
+ localHlsTest("hls.m3u8", false);
+ }
+
+ public void testPlayHlsStreamWithQueryString() throws Throwable {
+ localHlsTest("hls.m3u8", true);
+ }
+
+ private void localHlsTest(final String name, boolean appendQueryString)
+ throws Throwable {
+ mServer = new CtsTestServer(mContext);
+ try {
+ String 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/net/src/android/net/ipv6/cts/PingTest.java b/tests/tests/net/src/android/net/ipv6/cts/PingTest.java
index 41eb03d..acf474f 100644
--- a/tests/tests/net/src/android/net/ipv6/cts/PingTest.java
+++ b/tests/tests/net/src/android/net/ipv6/cts/PingTest.java
@@ -34,6 +34,21 @@
import java.util.Arrays;
import java.util.Random;
+/**
+ * Checks that the device has kernel support for the IPv6 ping socket. This allows ping6 to work
+ * without root privileges. The necessary kernel code is in Linux 3.11 or above, or the
+ * <code>common/android-3.x</code> kernel trees. If you are not running one of these kernels, the
+ * functionality can be obtained by cherry-picking the following patches from David Miller's
+ * <code>net-next</code> tree:
+ * <ul>
+ * <li>6d0bfe2 net: ipv6: Add IPv6 support to the ping socket.
+ * <li>c26d6b4 ping: always initialize ->sin6_scope_id and ->sin6_flowinfo
+ * <li>fbfe80c net: ipv6: fix wrong ping_v6_sendmsg return value
+ * <li>a1bdc45 net: ipv6: add missing lock in ping_v6_sendmsg
+ * <li>cf970c0 ping: prevent NULL pointer dereference on write to msg_name
+ * </ul>
+ * or the equivalent backports to the <code>common/android-3.x</code> trees.
+ */
public class PingTest extends AndroidTestCase {
/** Maximum size of the packets we're using to test. */
private static final int MAX_SIZE = 4096;
@@ -90,19 +105,25 @@
/**
* Checks that a socket has received a response appropriate to the specified packet.
*/
- private void checkResponse(FileDescriptor s,
- InetAddress dest, byte[] sent) throws ErrnoException, IOException {
- // Receive the response.
- InetSocketAddress from = new InetSocketAddress();
+ private void checkResponse(FileDescriptor s, InetAddress dest,
+ byte[] sent, boolean useRecvfrom) throws ErrnoException, IOException {
ByteBuffer responseBuffer = ByteBuffer.allocate(MAX_SIZE);
- int bytesRead = Libcore.os.recvfrom(s, responseBuffer, 0, from);
+ int bytesRead;
- // Check the source address and scope ID.
- assertTrue(from.getAddress() instanceof Inet6Address);
- Inet6Address fromAddress = (Inet6Address) from.getAddress();
- assertEquals(0, fromAddress.getScopeId());
- assertNull(fromAddress.getScopedInterface());
- assertEquals(dest.getHostAddress(), fromAddress.getHostAddress());
+ // Receive the response.
+ if (useRecvfrom) {
+ InetSocketAddress from = new InetSocketAddress();
+ bytesRead = Libcore.os.recvfrom(s, responseBuffer, 0, from);
+
+ // Check the source address and scope ID.
+ assertTrue(from.getAddress() instanceof Inet6Address);
+ Inet6Address fromAddress = (Inet6Address) from.getAddress();
+ assertEquals(0, fromAddress.getScopeId());
+ assertNull(fromAddress.getScopedInterface());
+ assertEquals(dest.getHostAddress(), fromAddress.getHostAddress());
+ } else {
+ bytesRead = Libcore.os.read(s, responseBuffer);
+ }
// Check the packet length.
assertEquals(sent.length, bytesRead);
@@ -135,8 +156,11 @@
for (int i = 0; i < NUM_PACKETS; i++) {
byte[] packet = pingPacket((int) (Math.random() * MAX_SIZE));
FileDescriptor s = createPingSocket();
+ // Use both recvfrom and read().
sendPing(s, ipv6Loopback, packet);
- checkResponse(s, ipv6Loopback, packet);
+ checkResponse(s, ipv6Loopback, packet, true);
+ sendPing(s, ipv6Loopback, packet);
+ checkResponse(s, ipv6Loopback, packet, false);
// Check closing the socket doesn't raise an exception.
Libcore.os.close(s);
}
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/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..4cc9a75
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CoreMathVerifier.java
@@ -0,0 +1,1441 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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 {
+ 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.sqrt((x - 1.0) / 2.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;
+ args.out = (float) (StrictMath.log(
+ args.in + StrictMath.sqrt(1 + StrictMath.pow(args.in, 2))));
+ }
+
+ 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(1 + x) - StrictMath.log(1 - x)) / 2);
+ }
+
+ 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 max = args.inMaxValue & 0xffffffff;
+ long min = args.inMinValue & 0xffffffff;
+ long in = args.inValue & 0xffffffff;
+ 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;
+ // TODO This is not correct for the very largest values.
+ args.out = StrictMath.min(args.inMaxValue,
+ StrictMath.max(args.inValue, args.inMinValue));
+ }
+ */
+
+ 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) {
+ // TODO The ulfs have been relaxed from 5, 128. Revisit.
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ args.out = (float) StrictMath.cos(args.in * 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 = length(lhs - rhs);
+ }
+ */
+
+ /* TODO To be implemented
+ 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 = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654;
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeErfc(TestErfc.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654;
+ }
+ */
+
+ static public void computeExp(TestExp.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.exp(args.in);
+ }
+
+ static public void computeExp10(TestExp10.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.pow(10.0, args.in);
+ }
+
+ static public void computeExp2(TestExp2.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ args.ulfRelaxed = 16;
+ args.out = (float) StrictMath.pow(2.0, args.in);
+ }
+
+ static public void computeExpm1(TestExpm1.ArgumentsFloatFloat args) {
+ args.ulf = 3;
+ 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 = 987654;
+ }
+ */
+
+ /* 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;
+ double sum = 0.0f;
+ for (int i = 0; i < args.inV.length; i++) {
+ sum += args.inV[i] * args.inV[i];
+ }
+ args.out = (float) StrictMath.sqrt(sum);
+ }
+ */
+
+ /* TODO To be implemented
+ static public void computeFastNormalize(TestFastNormalize.ArgumentsFloatFloat args) {
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ args.out = 987654;
+ }
+ */
+
+ 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);
+ }
+
+ 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;
+ double sum = args.inV * args.inV;
+ args.out = (float) StrictMath.sqrt(sum);
+ }
+
+ static public void computeLength(TestLength.ArgumentsFloatNFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ double sum = 0.0f;
+ for (int i = 0; i < args.inV.length; i++) {
+ sum += args.inV[i] * args.inV[i];
+ }
+ args.out = (float) StrictMath.sqrt(sum);
+ }
+ */
+
+ /* 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));
+ }
+
+ 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 = (float)((double)args.inA * (double)args.inB + (double)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;
+ args.out = 987654;
+ }
+ */
+
+ static public void computePow(TestPow.ArgumentsFloatFloatFloat args) {
+ args.ulf = 16;
+ args.ulfRelaxed = 128;
+ args.out = (float) StrictMath.pow(args.inX, args.inY);
+ }
+
+ 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 = 0;
+ args.ulfRelaxed = 0;
+ double num = (double)args.inX;
+ double den = (double)args.inY;
+ args.out = (float)(num - StrictMath.round(num / den) * den);
+ }
+
+ /* TODO To be implemented
+ static public void computeRemquo(TestRemquo.ArgumentsFloatFloatIntFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654; // TODO
+ }
+ */
+
+ 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);
+ }
+
+ /* TODO To be implemented
+ static public void computeRound(TestRound.ArgumentsFloatFloat args) {
+ args.ulf = 4;
+ args.ulfRelaxed = 12;
+ args.out = 987654;
+
+ }
+ */
+
+ 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;
+ // TODO how should we handle NaN?
+ // if (args.in != args.in) {
+ // args.out = args.in; // NaN case
+ //} else {
+ args.out = args.inV < 0.f ? -1.f : 1.f;
+ //}
+ }
+
+ 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) {
+ // TODO The ulfs have been relaxed from 5, 128. Revisit.
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ args.out = (float) StrictMath.sin(args.in * 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) {
+ // TODO The ulfs have been relaxed from 5, 128. Revisit.
+ args.ulf = 4096;
+ args.ulfRelaxed = 4096;
+ args.out = (float) StrictMath.tan(args.in * 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/ForEachTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ForEachTest.java
index 433b7e6..8e82f1f 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/ForEachTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ForEachTest.java
@@ -470,7 +470,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_root(A);
s.invoke_verify_root();
@@ -478,6 +477,7 @@
s.invoke_verify_foo();
s.invoke_foreach_test();
mRS.finish();
+ checkForErrors();
waitForMessage();
}
@@ -491,7 +491,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_foo(A, A);
s.invoke_verify_foo();
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/KernelTest.java b/tests/tests/renderscript/src/android/renderscript/cts/KernelTest.java
index 56b5e89..dcfc0ba 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/KernelTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/KernelTest.java
@@ -470,7 +470,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_root(A);
s.invoke_verify_root();
@@ -478,6 +477,7 @@
s.invoke_verify_foo();
s.invoke_foreach_test();
mRS.finish();
+ checkForErrors();
waitForMessage();
}
@@ -491,7 +491,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_foo(A, A);
s.invoke_verify_foo();
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 ad3d078..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, int fact, int offset, float[] inArray) {
- RSUtils.genRandomFloats(seed, 32, -16, 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 32308ce..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, 32, -16, 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, 32, -16, 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, 32, -16, 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, 32, -16, 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, 32, -16, 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, 32, -16, 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, 32, -16, 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, 32, -16, 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 cebbe24..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, int fact, int offset, float[] inArray) {
- RSUtils.genRandomFloats(seed, 64, 0, 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 d7759f1..83746a6 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,91 @@
}
}
- private void baseTestHelper(int testid, Element inElement, Element outElement, long seed, int fact,
- int offset, int rStride, int rSkip, int refStride, int outStride,
- int inStride, int skip, int ulp) {
- float[] inArray = makeInArray(INPUTSIZE * inStride);
- fillRandomFloats(seed, fact, offset, 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, 1, 0, 1, 0, refStride, outStride, inStride, skip, ulp);
+ protected Allocation CreateRandomAllocation(RenderScript rs, Element.DataType dataType,
+ int size, long seed) {
+ 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.genRandomFloats(seed, 0.0f, 1.0f, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else
+ */
+ /* TODO The ranges for float is too small. We need to accept a wider range of values.
+ * Same thing for the integer types. For some functions (e.g. native*), we would like to
+ * specify a range in the spec file, as differs by function. Besides generating random
+ * values, we'd also like to force specific values, like 0, 1, pi, pi/2, NaN, +inf, -inf.
+ */
+ if (dataType == Element.DataType.FLOAT_32) {
+ float[] inArray = new float[INPUTSIZE * width];
+ RSUtils.genRandomFloats(seed, 0.0f, 1.0f, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.SIGNED_32) {
+ int[] inArray = new int[INPUTSIZE * width];
+ RSUtils.genRandomInts(seed, -4000, 4000, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.UNSIGNED_32) {
+ int[] inArray = new int[INPUTSIZE * width];
+ RSUtils.genRandomInts(seed, 0, 4000, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.SIGNED_16) {
+ short[] inArray = new short[INPUTSIZE * width];
+ RSUtils.genRandomShorts(seed, -4000, 4000, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.UNSIGNED_16) {
+ short[] inArray = new short[INPUTSIZE * width];
+ RSUtils.genRandomShorts(seed, 0, 4000, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.SIGNED_8) {
+ byte[] inArray = new byte[INPUTSIZE * width];
+ RSUtils.genRandomBytes(seed, -128, 127, inArray);
+ alloc.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ } else if (dataType == Element.DataType.UNSIGNED_8) {
+ byte[] inArray = new byte[INPUTSIZE * width];
+ RSUtils.genRandomBytes(seed, 0, 255, 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, 1, 0, 1, 0, 1, 1, 1, 0, ulp);
- }
-
- public void doF32_2(long seed, int ulp) {
- baseTestHelper(TEST_F32_2, Element.F32_2(mRS), Element.F32_2(mRS), seed, 1, 0, 1, 0, 2, 2, 2, 0, ulp);
- }
-
- public void doF32_3(long seed, int ulp) {
- baseTestHelper(TEST_F32_3, Element.F32_3(mRS), Element.F32_3(mRS), seed, 1, 0, 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, 1, 0, 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, 1, 0, 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, 1, 0, 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, 1, 0, 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, 1, 0, 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 +168,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, int fact, int offset, float[] inArray) {
- RSUtils.genRandomFloats(seed, fact, offset, 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 d3fb5d0..cdf8a66 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
@@ -28,22 +28,57 @@
public class RSUtils {
/**
- * Fills the array with random floats. Values will be: offset + number between 0 and max.
+ * Fills the array with random floats. Values will be between min (inclusive) and
+ * max (inclusive).
*/
- public static void genRandomFloats(long seed, int max, int offset, float array[]) {
+ public static void genRandomDoubles(long seed, float min, float max, double array[]) {
Random r = new Random(seed);
for (int i = 0; i < array.length; i++) {
- array[i] = r.nextFloat() * max + offset;
+ array[i] = min + r.nextFloat() * (max - min);
}
}
/**
- * Fills the array with random ints. Values will be: offset + number between 0 and max (exclusive).
+ * Fills the array with random floats. Values will be between min (inclusive) and
+ * max (inclusive).
*/
- public static void genRandomInts(long seed, int max, int offset, int array[]) {
+ public static void genRandomFloats(long seed, float min, float max, float array[]) {
Random r = new Random(seed);
for (int i = 0; i < array.length; i++) {
- array[i] = (r.nextInt(max) + offset);
+ array[i] = min + r.nextFloat() * (max - min);
+ }
+ }
+
+ /**
+ * Fills the array with random floats. 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);
+ }
+ }
+
+ /**
+ * Fills the array with random floats. Values will be between min (inclusive) and
+ * max (inclusive).
+ */
+ public static void genRandomShorts(long seed, int min, int max, short array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = (short) (min + r.nextInt(max - min + 1));
+ }
+ }
+
+ /**
+ * Fills the array with random floats. Values will be between min (inclusive) and
+ * max (inclusive).
+ */
+ public static void genRandomBytes(long seed, int min, int max, byte array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = (byte) (min + r.nextInt(max - min + 1));
}
}
}
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 2c447bb..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, 32, 1, 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, 32, 1, 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, 32, 1, 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, 32, 1, 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, 32, 1, 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, 32, 1, 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, 32, 1, 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, 32, 1, 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/RsPackColorTo8888Test.java b/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java
index edff5b9..328160a 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java
@@ -72,7 +72,7 @@
float[] inArray = new float[INPUTSIZE * 4];
byte[] outArray = new byte[INPUTSIZE * 4];
byte[] refArray = new byte[INPUTSIZE * 4];
- RSUtils.genRandomFloats(seed, 1, 0, inArray);
+ RSUtils.genRandomFloats(seed, 0.0f, 1.0f, inArray);
mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
try {
forEach(testId, mAllocationIn, mAllocationOut);
@@ -99,7 +99,7 @@
float[] inArray = new float[INPUTSIZE * 4];
byte[] outArray = new byte[INPUTSIZE * 4];
byte[] refArray = new byte[INPUTSIZE * 4];
- RSUtils.genRandomFloats(seed, 1, 0, inArray);
+ RSUtils.genRandomFloats(seed, 0.0f, 1.0f, inArray);
mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
try {
forEach(testId, mAllocationIn, mAllocationOut);
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/SampleTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
index 3c8650d..1729aeb 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
@@ -34,6 +34,36 @@
Allocation mAlloc_RGBA_1D;
Allocation mAlloc_RGBA_2D;
+ Allocation createAlloc(Type t) {
+ Allocation a = Allocation.createTyped(mRS, t, Allocation.MipmapControl.MIPMAP_FULL,
+ Allocation.USAGE_SCRIPT);
+
+ int[] tmp = new int[t.getCount()];
+ int idx = 0;
+ int w = t.getY();
+ if (w < 1) {
+ w = 1;
+ }
+
+ for (int ct = 0; ct < (8 * w); ct++) {
+ tmp[idx++] = 0x0000ffff;
+ }
+ w = (w + 1) >> 1;
+ for (int ct = 0; ct < (4 * w); ct++) {
+ tmp[idx++] = 0x00ff00ff;
+ }
+ w = (w + 1) >> 1;
+ for (int ct = 0; ct < (2 * w); ct++) {
+ tmp[idx++] = 0x00ffff00;
+ }
+ w = (w + 1) >> 1;
+ for (int ct = 0; ct < (1 * 1); ct++) {
+ tmp[idx++] = 0xffffff00;
+ }
+ a.copyFromUnchecked(tmp);
+ return a;
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -41,18 +71,10 @@
Element format = Element.RGBA_8888(mRS);
Type.Builder b = new Type.Builder(mRS, format);
b.setMipmaps(true);
- mAlloc_RGBA_1D = Allocation.createTyped(mRS, b.setX(8).create(),
- Allocation.MipmapControl.MIPMAP_FULL,
- Allocation.USAGE_SCRIPT);
- mAlloc_RGBA_2D = Allocation.createTyped(mRS, b.setX(8).setY(8).create(),
- Allocation.MipmapControl.MIPMAP_FULL,
- Allocation.USAGE_SCRIPT);
+ mAlloc_RGBA_1D = createAlloc(b.setX(8).create());
+ mAlloc_RGBA_2D = createAlloc(b.setX(8).setY(8).create());
mScript = new ScriptC_sample(mRS, mRes, R.raw.sample);
- mScript.bind_gAllocPtr(mAlloc_RGBA_1D);
- mScript.invoke_init_RGBA(mAlloc_RGBA_1D);
- mScript.bind_gAllocPtr(mAlloc_RGBA_2D);
- mScript.invoke_init_RGBA(mAlloc_RGBA_2D);
mScript.set_gNearest(Sampler.CLAMP_NEAREST(mRS));
mScript.set_gLinear(Sampler.CLAMP_LINEAR(mRS));
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..68e88a6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAbs.java
@@ -0,0 +1,723 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x79257810f73902f7L);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xff611dd40e5e04cdL);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xff62e6ef047925abL);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xff64b009fa944689L);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xfab837da06445edL);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x231450e168567d8fL);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x23611868beb20ebbL);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x23addff0150d9fe7L);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x6adb1880ac5b4837L);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xc87280539385db4bL);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xc8728af4f28da03fL);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xc872959651956533L);
+ 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: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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..8209b27
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAcos.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x7910da753d440f10L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x64764baac94551f4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x64c313321fd3d73eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x650fdab976625c88L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..5d2dfe9
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAcosh.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xf12791d8718aeb7cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xb973b0794aaea1a8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc6593434d49f0516L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd33eb7f05e8f6884L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..0c7ea89
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAcospi.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x84f58d8d1c6630f2L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x13a52bca3d72a1aeL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x3e324c4a68d35528L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x68bf6cca943408a2L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..053e101
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAsin.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x9e785a6eea5e942aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x8d019dfe0a95ddc6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x8d4e658561246310L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x8d9b2d0cb7b2e85aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..1883578
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAsinh.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x19b2e42bb2ee41c8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x8fb94bcc06487eecL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x9c9ecf879038e25aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa98453431a2945c8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..68c4bde
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAsinpi.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x5b3b28dfdb2810b4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xb0640456b00956a8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xdaf124d6db6a0a22L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x57e455706cabd9cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..0082340
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x28043a1f860354b4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x444092335e1248L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x91081989ec9792L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xddcfa0e07b1cdcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..8aa0d8b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x596bb1cde5d90380L);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x596bb1cde5d90380L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xb6f336f7c8022f1eL);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xb6f336f7c8022f1eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x437b8c25447bf2f7L);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x437b8c25447bf2f7L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd003e152c0f5b6d0L);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xd003e152c0f5b6d0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..4e0eb91
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtan2pi.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x64e50d1eea01bb6aL);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x64e50d1eea01bb6aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6884a855f4c93e8aL);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6884a855f4c93e8aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6d33ddde0040c8dbL);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6d33ddde0040c8dbL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x71e313660bb8532cL);
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x71e313660bb8532cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Input inX: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..ba9bc45
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtanh.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x8cf586bfdbb76d34L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc018be694224490L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x18e70fa21e12a7feL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x25cc935da8030b6cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..dd267a8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestAtanpi.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xd78368fa692b4fa6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x563b042132f67412L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x80c824a15e57278cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xab55452189b7db06L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..f70e67a
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCbrt.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x9e2ae7a73a4fd5a6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x5d9f99b761ff3212L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x5dec613eb88db75cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x5e3928c60f1c3ca6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..828b68c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCeil.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x821f29454a5b56e6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xcccd885944867252L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xcd1a4fe09b14f79cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xcd671767f1a37ce6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..87b2446
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestClamp.java
@@ -0,0 +1,3602 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xa72e74a305a95f28L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa72e74a305a95f28L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa72e74a305a95f28L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x %.16f", Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x %.16f", Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x662f14ca3d7fd390L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x662f14ca3d7fd390L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x662f14ca3d7fd390L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x %.16f", Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x %.16f", Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x41bdbe03e90eeb4cL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x41bdbe03e90eeb4cL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x41bdbe03e90eeb4cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x %.16f", Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x %.16f", Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x1d4c673d949e0308L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x1d4c673d949e0308L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x1d4c673d949e0308L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x %.16f", Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x %.16f", Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe76aa9804cd9616cL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe76aa9804cd9616cL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe76aa9804cd9616cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x %.16f", Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x %.16f", Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x687f6efb2625c522L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x687f6efb2625c522L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x687f6efb2625c522L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x %.16f", Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x %.16f", Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe9943475ff7228d8L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe9943475ff7228d8L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xe9943475ff7228d8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x %.16f", Float.floatToRawIntBits(args.inMinValue), args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x %.16f", Float.floatToRawIntBits(args.inMaxValue), args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x5065bba87fc489e0L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x5065bba87fc489e0L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x5065bba87fc489e0L);
+ 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, 0x69ba39920cb86e08L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x69ba39920cb86e08L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x69ba39920cb86e08L);
+ 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, 0x3288563f173cc490L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x3288563f173cc490L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x3288563f173cc490L);
+ 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, 0xfb5672ec21c11b18L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xfb5672ec21c11b18L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xfb5672ec21c11b18L);
+ 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, 0xc68ba167fca487c0L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xc68ba167fca487c0L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xc68ba167fca487c0L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x4e3424d278a54dccL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x4e3424d278a54dccL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x4e3424d278a54dccL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x29c2ce0c24346588L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x29c2ce0c24346588L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x29c2ce0c24346588L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x5517745cfc37d44L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x5517745cfc37d44L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x5517745cfc37d44L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xae1ae395299ec988L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0xae1ae395299ec988L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0xae1ae395299ec988L);
+ 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, 0xc640e567961f080L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0xc640e567961f080L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0xc640e567961f080L);
+ 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, 0xe7f2b79024f1083cL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0xe7f2b79024f1083cL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0xe7f2b79024f1083cL);
+ 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, 0xc38160c9d0801ff8L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0xc38160c9d0801ff8L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0xc38160c9d0801ff8L);
+ 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, 0x3e4c5c80e2ef700cL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x3e4c5c80e2ef700cL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x3e4c5c80e2ef700cL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xf2e6b2dcac869df0L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0xf2e6b2dcac869df0L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0xf2e6b2dcac869df0L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x6d7975f06ef96e8L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x6d7975f06ef96e8L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x6d7975f06ef96e8L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x1ac87be161588fe0L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x1ac87be161588fe0L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x1ac87be161588fe0L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x9f1500ec34baf9b0L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x9f1500ec34baf9b0L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x9f1500ec34baf9b0L);
+ 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, 0xf0d1159ef106aeccL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xf0d1159ef106aeccL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xf0d1159ef106aeccL);
+ 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, 0x962a2573e2047118L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x962a2573e2047118L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x962a2573e2047118L);
+ 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, 0x3b833548d3023364L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x3b833548d3023364L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x3b833548d3023364L);
+ 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, 0x3473de1b3a9276e0L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x3473de1b3a9276e0L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x3473de1b3a9276e0L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xdf54b9e16f8b3808L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xdf54b9e16f8b3808L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xdf54b9e16f8b3808L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xa822d68e7a0f8e90L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xa822d68e7a0f8e90L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xa822d68e7a0f8e90L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x70f0f33b8493e518L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x70f0f33b8493e518L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x70f0f33b8493e518L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xf74149017b2ad71cL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xf74149017b2ad71cL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xf74149017b2ad71cL);
+ 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, 0x679a7725410134d0L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x679a7725410134d0L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x679a7725410134d0L);
+ 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, 0xd7f3a54906d79284L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xd7f3a54906d79284L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0xd7f3a54906d79284L);
+ 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, 0xb1bb06dfce29d93eL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xb1bb06dfce29d93eL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xb1bb06dfce29d93eL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x32cfcc5aa7763cf4L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x32cfcc5aa7763cf4L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x32cfcc5aa7763cf4L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xb3e491d580c2a0aaL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xb3e491d580c2a0aaL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0xb3e491d580c2a0aaL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x49ccdb9db709f6b4L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x49ccdb9db709f6b4L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x49ccdb9db709f6b4L);
+ 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, 0xcae1a11890565a6aL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0xcae1a11890565a6aL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0xcae1a11890565a6aL);
+ 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, 0x4bf6669369a2be20L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x4bf6669369a2be20L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x4bf6669369a2be20L);
+ 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, 0x9a431f7ce1e10402L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x9a431f7ce1e10402L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x9a431f7ce1e10402L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xe0533d88d33946deL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xe0533d88d33946deL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xe0533d88d33946deL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x26635b94c49189baL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x26635b94c49189baL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x26635b94c49189baL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x7a141f41910a8976L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x7a141f41910a8976L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x7a141f41910a8976L);
+ 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, 0xce773446a59095f4L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xce773446a59095f4L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xce773446a59095f4L);
+ 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, 0x22da494bba16a272L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x22da494bba16a272L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x22da494bba16a272L);
+ 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, 0xf3ff6ba92a95af9cL);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xf3ff6ba92a95af9cL);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xf3ff6ba92a95af9cL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x645899ccf06c0d50L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x645899ccf06c0d50L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0x645899ccf06c0d50L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xd4b1c7f0b6426b04L);
+ Allocation inMinValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xd4b1c7f0b6426b04L);
+ Allocation inMaxValue = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xd4b1c7f0b6426b04L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Input inMinValue: %x", args.inMinValue));
+ message.append("\n");
+ message.append(String.format("Input inMaxValue: %x", args.inMaxValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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..7b7dfb7
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestClz.java
@@ -0,0 +1,1407 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x4027c06bce499b9cL);
+ 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, 0x5f1c0cd1b86413c0L);
+ 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, 0x5f1c1773176bd8b4L);
+ 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, 0x5f1c221476739da8L);
+ 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, 0x1e8a89bd939a7c6cL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x965dc58989efa952L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x965f8ea4800aca30L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x966157bf7625eb0eL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xc23bfb32ff57e80L);
+ 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, 0xadf7c7bf62fe59acL);
+ 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, 0xadf990da59197a8aL);
+ 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, 0xadfb59f54f349b68L);
+ 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, 0xa6a82b331bf5ea72L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xa9eb9eaae6cf28a4L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xaa3866323d2ab9d0L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xaa852db993864afcL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x136b4d1a7cf62a04L);
+ 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, 0x41ffde6a49a000a2L);
+ 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, 0x41ffdea9934810d8L);
+ 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, 0x41ffdee8dcf0210eL);
+ 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, 0x45901bd5c6e2ce1cL);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x6dd792002fe754c0L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x6dd79ca18eef19b4L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x6dd7a742edf6dea8L);
+ 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: %x", args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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..9aaedea
--- /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, 0xad9a2981b90cee7dL);
+ 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, 0x77081cba471a9bb8L);
+ 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, 0x40760ff2d52848f3L);
+ 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, 0xb07a652a8d1df9bdL);
+ 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, 0x79e858631b2ba6f8L);
+ 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, 0x43564b9ba9395433L);
+ 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, 0x924ef7cca0caa94eL);
+ 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, 0x5bbceb052ed85689L);
+ 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, 0x252ade3dbce603c4L);
+ 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, 0x28db33046c18ecc1L);
+ 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, 0xf249263cfa2699fcL);
+ 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, 0xbbb7197588344737L);
+ 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, 0x178fd43dba1a6a1cL);
+ 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, 0xe0fdc77648281757L);
+ 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, 0xaa6bbaaed635c492L);
+ 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, 0xb9feee147e1725caL);
+ 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, 0x836ce14d0c24d305L);
+ 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, 0x4cdad4859a328040L);
+ 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, 0xcb27983013629afdL);
+ 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, 0x94958b68a1704838L);
+ 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, 0x5e037ea12f7df573L);
+ 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, 0x67c9e452c2fc5b9L);
+ 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, 0x9c8a41b0e8da438eL);
+ 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, 0x3297e51ca584c163L);
+ 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, 0x3ff06247353eaf9L);
+ 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, 0x9a0ca9902ffe68ceL);
+ 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, 0x301a4cfbeca8e6a3L);
+ 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, 0x3fee1bf576ccbe12L);
+ 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, 0xd5fbbf6133773be7L);
+ 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, 0x6c0962ccf021b9bcL);
+ 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, 0x5dc768a0df6521dL);
+ 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, 0x9bea19f5caa0cff2L);
+ 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, 0x31f7bd61874b4dc7L);
+ 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, 0x170520a5a341c750L);
+ 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, 0xad12c4115fec4525L);
+ 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, 0x4320677d1c96c2faL);
+ 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, 0x1e9598256861c26eL);
+ 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, 0xb4a33b91250c4043L);
+ 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, 0x4ab0defce1b6be18L);
+ 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, 0x6d5f9e9b62825639L);
+ 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, 0x36d42071f2cd40eL);
+ 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, 0x997ae572dbd751e3L);
+ 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, 0xa4eee6243d074207L);
+ 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, 0x6e5cd95ccb14ef42L);
+ 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, 0x37cacc9559229c7dL);
+ 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, 0xa7cf21cd11184d47L);
+ 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, 0x713d15059f25fa82L);
+ 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, 0x3aab083e2d33a7bdL);
+ 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, 0x89a3b46f24c4fcd8L);
+ 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, 0x5311a7a7b2d2aa13L);
+ 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, 0x1c7f9ae040e0574eL);
+ 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, 0x202fefa6f013404bL);
+ 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, 0xe99de2df7e20ed86L);
+ 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, 0xb30bd6180c2e9ac1L);
+ 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, 0xee490e03e14bda6L);
+ 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, 0xd8528418cc226ae1L);
+ 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, 0xa1c077515a30181cL);
+ 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, 0xb153aab702117954L);
+ 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, 0x7ac19def901f268fL);
+ 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, 0x442f91281e2cd3caL);
+ 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, 0xc27c54d2975cee87L);
+ 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, 0x8bea480b256a9bc2L);
+ 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, 0x55583b43b37848fdL);
+ 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, 0x35de3665a83b1aa5L);
+ 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, 0xff4c299e3648c7e0L);
+ 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, 0xc8ba1cd6c456751bL);
+ 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, 0x38be720e7c4c25e5L);
+ 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, 0x22c65470a59d320L);
+ 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, 0xcb9a587f9867805bL);
+ 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, 0x1a9304b08ff8d576L);
+ 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, 0xe400f7e91e0682b1L);
+ 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, 0xad6eeb21ac142fecL);
+ 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, 0xb11f3fe85b4718e9L);
+ 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, 0x7a8d3320e954c624L);
+ 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, 0x43fb26597762735fL);
+ 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, 0x9fd3e121a9489644L);
+ 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, 0x6941d45a3756437fL);
+ 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, 0x32afc792c563f0baL);
+ 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, 0x4242faf86d4551f2L);
+ 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, 0xbb0ee30fb52ff2dL);
+ 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, 0xd51ee1698960ac68L);
+ 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, 0x536ba5140290c725L);
+ 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, 0x1cd9984c909e7460L);
+ 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, 0xe6478b851eac219bL);
+ 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, 0xac98b52d16ff9185L);
+ 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, 0xaf78f5d329ced972L);
+ 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, 0xb25936793c9e215fL);
+ 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, 0x72279b90c619d2c5L);
+ 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, 0x7507dc36d8e91ab2L);
+ 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, 0x77e81cdcebb8629fL);
+ 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, 0x8a7eb030e059e10eL);
+ 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, 0x8d5ef0d6f32928fbL);
+ 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, 0x903f317d05f870e8L);
+ 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, 0xe556662c489f0aa9L);
+ 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, 0xe836a6d25b6e5296L);
+ 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, 0xeb16e7786e3d9a83L);
+ 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, 0xfbf6dd10b16170ecL);
+ 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, 0xfed71db6c430b8d9L);
+ 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, 0x1b75e5cd70000c6L);
+ 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, 0x30687d3e3dc8fcaaL);
+ 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, 0x3348bde450984497L);
+ 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, 0x3628fe8a63678c84L);
+ 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, 0x1f1d1e778bca7a05L);
+ 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, 0x21fd5f1d9e99c1f2L);
+ 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, 0x24dd9fc3b16909dfL);
+ 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, 0xb68131e53287f557L);
+ 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, 0xdb2da3cdedc112aL);
+ 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, 0x64e482948b302cfdL);
+ 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, 0xa694c98ec8ee0497L);
+ 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, 0xfdc671e67542206aL);
+ 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, 0x54f81a3e21963c3dL);
+ 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, 0x1987a008992a4f78L);
+ 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, 0x70b94860457e6b4bL);
+ 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, 0xc7eaf0b7f1d2871eL);
+ 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, 0xea0248fed93660dbL);
+ 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, 0x4133f156858a7caeL);
+ 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, 0x986599ae31de9881L);
+ 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, 0x38cc4f74d356f4a6L);
+ 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, 0x8ffdf7cc7fab1079L);
+ 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, 0xe72fa0242bff2c4cL);
+ 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, 0x3d181f56d9ad3ab4L);
+ 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, 0x9449c7ae86015687L);
+ 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, 0xeb7b70063255725aL);
+ 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, 0x637d068f43ba89d7L);
+ 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, 0xbaaeaee6f00ea5aaL);
+ 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, 0x11e0573e9c62c17dL);
+ 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, 0x203b5792acf9c8b9L);
+ 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, 0xb648fafe69a4468eL);
+ 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, 0x4c569e6a264ec463L);
+ 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, 0x1dbdbf71f41dedf9L);
+ 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, 0xb3cb62ddb0c86bceL);
+ 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, 0x49d906496d72e9a3L);
+ 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, 0x59acd542f796c112L);
+ 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, 0xefba78aeb4413ee7L);
+ 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, 0x85c81c1a70ebbcbcL);
+ 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, 0x1f9b2fd78ec0551dL);
+ 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, 0xb5a8d3434b6ad2f2L);
+ 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, 0x4bb676af081550c7L);
+ 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, 0x30c3d9f3240bca50L);
+ 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, 0xc6d17d5ee0b64825L);
+ 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, 0x5cdf20ca9d60c5faL);
+ 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, 0x38545172e92bc56eL);
+ 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, 0xce61f4dea5d64343L);
+ 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, 0x646f984a6280c118L);
+ 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, 0x871e57e8e34c5939L);
+ 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, 0x1d2bfb549ff6d70eL);
+ 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, 0xb3399ec05ca154e3L);
+ 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..3506ecf
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCopysign.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x56c2159453321654L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x56c2159453321654L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x647e56a01b19e906L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x647e56a01b19e906L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2dec547a082e24a1L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2dec547a082e24a1L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xf75a5253f542603cL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf75a5253f542603cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..b09affa
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCos.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xe70ae86bb80d3e8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x4bb740670b2b949cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x4bb909820146b57aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x4bbad29cf761d658L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..21aec6a
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCosh.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x372c7d91c7a6f8ceL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x7a1364ce39b5711aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x7a602c559043f664L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x7aacf3dce6d27baeL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..ee979a7
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestCospi.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xc04bfec8bc102da4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd78a84002c1ca960L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe47007bbb60d0cceL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xf1558b773ffd703cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..76c6719
--- /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, 0xdec3726a2862c67fL);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xdec3726a2862c67fL);
+ 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, 0x6b4bc797a4dc8a58L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6b4bc797a4dc8a58L);
+ 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..b8fb925
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestDegrees.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x3325fa50acef6868L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x7a202ebec979f3cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2d56787335d5c4baL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x530aedfa7f13ea38L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..1b44077
--- /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, 0xc59ba39081863ae0L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xc59ba39081863ae0L);
+ 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, 0x5c363077b8636a24L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x5c363077b8636a24L);
+ 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, 0x60e565c07a341ad2L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x60e565c07a341ad2L);
+ 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, 0x65949b093c04cb80L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x65949b093c04cb80L);
+ 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..86effa5
--- /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, 0x84945ebed029514eL);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x84945ebed029514eL);
+ 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, 0x801f9d8e635785faL);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x801f9d8e635785faL);
+ 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, 0xd56f5b47b0c7d224L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd56f5b47b0c7d224L);
+ 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, 0x2abf1900fe381e4eL);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x2abf1900fe381e4eL);
+ 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..349b57d
--- /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, 0xccfbfd30a3950390L);
+ 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, 0x87e26994448c3cb4L);
+ 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, 0x87e432af3aa75d92L);
+ 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, 0x87e5fbca30c27e70L);
+ 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..5dcf598
--- /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, 0xc8c9274758f95db0L);
+ 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, 0x2e992534c3bfa814L);
+ 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, 0x2ee5ecbc1a4e2d5eL);
+ 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, 0x2f32b44370dcb2a8L);
+ 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..74cc2e5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExp.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x45e6c49035f86de0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xdf9c6adc948f89e4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xdf9e33f78aaaaac2L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xdf9ffd1280c5cba0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..c338fbb
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExp10.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkExp10FloatFloat() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x2bee8d30fb6e3cf4L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testExp10FloatFloat(in, out);
+ verifyResultsExp10FloatFloat(in, out, false);
+ } 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);
+ verifyResultsExp10FloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10FloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp10FloatFloat(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.computeExp10(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkExp10FloatFloat" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExp10Float2Float2() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x40a112ee9b69b1d0L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testExp10Float2Float2(in, out);
+ verifyResultsExp10Float2Float2(in, out, false);
+ } 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);
+ verifyResultsExp10Float2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp10Float2Float2(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.computeExp10(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkExp10Float2Float2" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExp10Float3Float3() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x4d8696aa255a153eL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testExp10Float3Float3(in, out);
+ verifyResultsExp10Float3Float3(in, out, false);
+ } 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);
+ verifyResultsExp10Float3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp10Float3Float3(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.computeExp10(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkExp10Float3Float3" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkExp10Float4Float4() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x5a6c1a65af4a78acL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testExp10Float4Float4(in, out);
+ verifyResultsExp10Float4Float4(in, out, false);
+ } 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);
+ verifyResultsExp10Float4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testExp10Float4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsExp10Float4Float4(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.computeExp10(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkExp10Float4Float4" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ 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..ae5e93f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExp2.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xcc41e0fb06bf832eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x418e67f6dea0dffaL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x41db2f7e352f6544L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x4227f7058bbdea8eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..0ac536e
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestExpm1.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xf6e179108f325508L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x152ab4c0de72d2acL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2210387c6863361aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2ef5bc37f2539988L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..ddad4f2
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFabs.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x54edd0bb6d9c05fcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x63650c9dc94a00f0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x63b1d4251fd8863aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x63fe9bac76670b84L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..8530806
--- /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, 0x660a61c75e803475L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x660a61c75e803475L);
+ 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, 0xacdd5d5ec4a0b0a1L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xacdd5d5ec4a0b0a1L);
+ 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, 0x6346a98e6a48f9bbL);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x6346a98e6a48f9bbL);
+ 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, 0x19aff5be0ff142d5L);
+ Allocation inRhs = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x19aff5be0ff142d5L);
+ 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..c05469d
--- /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, 0x3ad9958ac7de281bL);
+ 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, 0x7c5f3a5a75e27579L);
+ 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, 0xa903c2336f9e363aL);
+ 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, 0xd5a84a0c6959f6fbL);
+ 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..f2ff39b
--- /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, 0x876187a43300d11bL);
+ 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, 0xe241260819c81167L);
+ 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, 0xabaf1940a7d5bea1L);
+ 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, 0x751d0c7935e36bdbL);
+ 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..abdae01
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFdim.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x4c289249dc9b7d54L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4c289249dc9b7d54L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xffe7527da8c37cf6L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xffe7527da8c37cf6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2cd8a1ddf90dc301L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x2cd8a1ddf90dc301L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x59c9f13e4958090cL);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x59c9f13e4958090cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..f05d8bb
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFloor.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xd87ca3ec721429f4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x8ee342e98040e0d0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x9bc8c6a50a31443eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa8ae4a609421a7acL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..a75c9e1
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFma.java
@@ -0,0 +1,341 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x5f6b3ee0c34510cL);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5f6b3ee0c34510cL);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5f6b3ee0c34510cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x47b62b8849bc2e24L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x47b62b8849bc2e24L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x47b62b8849bc2e24L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x1d2fcf231c2367c0L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1d2fcf231c2367c0L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1d2fcf231c2367c0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xf2a972bdee8aa15cL);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf2a972bdee8aa15cL);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xf2a972bdee8aa15cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..7a7d0fd
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFmax.java
@@ -0,0 +1,503 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xc9b7c29e8cc68e64L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xc9b7c29e8cc68e64L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x7da6a072aadf5c7eL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x7da6a072aadf5c7eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xaa97efd2fb29a289L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xaa97efd2fb29a289L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd7893f334b73e894L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xd7893f334b73e894L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa9c3f52704a0363cL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa9c3f52704a0363cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xfe270a2c109741b0L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xfe270a2c109741b0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x528a1f311c8e4d24L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x528a1f311c8e4d24L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..9df3c9c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFmin.java
@@ -0,0 +1,503 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xb4de439bf3a81afcL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb4de439bf3a81afcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x24f58c89dd0df54aL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x24f58c89dd0df54aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x51e6dbea2d583b55L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x51e6dbea2d583b55L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x7ed82b4a7da28160L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x7ed82b4a7da28160L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x12dd9b6317a74104L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x12dd9b6317a74104L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6740b068239e4c78L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x6740b068239e4c78L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xbba3c56d2f9557ecL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xbba3c56d2f9557ecL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..42cd913
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFmod.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xb7c844581b41c85cL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb7c844581b41c85cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2e37d088b111e5faL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2e37d088b111e5faL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x5b291fe9015c2c05L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x5b291fe9015c2c05L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x881a6f4951a67210L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x881a6f4951a67210L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..7871d70
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestFract.java
@@ -0,0 +1,584 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x7d97ac1345f88970L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %x %.16f", Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xbd43edfaaa8b52feL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %x %.16f", Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x49cc4328270516d7L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %x %.16f", Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd6549855a37edab0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outFloor: %x %.16f", Float.floatToRawIntBits(args.outFloor), args.outFloor));
+ message.append("\n");
+ message.append(String.format("Actual output outFloor: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x10bc1065ffc3a8bcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd0f9bcd9a7284368L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xdddf40953118a6d6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xeac4c450bb090a44L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..f55d193
--- /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, 0x4c40bc225a45eb6dL);
+ 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, 0xe7a92d375526161L);
+ 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, 0x6fc32b940b05a592L);
+ 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, 0xd10bc454a0b8e9c3L);
+ 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..1319c88
--- /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, 0xfee670a9054637cbL);
+ 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, 0x7eec14d826d57cffL);
+ 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, 0xabdd643876eb9859L);
+ 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, 0xd8ceb398c701b3b3L);
+ 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..5387611
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfRsqrt.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x364b5df5ce928ab9L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x96e20471919816b5L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc3d353d1e1ae320fL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xf0c4a33231c44d69L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..5dfd316
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestHalfSqrt.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x6e356e2297b39ce5L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xaf2d20c82e47a699L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x391fee8302471a7L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x57f6dd0832013cb5L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..419a99d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestHypot.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x793304b19151efd4L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x793304b19151efd4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x54c77f94caa5c9c6L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x54c77f94caa5c9c6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe14fd4c2471f8d9fL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xe14fd4c2471f8d9fL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6dd829efc3995178L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6dd829efc3995178L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..ed58bdc
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestIlogb.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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);
+ }
+
+ public class ArgumentsFloatInt {
+ public float in;
+ public int out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkIlogbFloatInt() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb4601a22fc81377dL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.SIGNED_32, 1), INPUTSIZE);
+ script.forEach_testIlogbFloatInt(in, out);
+ verifyResultsIlogbFloatInt(in, out, false);
+ } 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);
+ verifyResultsIlogbFloatInt(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloatInt: " + e.toString());
+ }
+ }
+
+ private void verifyResultsIlogbFloatInt(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 1];
+ in.copyTo(arrayIn);
+ 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.
+ ArgumentsFloatInt args = new ArgumentsFloatInt();
+ args.in = arrayIn[i];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeIlogb(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 in: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ 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 checkIlogbFloatInt" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkIlogbFloat2Int2() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc9f22a85624b6fb3L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.SIGNED_32, 2), INPUTSIZE);
+ script.forEach_testIlogbFloat2Int2(in, out);
+ verifyResultsIlogbFloat2Int2(in, out, false);
+ } 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);
+ verifyResultsIlogbFloat2Int2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat2Int2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsIlogbFloat2Int2(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 2];
+ in.copyTo(arrayIn);
+ 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.
+ ArgumentsFloatInt args = new ArgumentsFloatInt();
+ args.in = arrayIn[i * 2 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeIlogb(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 in: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ 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 checkIlogbFloat2Int2" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkIlogbFloat3Int3() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xc9f3f3a0612885b9L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.SIGNED_32, 3), INPUTSIZE);
+ script.forEach_testIlogbFloat3Int3(in, out);
+ verifyResultsIlogbFloat3Int3(in, out, false);
+ } 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);
+ verifyResultsIlogbFloat3Int3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat3Int3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsIlogbFloat3Int3(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ 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.
+ ArgumentsFloatInt args = new ArgumentsFloatInt();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeIlogb(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 in: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ 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 checkIlogbFloat3Int3" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkIlogbFloat4Int4() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc9f5bcbb60059bbfL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.SIGNED_32, 4), INPUTSIZE);
+ script.forEach_testIlogbFloat4Int4(in, out);
+ verifyResultsIlogbFloat4Int4(in, out, false);
+ } 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);
+ verifyResultsIlogbFloat4Int4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testIlogbFloat4Int4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsIlogbFloat4Int4(Allocation in, Allocation out, boolean relaxed) {
+ float[] arrayIn = new float[INPUTSIZE * 4];
+ in.copyTo(arrayIn);
+ 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.
+ ArgumentsFloatInt args = new ArgumentsFloatInt();
+ args.in = arrayIn[i * 4 + j];
+ // Figure out what the outputs should have been.
+ CoreMathVerifier.computeIlogb(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 in: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ 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 checkIlogbFloat4Int4" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ 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..12d9275
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLdexp.java
@@ -0,0 +1,503 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x540cf5311e374ac5L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x540cf5311e374ac5L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd5d7362d249470f1L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xd5d7362d249470f1L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x371fceedba47b522L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x371fceedba47b522L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x986867ae4ffaf953L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x986867ae4ffaf953L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x3add64b100463acbL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x3add64b100463acbL);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x902d17c8f773244fL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x902d17c8f773244fL);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe57ccae0eea00dd3L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xe57ccae0eea00dd3L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..7577690
--- /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, 0xa7d45e56e3a725e0L);
+ 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, 0x235324b72e990afaL);
+ 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, 0x3038a872afc642adL);
+ 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, 0x3d1e2c2e30f37a60L);
+ 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..403ec20
--- /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, 0x2978c2583eece3baL);
+ 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, 0x4b4d78396c12d256L);
+ 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, 0x75da98b9977385d0L);
+ 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, 0xa067b939c2d4394aL);
+ 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, 0xa3a72c46b5beab5L);
+ 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, 0x8686208259b8c68dL);
+ 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, 0xddb7c8db7ed53ac8L);
+ 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, 0x34e97134a3f1af03L);
+ 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..88c7e73
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x4176ec542a436d74L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd3cba12c04ddb030L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd3cd6a46faf8d10eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd3cf3361f113f1ecL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..0a7164f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog10.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xd4edd0f31fe0d7e0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xdc51781ddfc441f4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe936fbd969b4a562L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xf61c7f94f3a508d0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..79fed1b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog1p.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xedb31236109908e0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc505d49a821c5cf4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd1eb58560c0cc062L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xded0dc1195fd23d0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..d1e6285
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLog2.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xc071174a7715b3f8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xea8dabb901b9b7bcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xeada734058483d06L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xeb273ac7aed6c250L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..e7b6a0f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestLogb.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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);
+ }
+
+ public class ArgumentsFloatFloat {
+ public float in;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkLogbFloatFloat() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xbf62abc72ae949d8L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testLogbFloatFloat(in, out);
+ verifyResultsLogbFloatFloat(in, out, false);
+ } 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);
+ verifyResultsLogbFloatFloat(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloatFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogbFloatFloat(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.computeLogb(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkLogbFloatFloat" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLogbFloat2Float2() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x49672467d4eddc1cL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testLogbFloat2Float2(in, out);
+ verifyResultsLogbFloat2Float2(in, out, false);
+ } 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);
+ verifyResultsLogbFloat2Float2(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogbFloat2Float2(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.computeLogb(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkLogbFloat2Float2" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLogbFloat3Float3() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x49b3ebef2b7c6166L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testLogbFloat3Float3(in, out);
+ verifyResultsLogbFloat3Float3(in, out, false);
+ } 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);
+ verifyResultsLogbFloat3Float3(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogbFloat3Float3(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.computeLogb(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkLogbFloat3Float3" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkLogbFloat4Float4() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x4a00b376820ae6b0L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testLogbFloat4Float4(in, out);
+ verifyResultsLogbFloat4Float4(in, out, false);
+ } 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);
+ verifyResultsLogbFloat4Float4(in, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testLogbFloat4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsLogbFloat4Float4(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.computeLogb(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkLogbFloat4Float4" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ 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..3f8a434
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMad.java
@@ -0,0 +1,341 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xb3b9b8429c39984L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb3b9b8429c39984L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xb3b9b8429c39984L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x44d6ec3d0f204b7cL);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x44d6ec3d0f204b7cL);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x44d6ec3d0f204b7cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x1a508fd7e1878518L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1a508fd7e1878518L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1a508fd7e1878518L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xefca3372b3eebeb4L);
+ Allocation inB = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xefca3372b3eebeb4L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xefca3372b3eebeb4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inA), args.inA));
+ message.append("\n");
+ message.append(String.format("Input inB: %x %.16f", Float.floatToRawIntBits(args.inB), args.inB));
+ message.append("\n");
+ message.append(String.format("Input inC: %x %.16f", Float.floatToRawIntBits(args.inC), args.inC));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..a7de9f2
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMax.java
@@ -0,0 +1,1874 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x2952d868c2163f4cL);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x2952d868c2163f4cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc6031e7536adf5c6L);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc6031e7536adf5c6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x1a67fc95388bf767L);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1a67fc95388bf767L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6eccdab53a69f908L);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6eccdab53a69f908L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x5f77cf3cb6407362L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x5f77cf3cb6407362L);
+ 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, 0x800f9948853a3119L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x800f9948853a3119L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x920335e143b58d80L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x920335e143b58d80L);
+ 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, 0x8f869c73b9478b37L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0x8f869c73b9478b37L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x773d0d60e43d2a95L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x773d0d60e43d2a95L);
+ 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, 0xcd24e58385f75922L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xcd24e58385f75922L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x94dd090a19e442f0L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x94dd090a19e442f0L);
+ 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, 0xd31d5735b7e9c4c7L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0xd31d5735b7e9c4c7L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x42e9d46b56ecd4caL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0x42e9d46b56ecd4caL);
+ 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, 0xbe3c50e6150b3a81L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0xbe3c50e6150b3a81L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x32815a01bb9de7c3L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x32815a01bb9de7c3L);
+ 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, 0xbd5747860e84f1b0L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0xbd5747860e84f1b0L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xba9188f3788353bfL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0xba9188f3788353bfL);
+ 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, 0x27823555b9c7c668L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x27823555b9c7c668L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x974eb28b58cad66bL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x974eb28b58cad66bL);
+ 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, 0x3e2be9df5df02c18L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0x3e2be9df5df02c18L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x3f66ddfc86732facL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x3f66ddfc86732facL);
+ 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, 0xe30bc76f6d24027fL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0xe30bc76f6d24027fL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xe04608dcd722648eL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0xe04608dcd722648eL);
+ 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, 0x7be71375bba5c809L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0x7be71375bba5c809L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xebb390ab5aa8d80cL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0xebb390ab5aa8d80cL);
+ 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, 0xbe1b82d8a6d51dafL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0xbe1b82d8a6d51dafL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x4c4c61f751487795L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x4c4c61f751487795L);
+ 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, 0x8c04758cbc3134eL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x8c04758cbc3134eL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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..3da47f6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMin.java
@@ -0,0 +1,1874 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xbdad0b0971217378L);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xbdad0b0971217378L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2f1cc4b149b5008eL);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2f1cc4b149b5008eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x8381a2d14b93022fL);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x8381a2d14b93022fL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd7e680f14d7103d0L);
+ Allocation in1 = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xd7e680f14d7103d0L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Input in1: %x %.16f", Float.floatToRawIntBits(args.in1), args.in1));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x78bd3bd20e81b31aL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 1, 0x78bd3bd20e81b31aL);
+ 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, 0x1469cbe934456545L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 1, 0x1469cbe934456545L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x265d6881f2c0c1acL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 1, 0x265d6881f2c0c1acL);
+ 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, 0xf8a042afcc4e95ffL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 1, 0xf8a042afcc4e95ffL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xfb5d72ade703fc11L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0xfb5d72ade703fc11L);
+ 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, 0xe66a5218de3898daL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 1, 0xe66a5218de3898daL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x29373baac8ef771cL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 2, 0x29373baac8ef771cL);
+ 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, 0x3c36fd71caf0cf8fL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 2, 0x3c36fd71caf0cf8fL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0xac037aa769f3df92L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 2, 0xac037aa769f3df92L);
+ 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, 0x2743846f878f68ddL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 2, 0x2743846f878f68ddL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x4bc6c69713df277bL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0x4bc6c69713df277bL);
+ 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, 0x51b17a26bd9025dcL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 2, 0x51b17a26bd9025dcL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x4eebbb94278e87ebL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 3, 0x4eebbb94278e87ebL);
+ 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, 0x909bdb91ccced130L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 3, 0x909bdb91ccced130L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x6858c76bd1e133L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 3, 0x6858c76bd1e133L);
+ 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, 0xa7331d68d0745a74L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 3, 0xa7331d68d0745a74L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x58ac4a91deb46f64L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x58ac4a91deb46f64L);
+ 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, 0x7765fa101c2f36abL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 3, 0x7765fa101c2f36abL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x74a03b7d862d98baL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_8, 4, 0x74a03b7d862d98baL);
+ 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, 0xe500b9b1ceacd2d1L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_8, 4, 0xe500b9b1ceacd2d1L);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x54cd36e76dafe2d4L);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_16, 4, 0x54cd36e76dafe2d4L);
+ 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, 0x2722b66219594c0bL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_16, 4, 0x2722b66219594c0bL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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, 0x6591ce8ca989b74dL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x6591ce8ca989b74dL);
+ 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, 0x9d1a79f97ace477aL);
+ Allocation inV2 = CreateRandomAllocation(mRS, Element.DataType.UNSIGNED_32, 4, 0x9d1a79f97ace477aL);
+ 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: %x", args.inV1));
+ message.append("\n");
+ message.append(String.format("Input inV2: %x", args.inV2));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x", args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %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..5b68f94
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestMix.java
@@ -0,0 +1,560 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x683b1cd71c16e1b4L);
+ Allocation inStop = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x683b1cd71c16e1b4L);
+ Allocation inAmount = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x683b1cd71c16e1b4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %x %.16f", Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %x %.16f", Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc1902b42a420626cL);
+ Allocation inStop = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc1902b42a420626cL);
+ Allocation inAmount = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc1902b42a420626cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %x %.16f", Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %x %.16f", Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x9709cedd76879c08L);
+ Allocation inStop = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9709cedd76879c08L);
+ Allocation inAmount = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9709cedd76879c08L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %x %.16f", Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %x %.16f", Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6c83727848eed5a4L);
+ Allocation inStop = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6c83727848eed5a4L);
+ Allocation inAmount = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x6c83727848eed5a4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %x %.16f", Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %x %.16f", Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x4813e47584a0d66L);
+ Allocation inStop = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x4813e47584a0d66L);
+ Allocation inAmount = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x4813e47584a0d66L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %x %.16f", Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %x %.16f", Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xcdef317fe658f133L);
+ Allocation inStop = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xcdef317fe658f133L);
+ Allocation inAmount = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xcdef317fe658f133L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %x %.16f", Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %x %.16f", Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x975d24b87467d500L);
+ Allocation inStop = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x975d24b87467d500L);
+ Allocation inAmount = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x975d24b87467d500L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inStart), args.inStart));
+ message.append("\n");
+ message.append(String.format("Input inStop: %x %.16f", Float.floatToRawIntBits(args.inStop), args.inStop));
+ message.append("\n");
+ message.append(String.format("Input inAmount: %x %.16f", Float.floatToRawIntBits(args.inAmount), args.inAmount));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..a28b72c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestModf.java
@@ -0,0 +1,348 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x4006bf4f961b14dcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %x %.16f", Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x13001b5d01bf043aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %x %.16f", Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x3ff16abd52094a45L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %x %.16f", Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6ce2ba1da2539050L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Expected output outIret: %x %.16f", Float.floatToRawIntBits(args.outIret), args.outIret));
+ message.append("\n");
+ message.append(String.format("Actual output outIret: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..7883c42
--- /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, 0xbc42cb366a8a32d8L);
+ 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..f433196
--- /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, 0xbb1cf06f49160b0fL);
+ 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, 0x972827bc153e65f3L);
+ 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, 0xc419771c6554814dL);
+ 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, 0xf10ac67cb56a9ca7L);
+ 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..f74eab0
--- /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, 0x1ea468d5c9dc26f5L);
+ 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, 0x1d70d62b016cd7e1L);
+ 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, 0xb85724cd711864ebL);
+ 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, 0x533d736fe0c3f1f5L);
+ 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..3f9621f
--- /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, 0xe8394a67b7f984a1L);
+ 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, 0x2cc4414fb19c221dL);
+ 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, 0xb94c967d2552ba3bL);
+ 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, 0x45d4ebaa99095259L);
+ 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..52c6a70
--- /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, 0xe1bdef5f88d6ab65L);
+ 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, 0x97f97cf88a22a571L);
+ 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, 0xc4eacc58da38c0cbL);
+ 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, 0xf1dc1bb92a4edc25L);
+ 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..fa3d0de
--- /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, 0x6950a7e0e6abc03L);
+ 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, 0x56706e782fd90797L);
+ 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, 0xf156bd1a9f8494a1L);
+ 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, 0x8c3d0bbd0f3021abL);
+ 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..c128ef3
--- /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, 0xe90a9fa42ce5ce9dL);
+ 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, 0x14b4e2f7f4d0f401L);
+ 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, 0xa13d382568878c1fL);
+ 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, 0x2dc58d52dc3e243dL);
+ 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..1c3999e
--- /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, 0x3b156b9fa2feb73bL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x3b156b9fa2feb73bL);
+ 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, 0x155505e172fd0d1fL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x155505e172fd0d1fL);
+ 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, 0xf0e3af1b15c8f920L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xf0e3af1b15c8f920L);
+ 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, 0xcc725854b894e521L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xcc725854b894e521L);
+ 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..6369692
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestNextafter.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x61509de26cb176feL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x61509de26cb176feL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa0ecc3aa86e3feaaL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xa0ecc3aa86e3feaaL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x76666745594a01b3L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x76666745594a01b3L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x4be00ae02bb004bcL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x4be00ae02bb004bcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..5ed3576
--- /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, 0x1eccbdb2ed714b78L);
+ 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, 0x22251f5f5d16001cL);
+ 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, 0x7689fd7f5ef2cb2aL);
+ 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, 0xcaeedb9f60cf9638L);
+ 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..820925c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestPow.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x470aeab183127734L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x470aeab183127734L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xbcd9b7ed561275b6L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xbcd9b7ed561275b6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x113e960d57f07757L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x113e960d57f07757L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x65a3742d59ce78f8L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x65a3742d59ce78f8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..dadd982
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestPown.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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);
+ }
+
+ public class ArgumentsFloatIntFloat {
+ public float inX;
+ public int inY;
+ public float out;
+
+ public int ulf;
+ public int ulfRelaxed;
+ }
+
+ private void checkPownFloatIntFloat() {
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5aab6c366fd179f9L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x5aab6c366fd179f9L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloatIntFloat(inX, out);
+ verifyResultsPownFloatIntFloat(inX, inY, out, false);
+ } 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);
+ verifyResultsPownFloatIntFloat(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloatIntFloat: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPownFloatIntFloat(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.computePown(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkPownFloatIntFloat" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPownFloat2Int2Float2() {
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc87bf6763d9c0b6bL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xc87bf6763d9c0b6bL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloat2Int2Float2(inX, out);
+ verifyResultsPownFloat2Int2Float2(inX, inY, out, false);
+ } 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);
+ verifyResultsPownFloat2Int2Float2(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat2Int2Float2: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPownFloat2Int2Float2(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.computePown(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkPownFloat2Int2Float2" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPownFloat3Int3Float3() {
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x1e18711582944e7eL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x1e18711582944e7eL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloat3Int3Float3(inX, out);
+ verifyResultsPownFloat3Int3Float3(inX, inY, out, false);
+ } 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);
+ verifyResultsPownFloat3Int3Float3(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat3Int3Float3: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPownFloat3Int3Float3(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.computePown(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkPownFloat3Int3Float3" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ private void checkPownFloat4Int4Float4() {
+ Allocation inX = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x73b4ebb4c78c9191L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x73b4ebb4c78c9191L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.set_gAllocInY(inY);
+ script.forEach_testPownFloat4Int4Float4(inX, out);
+ verifyResultsPownFloat4Int4Float4(inX, inY, out, false);
+ } 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);
+ verifyResultsPownFloat4Int4Float4(inX, inY, out, true);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testPownFloat4Int4Float4: " + e.toString());
+ }
+ }
+
+ private void verifyResultsPownFloat4Int4Float4(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.computePown(args);
+ int ulf = relaxed ? args.ulfRelaxed : 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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 checkPownFloat4Int4Float4" + (relaxed ? "_relaxed" : "") + ":\n" + message.toString(), valid);
+ }
+ }
+ }
+ }
+
+ 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..e0e0721
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestPowr.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x5d7e04a79f1f7094L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5d7e04a79f1f7094L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x6c7587d1080d6296L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x6c7587d1080d6296L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x9966d7315857a8a1L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x9966d7315857a8a1L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc6582691a8a1eeacL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xc6582691a8a1eeacL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..4605b05
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRadians.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xaa72f23429911decL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xb28bd93e3e0b3578L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd8404ec587495af6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xfdf4c44cd0878074L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inValue), args.inValue));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..b99eba8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRemainder.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xa59164b80fbf665eL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xa59164b80fbf665eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xf642b6dc30d666aL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xf642b6dc30d666aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe4ddcf0895736973L);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xe4ddcf0895736973L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xba5772a367d96c7cL);
+ Allocation inY = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xba5772a367d96c7cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inX), args.inX));
+ message.append("\n");
+ message.append(String.format("Input inY: %x %.16f", Float.floatToRawIntBits(args.inY), args.inY));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..d29460c
--- /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, 0x5d326c1d386b6633L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x5d326c1d386b6633L);
+ 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, 0x2c64ad3c01961703L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2c64ad3c01961703L);
+ 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, 0x321381362dbef267L);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x321381362dbef267L);
+ 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, 0x37c2553059e7cdcbL);
+ Allocation inC = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x37c2553059e7cdcbL);
+ 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..bf6d8c0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRint.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xffa8902f1585a2a6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x8235d6f524cf5b12L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x82829e7c7b5de05cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x82cf6603d1ec65a6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..705681b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRootn.java
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x23719c39f90920b3L);
+ Allocation inN = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 1, 0x23719c39f90920b3L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xcee7d7b0a41598e5L);
+ Allocation inN = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 2, 0xcee7d7b0a41598e5L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x3030707139c8dd16L);
+ Allocation inN = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 3, 0x3030707139c8dd16L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x91790931cf7c2147L);
+ Allocation inN = CreateRandomAllocation(mRS, Element.DataType.SIGNED_32, 4, 0x91790931cf7c2147L);
+ 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: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..d9d2839
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRound.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 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);
+ }
+
+ private void checkRoundFloatFloat() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xd10a68ecd7487ffcL);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 1), INPUTSIZE);
+ script.forEach_testRoundFloatFloat(in, out);
+ } 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);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloatFloat: " + e.toString());
+ }
+ }
+
+ private void checkRoundFloat2Float2() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0xc6d722b2b4d30328L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 2), INPUTSIZE);
+ script.forEach_testRoundFloat2Float2(in, out);
+ } 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);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat2Float2: " + e.toString());
+ }
+ }
+
+ private void checkRoundFloat3Float3() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0xd3bca66e3ec36696L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 3), INPUTSIZE);
+ script.forEach_testRoundFloat3Float3(in, out);
+ } 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);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat3Float3: " + e.toString());
+ }
+ }
+
+ private void checkRoundFloat4Float4() {
+ Allocation in = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0xe0a22a29c8b3ca04L);
+ try {
+ Allocation out = Allocation.createSized(mRS, GetElement(mRS, Element.DataType.FLOAT_32, 4), INPUTSIZE);
+ script.forEach_testRoundFloat4Float4(in, out);
+ } 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);
+ } catch (Exception e) {
+ throw new RSRuntimeException("RenderScript. Can't invoke forEach_testRoundFloat4Float4: " + e.toString());
+ }
+ }
+
+ 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..fa8ee8b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestRsqrt.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x8ca74b68a491938cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd6f6f2e04764ba58L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe3dc769bd1551dc6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xf0c1fa575b458134L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..788e91c8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSign.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x30b79bee1f41a066L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd7e1adc26ae1cdd2L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd82e7549c170531cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd87b3cd117fed866L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..4188610
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSin.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x983d81dfe34064a4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x9419bf571e8d2580L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x941b887214a8465eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x941d518d0ac3673cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..b220730
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSincos.java
@@ -0,0 +1,348 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xef9ac07a1196580L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %x %.16f", Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe141d3be7ba8ff8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %x %.16f", Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa8fa6bdfd02e756bL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %x %.16f", Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x43e0ba83b8a25adeL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output outCosptr: %x %.16f", Float.floatToRawIntBits(args.outCosptr), args.outCosptr));
+ message.append("\n");
+ message.append(String.format("Actual output outCosptr: %x %.16f", 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: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..4165d8d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSinh.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x7f8efc81db1b542cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x497a38ca323ced60L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x49c7005188cb72aaL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x4a13c7d8df59f7f4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..4f0f738
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSinpi.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x8fb2d2c4b7bfac68L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xd53b9ae5aef4d3ccL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe2211ea138e5373aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xef06a25cc2d59aa8L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..6af0df5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestSqrt.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x35fbf47d04f9fd2cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe2854ddb99c94260L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe2d21562f057c7aaL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xe31edcea46e64cf4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..1673ce0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestStep.java
@@ -0,0 +1,503 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x64760a408fce32cL);
+ Allocation inV = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x64760a408fce32cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x2d7901ef68828e62L);
+ Allocation inV = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 2, 0x2d7901ef68828e62L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x5a6a514fb8ccd46dL);
+ Allocation inV = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 3, 0x5a6a514fb8ccd46dL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x875ba0b009171a78L);
+ Allocation inV = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 4, 0x875ba0b009171a78L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x13104ac4b5bf8394L);
+ Allocation inV = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x13104ac4b5bf8394L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0x67735fc9c1b68f08L);
+ Allocation inV = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0x67735fc9c1b68f08L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xbbd674cecdad9a7cL);
+ Allocation inV = CreateRandomAllocation(mRS, Element.DataType.FLOAT_32, 1, 0xbbd674cecdad9a7cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.inEdge), args.inEdge));
+ message.append("\n");
+ message.append(String.format("Input inV: %x %.16f", Float.floatToRawIntBits(args.inV), args.inV));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..884bec6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTan.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x4222fe257bb55d00L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xae985201433885c4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xae9a1b1c3953a6a2L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xae9be4372f6ec780L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..11e6251
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTanh.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x9a0d8f2bffc7ab5aL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa5ab87ad0bddbf36L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa5f84f34626c4480L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa64516bbb8fac9caL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..68f2e72
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTanpi.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0xebe421a79189f78cL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xb55e5f5b82890658L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xc243e3170c7969c6L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xcf2966d29669cd34L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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..7692717
--- /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, 0x321eee2f0950016aL);
+ 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, 0xc380189b2ad6cf46L);
+ 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, 0xee0d391b563782c0L);
+ 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, 0x189a599b8198363aL);
+ 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..2b779f5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TestTrunc.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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, 0x8ba85e54879df7e4L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xa5b89c9842b3da20L);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xb29e2053cca43d8eL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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, 0xbf83a40f5694a0fcL);
+ 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: %x %.16f", Float.floatToRawIntBits(args.in), args.in));
+ message.append("\n");
+ message.append(String.format("Expected output out: %x %.16f", Float.floatToRawIntBits(args.out), args.out));
+ message.append("\n");
+ message.append(String.format("Actual output out: %x %.16f", 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/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/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..797a7fb
--- /dev/null
+++ b/tests/tests/util/src/android/util/cts/JsonReaderTest.java
@@ -0,0 +1,945 @@
+/*
+ * 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());
+ }
+
+ /**
+ * This test fails because there's no double for 9223372036854775806, and
+ * our long parsing uses Double.parseDouble() for fractional values.
+ */
+ public void testHighPrecisionLong() throws IOException {
+ String json = "[9223372036854775806.000]";
+ JsonReader reader = new JsonReader(new StringReader(json));
+ reader.beginArray();
+ assertEquals(9223372036854775806L, 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/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/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/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java
index e972640..0ebdeea 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/VMHostTest.java
@@ -33,6 +33,7 @@
public class VMHostTest extends JarHostTest {
private static final String VM_TEST_TEMP_DIR = "/data/local/tmp/vm-tests";
+ private static final String EMULATOR_TEMP_DIR = "/data/local/tmp";
/**
* {@inheritDoc}
@@ -66,7 +67,7 @@
CLog.d("Creating device temp directory, including dalvik-cache.");
createRemoteDir(device, VM_TEST_TEMP_DIR + "/dalvik-cache" );
try {
- File localTmpDir = FileUtil.createTempDir("cts-vm", new File("/tmp/"));
+ File localTmpDir = FileUtil.createTempDir("cts-vm", new File(System.getProperty("java.io.tmpdir")));
CLog.d("Creating host temp dir %s", localTmpDir.getPath());
File jarFile = new File(ctsBuild.getTestCasesDir(), getJarFileName());
if (!jarFile.exists()) {
@@ -119,11 +120,10 @@
if (device.doesFileExist(remoteFilePath)) {
return;
}
- File f = new File(remoteFilePath);
- String parentPath = f.getParent();
- if (parentPath != null) {
- createRemoteDir(device, parentPath);
+ if (!(device.doesFileExist(EMULATOR_TEMP_DIR))) {
+ CLog.e("Error: Can not found the /data/local/tmp directory!!!");
}
+ device.executeShellCommand(String.format("mkdir %s", VM_TEST_TEMP_DIR));
device.executeShellCommand(String.format("mkdir %s", remoteFilePath));
}
}
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')