xref: /llvm-project/llvm/test/Analysis/CostModel/RISCV/abs.ll (revision db140104054d5af588e26c36ad5faadbb599de1e)
1f3408739Sliqinweng; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2400b725cSLuke Lau; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -S -mtriple=riscv64 -mattr=+v | FileCheck %s
3f3408739Sliqinweng; Check that we don't crash querying costs when vectors are not enabled.
4f3408739Sliqinweng; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output -mtriple=riscv64
5f3408739Sliqinweng
6f3408739Sliqinwengdeclare <2 x i64>  @llvm.abs.v2i64(<2 x i64>, i1)
7f3408739Sliqinwengdeclare <4 x i64>  @llvm.abs.v4i64(<4 x i64>, i1)
8f3408739Sliqinwengdeclare <8 x i64>  @llvm.abs.v8i64(<8 x i64>, i1)
9f3408739Sliqinwengdeclare <vscale x 2 x i64> @llvm.abs.nxv2i64(<vscale x 2 x i64>, i1)
10f3408739Sliqinwengdeclare <vscale x 4 x i64> @llvm.abs.nxv4i64(<vscale x 4 x i64>, i1)
11f3408739Sliqinwengdeclare <vscale x 8 x i64> @llvm.abs.nxv8i64(<vscale x 8 x i64>, i1)
12f3408739Sliqinweng
13f3408739Sliqinwengdeclare <2 x i32>  @llvm.abs.v2i32(<2 x i32>, i1)
14f3408739Sliqinwengdeclare <4 x i32>  @llvm.abs.v4i32(<4 x i32>, i1)
15f3408739Sliqinwengdeclare <8 x i32>  @llvm.abs.v8i32(<8 x i32>, i1)
16f3408739Sliqinwengdeclare <16 x i32> @llvm.abs.v16i32(<16 x i32>, i1)
17f3408739Sliqinwengdeclare <vscale x 2 x i32>  @llvm.abs.nxv2i32(<vscale x 2 x i32>, i1)
18f3408739Sliqinwengdeclare <vscale x 4 x i32>  @llvm.abs.nxv4i32(<vscale x 4 x i32>, i1)
19f3408739Sliqinwengdeclare <vscale x 8 x i32>  @llvm.abs.nxv8i32(<vscale x 8 x i32>, i1)
20f3408739Sliqinwengdeclare <vscale x 16 x i32> @llvm.abs.nxv16i32(<vscale x 16 x i32>, i1)
21f3408739Sliqinweng
22f3408739Sliqinwengdeclare <2 x i16>  @llvm.abs.v2i16(<2 x i16>, i1)
23f3408739Sliqinwengdeclare <4 x i16>  @llvm.abs.v4i16(<4 x i16>, i1)
24f3408739Sliqinwengdeclare <8 x i16>  @llvm.abs.v8i16(<8 x i16>, i1)
25f3408739Sliqinwengdeclare <16 x i16> @llvm.abs.v16i16(<16 x i16>, i1)
26f3408739Sliqinwengdeclare <32 x i16> @llvm.abs.v32i16(<32 x i16>, i1)
27f3408739Sliqinwengdeclare <vscale x 2 x i16>  @llvm.abs.nxv2i16(<vscale x 2 x i16>, i1)
28f3408739Sliqinwengdeclare <vscale x 4 x i16>  @llvm.abs.nxv4i16(<vscale x 4 x i16>, i1)
29f3408739Sliqinwengdeclare <vscale x 8 x i16>  @llvm.abs.nxv8i16(<vscale x 8 x i16>, i1)
30f3408739Sliqinwengdeclare <vscale x 16 x i16> @llvm.abs.nxv16i16(<vscale x 16 x i16>, i1)
31f3408739Sliqinwengdeclare <vscale x 32 x i16> @llvm.abs.nxv32i16(<vscale x 32 x i16>, i1)
32f3408739Sliqinweng
33f3408739Sliqinwengdeclare <2 x i8>   @llvm.abs.v2i8(<2 x i8>, i1)
34f3408739Sliqinwengdeclare <4 x i8>   @llvm.abs.v4i8(<4 x i8>, i1)
35f3408739Sliqinwengdeclare <8 x i8>   @llvm.abs.v8i8(<8 x i8>, i1)
36f3408739Sliqinwengdeclare <16 x i8>  @llvm.abs.v16i8(<16 x i8>, i1)
37f3408739Sliqinwengdeclare <32 x i8>  @llvm.abs.v32i8(<32 x i8>, i1)
38f3408739Sliqinwengdeclare <64 x i8>  @llvm.abs.v64i8(<64 x i8>, i1)
39f3408739Sliqinwengdeclare <vscale x 8 x i8>  @llvm.abs.nxv8i8(<vscale x 8 x i8>, i1)
40f3408739Sliqinwengdeclare <vscale x 16 x i8> @llvm.abs.nxv16i8(<vscale x 16 x i8>, i1)
41f3408739Sliqinwengdeclare <vscale x 32 x i8> @llvm.abs.nxv32i8(<vscale x 32 x i8>, i1)
42f3408739Sliqinwengdeclare <vscale x 64 x i8> @llvm.abs.nxv64i8(<vscale x 64 x i8>, i1)
43f3408739Sliqinweng
44f3408739Sliqinwengdefine i32 @abs(i32 %arg) {
45f3408739Sliqinweng; CHECK-LABEL: 'abs'
46f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %1 = call <2 x i64> @llvm.abs.v2i64(<2 x i64> undef, i1 false)
47*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %2 = call <4 x i64> @llvm.abs.v4i64(<4 x i64> undef, i1 false)
48*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %3 = call <8 x i64> @llvm.abs.v8i64(<8 x i64> undef, i1 false)
49*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %4 = call <vscale x 2 x i64> @llvm.abs.nxv2i64(<vscale x 2 x i64> undef, i1 false)
50*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %5 = call <vscale x 4 x i64> @llvm.abs.nxv4i64(<vscale x 4 x i64> undef, i1 false)
51*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %6 = call <vscale x 8 x i64> @llvm.abs.nxv8i64(<vscale x 8 x i64> undef, i1 false)
52f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %7 = call <2 x i32> @llvm.abs.v2i32(<2 x i32> undef, i1 false)
53f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %8 = call <4 x i32> @llvm.abs.v4i32(<4 x i32> undef, i1 false)
54*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %9 = call <8 x i32> @llvm.abs.v8i32(<8 x i32> undef, i1 false)
55*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %10 = call <16 x i32> @llvm.abs.v16i32(<16 x i32> undef, i1 false)
56f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %11 = call <vscale x 2 x i32> @llvm.abs.nxv2i32(<vscale x 2 x i32> undef, i1 false)
57*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %12 = call <vscale x 4 x i32> @llvm.abs.nxv4i32(<vscale x 4 x i32> undef, i1 false)
58*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %13 = call <vscale x 8 x i32> @llvm.abs.nxv8i32(<vscale x 8 x i32> undef, i1 false)
59*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %14 = call <vscale x 16 x i32> @llvm.abs.nxv16i32(<vscale x 16 x i32> undef, i1 false)
60f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %15 = call <2 x i16> @llvm.abs.v2i16(<2 x i16> undef, i1 false)
61f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %16 = call <4 x i16> @llvm.abs.v4i16(<4 x i16> undef, i1 false)
62f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %17 = call <8 x i16> @llvm.abs.v8i16(<8 x i16> undef, i1 false)
63*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %18 = call <16 x i16> @llvm.abs.v16i16(<16 x i16> undef, i1 false)
64*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %19 = call <32 x i16> @llvm.abs.v32i16(<32 x i16> undef, i1 false)
65f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %20 = call <vscale x 2 x i16> @llvm.abs.nxv2i16(<vscale x 2 x i16> undef, i1 false)
66f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %21 = call <vscale x 4 x i16> @llvm.abs.nxv4i16(<vscale x 4 x i16> undef, i1 false)
67*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %22 = call <vscale x 8 x i16> @llvm.abs.nxv8i16(<vscale x 8 x i16> undef, i1 false)
68*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %23 = call <vscale x 16 x i16> @llvm.abs.nxv16i16(<vscale x 16 x i16> undef, i1 false)
69*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %24 = call <vscale x 32 x i16> @llvm.abs.nxv32i16(<vscale x 32 x i16> undef, i1 false)
70f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %25 = call <8 x i8> @llvm.abs.v8i8(<8 x i8> undef, i1 false)
71f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %26 = call <16 x i8> @llvm.abs.v16i8(<16 x i8> undef, i1 false)
72*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %27 = call <32 x i8> @llvm.abs.v32i8(<32 x i8> undef, i1 false)
73*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %28 = call <64 x i8> @llvm.abs.v64i8(<64 x i8> undef, i1 false)
74f3408739Sliqinweng; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: %29 = call <vscale x 8 x i8> @llvm.abs.nxv8i8(<vscale x 8 x i8> undef, i1 false)
75*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: %30 = call <vscale x 16 x i8> @llvm.abs.nxv16i8(<vscale x 16 x i8> undef, i1 false)
76*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 8 for instruction: %31 = call <vscale x 32 x i8> @llvm.abs.nxv32i8(<vscale x 32 x i8> undef, i1 false)
77*db140104SLiqinWeng; CHECK-NEXT:  Cost Model: Found an estimated cost of 16 for instruction: %32 = call <vscale x 64 x i8> @llvm.abs.nxv64i8(<vscale x 64 x i8> undef, i1 false)
780a5d52a7SSergey Kachkov; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
79f3408739Sliqinweng;
80f3408739Sliqinweng  call <2 x i64> @llvm.abs.v2i64(<2 x i64> undef, i1 false)
81f3408739Sliqinweng  call <4 x i64> @llvm.abs.v4i64(<4 x i64> undef, i1 false)
82f3408739Sliqinweng  call <8 x i64> @llvm.abs.v8i64(<8 x i64> undef, i1 false)
83f3408739Sliqinweng  call <vscale x 2 x i64> @llvm.abs.nxv2i64(<vscale x 2 x i64> undef, i1 false)
84f3408739Sliqinweng  call <vscale x 4 x i64> @llvm.abs.nxv4i64(<vscale x 4 x i64> undef, i1 false)
85f3408739Sliqinweng  call <vscale x 8 x i64> @llvm.abs.nxv8i64(<vscale x 8 x i64> undef, i1 false)
86f3408739Sliqinweng
87f3408739Sliqinweng  call <2 x i32>  @llvm.abs.v2i32(<2 x i32> undef, i1 false)
88f3408739Sliqinweng  call <4 x i32>  @llvm.abs.v4i32(<4 x i32> undef, i1 false)
89f3408739Sliqinweng  call <8 x i32>  @llvm.abs.v8i32(<8 x i32> undef, i1 false)
90f3408739Sliqinweng  call <16 x i32> @llvm.abs.v16i32(<16 x i32> undef, i1 false)
91f3408739Sliqinweng  call <vscale x 2 x i32>  @llvm.abs.nxv2i32(<vscale x 2 x i32> undef, i1 false)
92f3408739Sliqinweng  call <vscale x 4 x i32>  @llvm.abs.nxv4i32(<vscale x 4 x i32> undef, i1 false)
93f3408739Sliqinweng  call <vscale x 8 x i32>  @llvm.abs.nxv8i32(<vscale x 8 x i32> undef, i1 false)
94f3408739Sliqinweng  call <vscale x 16 x i32> @llvm.abs.nxv16i32(<vscale x 16 x i32> undef, i1 false)
95f3408739Sliqinweng
96f3408739Sliqinweng  call <2 x i16>  @llvm.abs.v2i16(<2 x i16> undef, i1 false)
97f3408739Sliqinweng  call <4 x i16>  @llvm.abs.v4i16(<4 x i16> undef, i1 false)
98f3408739Sliqinweng  call <8 x i16>  @llvm.abs.v8i16(<8 x i16> undef, i1 false)
99f3408739Sliqinweng  call <16 x i16> @llvm.abs.v16i16(<16 x i16> undef, i1 false)
100f3408739Sliqinweng  call <32 x i16> @llvm.abs.v32i16(<32 x i16> undef, i1 false)
101f3408739Sliqinweng  call <vscale x 2 x i16>  @llvm.abs.nxv2i16(<vscale x 2 x i16> undef, i1 false)
102f3408739Sliqinweng  call <vscale x 4 x i16>  @llvm.abs.nxv4i16(<vscale x 4 x i16> undef, i1 false)
103f3408739Sliqinweng  call <vscale x 8 x i16>  @llvm.abs.nxv8i16(<vscale x 8 x i16> undef, i1 false)
104f3408739Sliqinweng  call <vscale x 16 x i16> @llvm.abs.nxv16i16(<vscale x 16 x i16> undef, i1 false)
105f3408739Sliqinweng  call <vscale x 32 x i16> @llvm.abs.nxv32i16(<vscale x 32 x i16> undef, i1 false)
106f3408739Sliqinweng
107f3408739Sliqinweng  call <8 x i8>  @llvm.abs.v8i8(<8 x i8> undef, i1 false)
108f3408739Sliqinweng  call <16 x i8> @llvm.abs.v16i8(<16 x i8> undef, i1 false)
109f3408739Sliqinweng  call <32 x i8> @llvm.abs.v32i8(<32 x i8> undef, i1 false)
110f3408739Sliqinweng  call <64 x i8> @llvm.abs.v64i8(<64 x i8> undef, i1 false)
111f3408739Sliqinweng  call <vscale x 8 x i8>  @llvm.abs.nxv8i8(<vscale x 8 x i8> undef, i1 false)
112f3408739Sliqinweng  call <vscale x 16 x i8> @llvm.abs.nxv16i8(<vscale x 16 x i8> undef, i1 false)
113f3408739Sliqinweng  call <vscale x 32 x i8> @llvm.abs.nxv32i8(<vscale x 32 x i8> undef, i1 false)
114f3408739Sliqinweng  call <vscale x 64 x i8> @llvm.abs.nxv64i8(<vscale x 64 x i8> undef, i1 false)
115f3408739Sliqinweng
116f3408739Sliqinweng  ret i32 undef
117f3408739Sliqinweng}
118