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