File: udiv-of-x-xsmaxone-fold.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (96 lines) | stat: -rw-r--r-- 4,137 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt -disable-output -passes="print<scalar-evolution>" < %s 2>&1 | FileCheck %s

define i32 @test_expr_with_constant_1(i32 %x) {
; CHECK-LABEL: 'test_expr_with_constant_1'
; CHECK-NEXT:  Classifying expressions for: @test_expr_with_constant_1
; CHECK-NEXT:    %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 1)
; CHECK-NEXT:    --> (1 smax %x) U: [1,-2147483648) S: [1,-2147483648)
; CHECK-NEXT:    %add = add nsw i32 %smax, -1
; CHECK-NEXT:    --> (-1 + (1 smax %x))<nsw> U: [0,2147483647) S: [0,2147483647)
; CHECK-NEXT:    %udiv = udiv i32 %add, %x
; CHECK-NEXT:    --> 0 U: [0,1) S: [0,1)
; CHECK-NEXT:  Determining loop execution counts for: @test_expr_with_constant_1
;
entry:
  %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 1)
  %add = add nsw i32 %smax, -1
  %udiv = udiv i32 %add, %x
  ret i32 %udiv
}

; Non-1 constant: (-2 + (2 smax %x)) /u %x
define i32 @test_expr_with_constant_2(i32 %x) {
; CHECK-LABEL: 'test_expr_with_constant_2'
; CHECK-NEXT:  Classifying expressions for: @test_expr_with_constant_2
; CHECK-NEXT:    %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 2)
; CHECK-NEXT:    --> (2 smax %x) U: [2,-2147483648) S: [2,-2147483648)
; CHECK-NEXT:    %add = add nsw i32 %smax, -2
; CHECK-NEXT:    --> (-2 + (2 smax %x))<nsw> U: [0,2147483646) S: [0,2147483646)
; CHECK-NEXT:    %udiv = udiv i32 %add, %x
; CHECK-NEXT:    --> 0 U: [0,1) S: [0,1)
; CHECK-NEXT:  Determining loop execution counts for: @test_expr_with_constant_2
;
entry:
  %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 2)
  %add = add nsw i32 %smax, -2
  %udiv = udiv i32 %add, %x
  ret i32 %udiv
}

; Negative test, constants mismatch: (-3 + (2 smax %x)) /u %x
define i32 @test_expr_mismatch_constants(i32 %x) {
; CHECK-LABEL: 'test_expr_mismatch_constants'
; CHECK-NEXT:  Classifying expressions for: @test_expr_mismatch_constants
; CHECK-NEXT:    %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 2)
; CHECK-NEXT:    --> (2 smax %x) U: [2,-2147483648) S: [2,-2147483648)
; CHECK-NEXT:    %add = add nsw i32 %smax, -3
; CHECK-NEXT:    --> (-3 + (2 smax %x))<nsw> U: [-1,2147483645) S: [-1,2147483645)
; CHECK-NEXT:    %udiv = udiv i32 %add, %x
; CHECK-NEXT:    --> ((-3 + (2 smax %x))<nsw> /u %x) U: full-set S: full-set
; CHECK-NEXT:  Determining loop execution counts for: @test_expr_mismatch_constants
;
entry:
  %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 2)
  %add = add nsw i32 %smax, -3
  %udiv = udiv i32 %add, %x
  ret i32 %udiv
}

; Negative constant: (3 + (-3 smax %x)) /u %x
define i32 @test_expr_negative_constant(i32 %x) {
; CHECK-LABEL: 'test_expr_negative_constant'
; CHECK-NEXT:  Classifying expressions for: @test_expr_negative_constant
; CHECK-NEXT:    %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 -3)
; CHECK-NEXT:    --> (-3 smax %x) U: [-3,-2147483648) S: [-3,-2147483648)
; CHECK-NEXT:    %add = add nsw i32 %smax, 3
; CHECK-NEXT:    --> (3 + (-3 smax %x)) U: [0,-2147483645) S: [0,-2147483645)
; CHECK-NEXT:    %udiv = udiv i32 %add, %x
; CHECK-NEXT:    --> ((3 + (-3 smax %x)) /u %x) U: [0,-2147483645) S: [0,-2147483645)
; CHECK-NEXT:  Determining loop execution counts for: @test_expr_negative_constant
;
entry:
  %smax = tail call i32 @llvm.smax.i32(i32 %x, i32 -3)
  %add = add nsw i32 %smax, 3
  %udiv = udiv i32 %add, %x
  ret i32 %udiv
}

; Negative signed minimum value.
define i8 @text_expr_with_constant_signed_min(i8 %x) {
; CHECK-LABEL: 'text_expr_with_constant_signed_min'
; CHECK-NEXT:  Classifying expressions for: @text_expr_with_constant_signed_min
; CHECK-NEXT:    %smax = tail call i8 @llvm.smax.i8(i8 %x, i8 -128)
; CHECK-NEXT:    --> %x U: full-set S: full-set
; CHECK-NEXT:    %add = add nsw i8 %smax, -128
; CHECK-NEXT:    --> (-128 + %x) U: full-set S: full-set
; CHECK-NEXT:    %udiv = udiv i8 %add, %x
; CHECK-NEXT:    --> ((-128 + %x) /u %x) U: full-set S: full-set
; CHECK-NEXT:  Determining loop execution counts for: @text_expr_with_constant_signed_min
;
entry:
  %smax = tail call i8 @llvm.smax.i8(i8 %x, i8 128)
  %add = add nsw i8 %smax, -128
  %udiv = udiv i8 %add, %x
  ret i8 %udiv
}