1 ; RUN: opt -analyze -enable-new-pm=0 -scalar-evolution -S < %s | FileCheck %s
2 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" -S < %s 2>&1 | FileCheck %s
4 define i64 @test1(i32 %a, i32 %b) {
7 %zext = zext i32 %div to i64
9 ; CHECK-NEXT: --> ((zext i32 %a to i64) /u (zext i32 %b to i64))
13 define i64 @test2(i32 %a, i32 %b) {
15 %rem = urem i32 %a, %b
16 %zext = zext i32 %rem to i64
18 ; CHECK-NEXT: --> ((zext i32 %a to i64) + (-1 * (zext i32 %b to i64) * ((zext i32 %a to i64) /u (zext i32 %b to i64))))
22 define i64 @test3(i32 %a, i32 %b) {
24 %div = udiv i32 %a, %b
25 %mul = mul i32 %div, %b
26 %sub = sub i32 %a, %mul
27 %zext = zext i32 %sub to i64
29 ; CHECK-NEXT: --> ((zext i32 %a to i64) + (-1 * (zext i32 %b to i64) * ((zext i32 %a to i64) /u (zext i32 %b to i64))))
33 define i64 @test4(i32 %t) {
36 %div = udiv i32 %t, 112
37 %mul = mul i32 %div, 56
38 %sub = sub i32 %a, %mul
39 %zext = zext i32 %sub to i64
41 ; CHECK-NEXT: --> ((-56 * ((zext i32 %t to i64) /u 112))<nsw> + ((zext i32 %t to i64) /u 2))