1 // REQUIRES: arm-target-arch || armv6m-target-arch
2 // RUN: %arm_call_apsr -o %t.aspr.o
3 // RUN: %clang_builtins %s %t.aspr.o %librt -o %t && %run %t
4 //===-- aeabi_cdcmpeq.c - Test __aeabi_cdcmpeq ----------------------------===//
6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7 // See https://llvm.org/LICENSE.txt for license information.
8 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10 //===----------------------------------------------------------------------===//
12 // This file tests __aeabi_cdcmpeq for the compiler_rt library.
14 //===----------------------------------------------------------------------===//
22 #include "call_apsr.h"
24 extern __attribute__((pcs("aapcs"))) void __aeabi_cdcmpeq(double a
, double b
);
26 int test__aeabi_cdcmpeq(double a
, double b
, int expected
)
28 uint32_t cpsr_value
= call_apsr_d(a
, b
, __aeabi_cdcmpeq
);
29 union cpsr cpsr
= { .value
= cpsr_value
};
30 if (expected
!= cpsr
.flags
.z
) {
31 printf("error in __aeabi_cdcmpeq(%f, %f) => Z = %d, expected %d\n",
32 a
, b
, cpsr
.flags
.z
, expected
);
42 if (test__aeabi_cdcmpeq(1.0, 1.0, 1))
44 if (test__aeabi_cdcmpeq(1234.567, 765.4321, 0))
46 if (test__aeabi_cdcmpeq(-123.0, -678.0, 0))
48 if (test__aeabi_cdcmpeq(0.0, -0.0, 1))
50 if (test__aeabi_cdcmpeq(1.0, NAN
, 0))
52 if (test__aeabi_cdcmpeq(NAN
, 1.0, 0))
54 if (test__aeabi_cdcmpeq(NAN
, NAN
, 0))
56 if (test__aeabi_cdcmpeq(INFINITY
, 1.0, 0))
58 if (test__aeabi_cdcmpeq(0.0, INFINITY
, 0))
60 if (test__aeabi_cdcmpeq(-INFINITY
, 0.0, 0))
62 if (test__aeabi_cdcmpeq(0.0, -INFINITY
, 0))
64 if (test__aeabi_cdcmpeq(INFINITY
, INFINITY
, 1))
66 if (test__aeabi_cdcmpeq(-INFINITY
, -INFINITY
, 1))