]>
git.proxmox.com Git - rustc.git/blob - src/compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c
1 //===-- aeabi_cdcmpeq.c - Test __aeabi_cdcmpeq ----------------------------===//
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_cdcmpeq for the compiler_rt library.
12 //===----------------------------------------------------------------------===//
20 #include "call_apsr.h"
22 extern __attribute__((pcs("aapcs"))) void __aeabi_cdcmpeq(double a
, double b
);
24 int test__aeabi_cdcmpeq(double a
, double b
, int expected
)
26 uint32_t cpsr_value
= call_apsr_d(a
, b
, __aeabi_cdcmpeq
);
27 union cpsr cpsr
= { .value
= cpsr_value
};
28 if (expected
!= cpsr
.flags
.z
) {
29 printf("error in __aeabi_cdcmpeq(%f, %f) => Z = %d, expected %d\n",
30 a
, b
, cpsr
.flags
.z
, expected
);
40 if (test__aeabi_cdcmpeq(1.0, 1.0, 1))
42 if (test__aeabi_cdcmpeq(1234.567, 765.4321, 0))
44 if (test__aeabi_cdcmpeq(-123.0, -678.0, 0))
46 if (test__aeabi_cdcmpeq(0.0, -0.0, 1))
48 if (test__aeabi_cdcmpeq(1.0, NAN
, 0))
50 if (test__aeabi_cdcmpeq(NAN
, 1.0, 0))
52 if (test__aeabi_cdcmpeq(NAN
, NAN
, 0))
54 if (test__aeabi_cdcmpeq(INFINITY
, 1.0, 0))
56 if (test__aeabi_cdcmpeq(0.0, INFINITY
, 0))
58 if (test__aeabi_cdcmpeq(-INFINITY
, 0.0, 0))
60 if (test__aeabi_cdcmpeq(0.0, -INFINITY
, 0))
62 if (test__aeabi_cdcmpeq(INFINITY
, INFINITY
, 1))
64 if (test__aeabi_cdcmpeq(-INFINITY
, -INFINITY
, 1))