1 ; RUN: llc -march=hexagon -mcpu=hexagonv5 < %s | FileCheck %s
2 ; Generate MemOps for V4 and above.
5 define void @f(ptr nocapture %p) nounwind {
7 ; CHECK: memh(r{{[0-9]+}}+#20) -= #1
8 %add.ptr = getelementptr inbounds i16, ptr %p, i32 10
9 %0 = load i16, ptr %add.ptr, align 2
10 %conv2 = zext i16 %0 to i32
11 %sub = add nsw i32 %conv2, 65535
12 %conv1 = trunc i32 %sub to i16
13 store i16 %conv1, ptr %add.ptr, align 2
17 define void @g(ptr nocapture %p, i32 %i) nounwind {
19 ; CHECK: memh(r{{[0-9]+}}+#20) -= #1
20 %add.ptr.sum = add i32 %i, 10
21 %add.ptr1 = getelementptr inbounds i16, ptr %p, i32 %add.ptr.sum
22 %0 = load i16, ptr %add.ptr1, align 2
23 %conv3 = zext i16 %0 to i32
24 %sub = add nsw i32 %conv3, 65535
25 %conv2 = trunc i32 %sub to i16
26 store i16 %conv2, ptr %add.ptr1, align 2