File: ctpop-range.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 (142 lines) | stat: -rw-r--r-- 4,229 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -S -passes=correlated-propagation %s | FileCheck %s

declare void @use(i1)

define void @ctpop1(i8 %v) {
; CHECK-LABEL: define void @ctpop1(
; CHECK-SAME: i8 [[V:%.*]]) {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[RES:%.*]] = call range(i8 0, 9) i8 @llvm.ctpop.i8(i8 [[V]])
; CHECK-NEXT:    [[C0_0:%.*]] = icmp samesign uge i8 [[RES]], 3
; CHECK-NEXT:    [[C0_1:%.*]] = icmp samesign ule i8 [[RES]], 7
; CHECK-NEXT:    [[C0:%.*]] = and i1 [[C0_0]], [[C0_1]]
; CHECK-NEXT:    br i1 [[C0]], label %[[RANGE_3_8:.*]], label %[[ED:.*]]
; CHECK:       [[RANGE_3_8]]:
; CHECK-NEXT:    call void @use(i1 true)
; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 [[V]], 8
; CHECK-NEXT:    call void @use(i1 [[CMP1]])
; CHECK-NEXT:    call void @use(i1 true)
; CHECK-NEXT:    [[CMP3:%.*]] = icmp ule i8 [[V]], -3
; CHECK-NEXT:    call void @use(i1 [[CMP3]])
; CHECK-NEXT:    ret void
; CHECK:       [[ED]]:
; CHECK-NEXT:    ret void
;
entry:
  %res = call range(i8 0, 9) i8 @llvm.ctpop.i8(i8 %v)
  %c0.0 = icmp uge i8 %res, 3
  %c0.1 = icmp ule i8 %res, 7
  %c0 = and i1 %c0.0, %c0.1
  br i1 %c0, label %range.3.8, label %ed

range.3.8:
  %cmp0 = icmp uge i8 %v, 7
  call void @use(i1 %cmp0) ; true
  %cmp1 = icmp uge i8 %v, 8
  call void @use(i1 %cmp1) ; unknown
  %cmp2 = icmp ule i8 %v, 254
  call void @use(i1 %cmp2) ; true
  %cmp3 = icmp ule i8 %v, 253
  call void @use(i1 %cmp3) ; unknown
  ret void

ed:
  ret void
}

define void @ctpop2(i8 %v) {
; CHECK-LABEL: define void @ctpop2(
; CHECK-SAME: i8 [[V:%.*]]) {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[RES:%.*]] = call range(i8 0, 9) i8 @llvm.ctpop.i8(i8 [[V]])
; CHECK-NEXT:    [[C2_0:%.*]] = icmp samesign uge i8 [[RES]], 1
; CHECK-NEXT:    [[C2_1:%.*]] = icmp samesign ule i8 [[RES]], 4
; CHECK-NEXT:    [[C2:%.*]] = and i1 [[C2_0]], [[C2_1]]
; CHECK-NEXT:    br i1 [[C2]], label %[[RANGE_1_5:.*]], label %[[ED:.*]]
; CHECK:       [[RANGE_1_5]]:
; CHECK-NEXT:    call void @use(i1 true)
; CHECK-NEXT:    [[CMP9:%.*]] = icmp uge i8 [[V]], 2
; CHECK-NEXT:    call void @use(i1 [[CMP9]])
; CHECK-NEXT:    call void @use(i1 true)
; CHECK-NEXT:    [[CMP11:%.*]] = icmp ule i8 [[V]], -17
; CHECK-NEXT:    call void @use(i1 [[CMP11]])
; CHECK-NEXT:    ret void
; CHECK:       [[ED]]:
; CHECK-NEXT:    ret void
;
entry:
  %res = call range(i8 0, 9) i8 @llvm.ctpop.i8(i8 %v)
  %c2.0 = icmp uge i8 %res, 1
  %c2.1 = icmp ule i8 %res, 4
  %c2 = and i1 %c2.0, %c2.1
  br i1 %c2, label %range.1.5, label %ed

range.1.5:
  %cmp8 = icmp uge i8 %v, 1
  call void @use(i1 %cmp8) ; true
  %cmp9 = icmp uge i8 %v, 2
  call void @use(i1 %cmp9) ; unknown
  %cmp10 = icmp ule i8 %v, 240
  call void @use(i1 %cmp10) ; true
  %cmp11 = icmp ule i8 %v, 239
  call void @use(i1 %cmp11) ; unknown
  ret void

ed:
  ret void
}

define void @ctpop3(i8 %v) {
; CHECK-LABEL: define void @ctpop3(
; CHECK-SAME: i8 [[V:%.*]]) {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[RES:%.*]] = call i8 @llvm.ctpop.i8(i8 [[V]])
; CHECK-NEXT:    [[C3:%.*]] = icmp samesign uge i8 [[RES]], 8
; CHECK-NEXT:    br i1 [[C3]], label %[[RANGE_8_9:.*]], label %[[ED:.*]]
; CHECK:       [[RANGE_8_9]]:
; CHECK-NEXT:    call void @use(i1 true)
; CHECK-NEXT:    ret void
; CHECK:       [[ED]]:
; CHECK-NEXT:    ret void
;
entry:
  %res = call i8 @llvm.ctpop.i8(i8 %v)
  %c3 = icmp uge i8 %res, 8
  br i1 %c3, label %range.8.9, label %ed

range.8.9:
  %cmp4 = icmp eq i8 %v, -1
  call void @use(i1 %cmp4) ; true
  ret void

ed:
  ret void
}

define void @ctpop4(i8 %v) {
; CHECK-LABEL: define void @ctpop4(
; CHECK-SAME: i8 [[V:%.*]]) {
; CHECK-NEXT:  [[TEST4:.*:]]
; CHECK-NEXT:    [[RES:%.*]] = call i8 @llvm.ctpop.i8(i8 [[V]])
; CHECK-NEXT:    [[C4:%.*]] = icmp eq i8 [[RES]], 0
; CHECK-NEXT:    br i1 [[C4]], label %[[RANGE_0_1:.*]], label %[[ED:.*]]
; CHECK:       [[RANGE_0_1]]:
; CHECK-NEXT:    call void @use(i1 true)
; CHECK-NEXT:    ret void
; CHECK:       [[ED]]:
; CHECK-NEXT:    ret void
;
test4:
  %res = call i8 @llvm.ctpop.i8(i8 %v)
  %c4 = icmp eq i8 %res, 0
  br i1 %c4, label %range.0.1, label %ed

range.0.1:
  %cmp5 = icmp eq i8 %v, 0
  call void @use(i1 %cmp5) ; true
  ret void

ed:
  ret void
}