[llvm] 8d2a199 - [AArch64] Add some fp16 cast cost-model tests.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 11 10:22:13 PST 2021
Author: Florian Hahn
Date: 2021-11-11T18:21:44Z
New Revision: 8d2a1994c89864e8757a192db34c8c91ab54eeda
URL: https://github.com/llvm/llvm-project/commit/8d2a1994c89864e8757a192db34c8c91ab54eeda
DIFF: https://github.com/llvm/llvm-project/commit/8d2a1994c89864e8757a192db34c8c91ab54eeda.diff
LOG: [AArch64] Add some fp16 cast cost-model tests.
This adds initial tests for cost-modeling {u,s}itofp for fp16 vectors.
At the moment, they are under-estimated in a couple of cases.
Added:
Modified:
llvm/test/Analysis/CostModel/AArch64/cast.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/CostModel/AArch64/cast.ll b/llvm/test/Analysis/CostModel/AArch64/cast.ll
index de70264ecbfcc..4f82add71d5bc 100644
--- a/llvm/test/Analysis/CostModel/AArch64/cast.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/cast.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
-; RUN: opt -cost-model -analyze -mtriple=aarch64-none-linux-gnueabi %s -o - | FileCheck %s
+; RUN: opt -cost-model -analyze -mtriple=aarch64-none-linux-gnueabi %s -o - | FileCheck --check-prefixes=CHECK,NOFP16 %s
+; RUN: opt -cost-model -analyze -mtriple=aarch64-none-linux-gnueabi -mattr=+fullfp16 %s -o - | FileCheck --check-prefixes=CHECK,FULLFP16 %s
define i32 @casts_no_users() {
; CHECK-LABEL: 'casts_no_users'
@@ -267,6 +268,30 @@ define i32 @casts_no_users() {
; CHECK-NEXT: Cost Model: Found an estimated cost of 38 for instruction: %r247 = sitofp <16 x i16> undef to <16 x double>
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %r248 = uitofp <16 x i64> undef to <16 x double>
; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %r249 = sitofp <16 x i64> undef to <16 x double>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r250 = uitofp <8 x i1> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r251 = sitofp <8 x i1> undef to <8 x half>
+; NOFP16-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r252 = uitofp <8 x i8> undef to <8 x half>
+; NOFP16-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r253 = sitofp <8 x i8> undef to <8 x half>
+; FULLFP16-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r252 = uitofp <8 x i8> undef to <8 x half>
+; FULLFP16-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r253 = sitofp <8 x i8> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r254 = uitofp <8 x i16> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r255 = sitofp <8 x i16> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r256 = uitofp <8 x i32> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r257 = sitofp <8 x i32> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %r258 = uitofp <8 x i64> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 7 for instruction: %r259 = sitofp <8 x i64> undef to <8 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r260 = uitofp <16 x i1> undef to <16 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r261 = sitofp <16 x i1> undef to <16 x half>
+; NOFP16-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
+; NOFP16-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
+; FULLFP16-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r262 = uitofp <16 x i8> undef to <16 x half>
+; FULLFP16-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r263 = sitofp <16 x i8> undef to <16 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r264 = uitofp <16 x i16> undef to <16 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r265 = sitofp <16 x i16> undef to <16 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %r266 = uitofp <16 x i32> undef to <16 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %r267 = sitofp <16 x i32> undef to <16 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %r268 = uitofp <16 x i64> undef to <16 x half>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 14 for instruction: %r269 = sitofp <16 x i64> undef to <16 x half>
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
;
%r0 = sext i1 undef to i8
@@ -549,6 +574,28 @@ define i32 @casts_no_users() {
%r248 = uitofp <16 x i64> undef to <16 x double>
%r249 = sitofp <16 x i64> undef to <16 x double>
+ %r250 = uitofp <8 x i1> undef to <8 x half>
+ %r251 = sitofp <8 x i1> undef to <8 x half>
+ %r252 = uitofp <8 x i8> undef to <8 x half>
+ %r253 = sitofp <8 x i8> undef to <8 x half>
+ %r254 = uitofp <8 x i16> undef to <8 x half>
+ %r255 = sitofp <8 x i16> undef to <8 x half>
+ %r256 = uitofp <8 x i32> undef to <8 x half>
+ %r257 = sitofp <8 x i32> undef to <8 x half>
+ %r258 = uitofp <8 x i64> undef to <8 x half>
+ %r259 = sitofp <8 x i64> undef to <8 x half>
+
+ %r260 = uitofp <16 x i1> undef to <16 x half>
+ %r261 = sitofp <16 x i1> undef to <16 x half>
+ %r262 = uitofp <16 x i8> undef to <16 x half>
+ %r263 = sitofp <16 x i8> undef to <16 x half>
+ %r264 = uitofp <16 x i16> undef to <16 x half>
+ %r265 = sitofp <16 x i16> undef to <16 x half>
+ %r266 = uitofp <16 x i32> undef to <16 x half>
+ %r267 = sitofp <16 x i32> undef to <16 x half>
+ %r268 = uitofp <16 x i64> undef to <16 x half>
+ %r269 = sitofp <16 x i64> undef to <16 x half>
+
ret i32 undef
}
More information about the llvm-commits
mailing list