<div dir="ltr">HI all,<div><br></div><div>I'm trying to add a new FunctionPas to Mips backend in order to recognise a specific loop and substitute it with an intrinsic. The pattern that I want to recognise is:<br><br><div>  %7 = load i32, i32* %i, align 4</div><div>  %arrayidx = getelementptr inbounds [1024 x i32], [1024 x i32]* %seq, i32 0, i32 %7</div><div>  %8 = load i32, i32* %arrayidx, align 4</div><div>  %9 = load i32, i32* %j, align 4</div><div>  %mul = mul nsw i32 %9, 2</div><div>  %shl = shl i32 3, %mul</div><div>  %and = and i32 %8, %shl</div><div>  %10 = load i32, i32* %j, align 4</div><div>  %mul2 = mul nsw i32 %10, 2</div><div>  %shr = ashr i32 %and, %mul2</div><div>  %conv = trunc i32 %shr to i8</div><div>  store i8 %conv, i8* %hn, align 1</div><div>  %11 = load i8, i8* %hn, align 1</div><div>  %conv3 = sext i8 %11 to i32</div><div>  %cmp4 = icmp eq i32 %conv3, 2</div><div>  br i1 %cmp4, label %12, label %14</div><div><br></div><div>; <label>:12:                                     ; preds = %6</div><div>  %13 = load i32, i32* %cnt, align 4</div><div>  %inc = add nsw i32 %13, 1</div><div>  store i32 %inc, i32* %cnt, align 4</div><div>  br label %14</div><div><br></div><div>How can I detect it? There is a similar thing in other backends that I can use for my purpose?</div><div><br></div><div>Thanks,</div><div><br></div><div>Catello   </div><br></div></div>