]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/builtins/Unit/arm/aeabi_cfcmpeq_test.c
1 //===-- aeabi_cfcmpeq.c - Test __aeabi_cfcmpeq ----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file tests __aeabi_cfcmpeq for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
20 #include "call_apsr.h"
22 extern __attribute__((pcs("aapcs"))) void __aeabi_cfcmpeq(float a
, float b
);
24 int test__aeabi_cfcmpeq(float a
, float b
, int expected
)
26 uint32_t cpsr_value
= call_apsr_f(a
, b
, __aeabi_cfcmpeq
);
27 union cpsr cpsr
= { .value
= cpsr_value
};
28 if (expected
!= cpsr
.flags
.z
) {
29 printf("error in __aeabi_cfcmpeq(%f, %f) => Z = %d, expected %d\n",
30 a
, b
, cpsr
.flags
.z
, expected
);
40 if (test__aeabi_cfcmpeq(1.0, 1.0, 1))
42 if (test__aeabi_cfcmpeq(1234.567, 765.4321, 0))
44 if (test__aeabi_cfcmpeq(-123.0, -678.0, 0))
46 if (test__aeabi_cfcmpeq(0.0, -0.0, 1))
48 if (test__aeabi_cfcmpeq(1.0, NAN
, 0))
50 if (test__aeabi_cfcmpeq(NAN
, 1.0, 0))
52 if (test__aeabi_cfcmpeq(NAN
, NAN
, 0))
54 if (test__aeabi_cfcmpeq(INFINITY
, 1.0, 0))
56 if (test__aeabi_cfcmpeq(0.0, INFINITY
, 0))
58 if (test__aeabi_cfcmpeq(-INFINITY
, 0.0, 0))
60 if (test__aeabi_cfcmpeq(0.0, -INFINITY
, 0))
62 if (test__aeabi_cfcmpeq(INFINITY
, INFINITY
, 1))
64 if (test__aeabi_cfcmpeq(-INFINITY
, -INFINITY
, 1))