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_cfcmpeq.c - Test __aeabi_cfcmpeq ----------------------------===//
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_cfcmpeq for the compiler_rt library.
14 //===----------------------------------------------------------------------===//
22 #include "call_apsr.h"
24 extern __attribute__((pcs("aapcs"))) void __aeabi_cfcmpeq(float a
, float b
);
26 int test__aeabi_cfcmpeq(float a
, float b
, int expected
)
28 uint32_t cpsr_value
= call_apsr_f(a
, b
, __aeabi_cfcmpeq
);
29 union cpsr cpsr
= { .value
= cpsr_value
};
30 if (expected
!= cpsr
.flags
.z
) {
31 printf("error in __aeabi_cfcmpeq(%f, %f) => Z = %d, expected %d\n",
32 a
, b
, cpsr
.flags
.z
, expected
);
42 if (test__aeabi_cfcmpeq(1.0, 1.0, 1))
44 if (test__aeabi_cfcmpeq(1234.567, 765.4321, 0))
46 if (test__aeabi_cfcmpeq(-123.0, -678.0, 0))
48 if (test__aeabi_cfcmpeq(0.0, -0.0, 1))
50 if (test__aeabi_cfcmpeq(1.0, NAN
, 0))
52 if (test__aeabi_cfcmpeq(NAN
, 1.0, 0))
54 if (test__aeabi_cfcmpeq(NAN
, NAN
, 0))
56 if (test__aeabi_cfcmpeq(INFINITY
, 1.0, 0))
58 if (test__aeabi_cfcmpeq(0.0, INFINITY
, 0))
60 if (test__aeabi_cfcmpeq(-INFINITY
, 0.0, 0))
62 if (test__aeabi_cfcmpeq(0.0, -INFINITY
, 0))
64 if (test__aeabi_cfcmpeq(INFINITY
, INFINITY
, 1))
66 if (test__aeabi_cfcmpeq(-INFINITY
, -INFINITY
, 1))