1; RUN: llc -march=hexagon < %s | FileCheck %s
2; Honor the alignment of a halfword on byte boundaries.
3; CHECK-NOT: memh
4
5target triple = "hexagon-unknown-linux-gnu"
6
7%s.0 = type <{ i16, i8, i16 }>
8
9@g0 = common global %s.0 zeroinitializer, align 1
10
11; Function Attrs: nounwind
12define i32 @f0(i32 %a0) #0 {
13b0:
14  %v0 = alloca i32, align 4
15  store i32 %a0, i32* %v0, align 4
16  store i8 1, i8* getelementptr inbounds (%s.0, %s.0* @g0, i32 0, i32 1), align 1
17  %v1 = load i16, i16* getelementptr inbounds (%s.0, %s.0* @g0, i32 0, i32 2), align 1
18  %v2 = add i16 %v1, 1
19  store i16 %v2, i16* getelementptr inbounds (%s.0, %s.0* @g0, i32 0, i32 2), align 1
20  %v3 = load i32, i32* %v0, align 4
21  %v4 = icmp ne i32 %v3, 0
22  br i1 %v4, label %b1, label %b2
23
24b1:                                               ; preds = %b0
25  %v5 = load i16, i16* getelementptr inbounds (%s.0, %s.0* @g0, i32 0, i32 2), align 1
26  %v6 = zext i16 %v5 to i32
27  %v7 = or i32 %v6, 6144
28  %v8 = trunc i32 %v7 to i16
29  store i16 %v8, i16* getelementptr inbounds (%s.0, %s.0* @g0, i32 0, i32 2), align 1
30  br label %b3
31
32b2:                                               ; preds = %b0
33  %v9 = load i16, i16* getelementptr inbounds (%s.0, %s.0* @g0, i32 0, i32 2), align 1
34  %v10 = zext i16 %v9 to i32
35  %v11 = or i32 %v10, 2048
36  %v12 = trunc i32 %v11 to i16
37  store i16 %v12, i16* getelementptr inbounds (%s.0, %s.0* @g0, i32 0, i32 2), align 1
38  br label %b3
39
40b3:                                               ; preds = %b2, %b1
41  ret i32 0
42}
43
44attributes #0 = { nounwind }
45