blob: ff01a1e00023564e78f0de15e2e59302adc77dc4 [file] [log] [blame]
Matt Arsenault24309582014-03-01 21:45:41 +00001; REQUIRES: asserts
2; XFAIL: *
3; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=r600 -mcpu=SI < %s | FileCheck -check-prefix=SI -check-prefix=COMMON %s
4; RUN: llc -O0 -verify-machineinstrs -asm-verbose=0 -march=r600 -mcpu=redwood < %s | FileCheck -check-prefix=EG -check-prefix=COMMON %s
5
6; SI hits an assertion at -O0, evergreen hits a not implemented unreachable.
7
Tom Stellard79243d92014-10-01 17:15:17 +00008; COMMON-LABEL: {{^}}branch_true:
Matt Arsenault24309582014-03-01 21:45:41 +00009define void @branch_true(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 {
10entry:
11 br i1 true, label %for.end, label %for.body.lr.ph
12
13for.body.lr.ph: ; preds = %entry
14 %add.ptr.sum = shl i32 %main_stride, 1
15 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
16 %add.ptr4.sum = shl i32 %main_stride, 2
17 br label %for.body
18
19for.body: ; preds = %for.body, %for.body.lr.ph
20 %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
21 %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)*
22 %1 = load i32 addrspace(1)* %0, align 4
23 %add.ptr = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %main_stride
24 %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)*
25 %3 = load i32 addrspace(1)* %2, align 4
26 %add.ptr1 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum
27 %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)*
28 %5 = load i32 addrspace(1)* %4, align 4
29 %add.ptr2 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum
30 %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)*
31 %7 = load i32 addrspace(1)* %6, align 4
32 %add.ptr3 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum
33 %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)*
34 %9 = load i32 addrspace(1)* %8, align 4
35 %add.ptr6 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 undef
36 br i1 undef, label %for.end, label %for.body
37
38for.end: ; preds = %for.body, %entry
39 ret void
40}
41
Tom Stellard79243d92014-10-01 17:15:17 +000042; COMMON-LABEL: {{^}}branch_false:
Matt Arsenault24309582014-03-01 21:45:41 +000043; SI: .text
Tom Stellard326d6ec2014-11-05 14:50:53 +000044; SI-NEXT: s_endpgm
Matt Arsenault24309582014-03-01 21:45:41 +000045define void @branch_false(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 {
46entry:
47 br i1 false, label %for.end, label %for.body.lr.ph
48
49for.body.lr.ph: ; preds = %entry
50 %add.ptr.sum = shl i32 %main_stride, 1
51 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
52 %add.ptr4.sum = shl i32 %main_stride, 2
53 br label %for.body
54
55for.body: ; preds = %for.body, %for.body.lr.ph
56 %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
57 %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)*
58 %1 = load i32 addrspace(1)* %0, align 4
59 %add.ptr = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %main_stride
60 %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)*
61 %3 = load i32 addrspace(1)* %2, align 4
62 %add.ptr1 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum
63 %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)*
64 %5 = load i32 addrspace(1)* %4, align 4
65 %add.ptr2 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum
66 %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)*
67 %7 = load i32 addrspace(1)* %6, align 4
68 %add.ptr3 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum
69 %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)*
70 %9 = load i32 addrspace(1)* %8, align 4
71 %add.ptr6 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 undef
72 br i1 undef, label %for.end, label %for.body
73
74for.end: ; preds = %for.body, %entry
75 ret void
76}
77
Tom Stellard79243d92014-10-01 17:15:17 +000078; COMMON-LABEL: {{^}}branch_undef:
Matt Arsenault24309582014-03-01 21:45:41 +000079; SI: .text
Tom Stellard326d6ec2014-11-05 14:50:53 +000080; SI-NEXT: s_endpgm
Matt Arsenault24309582014-03-01 21:45:41 +000081define void @branch_undef(i8 addrspace(1)* nocapture %main, i32 %main_stride) #0 {
82entry:
83 br i1 undef, label %for.end, label %for.body.lr.ph
84
85for.body.lr.ph: ; preds = %entry
86 %add.ptr.sum = shl i32 %main_stride, 1
87 %add.ptr1.sum = add i32 %add.ptr.sum, %main_stride
88 %add.ptr4.sum = shl i32 %main_stride, 2
89 br label %for.body
90
91for.body: ; preds = %for.body, %for.body.lr.ph
92 %main.addr.011 = phi i8 addrspace(1)* [ %main, %for.body.lr.ph ], [ %add.ptr6, %for.body ]
93 %0 = bitcast i8 addrspace(1)* %main.addr.011 to i32 addrspace(1)*
94 %1 = load i32 addrspace(1)* %0, align 4
95 %add.ptr = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %main_stride
96 %2 = bitcast i8 addrspace(1)* %add.ptr to i32 addrspace(1)*
97 %3 = load i32 addrspace(1)* %2, align 4
98 %add.ptr1 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr.sum
99 %4 = bitcast i8 addrspace(1)* %add.ptr1 to i32 addrspace(1)*
100 %5 = load i32 addrspace(1)* %4, align 4
101 %add.ptr2 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr1.sum
102 %6 = bitcast i8 addrspace(1)* %add.ptr2 to i32 addrspace(1)*
103 %7 = load i32 addrspace(1)* %6, align 4
104 %add.ptr3 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 %add.ptr4.sum
105 %8 = bitcast i8 addrspace(1)* %add.ptr3 to i32 addrspace(1)*
106 %9 = load i32 addrspace(1)* %8, align 4
107 %add.ptr6 = getelementptr inbounds i8 addrspace(1)* %main.addr.011, i32 undef
108 br i1 undef, label %for.end, label %for.body
109
110for.end: ; preds = %for.body, %entry
111 ret void
112}
113
114attributes #0 = { nounwind }