1; RUN: llc -march=hexagon < %s
2; Used to fail with: "Cannot select: 0x3bab680: ch = store <ST4[%lsr.iv522525], trunc to v2i16>
3; ModuleID = 'bugpoint-reduced-simplified.bc'
4target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-a0:0-n32"
5target triple = "hexagon-unknown-linux-gnu"
6
7define void @foobar() nounwind {
8entry:
9  br label %for.cond7.preheader.single_entry.i
10
11for.cond7.preheader.single_entry.i:               ; preds = %for.cond7.preheader.single_entry.i, %entry
12  %exitcond72.i = icmp eq i32 undef, 64
13  br i1 %exitcond72.i, label %foo_32.exit, label %for.cond7.preheader.single_entry.i
14
15foo_32.exit:                         ; preds = %for.cond7.preheader.single_entry.i
16  br label %for.body.i428
17
18for.body.i428:                                    ; preds = %for.body.i428, %foo_32.exit
19  br i1 undef, label %foo_12.exit, label %for.body.i428
20
21foo_12.exit:                            ; preds = %for.body.i428
22  br label %for.body.i.i
23
24for.body.i.i:                                     ; preds = %for.body.i.i, %foo_12.exit
25  br i1 undef, label %foo_14.exit, label %for.body.i.i
26
27foo_14.exit:                         ; preds = %for.body.i.i
28  br label %for.body
29
30for.body:                                         ; preds = %for.body, %foo_14.exit
31  br i1 undef, label %for.end, label %for.body
32
33for.end:                                          ; preds = %for.body
34  %storemerge294 = select i1 undef, i32 32767, i32 undef
35  %_p_splat_one386 = insertelement <1 x i32> undef, i32 %storemerge294, i32 0
36  %_p_splat387 = shufflevector <1 x i32> %_p_splat_one386, <1 x i32> undef, <2 x i32> zeroinitializer
37  br label %polly.loop_body377
38
39polly.loop_after378:                              ; preds = %polly.loop_body377
40  unreachable
41
42polly.loop_body377:                               ; preds = %polly.loop_body377, %for.end
43  %_p_vec_full384 = load <2 x i16>, <2 x i16>* undef, align 4
44  %0 = sext <2 x i16> %_p_vec_full384 to <2 x i32>
45  %mulp_vec = mul <2 x i32> %0, %_p_splat387
46  %shr100293p_vec = lshr <2 x i32> %mulp_vec, <i32 15, i32 15>
47  %1 = trunc <2 x i32> %shr100293p_vec to <2 x i16>
48  store <2 x i16> %1, <2 x i16>* undef, align 4
49  br i1 undef, label %polly.loop_body377, label %polly.loop_after378
50}
51
52