-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[TTI][RISCV] Implement cost of some intrinsics with LMUL #117874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,28 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py | ||
| ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -S -mtriple=riscv64 -mattr=+v,+f,+d,+zfh,+zvfh | FileCheck %s --check-prefixes=CHECK,ZVFH | ||
| ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -S -mtriple=riscv64 -mattr=+v,+f,+d,+zfh,+zvfhmin | FileCheck %s --check-prefixes=CHECK,ZVFHMIN | ||
| ; RUN: opt < %s -passes="print<cost-model>" 2>&1 -disable-output -S -mtriple=riscv64 -mattr=+v,+f,+d,+zfh,+zvfhmin,+zvfbfmin | FileCheck %s --check-prefixes=CHECK,ZVFHMIN | ||
|
|
||
| define void @fabs() { | ||
| ; CHECK-LABEL: 'fabs' | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call float @llvm.fabs.f32(float undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <2 x float> @llvm.fabs.v2f32(<2 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = call <4 x float> @llvm.fabs.v4f32(<4 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = call <8 x float> @llvm.fabs.v8f32(<8 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %5 = call <16 x float> @llvm.fabs.v16f32(<16 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %4 = call <8 x float> @llvm.fabs.v8f32(<8 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %5 = call <16 x float> @llvm.fabs.v16f32(<16 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %6 = call <vscale x 1 x float> @llvm.fabs.nxv1f32(<vscale x 1 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %7 = call <vscale x 2 x float> @llvm.fabs.nxv2f32(<vscale x 2 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %8 = call <vscale x 4 x float> @llvm.fabs.nxv4f32(<vscale x 4 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %9 = call <vscale x 8 x float> @llvm.fabs.nxv8f32(<vscale x 8 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %10 = call <vscale x 16 x float> @llvm.fabs.nxv16f32(<vscale x 16 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %8 = call <vscale x 4 x float> @llvm.fabs.nxv4f32(<vscale x 4 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %9 = call <vscale x 8 x float> @llvm.fabs.nxv8f32(<vscale x 8 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %10 = call <vscale x 16 x float> @llvm.fabs.nxv16f32(<vscale x 16 x float> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %11 = call double @llvm.fabs.f64(double undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %12 = call <2 x double> @llvm.fabs.v2f64(<2 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %13 = call <4 x double> @llvm.fabs.v4f64(<4 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %14 = call <8 x double> @llvm.fabs.v8f64(<8 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %15 = call <16 x double> @llvm.fabs.v16f64(<16 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %13 = call <4 x double> @llvm.fabs.v4f64(<4 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %14 = call <8 x double> @llvm.fabs.v8f64(<8 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %15 = call <16 x double> @llvm.fabs.v16f64(<16 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %16 = call <vscale x 1 x double> @llvm.fabs.nxv1f64(<vscale x 1 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %17 = call <vscale x 2 x double> @llvm.fabs.nxv2f64(<vscale x 2 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %18 = call <vscale x 4 x double> @llvm.fabs.nxv4f64(<vscale x 4 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %19 = call <vscale x 8 x double> @llvm.fabs.nxv8f64(<vscale x 8 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %17 = call <vscale x 2 x double> @llvm.fabs.nxv2f64(<vscale x 2 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %18 = call <vscale x 4 x double> @llvm.fabs.nxv4f64(<vscale x 4 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %19 = call <vscale x 8 x double> @llvm.fabs.nxv8f64(<vscale x 8 x double> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void | ||
| ; | ||
| call float @llvm.fabs.f32(float undef) | ||
|
|
@@ -48,23 +48,59 @@ define void @fabs() { | |
| } | ||
|
|
||
| define void @fabs_f16() { | ||
| ; CHECK-LABEL: 'fabs_f16' | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call half @llvm.fabs.f16(half undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = call <8 x half> @llvm.fabs.v8f16(<8 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %5 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %6 = call <vscale x 2 x half> @llvm.fabs.nxv2f16(<vscale x 2 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %7 = call <vscale x 4 x half> @llvm.fabs.nxv4f16(<vscale x 4 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %8 = call <vscale x 8 x half> @llvm.fabs.nxv8f16(<vscale x 8 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %9 = call <vscale x 16 x half> @llvm.fabs.nxv16f16(<vscale x 16 x half> undef) | ||
| ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void | ||
| ; ZVFH-LABEL: 'fabs_f16' | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call half @llvm.fabs.f16(half undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %2 = call <2 x bfloat> @llvm.fabs.v2bf16(<2 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %3 = call <4 x bfloat> @llvm.fabs.v4bf16(<4 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %4 = call <8 x bfloat> @llvm.fabs.v8bf16(<8 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %5 = call <16 x bfloat> @llvm.fabs.v16bf16(<16 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %6 = call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %7 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %8 = call <8 x half> @llvm.fabs.v8f16(<8 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %9 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Invalid cost for instruction: %10 = call <vscale x 2 x bfloat> @llvm.fabs.nxv2bf16(<vscale x 2 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Invalid cost for instruction: %11 = call <vscale x 4 x bfloat> @llvm.fabs.nxv4bf16(<vscale x 4 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Invalid cost for instruction: %12 = call <vscale x 8 x bfloat> @llvm.fabs.nxv8bf16(<vscale x 8 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Invalid cost for instruction: %13 = call <vscale x 16 x bfloat> @llvm.fabs.nxv16bf16(<vscale x 16 x bfloat> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %14 = call <vscale x 2 x half> @llvm.fabs.nxv2f16(<vscale x 2 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %15 = call <vscale x 4 x half> @llvm.fabs.nxv4f16(<vscale x 4 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %16 = call <vscale x 8 x half> @llvm.fabs.nxv8f16(<vscale x 8 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %17 = call <vscale x 16 x half> @llvm.fabs.nxv16f16(<vscale x 16 x half> undef) | ||
| ; ZVFH-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void | ||
| ; | ||
| ; ZVFHMIN-LABEL: 'fabs_f16' | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = call half @llvm.fabs.f16(half undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = call <2 x bfloat> @llvm.fabs.v2bf16(<2 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %3 = call <4 x bfloat> @llvm.fabs.v4bf16(<4 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %4 = call <8 x bfloat> @llvm.fabs.v8bf16(<8 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %5 = call <16 x bfloat> @llvm.fabs.v16bf16(<16 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %6 = call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %7 = call <4 x half> @llvm.fabs.v4f16(<4 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %8 = call <8 x half> @llvm.fabs.v8f16(<8 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %9 = call <16 x half> @llvm.fabs.v16f16(<16 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %10 = call <vscale x 2 x bfloat> @llvm.fabs.nxv2bf16(<vscale x 2 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %11 = call <vscale x 4 x bfloat> @llvm.fabs.nxv4bf16(<vscale x 4 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %12 = call <vscale x 8 x bfloat> @llvm.fabs.nxv8bf16(<vscale x 8 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %13 = call <vscale x 16 x bfloat> @llvm.fabs.nxv16bf16(<vscale x 16 x bfloat> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %14 = call <vscale x 2 x half> @llvm.fabs.nxv2f16(<vscale x 2 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %15 = call <vscale x 4 x half> @llvm.fabs.nxv4f16(<vscale x 4 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %16 = call <vscale x 8 x half> @llvm.fabs.nxv8f16(<vscale x 8 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %17 = call <vscale x 16 x half> @llvm.fabs.nxv16f16(<vscale x 16 x half> undef) | ||
| ; ZVFHMIN-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void | ||
| ; | ||
| call half @llvm.fabs.f16(half undef) | ||
| call <2 x bfloat> @llvm.fabs.v2f16(<2 x bfloat> undef) | ||
|
||
| call <4 x bfloat> @llvm.fabs.v4f16(<4 x bfloat> undef) | ||
| call <8 x bfloat> @llvm.fabs.v8f16(<8 x bfloat> undef) | ||
| call <16 x bfloat> @llvm.fabs.v16f16(<16 x bfloat> undef) | ||
|
||
| call <2 x half> @llvm.fabs.v2f16(<2 x half> undef) | ||
| call <4 x half> @llvm.fabs.v4f16(<4 x half> undef) | ||
| call <8 x half> @llvm.fabs.v8f16(<8 x half> undef) | ||
| call <16 x half> @llvm.fabs.v16f16(<16 x half> undef) | ||
| call <vscale x 2 x bfloat> @llvm.fabs.nxv2f16(<vscale x 2 x bfloat> undef) | ||
| call <vscale x 4 x bfloat> @llvm.fabs.nxv4f16(<vscale x 4 x bfloat> undef) | ||
| call <vscale x 8 x bfloat> @llvm.fabs.nxv8f16(<vscale x 8 x bfloat> undef) | ||
| call <vscale x 16 x bfloat> @llvm.fabs.nxv16f16(<vscale x 16 x bfloat> undef) | ||
| call <vscale x 2 x half> @llvm.fabs.nxv2f16(<vscale x 2 x half> undef) | ||
| call <vscale x 4 x half> @llvm.fabs.nxv4f16(<vscale x 4 x half> undef) | ||
| call <vscale x 8 x half> @llvm.fabs.nxv8f16(<vscale x 8 x half> undef) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add zvfbfmin to the ZVFH run line too? I think that matches the other tests with bfloat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done