[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.
This commit is contained in:
Florian Hahn 2021-11-11 18:21:44 +00:00
parent 4cdf9884b6
commit 8d2a1994c8
No known key found for this signature in database
GPG Key ID: EEF712BB5E80EBBA
1 changed files with 48 additions and 1 deletions

View File

@ -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
}