1//===-- call_apsr.S - Helpers for ARM EABI floating point tests -----------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements helpers for ARM EABI floating point tests for the
11// compiler_rt library.
12//
13//===----------------------------------------------------------------------===//
14
15#include "../../../../lib/builtins/assembly.h"
16
17.syntax unified
18// __attribute__((pcs("aapcs")))
19// int32_t call_apsr_d(double a, double b, void(*fn)(double, double)) {
20//   fn(a, b);
21//   return apsr;
22// }
23
24DEFINE_COMPILERRT_PRIVATE_FUNCTION(call_apsr_d)
25    push {lr}
26    ldr ip, [sp, #4]
27    blx ip
28    mrs r0, apsr
29    pop {pc}
30END_COMPILERRT_FUNCTION(call_apsr_d)
31
32// __attribute__((pcs("aapcs")))
33// int32_t call_apsr_f(float a, float b, void(*fn)(float, float)) {
34//   fn(a, b);
35//   return apsr;
36// }
37
38DEFINE_COMPILERRT_PRIVATE_FUNCTION(call_apsr_f)
39    push {lr}
40    blx r2
41    mrs r0, apsr
42    pop {pc}
43END_COMPILERRT_FUNCTION(call_apsr_f)
44