1 // REQUIRES: arm-target-arch || armv6m-target-arch
2 // RUN: %clang_builtins %s %librt -o %t && %run %t
3 //===-- aeabi_frsub.c - Test __aeabi_frsub --------------------------------===//
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //===----------------------------------------------------------------------===//
11 // This file tests __aeabi_frsub for the compiler_rt library.
13 //===----------------------------------------------------------------------===//
21 extern __attribute__((pcs("aapcs"))) float __aeabi_frsub(float a
, float b
);
23 int test__aeabi_frsub(float a
, float b
, float expected
)
25 float actual
= __aeabi_frsub(a
, b
);
26 if (actual
!= expected
)
27 printf("error in __aeabi_frsub(%f, %f) = %f, expected %f\n",
28 a
, b
, actual
, expected
);
29 return actual
!= expected
;
36 if (test__aeabi_frsub(1.0, 1.0, 0.0))
38 if (test__aeabi_frsub(1234.567, 765.4321, -469.134900))
40 if (test__aeabi_frsub(-123.0, -678.0, -555.0))
42 if (test__aeabi_frsub(0.0, -0.0, 0.0))