Skip to content

Commit bff4172

Browse files
committed
[CostModel] Add tests for ldexp, [l]lround
1 parent 6ce3e2a commit bff4172

File tree

2 files changed

+303
-0
lines changed

2 files changed

+303
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2+
; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -S -mtriple=riscv64 -mattr=+v,+f,+d,+zvfh,+zvfbfmin %s | FileCheck %s
3+
4+
define void @ldexp() {
5+
; CHECK-LABEL: 'ldexp'
6+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call bfloat @llvm.ldexp.bf16.i32(bfloat poison, i32 poison)
7+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %2 = call <2 x bfloat> @llvm.ldexp.v2bf16.v2i32(<2 x bfloat> poison, <2 x i32> poison)
8+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %3 = call <4 x bfloat> @llvm.ldexp.v4bf16.v4i32(<4 x bfloat> poison, <4 x i32> poison)
9+
; CHECK-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %4 = call <8 x bfloat> @llvm.ldexp.v8bf16.v8i32(<8 x bfloat> poison, <8 x i32> poison)
10+
; CHECK-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %5 = call <16 x bfloat> @llvm.ldexp.v16bf16.v16i32(<16 x bfloat> poison, <16 x i32> poison)
11+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %6 = call <vscale x 1 x bfloat> @llvm.ldexp.nxv1bf16.nxv1i32(<vscale x 1 x bfloat> poison, <vscale x 1 x i32> poison)
12+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %7 = call <vscale x 2 x bfloat> @llvm.ldexp.nxv2bf16.nxv2i32(<vscale x 2 x bfloat> poison, <vscale x 2 x i32> poison)
13+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %8 = call <vscale x 4 x bfloat> @llvm.ldexp.nxv4bf16.nxv4i32(<vscale x 4 x bfloat> poison, <vscale x 4 x i32> poison)
14+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %9 = call <vscale x 8 x bfloat> @llvm.ldexp.nxv8bf16.nxv8i32(<vscale x 8 x bfloat> poison, <vscale x 8 x i32> poison)
15+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %10 = call <vscale x 16 x bfloat> @llvm.ldexp.nxv16bf16.nxv16i32(<vscale x 16 x bfloat> poison, <vscale x 16 x i32> poison)
16+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %11 = call float @llvm.ldexp.f32.i32(float poison, i32 poison)
17+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %12 = call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> poison, <2 x i32> poison)
18+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %13 = call <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float> poison, <4 x i32> poison)
19+
; CHECK-NEXT: Cost Model: Found an estimated cost of 23 for instruction: %14 = call <8 x float> @llvm.ldexp.v8f32.v8i32(<8 x float> poison, <8 x i32> poison)
20+
; CHECK-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %15 = call <16 x float> @llvm.ldexp.v16f32.v16i32(<16 x float> poison, <16 x i32> poison)
21+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %16 = call <vscale x 1 x float> @llvm.ldexp.nxv1f32.nxv1i32(<vscale x 1 x float> poison, <vscale x 1 x i32> poison)
22+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %17 = call <vscale x 2 x float> @llvm.ldexp.nxv2f32.nxv2i32(<vscale x 2 x float> poison, <vscale x 2 x i32> poison)
23+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %18 = call <vscale x 4 x float> @llvm.ldexp.nxv4f32.nxv4i32(<vscale x 4 x float> poison, <vscale x 4 x i32> poison)
24+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %19 = call <vscale x 8 x float> @llvm.ldexp.nxv8f32.nxv8i32(<vscale x 8 x float> poison, <vscale x 8 x i32> poison)
25+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %20 = call <vscale x 16 x float> @llvm.ldexp.nxv16f32.nxv16i32(<vscale x 16 x float> poison, <vscale x 16 x i32> poison)
26+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %21 = call double @llvm.ldexp.f64.i32(double poison, i32 poison)
27+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %22 = call <2 x double> @llvm.ldexp.v2f64.v2i32(<2 x double> poison, <2 x i32> poison)
28+
; CHECK-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %23 = call <4 x double> @llvm.ldexp.v4f64.v4i32(<4 x double> poison, <4 x i32> poison)
29+
; CHECK-NEXT: Cost Model: Found an estimated cost of 23 for instruction: %24 = call <8 x double> @llvm.ldexp.v8f64.v8i32(<8 x double> poison, <8 x i32> poison)
30+
; CHECK-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %25 = call <16 x double> @llvm.ldexp.v16f64.v16i32(<16 x double> poison, <16 x i32> poison)
31+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %26 = call <vscale x 1 x double> @llvm.ldexp.nxv1f64.nxv1i32(<vscale x 1 x double> poison, <vscale x 1 x i32> poison)
32+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %27 = call <vscale x 2 x double> @llvm.ldexp.nxv2f64.nxv2i32(<vscale x 2 x double> poison, <vscale x 2 x i32> poison)
33+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %28 = call <vscale x 4 x double> @llvm.ldexp.nxv4f64.nxv4i32(<vscale x 4 x double> poison, <vscale x 4 x i32> poison)
34+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %29 = call <vscale x 8 x double> @llvm.ldexp.nxv8f64.nxv8i32(<vscale x 8 x double> poison, <vscale x 8 x i32> poison)
35+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %30 = call <vscale x 16 x double> @llvm.ldexp.nxv16f64.nxv16i32(<vscale x 16 x double> poison, <vscale x 16 x i32> poison)
36+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %31 = call float @llvm.ldexp.f32.i64(float poison, i64 poison)
37+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %32 = call <2 x float> @llvm.ldexp.v2f32.v2i64(<2 x float> poison, <2 x i64> poison)
38+
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %33 = call <4 x float> @llvm.ldexp.v4f32.v4i64(<4 x float> poison, <4 x i64> poison)
39+
; CHECK-NEXT: Cost Model: Found an estimated cost of 23 for instruction: %34 = call <8 x float> @llvm.ldexp.v8f32.v8i64(<8 x float> poison, <8 x i64> poison)
40+
; CHECK-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %35 = call <16 x float> @llvm.ldexp.v16f32.v16i64(<16 x float> poison, <16 x i64> poison)
41+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %36 = call <vscale x 1 x float> @llvm.ldexp.nxv1f32.nxv1i64(<vscale x 1 x float> poison, <vscale x 1 x i64> poison)
42+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %37 = call <vscale x 2 x float> @llvm.ldexp.nxv2f32.nxv2i64(<vscale x 2 x float> poison, <vscale x 2 x i64> poison)
43+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %38 = call <vscale x 4 x float> @llvm.ldexp.nxv4f32.nxv4i64(<vscale x 4 x float> poison, <vscale x 4 x i64> poison)
44+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %39 = call <vscale x 8 x float> @llvm.ldexp.nxv8f32.nxv8i64(<vscale x 8 x float> poison, <vscale x 8 x i64> poison)
45+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %40 = call <vscale x 16 x float> @llvm.ldexp.nxv16f32.nxv16i64(<vscale x 16 x float> poison, <vscale x 16 x i64> poison)
46+
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %41 = call double @llvm.ldexp.f64.i64(double poison, i64 poison)
47+
; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %42 = call <2 x double> @llvm.ldexp.v2f64.v2i64(<2 x double> poison, <2 x i64> poison)
48+
; CHECK-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %43 = call <4 x double> @llvm.ldexp.v4f64.v4i64(<4 x double> poison, <4 x i64> poison)
49+
; CHECK-NEXT: Cost Model: Found an estimated cost of 23 for instruction: %44 = call <8 x double> @llvm.ldexp.v8f64.v8i64(<8 x double> poison, <8 x i64> poison)
50+
; CHECK-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %45 = call <16 x double> @llvm.ldexp.v16f64.v16i64(<16 x double> poison, <16 x i64> poison)
51+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %46 = call <vscale x 1 x double> @llvm.ldexp.nxv1f64.nxv1i64(<vscale x 1 x double> poison, <vscale x 1 x i64> poison)
52+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %47 = call <vscale x 2 x double> @llvm.ldexp.nxv2f64.nxv2i64(<vscale x 2 x double> poison, <vscale x 2 x i64> poison)
53+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %48 = call <vscale x 4 x double> @llvm.ldexp.nxv4f64.nxv4i64(<vscale x 4 x double> poison, <vscale x 4 x i64> poison)
54+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %49 = call <vscale x 8 x double> @llvm.ldexp.nxv8f64.nxv8i64(<vscale x 8 x double> poison, <vscale x 8 x i64> poison)
55+
; CHECK-NEXT: Cost Model: Invalid cost for instruction: %50 = call <vscale x 16 x double> @llvm.ldexp.nxv16f64.nxv16i64(<vscale x 16 x double> poison, <vscale x 16 x i64> poison)
56+
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
57+
;
58+
call bfloat @llvm.ldexp.bf16.i32(bfloat poison, i32 poison)
59+
call <2 x bfloat> @llvm.ldexp.v2bf16.v2i32(<2 x bfloat> poison, <2 x i32> poison)
60+
call <4 x bfloat> @llvm.ldexp.v4bf16.v4i32(<4 x bfloat> poison, <4 x i32> poison)
61+
call <8 x bfloat> @llvm.ldexp.v8bf16.v8i32(<8 x bfloat> poison, <8 x i32> poison)
62+
call <16 x bfloat> @llvm.ldexp.v16bf16.v16i32(<16 x bfloat> poison, <16 x i32> poison)
63+
call <vscale x 1 x bfloat> @llvm.ldexp.nxv1bf16.nxv1i32(<vscale x 1 x bfloat> poison, <vscale x 1 x i32> poison)
64+
call <vscale x 2 x bfloat> @llvm.ldexp.nxv2bf16.nxv2i32(<vscale x 2 x bfloat> poison, <vscale x 2 x i32> poison)
65+
call <vscale x 4 x bfloat> @llvm.ldexp.nxv4bf16.nxv4i32(<vscale x 4 x bfloat> poison, <vscale x 4 x i32> poison)
66+
call <vscale x 8 x bfloat> @llvm.ldexp.nxv8bf16.nxv8i32(<vscale x 8 x bfloat> poison, <vscale x 8 x i32> poison)
67+
call <vscale x 16 x bfloat> @llvm.ldexp.nxv16bf16.nxv16i32(<vscale x 16 x bfloat> poison, <vscale x 16 x i32> poison)
68+
call float @llvm.ldexp.f32.i32(float poison, i32 poison)
69+
call <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> poison, <2 x i32> poison)
70+
call <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float> poison, <4 x i32> poison)
71+
call <8 x float> @llvm.ldexp.v8f32.v8i32(<8 x float> poison, <8 x i32> poison)
72+
call <16 x float> @llvm.ldexp.v16f32.v16i32(<16 x float> poison, <16 x i32> poison)
73+
call <vscale x 1 x float> @llvm.ldexp.nxv1f32.nxv1i32(<vscale x 1 x float> poison, <vscale x 1 x i32> poison)
74+
call <vscale x 2 x float> @llvm.ldexp.nxv2f32.nxv2i32(<vscale x 2 x float> poison, <vscale x 2 x i32> poison)
75+
call <vscale x 4 x float> @llvm.ldexp.nxv4f32.nxv4i32(<vscale x 4 x float> poison, <vscale x 4 x i32> poison)
76+
call <vscale x 8 x float> @llvm.ldexp.nxv8f32.nxv8i32(<vscale x 8 x float> poison, <vscale x 8 x i32> poison)
77+
call <vscale x 16 x float> @llvm.ldexp.nxv16f32.nxv16i32(<vscale x 16 x float> poison, <vscale x 16 x i32> poison)
78+
call double @llvm.ldexp.f64.i32(double poison, i32 poison)
79+
call <2 x double> @llvm.ldexp.v2f64.v2i32(<2 x double> poison, <2 x i32> poison)
80+
call <4 x double> @llvm.ldexp.v4f64.v4i32(<4 x double> poison, <4 x i32> poison)
81+
call <8 x double> @llvm.ldexp.v8f64.v8i32(<8 x double> poison, <8 x i32> poison)
82+
call <16 x double> @llvm.ldexp.v16f64.v16i32(<16 x double> poison, <16 x i32> poison)
83+
call <vscale x 1 x double> @llvm.ldexp.nxv1f64.nxv1i32(<vscale x 1 x double> poison, <vscale x 1 x i32> poison)
84+
call <vscale x 2 x double> @llvm.ldexp.nxv2f64.nxv2i32(<vscale x 2 x double> poison, <vscale x 2 x i32> poison)
85+
call <vscale x 4 x double> @llvm.ldexp.nxv4f64.nxv4i32(<vscale x 4 x double> poison, <vscale x 4 x i32> poison)
86+
call <vscale x 8 x double> @llvm.ldexp.nxv8f64.nxv8i32(<vscale x 8 x double> poison, <vscale x 8 x i32> poison)
87+
call <vscale x 16 x double> @llvm.ldexp.nxv16f64.nxv16i32(<vscale x 16 x double> poison, <vscale x 16 x i32> poison)
88+
call float @llvm.ldexp.f32.i64(float poison, i64 poison)
89+
call <2 x float> @llvm.ldexp.v2f32.v2i64(<2 x float> poison, <2 x i64> poison)
90+
call <4 x float> @llvm.ldexp.v4f32.v4i64(<4 x float> poison, <4 x i64> poison)
91+
call <8 x float> @llvm.ldexp.v8f32.v8i64(<8 x float> poison, <8 x i64> poison)
92+
call <16 x float> @llvm.ldexp.v16f32.v16i64(<16 x float> poison, <16 x i64> poison)
93+
call <vscale x 1 x float> @llvm.ldexp.nxv1f32.nxv1i64(<vscale x 1 x float> poison, <vscale x 1 x i64> poison)
94+
call <vscale x 2 x float> @llvm.ldexp.nxv2f32.nxv2i64(<vscale x 2 x float> poison, <vscale x 2 x i64> poison)
95+
call <vscale x 4 x float> @llvm.ldexp.nxv4f32.nxv4i64(<vscale x 4 x float> poison, <vscale x 4 x i64> poison)
96+
call <vscale x 8 x float> @llvm.ldexp.nxv8f32.nxv8i64(<vscale x 8 x float> poison, <vscale x 8 x i64> poison)
97+
call <vscale x 16 x float> @llvm.ldexp.nxv16f32.nxv16i64(<vscale x 16 x float> poison, <vscale x 16 x i64> poison)
98+
call double @llvm.ldexp.f64.i64(double poison, i64 poison)
99+
call <2 x double> @llvm.ldexp.v2f64.v2i64(<2 x double> poison, <2 x i64> poison)
100+
call <4 x double> @llvm.ldexp.v4f64.v4i64(<4 x double> poison, <4 x i64> poison)
101+
call <8 x double> @llvm.ldexp.v8f64.v8i64(<8 x double> poison, <8 x i64> poison)
102+
call <16 x double> @llvm.ldexp.v16f64.v16i64(<16 x double> poison, <16 x i64> poison)
103+
call <vscale x 1 x double> @llvm.ldexp.nxv1f64.nxv1i64(<vscale x 1 x double> poison, <vscale x 1 x i64> poison)
104+
call <vscale x 2 x double> @llvm.ldexp.nxv2f64.nxv2i64(<vscale x 2 x double> poison, <vscale x 2 x i64> poison)
105+
call <vscale x 4 x double> @llvm.ldexp.nxv4f64.nxv4i64(<vscale x 4 x double> poison, <vscale x 4 x i64> poison)
106+
call <vscale x 8 x double> @llvm.ldexp.nxv8f64.nxv8i64(<vscale x 8 x double> poison, <vscale x 8 x i64> poison)
107+
call <vscale x 16 x double> @llvm.ldexp.nxv16f64.nxv16i64(<vscale x 16 x double> poison, <vscale x 16 x i64> poison)
108+
ret void
109+
}

0 commit comments

Comments
 (0)