File: ashr.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (71 lines) | stat: -rw-r--r-- 2,593 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
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
; RUN: opt < %s --data-layout="e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
; RUN: opt < %s --data-layout="e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128" -S -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s

; In general, we can't deal with ashr.
define i32 @t0(i32 %x, i32 %y) {
; CHECK-LABEL: 't0'
; CHECK-NEXT:  Classifying expressions for: @t0
; CHECK-NEXT:    %i0 = ashr i32 %x, %y
; CHECK-NEXT:    --> %i0 U: full-set S: full-set
; CHECK-NEXT:  Determining loop execution counts for: @t0
;
  %i0 = ashr i32 %x, %y
  ret i32 %i0
}
; Not even if we know it's exact
define i32 @t1(i32 %x, i32 %y) {
; CHECK-LABEL: 't1'
; CHECK-NEXT:  Classifying expressions for: @t1
; CHECK-NEXT:    %i0 = ashr exact i32 %x, %y
; CHECK-NEXT:    --> %i0 U: full-set S: full-set
; CHECK-NEXT:  Determining loop execution counts for: @t1
;
  %i0 = ashr exact i32 %x, %y
  ret i32 %i0
}
; Not even if the shift amount is a constant.
define i32 @t2(i32 %x, i32 %y) {
; CHECK-LABEL: 't2'
; CHECK-NEXT:  Classifying expressions for: @t2
; CHECK-NEXT:    %i0 = ashr i32 %x, 4
; CHECK-NEXT:    --> %i0 U: [-134217728,134217728) S: [-134217728,134217728)
; CHECK-NEXT:  Determining loop execution counts for: @t2
;
  %i0 = ashr i32 %x, 4
  ret i32 %i0
}
; However, if it's a constant AND the shift is exact, we can model it!
define i32 @t3(i32 %x, i32 %y) {
; CHECK-LABEL: 't3'
; CHECK-NEXT:  Classifying expressions for: @t3
; CHECK-NEXT:    %i0 = ashr exact i32 %x, 4
; CHECK-NEXT:    --> %i0 U: [-134217728,134217728) S: [-134217728,134217728)
; CHECK-NEXT:  Determining loop execution counts for: @t3
;
  %i0 = ashr exact i32 %x, 4
  ret i32 %i0
}
; As long as the shift amount is in-bounds
define i32 @t4(i32 %x, i32 %y) {
; CHECK-LABEL: 't4'
; CHECK-NEXT:  Classifying expressions for: @t4
; CHECK-NEXT:    %i0 = ashr exact i32 %x, 32
; CHECK-NEXT:    --> %i0 U: full-set S: full-set
; CHECK-NEXT:  Determining loop execution counts for: @t4
;
  %i0 = ashr exact i32 %x, 32
  ret i32 %i0
}

; One more test, just to see that we model constant correctly
define i32 @t5(i32 %x, i32 %y) {
; CHECK-LABEL: 't5'
; CHECK-NEXT:  Classifying expressions for: @t5
; CHECK-NEXT:    %i0 = ashr exact i32 %x, 5
; CHECK-NEXT:    --> %i0 U: [-67108864,67108864) S: [-67108864,67108864)
; CHECK-NEXT:  Determining loop execution counts for: @t5
;
  %i0 = ashr exact i32 %x, 5
  ret i32 %i0
}