xref: /llvm-project/llvm/test/CodeGen/Hexagon/widen-not-load.ll (revision 2208c97c1bec2512d4e47b6223db6d95a7037956)
1; Test that double word post increment load is not generated.
2; REQUIRES: asserts
3
4; REQUIRES: asserts
5; RUN: llc -mtriple=hexagon -O2 -debug-only=hexagon-load-store-widening \
6; RUN:      %s -o 2>&1 - | FileCheck %s
7
8; Loads with positive invalid postinc is not widened
9define ptr @test1() {
10; CHECK-LABEL: test1
11; CHECK-NOT: memd(r{{[0-9]+}}++
12entry:
13  %0 = load ptr, ptr null, align 4
14  %b = getelementptr i8, ptr %0, i32 20
15  %1 = load i32, ptr %0, align 8
16  %c = getelementptr i8, ptr %0, i32 4
17  %2 = load i32, ptr %c, align 4
18  %call55 = call i8 @foo(ptr %b, i32 %1, i32 %2)
19  ret ptr null
20}
21
22; Loads with negative invalid postinc is not widened
23define ptr @test2() {
24; CHECK-LABEL: test2
25; CHECK-NOT: memd(r{{[0-9]+}}++
26entry:
27  %0 = load ptr, ptr null, align 4
28  %b = getelementptr i8, ptr %0, i32 -20
29  %1 = load i32, ptr %0, align 8
30  %c = getelementptr i8, ptr %0, i32 4
31  %2 = load i32, ptr %c, align 4
32  %call55 = call i8 @foo(ptr %b, i32 %1, i32 %2)
33  ret ptr null
34}
35
36; Loads with valid positive postinc is widened
37define ptr @test3() {
38; CHECK-LABEL: test3
39; CHECK: memd
40entry:
41  %0 = load ptr, ptr null, align 4
42  %b = getelementptr i8, ptr %0, i32 24
43  %1 = load i32, ptr %0, align 8
44  %c = getelementptr i8, ptr %0, i32 4
45  %2 = load i32, ptr %c, align 4
46  %call55 = call i8 @foo(ptr %b, i32 %1, i32 %2)
47  ret ptr null
48}
49
50; Loads with valid negative postinc is widened
51define ptr @test4() {
52; CHECK-LABEL: test4
53; CHECK: memd
54entry:
55  %0 = load ptr, ptr null, align 4
56  %b = getelementptr i8, ptr %0, i32 -24
57  %1 = load i32, ptr %0, align 8
58  %c = getelementptr i8, ptr %0, i32 4
59  %2 = load i32, ptr %c, align 4
60  %call55 = call i8 @foo(ptr %b, i32 %1, i32 %2)
61  ret ptr null
62}
63
64declare i8 @foo(ptr, i32, i32)
65