xref: /llvm-project/llvm/test/Analysis/CostModel/RISCV/phi-const.ll (revision 0a5d52a757f389b4f7ee3ee1ad6840ff7ce33e51)
1b87a0930SLuke Lau; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
2b87a0930SLuke Lau; RUN: opt < %s -mtriple=riscv64 -mattr=+f,+d -disable-output -passes="print<cost-model>" 2>&1 | FileCheck %s
3b87a0930SLuke Lau
4b87a0930SLuke Laudefine i8 @phi_i8(i1 %c) {
5b87a0930SLuke Lau; CHECK-LABEL: 'phi_i8'
6*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
7*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
8*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
9*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi i8 [ 16, %a ], [ 32, %b ]
10*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i8 %x
11b87a0930SLuke Lau;
12b87a0930SLuke Lau  br i1 %c, label %a, label %b
13b87a0930SLuke Laua:
14b87a0930SLuke Lau  br label %d
15b87a0930SLuke Laub:
16b87a0930SLuke Lau  br label %d
17b87a0930SLuke Laud:
18b87a0930SLuke Lau  %x = phi i8 [16, %a], [32, %b]
19b87a0930SLuke Lau  ret i8 %x
20b87a0930SLuke Lau}
21b87a0930SLuke Lau
22b87a0930SLuke Laudefine i16 @phi_i16_small(i1 %c) {
23b87a0930SLuke Lau; CHECK-LABEL: 'phi_i16_small'
24*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
25*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
26*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
27*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi i16 [ 1, %a ], [ 2, %b ]
28*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %x
29b87a0930SLuke Lau;
30b87a0930SLuke Lau  br i1 %c, label %a, label %b
31b87a0930SLuke Laua:
32b87a0930SLuke Lau  br label %d
33b87a0930SLuke Laub:
34b87a0930SLuke Lau  br label %d
35b87a0930SLuke Laud:
36b87a0930SLuke Lau  %x = phi i16 [1, %a], [2, %b]
37b87a0930SLuke Lau  ret i16 %x
38b87a0930SLuke Lau}
39b87a0930SLuke Lau
40b87a0930SLuke Laudefine i16 @phi_i16_large(i1 %c) {
41b87a0930SLuke Lau; CHECK-LABEL: 'phi_i16_large'
42*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
43*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
44*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
45*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi i16 [ 42, %a ], [ -7616, %b ]
46*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i16 %x
47b87a0930SLuke Lau;
48b87a0930SLuke Lau  br i1 %c, label %a, label %b
49b87a0930SLuke Laua:
50b87a0930SLuke Lau  br label %d
51b87a0930SLuke Laub:
52b87a0930SLuke Lau  br label %d
53b87a0930SLuke Laud:
54b87a0930SLuke Lau  %x = phi i16 [42, %a], [123456, %b]
55b87a0930SLuke Lau  ret i16 %x
56b87a0930SLuke Lau}
57b87a0930SLuke Lau
58b87a0930SLuke Laudefine i32 @phi_i32_small(i1 %c) {
59b87a0930SLuke Lau; CHECK-LABEL: 'phi_i32_small'
60*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
61*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
62*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
63*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi i32 [ 1, %a ], [ 2, %b ]
64*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
65b87a0930SLuke Lau;
66b87a0930SLuke Lau  br i1 %c, label %a, label %b
67b87a0930SLuke Laua:
68b87a0930SLuke Lau  br label %d
69b87a0930SLuke Laub:
70b87a0930SLuke Lau  br label %d
71b87a0930SLuke Laud:
72b87a0930SLuke Lau  %x = phi i32 [1, %a], [2, %b]
73b87a0930SLuke Lau  ret i32 %x
74b87a0930SLuke Lau}
75b87a0930SLuke Lau
76b87a0930SLuke Laudefine i32 @phi_i32_large(i1 %c) {
77b87a0930SLuke Lau; CHECK-LABEL: 'phi_i32_large'
78*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
79*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
80*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
81*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi i32 [ 42, %a ], [ 123456, %b ]
82*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 %x
83b87a0930SLuke Lau;
84b87a0930SLuke Lau  br i1 %c, label %a, label %b
85b87a0930SLuke Laua:
86b87a0930SLuke Lau  br label %d
87b87a0930SLuke Laub:
88b87a0930SLuke Lau  br label %d
89b87a0930SLuke Laud:
90b87a0930SLuke Lau  %x = phi i32 [42, %a], [123456, %b]
91b87a0930SLuke Lau  ret i32 %x
92b87a0930SLuke Lau}
93b87a0930SLuke Lau
94b87a0930SLuke Laudefine i64 @phi_i64_small(i1 %c) {
95b87a0930SLuke Lau; CHECK-LABEL: 'phi_i64_small'
96*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
97*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
98*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
99*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi i64 [ 1, %a ], [ 2, %b ]
100*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %x
101b87a0930SLuke Lau;
102b87a0930SLuke Lau  br i1 %c, label %a, label %b
103b87a0930SLuke Laua:
104b87a0930SLuke Lau  br label %d
105b87a0930SLuke Laub:
106b87a0930SLuke Lau  br label %d
107b87a0930SLuke Laud:
108b87a0930SLuke Lau  %x = phi i64 [1, %a], [2, %b]
109b87a0930SLuke Lau  ret i64 %x
110b87a0930SLuke Lau}
111b87a0930SLuke Lau
112b87a0930SLuke Laudefine i64 @phi_i64_large(i1 %c) {
113b87a0930SLuke Lau; CHECK-LABEL: 'phi_i64_large'
114*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
115*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
116*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
117*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi i64 [ 42, %a ], [ 123456, %b ]
118*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i64 %x
119b87a0930SLuke Lau;
120b87a0930SLuke Lau  br i1 %c, label %a, label %b
121b87a0930SLuke Laua:
122b87a0930SLuke Lau  br label %d
123b87a0930SLuke Laub:
124b87a0930SLuke Lau  br label %d
125b87a0930SLuke Laud:
126b87a0930SLuke Lau  %x = phi i64 [42, %a], [123456, %b]
127b87a0930SLuke Lau  ret i64 %x
128b87a0930SLuke Lau}
129b87a0930SLuke Lau
130b87a0930SLuke Laudefine half @phi_f16(i1 %c) {
131b87a0930SLuke Lau; CHECK-LABEL: 'phi_f16'
132*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
133*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
134*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
135*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi half [ 0xHE3CE, %a ], [ 0xH5144, %b ]
136*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret half %x
137b87a0930SLuke Lau;
138b87a0930SLuke Lau  br i1 %c, label %a, label %b
139b87a0930SLuke Laua:
140b87a0930SLuke Lau  br label %d
141b87a0930SLuke Laub:
142b87a0930SLuke Lau  br label %d
143b87a0930SLuke Laud:
144b87a0930SLuke Lau  %x = phi half [-999.0, %a], [42.125, %b]
145b87a0930SLuke Lau  ret half %x
146b87a0930SLuke Lau}
147b87a0930SLuke Lau
148b87a0930SLuke Laudefine float @phi_f32(i1 %c) {
149b87a0930SLuke Lau; CHECK-LABEL: 'phi_f32'
150*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
151*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
152*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
153*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi float [ -9.990000e+02, %a ], [ 4.212500e+01, %b ]
154*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret float %x
155b87a0930SLuke Lau;
156b87a0930SLuke Lau  br i1 %c, label %a, label %b
157b87a0930SLuke Laua:
158b87a0930SLuke Lau  br label %d
159b87a0930SLuke Laub:
160b87a0930SLuke Lau  br label %d
161b87a0930SLuke Laud:
162b87a0930SLuke Lau  %x = phi float [-999.0, %a], [42.125, %b]
163b87a0930SLuke Lau  ret float %x
164b87a0930SLuke Lau}
165b87a0930SLuke Lau
166b87a0930SLuke Laudefine double @phi_f64(i1 %c) {
167b87a0930SLuke Lau; CHECK-LABEL: 'phi_f64'
168*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br i1 %c, label %a, label %b
169*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
170*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: br label %d
171*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %x = phi double [ -9.990000e+02, %a ], [ 4.212500e+01, %b ]
172*0a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret double %x
173b87a0930SLuke Lau;
174b87a0930SLuke Lau  br i1 %c, label %a, label %b
175b87a0930SLuke Laua:
176b87a0930SLuke Lau  br label %d
177b87a0930SLuke Laub:
178b87a0930SLuke Lau  br label %d
179b87a0930SLuke Laud:
180b87a0930SLuke Lau  %x = phi double [-999.0, %a], [42.125, %b]
181b87a0930SLuke Lau  ret double %x
182b87a0930SLuke Lau}
183