1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -S -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
5 define i32 @mul(i32 %val) nounwind {
7 ; CHECK-NEXT: Classifying expressions for: @mul
8 ; CHECK-NEXT: %tmp1 = mul i32 %val, 16
9 ; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633)
10 ; CHECK-NEXT: %tmp2 = udiv i32 %tmp1, 16
11 ; CHECK-NEXT: --> ((16 * %val) /u 16) U: [0,268435456) S: [0,268435456)
12 ; CHECK-NEXT: Determining loop execution counts for: @mul
14 %tmp1 = mul i32 %val, 16
15 %tmp2 = udiv i32 %tmp1, 16
19 ; Or, it could be any number of equivalent patterns with mask:
20 ; a) x & (1 << nbits) - 1
21 ; b) x & ~(-1 << nbits)
22 ; c) x & (-1 >> (32 - y))
23 ; d) x << (32 - y) >> (32 - y)
25 define i32 @mask_abc(i32 %val) nounwind {
26 ; CHECK-LABEL: 'mask_abc'
27 ; CHECK-NEXT: Classifying expressions for: @mask_abc
28 ; CHECK-NEXT: %masked = and i32 %val, 15
29 ; CHECK-NEXT: --> (zext i4 (trunc i32 %val to i4) to i32) U: [0,16) S: [0,16)
30 ; CHECK-NEXT: Determining loop execution counts for: @mask_abc
32 %masked = and i32 %val, 15
36 define i32 @mask_d(i32 %val) nounwind {
37 ; CHECK-LABEL: 'mask_d'
38 ; CHECK-NEXT: Classifying expressions for: @mask_d
39 ; CHECK-NEXT: %highbitscleared = shl i32 %val, 4
40 ; CHECK-NEXT: --> (16 * %val) U: [0,-15) S: [-2147483648,2147483633)
41 ; CHECK-NEXT: %masked = lshr i32 %highbitscleared, 4
42 ; CHECK-NEXT: --> ((16 * %val) /u 16) U: [0,268435456) S: [0,268435456)
43 ; CHECK-NEXT: Determining loop execution counts for: @mask_d
45 %highbitscleared = shl i32 %val, 4
46 %masked = lshr i32 %highbitscleared, 4