1 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" -S < %s 2>&1 | FileCheck %s
3 define i64 @test1(i32 %a, i32 %b) {
6 %zext = zext i32 %div to i64
8 ; CHECK-NEXT: --> ((zext i32 %a to i64) /u (zext i32 %b to i64))
12 define i64 @test2(i32 %a, i32 %b) {
14 %rem = urem i32 %a, %b
15 %zext = zext i32 %rem to i64
17 ; CHECK-NEXT: --> ((zext i32 %a to i64) + (-1 * (zext i32 %b to i64) * ((zext i32 %a to i64) /u (zext i32 %b to i64))))
21 define i64 @test3(i32 %a, i32 %b) {
23 %div = udiv i32 %a, %b
24 %mul = mul i32 %div, %b
25 %sub = sub i32 %a, %mul
26 %zext = zext i32 %sub to i64
28 ; CHECK-NEXT: --> ((zext i32 %a to i64) + (-1 * (zext i32 %b to i64) * ((zext i32 %a to i64) /u (zext i32 %b to i64))))
32 define i64 @test4(i32 %t) {
35 %div = udiv i32 %t, 112
36 %mul = mul i32 %div, 56
37 %sub = sub i32 %a, %mul
38 %zext = zext i32 %sub to i64
40 ; CHECK-NEXT: --> ((-56 * ((zext i32 %t to i64) /u 112))<nsw> + ((zext i32 %t to i64) /u 2))