/none/tests/arm64/fmadd_sub
/none/tests/arm64/fp_and_simd
/none/tests/arm64/fp_and_simd_v82
+/none/tests/arm64/frinta_frintn
/none/tests/arm64/ldxp_stxp
/none/tests/arm64/integer
/none/tests/arm64/memory_test
crc32.stdout.exp crc32.stderr.exp crc32.vgtest \
cvtf_imm.stdout.exp cvtf_imm.stderr.exp cvtf_imm.vgtest \
fp_and_simd.stdout.exp fp_and_simd.stderr.exp fp_and_simd.vgtest \
+ frinta_frintn.stderr.exp frinta_frintn.vgtest \
integer.stdout.exp integer.stderr.exp integer.vgtest \
memory_test.stdout.exp memory_test.stderr.exp memory_test.vgtest \
memory_test.stdout.exp-clang \
check_PROGRAMS += fp_and_simd_v82
endif
+if HAVE_CXX17
+ check_PROGRAMS += frinta_frintn
+endif
+
if BUILD_ARMV82_DOTPROD_TESTS
check_PROGRAMS += simd_dotprod
endif
simd_dotprod_CFLAGS = $(AM_CFLAGS) -march=armv8.2-a+dotprod
fp_and_simd_CFLAGS = $(AM_CFLAGS) -march=armv8-a+crypto
fp_and_simd_v82_CFLAGS = $(AM_CFLAGS) -march=armv8.2-a+fp16+crypto
+frinta_frintn_SOURCES = frinta_frintn.cpp
+frinta_frintn_CXXFLAGS = ${AM_CXXFLAGS} -std=c++17
integer_CFLAGS = $(AM_CFLAGS) -g -O0 -DTEST_BFM=0
fp_and_simd_LDADD = -lm
--- /dev/null
+/*
+ * An extra testcase for bug484426
+ * The testcase supplied only tests single precision frinta
+ */
+
+#include <type_traits>
+#include <cassert>
+
+template<typename T>
+void test_frinta(T input, T expected)
+{
+ T result;
+ T* rp(&result);
+ T* ip(&input);
+ if constexpr (std::is_same_v<double, T> == true)
+ {
+ __asm__ __volatile__(
+ "ldr d0, [%1];\n"
+ "frinta d0, d0;\n"
+ "str d0, [%0];\n"
+ : "+rm" (rp)
+ : "r" (ip)
+ : "memory", "d0");
+ assert(result == expected);
+ }
+ else
+ {
+ __asm__ __volatile__(
+ "ldr s0, [%1];\n"
+ "frinta s0, s0;\n"
+ "str s0, [%0];\n"
+ : "+rm" (rp)
+ : "r" (ip)
+ : "memory", "s0");
+ assert(result == expected);
+ }
+}
+
+template<typename T>
+void test_frintn(T input, T expected)
+{
+ T result;
+ T* rp(&result);
+ T* ip(&input);
+ if constexpr (std::is_same_v<double, T> == true)
+ {
+ __asm__ __volatile__(
+ "ldr d0, [%1];\n"
+ "frintn d0, d0;\n"
+ "str d0, [%0];\n"
+ : "+rm" (rp)
+ : "r" (ip)
+ : "memory", "d0");
+ assert(result == expected);
+ }
+ else
+ {
+ __asm__ __volatile__(
+ "ldr s0, [%1];\n"
+ "frintn s0, s0;\n"
+ "str s0, [%0];\n"
+ : "+rm" (rp)
+ : "r" (ip)
+ : "memory", "s0");
+ assert(result == expected);
+ }
+}
+
+int main()
+{
+ // round "away from zero"
+ test_frinta(1.5, 2.0);
+ test_frinta(2.5, 3.0);
+ test_frinta(-1.5, -2.0);
+ test_frinta(-2.5, -3.0);
+ test_frinta(1.5F, 2.0F);
+ test_frinta(2.5F, 3.0F);
+ test_frinta(-1.5F, -2.0F);
+ test_frinta(-2.5F, -3.0F);
+
+ // round "to even"
+ test_frintn(1.5, 2.0);
+ test_frintn(2.5, 2.0);
+ test_frintn(-1.5, -2.0);
+ test_frintn(-2.5, -2.0);
+ test_frintn(1.5F, 2.0F);
+ test_frintn(2.5F, 2.0F);
+ test_frintn(-1.5F, -2.0F);
+ test_frintn(-2.5F, -2.0F);
+}
+