blob: 51b91ee286f94fd483ecfc9a030e2f049e5512a0 [file] [log] [blame]
Nicolai Haehnle87bc4c22016-10-07 08:40:14 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
Matt Arsenault7aad8fd2017-01-24 22:02:15 +00002; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
Nicolai Haehnle87bc4c22016-10-07 08:40:14 +00003
4; This used to crash because during intermediate control flow lowering, there
5; was a sequence
6; s_mov_b64 s[0:1], exec
7; s_and_b64 s[2:3], s[0:1], s[2:3] ; def & use of the same register pair
8; ...
9; s_mov_b64_term exec, s[2:3]
10; that was not treated correctly.
11;
12; GCN-LABEL: {{^}}ham:
13; GCN-DAG: v_cmp_lt_f32_e64 [[OTHERCC:s\[[0-9]+:[0-9]+\]]],
14; GCN-DAG: v_cmp_lt_f32_e32 vcc,
15; GCN: s_and_b64 [[AND:s\[[0-9]+:[0-9]+\]]], vcc, [[OTHERCC]]
16; GCN: s_and_saveexec_b64 [[SAVED:s\[[0-9]+:[0-9]+\]]], [[AND]]
Matt Arsenaultb8f8dbc2017-03-24 19:52:05 +000017; GCN: ; mask branch [[BB5:BB[0-9]+_[0-9]+]]
18
19; GCN-NEXT: BB{{[0-9]+_[0-9]+}}: ; %bb4
20; GCN: ds_write_b32
Matt Arsenaultb8f8dbc2017-03-24 19:52:05 +000021
Mark Searles70359ac2017-06-02 14:19:25 +000022; GCN: [[BB5]]
Matt Arsenaultb8f8dbc2017-03-24 19:52:05 +000023; GCN: s_or_b64 exec, exec
24; GCN-NEXT: s_endpgm
25; GCN-NEXT: .Lfunc_end
Nicolai Haehnle87bc4c22016-10-07 08:40:14 +000026define amdgpu_ps void @ham(float %arg, float %arg1) #0 {
27bb:
28 %tmp = fcmp ogt float %arg, 0.000000e+00
29 %tmp2 = fcmp ogt float %arg1, 0.000000e+00
30 %tmp3 = and i1 %tmp, %tmp2
31 br i1 %tmp3, label %bb4, label %bb5
32
33bb4: ; preds = %bb
Matt Arsenaultb8f8dbc2017-03-24 19:52:05 +000034 store volatile i32 4, i32 addrspace(3)* undef
Nicolai Haehnle87bc4c22016-10-07 08:40:14 +000035 unreachable
36
37bb5: ; preds = %bb
38 ret void
39}
40
41attributes #0 = { nounwind readonly "InitialPSInputAddr"="36983" }
42attributes #1 = { nounwind readnone }