summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/CostModel/SystemZ/div-pow2.ll
blob: 9ef2dd71e8fa747244bcc7328cb00edfa95f0612 (plain)
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
143
144
145
146
147
148
149
150
151
152
153
154
; RUN: opt < %s -cost-model -analyze -mtriple=systemz-unknown -mcpu=z13 | FileCheck %s

; Scalar sdiv

define i64 @fun0(i64 %a) {
  %r = sdiv i64 %a, 2
  ret i64 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i64 %a, 2
}

define i64 @fun1(i64 %a) {
  %r = sdiv i64 %a, -4
  ret i64 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i64 %a, -4
}

define i32 @fun2(i32 %a) {
  %r = sdiv i32 %a, 8
  ret i32 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i32 %a, 8
}

define i32 @fun3(i32 %a) {
  %r = sdiv i32 %a, -16
  ret i32 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i32 %a, -16
}

define i16 @fun4(i16 %a) {
  %r = sdiv i16 %a, 32
  ret i16 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i16 %a, 32
}

define i16 @fun5(i16 %a) {
  %r = sdiv i16 %a, -64
  ret i16 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i16 %a, -64
}

define i8 @fun6(i8 %a) {
  %r = sdiv i8 %a, 64
  ret i8 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i8 %a, 64
}

define i8 @fun7(i8 %a) {
  %r = sdiv i8 %a, -128
  ret i8 %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv i8 %a, -128
}


; Vector sdiv

define <2 x i64> @fun8(<2 x i64> %a) {
  %r = sdiv <2 x i64> %a, <i64 2, i64 2>
  ret <2 x i64> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <2 x i64> %a, <i64 2, i64 2>
}

define <2 x i64> @fun9(<2 x i64> %a) {
  %r = sdiv <2 x i64> %a, <i64 -4, i64 -4>
  ret <2 x i64> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <2 x i64> %a, <i64 -4, i64 -4>
}

define <4 x i32> @fun10(<4 x i32> %a) {
  %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
  ret <4 x i32> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
}

define <4 x i32> @fun11(<4 x i32> %a) {
  %r = sdiv <4 x i32> %a, <i32 -16, i32 -16, i32 -16, i32 -16>
  ret <4 x i32> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <4 x i32> %a, <i32 -16
}

define <8 x i16> @fun12(<8 x i16> %a) {
  %r = sdiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
  ret <8 x i16> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <8 x i16> %a, <i16 32
}

define <8 x i16> @fun13(<8 x i16> %a) {
  %r = sdiv <8 x i16> %a, <i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64, i16 -64>
  ret <8 x i16> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <8 x i16> %a, <i16 -64
}

define <16 x i8> @fun14(<16 x i8> %a) {
  %r = sdiv <16 x i8> %a, <i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64, i8 64>
  ret <16 x i8> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <16 x i8> %a, <i8 64
}

define <16 x i8> @fun15(<16 x i8> %a) {
  %r = sdiv <16 x i8> %a, <i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128, i8 -128>
  ret <16 x i8> %r
; CHECK: Cost Model: Found an estimated cost of 4 for instruction:   %r = sdiv <16 x i8> %a, <i8 -128
}

; Scalar udiv

define i64 @fun16(i64 %a) {
  %r = udiv i64 %a, 2
  ret i64 %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv i64 %a, 2
}

define i32 @fun17(i32 %a) {
  %r = udiv i32 %a, 8
  ret i32 %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv i32 %a, 8
}

define i16 @fun18(i16 %a) {
  %r = udiv i16 %a, 32
  ret i16 %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv i16 %a, 32
}

define i8 @fun19(i8 %a) {
  %r = udiv i8 %a, 128
  ret i8 %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv i8 %a, -128
}

; Vector udiv

define <2 x i64> @fun20(<2 x i64> %a) {
  %r = udiv <2 x i64> %a, <i64 2, i64 2>
  ret <2 x i64> %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv <2 x i64> %a, <i64 2
}

define <4 x i32> @fun21(<4 x i32> %a) {
  %r = udiv <4 x i32> %a, <i32 8, i32 8, i32 8, i32 8>
  ret <4 x i32> %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv <4 x i32> %a, <i32 8
}

define <8 x i16> @fun22(<8 x i16> %a) {
  %r = udiv <8 x i16> %a, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
  ret <8 x i16> %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv <8 x i16> %a, <i16 32
}

define <16 x i8> @fun23(<16 x i8> %a) {
  %r = udiv <16 x i8> %a, <i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128, i8 128>
  ret <16 x i8> %r
; CHECK: Cost Model: Found an estimated cost of 1 for instruction:   %r = udiv <16 x i8> %a, <i8 -128
}
OpenPOWER on IntegriCloud