1; RUN: llc -mtriple=aarch64-linux-gnu                                                  -verify-machineinstrs < %s | FileCheck %s
2; RUN: llc -mtriple=aarch64-apple-darwin -code-model=large                             -verify-machineinstrs < %s | FileCheck %s --check-prefix=LARGE
3; RUN: llc -mtriple=aarch64-apple-darwin -code-model=large -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s --check-prefix=LARGE
4
5@varf32 = global float 0.0
6@varf64 = global double 0.0
7
8define void @check_float() {
9; CHECK-LABEL: check_float:
10
11  %val = load float, float* @varf32
12  %newval1 = fadd float %val, 8.5
13  store volatile float %newval1, float* @varf32
14; CHECK-DAG: fmov [[EIGHT5:s[0-9]+]], #8.5
15
16  %newval2 = fadd float %val, 128.0
17  store volatile float %newval2, float* @varf32
18; CHECK-DAG: ldr [[HARD:s[0-9]+]], [{{x[0-9]+}}, {{#?}}:lo12:.LCPI0_0
19
20; CHECK: ret
21  ret void
22}
23
24define void @check_double() {
25; CHECK-LABEL: check_double:
26
27  %val = load double, double* @varf64
28  %newval1 = fadd double %val, 8.5
29  store volatile double %newval1, double* @varf64
30; CHECK-DAG: fmov {{d[0-9]+}}, #8.5
31
32  %newval2 = fadd double %val, 128.0
33  store volatile double %newval2, double* @varf64
34; CHECK-DAG: ldr {{d[0-9]+}}, [{{x[0-9]+}}, {{#?}}:lo12:.LCPI1_0
35
36; CHECK: ret
37  ret void
38}
39
40; LARGE-LABEL: check_float2
41; LARGE:       mov [[REG:w[0-9]+]], #4059
42; LARGE-NEXT:  movk [[REG]], #16457, lsl #16
43; LARGE-NEXT:  fmov s0, [[REG]]
44define float @check_float2() {
45  ret float 3.14159274101257324218750
46}
47
48; LARGE-LABEL: check_double2
49; LARGE:       mov [[REG:x[0-9]+]], #11544
50; LARGE-NEXT:  movk [[REG]], #21572, lsl #16
51; LARGE-NEXT:  movk [[REG]], #8699, lsl #32
52; LARGE-NEXT:  movk [[REG]], #16393, lsl #48
53; LARGE-NEXT:  fmov d0, [[REG]]
54define double @check_double2() {
55  ret double 3.1415926535897931159979634685441851615905761718750
56}
57