1; RUN: llc < %s -mtriple=arm64-eabi
2
3; This test case tests an infinite loop bug in DAG combiner.
4; It just tries to do the following replacing endlessly:
5; (1)  Replacing.3 0x2c509f0: v4i32 = any_extend 0x2c4cd08 [ORD=4]
6;      With: 0x2c4d128: v4i32 = sign_extend 0x2c4cd08 [ORD=4]
7;
8; (2)  Replacing.2 0x2c4d128: v4i32 = sign_extend 0x2c4cd08 [ORD=4]
9;      With: 0x2c509f0: v4i32 = any_extend 0x2c4cd08 [ORD=4]
10; As we think the (2) optimization from SIGN_EXTEND to ANY_EXTEND is
11; an optimization to replace unused bits with undefined bits, we remove
12; the (1) optimization (It doesn't make sense to replace undefined bits
13; with signed bits).
14
15define <4 x i32> @infiniteLoop(<4 x i32> %in0, <4 x i16> %in1) {
16entry:
17  %cmp.i = icmp sge <4 x i16> %in1, <i16 32767, i16 32767, i16 -1, i16 -32768>
18  %sext.i = sext <4 x i1> %cmp.i to <4 x i32>
19  %mul.i = mul <4 x i32> %in0, %sext.i
20  %sext = shl <4 x i32> %mul.i, <i32 16, i32 16, i32 16, i32 16>
21  %vmovl.i.i = ashr <4 x i32> %sext, <i32 16, i32 16, i32 16, i32 16>
22  ret <4 x i32> %vmovl.i.i
23}
24