1 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-none-linux-gnu -mcpu=cyclone | FileCheck %s
2 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-none-linux-gnu -code-model=large -mcpu=cyclone | FileCheck --check-prefix=CHECK-LARGE %s
3 ; RUN: llc -verify-machineinstrs -o - %s -mtriple=aarch64-none-elf -code-model=tiny -mcpu=cyclone | FileCheck --check-prefix=CHECK-TINY %s
4 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -mattr=-fp-armv8 | FileCheck --check-prefix=CHECK-NOFP %s
5 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -code-model=large -mattr=-fp-armv8 | FileCheck --check-prefix=CHECK-NOFP-LARGE %s
6 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-elf -code-model=tiny -mattr=-fp-armv8 | FileCheck --check-prefix=CHECK-NOFP-TINY %s
8 @varfloat = dso_local global float 0.0
9 @vardouble = dso_local global double 0.0
11 define dso_local void @floating_lits() optsize {
12 ; CHECK-LABEL: floating_lits:
14 %floatval = load float, ptr @varfloat
15 %newfloat = fadd float %floatval, 511.0
16 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI[0-9]+_[0-9]+]]
17 ; CHECK: ldr [[LIT128:s[0-9]+]], [x[[LITBASE]], {{#?}}:lo12:[[CURLIT]]]
18 ; CHECK-NOFP-NOT: ldr {{s[0-9]+}},
20 ; CHECK-TINY: ldr [[LIT128:s[0-9]+]], [[CURLIT:.LCPI[0-9]+_[0-9]+]]
21 ; CHECK-NOFP-TINY-NOT: ldr {{s[0-9]+}},
23 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g0_nc:[[CURLIT:.LCPI[0-9]+_[0-9]+]]
24 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
25 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
26 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g3:[[CURLIT]]
27 ; CHECK-LARGE: ldr {{s[0-9]+}}, [x[[LITADDR]]]
29 ; CHECK-NOFP-LARGE-NOT: ldr {{s[0-9]+}},
30 ; CHECK-NOFP-LARGE-NOT: fadd
32 store float %newfloat, ptr @varfloat
34 %doubleval = load double, ptr @vardouble
35 %newdouble = fadd double %doubleval, 511.0
36 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI[0-9]+_[0-9]+]]
37 ; CHECK: ldr [[LIT129:d[0-9]+]], [x[[LITBASE]], {{#?}}:lo12:[[CURLIT]]]
38 ; CHECK-NOFP-NOT: ldr {{d[0-9]+}},
39 ; CHECK-NOFP-NOT: fadd
41 ; CHECK-TINY: ldr [[LIT129:d[0-9]+]], [[CURLIT:.LCPI[0-9]+_[0-9]+]]
42 ; CHECK-NOFP-TINY-NOT: ldr {{d[0-9]+}},
43 ; CHECK-NOFP-TINY-NOT: fadd
45 ; CHECK-LARGE: movz x[[LITADDR:[0-9]+]], #:abs_g0_nc:[[CURLIT:.LCPI[0-9]+_[0-9]+]]
46 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g1_nc:[[CURLIT]]
47 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g2_nc:[[CURLIT]]
48 ; CHECK-LARGE: movk x[[LITADDR]], #:abs_g3:[[CURLIT]]
49 ; CHECK-LARGE: ldr {{d[0-9]+}}, [x[[LITADDR]]]
50 ; CHECK-NOFP-LARGE-NOT: ldr {{d[0-9]+}},
52 store double %newdouble, ptr @vardouble
57 define dso_local float @float_ret_optnone() optnone noinline {
58 ; CHECK-LABEL: float_ret_optnone:
60 ret float 0x3FB99999A0000000
61 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI[0-9]+_[0-9]+]]
62 ; CHECK: ldr [[LIT128:s[0-9]+]], [x[[LITBASE]], {{#?}}:lo12:[[CURLIT]]]
64 ; In the large code model, FastISel cannot load from the constant pool.
65 ; CHECK-LARGE-NOT: adrp
66 ; CHECK-LARGE-NOT: ldr
69 define dso_local double @double_ret_optnone() optnone noinline {
70 ; CHECK-LABEL: double_ret_optnone:
73 ; CHECK: adrp x[[LITBASE:[0-9]+]], [[CURLIT:.LCPI[0-9]+_[0-9]+]]
74 ; CHECK: ldr [[LIT128:d[0-9]+]], [x[[LITBASE]], {{#?}}:lo12:[[CURLIT]]]
76 ; In the large code model, FastISel cannot load from the constant pool.
77 ; CHECK-LARGE-NOT: adrp
78 ; CHECK-LARGE-NOT: ldr