1; RUN: llc -O2 -march=bpfel -mattr=+alu32 < %s | FileCheck %s
2;
3; unsigned char loadu8(unsigned char *p)
4; {
5;   return *p;
6; }
7;
8; unsigned short loadu16(unsigned short *p)
9; {
10;   return *p;
11; }
12;
13; unsigned loadu32(unsigned *p)
14; {
15;   return *p;
16; }
17;
18; unsigned long long loadu64(unsigned long long *p)
19; {
20;   return *p;
21; }
22;
23; void storeu8(unsigned char *p, unsigned long long v)
24; {
25;   *p = (unsigned char)v;
26; }
27;
28; void storeu16(unsigned short *p, unsigned long long v)
29; {
30;   *p = (unsigned short)v;
31; }
32;
33; void storeu32(unsigned *p, unsigned long long v)
34; {
35;   *p = (unsigned)v;
36; }
37;
38; void storeu64(unsigned long long *p, unsigned long long v)
39; {
40;   *p = v;
41; }
42; Function Attrs: norecurse nounwind readonly
43define dso_local zeroext i8 @loadu8(i8* nocapture readonly %p) local_unnamed_addr #0 {
44entry:
45  %0 = load i8, i8* %p, align 1
46; CHECK: w{{[0-9]+}} = *(u8 *)(r{{[0-9]+}} + 0)
47  ret i8 %0
48}
49
50; Function Attrs: norecurse nounwind readonly
51define dso_local zeroext i16 @loadu16(i16* nocapture readonly %p) local_unnamed_addr #0 {
52entry:
53  %0 = load i16, i16* %p, align 2
54; CHECK: w{{[0-9]+}} = *(u16 *)(r{{[0-9]+}} + 0)
55  ret i16 %0
56}
57
58; Function Attrs: norecurse nounwind readonly
59define dso_local i32 @loadu32(i32* nocapture readonly %p) local_unnamed_addr #0 {
60entry:
61  %0 = load i32, i32* %p, align 4
62; CHECK: w{{[0-9]+}} = *(u32 *)(r{{[0-9]+}} + 0)
63  ret i32 %0
64}
65
66; Function Attrs: norecurse nounwind readonly
67define dso_local i64 @loadu64(i64* nocapture readonly %p) local_unnamed_addr #0 {
68entry:
69  %0 = load i64, i64* %p, align 8
70; CHECK: r{{[0-9]+}} = *(u64 *)(r{{[0-9]+}} + 0)
71  ret i64 %0
72}
73
74; Function Attrs: norecurse nounwind
75define dso_local void @storeu8(i8* nocapture %p, i64 %v) local_unnamed_addr #1 {
76entry:
77  %conv = trunc i64 %v to i8
78  store i8 %conv, i8* %p, align 1
79; CHECK: *(u8 *)(r{{[0-9]+}} + 0) = w{{[0-9]+}}
80  ret void
81}
82
83; Function Attrs: norecurse nounwind
84define dso_local void @storeu16(i16* nocapture %p, i64 %v) local_unnamed_addr #1 {
85entry:
86  %conv = trunc i64 %v to i16
87  store i16 %conv, i16* %p, align 2
88; CHECK: *(u16 *)(r{{[0-9]+}} + 0) = w{{[0-9]+}}
89  ret void
90}
91
92; Function Attrs: norecurse nounwind
93define dso_local void @storeu32(i32* nocapture %p, i64 %v) local_unnamed_addr #1 {
94entry:
95  %conv = trunc i64 %v to i32
96  store i32 %conv, i32* %p, align 4
97; CHECK: *(u32 *)(r{{[0-9]+}} + 0) = w{{[0-9]+}}
98  ret void
99}
100
101; Function Attrs: norecurse nounwind
102define dso_local void @storeu64(i64* nocapture %p, i64 %v) local_unnamed_addr #1 {
103entry:
104  store i64 %v, i64* %p, align 8
105; CHECK: *(u64 *)(r{{[0-9]+}} + 0) = r{{[0-9]+}}
106  ret void
107}
108