1 ; RUN: llc %s -o - -mtriple=aarch64-unknown -mattr=fuse-address | FileCheck %s
2 ; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=cortex-a65 | FileCheck %s
3 ; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=exynos-m3 | FileCheck %s
4 ; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=exynos-m4 | FileCheck %s
5 ; RUN: llc %s -o - -mtriple=aarch64-unknown -mcpu=exynos-m5 | FileCheck %s
7 target triple = "aarch64-unknown"
9 @var_8bit = dso_local global i8 0
10 @var_16bit = dso_local global i16 0
11 @var_32bit = dso_local global i32 0
12 @var_64bit = dso_local global i64 0
13 @var_128bit = dso_local global i128 0
14 @var_half = dso_local global half 0.0
15 @var_float = dso_local global float 0.0
16 @var_double = dso_local global double 0.0
17 @var_double2 = dso_local global <2 x double> <double 0.0, double 0.0>
19 define dso_local void @ldst_8bit() {
20 %val8 = load volatile i8, ptr @var_8bit
21 %ext = zext i8 %val8 to i64
22 %add = add i64 %ext, 1
23 %val16 = trunc i64 %add to i16
24 store volatile i16 %val16, ptr @var_16bit
27 ; CHECK-LABEL: ldst_8bit:
28 ; CHECK: adrp [[RB:x[0-9]+]], var_8bit
29 ; CHECK-NEXT: ldrb {{w[0-9]+}}, [[[RB]], {{#?}}:lo12:var_8bit]
30 ; CHECK: adrp [[RH:x[0-9]+]], var_16bit
31 ; CHECK-NEXT: strh {{w[0-9]+}}, [[[RH]], {{#?}}:lo12:var_16bit]
34 define dso_local void @ldst_16bit() {
35 %val16 = load volatile i16, ptr @var_16bit
36 %ext = zext i16 %val16 to i64
37 %add = add i64 %ext, 1
38 %val32 = trunc i64 %add to i32
39 store volatile i32 %val32, ptr @var_32bit
42 ; CHECK-LABEL: ldst_16bit:
43 ; CHECK: adrp [[RH:x[0-9]+]], var_16bit
44 ; CHECK-NEXT: ldrh {{w[0-9]+}}, [[[RH]], {{#?}}:lo12:var_16bit]
45 ; CHECK: adrp [[RW:x[0-9]+]], var_32bit
46 ; CHECK-NEXT: str {{w[0-9]+}}, [[[RW]], {{#?}}:lo12:var_32bit]
49 define dso_local void @ldst_32bit() {
50 %val32 = load volatile i32, ptr @var_32bit
51 %ext = zext i32 %val32 to i64
52 %val64 = add i64 %ext, 1
53 store volatile i64 %val64, ptr @var_64bit
56 ; CHECK-LABEL: ldst_32bit:
57 ; CHECK: adrp [[RW:x[0-9]+]], var_32bit
58 ; CHECK-NEXT: ldr {{w[0-9]+}}, [[[RW]], {{#?}}:lo12:var_32bit]
59 ; CHECK: adrp [[RL:x[0-9]+]], var_64bit
60 ; CHECK-NEXT: str {{x[0-9]+}}, [[[RL]], {{#?}}:lo12:var_64bit]
63 define dso_local void @ldst_64bit() {
64 %val64 = load volatile i64, ptr @var_64bit
65 %ext = zext i64 %val64 to i128
66 %val128 = add i128 %ext, 1
67 store volatile i128 %val128, ptr @var_128bit
70 ; CHECK-LABEL: ldst_64bit:
71 ; CHECK: adrp [[RL:x[0-9]+]], var_64bit
72 ; CHECK-NEXT: ldr {{x[0-9]+}}, [[[RL]], {{#?}}:lo12:var_64bit]
73 ; CHECK: adrp [[RQ:x[0-9]+]], var_128bit
74 ; CHECK-NEXT: add {{x[0-9]+}}, [[RQ]], {{#?}}:lo12:var_128bit
77 define dso_local void @ldst_half() {
78 %valh = load volatile half, ptr @var_half
79 %valf = fpext half %valh to float
80 store volatile float %valf, ptr @var_float
83 ; CHECK-LABEL: ldst_half:
84 ; CHECK: adrp [[RH:x[0-9]+]], var_half
85 ; CHECK-NEXT: ldr {{h[0-9]+}}, [[[RH]], {{#?}}:lo12:var_half]
86 ; CHECK: adrp [[RF:x[0-9]+]], var_float
87 ; CHECK-NEXT: str {{s[0-9]+}}, [[[RF]], {{#?}}:lo12:var_float]
90 define dso_local void @ldst_float() {
91 %valf = load volatile float, ptr @var_float
92 %vald = fpext float %valf to double
93 store volatile double %vald, ptr @var_double
96 ; CHECK-LABEL: ldst_float:
97 ; CHECK: adrp [[RF:x[0-9]+]], var_float
98 ; CHECK-NEXT: ldr {{s[0-9]+}}, [[[RF]], {{#?}}:lo12:var_float]
99 ; CHECK: adrp [[RD:x[0-9]+]], var_double
100 ; CHECK-NEXT: str {{d[0-9]+}}, [[[RD]], {{#?}}:lo12:var_double]
103 define dso_local void @ldst_double() {
104 %valf = load volatile float, ptr @var_float
105 %vale = fpext float %valf to double
106 %vald = load volatile double, ptr @var_double
107 %vald1 = insertelement <2 x double> undef, double %vald, i32 0
108 %vald2 = insertelement <2 x double> %vald1, double %vale, i32 1
109 store volatile <2 x double> %vald2, ptr @var_double2
112 ; CHECK-LABEL: ldst_double:
113 ; CHECK: adrp [[RD:x[0-9]+]], var_double
114 ; CHECK-NEXT: ldr {{d[0-9]+}}, [[[RD]], {{#?}}:lo12:var_double]
115 ; CHECK: adrp [[RQ:x[0-9]+]], var_double2
116 ; CHECK-NEXT: str {{q[0-9]+}}, [[[RQ]], {{#?}}:lo12:var_double2]