blob: 434f8395090cedf0531feeac0199670da647a8a8 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 6
; RUN: opt -passes="print<cost-model>" -cost-kind=throughput -disable-output -mtriple=amdgpu6.01-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=NO16BIT
; RUN: opt -passes="print<cost-model>" -cost-kind=throughput -disable-output -mtriple=amdgpu9.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=GFX9
; RUN: opt -passes="print<cost-model>" -cost-kind=throughput -disable-output -mtriple=amdgpu11.00-amd-amdhsa -mattr=-real-true16 < %s 2>&1 | FileCheck %s --check-prefixes=GFX11-FAKE16
; RUN: opt -passes="print<cost-model>" -cost-kind=throughput -disable-output -mtriple=amdgpu11.00-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=GFX11-TRUE16
; RUN: opt -passes="print<cost-model>" -cost-kind=throughput -disable-output -mtriple=amdgpu9.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=GFX950
; RUN: opt -passes="print<cost-model>" -cost-kind=throughput -disable-output -mtriple=amdgpu12.50-amd-amdhsa < %s 2>&1 | FileCheck %s --check-prefixes=GFX1250
define void @fptrunc_f32_to_f16(float %s, <2 x float> %v2, <3 x float> %v3, <4 x float> %v4, <8 x float> %v8, <16 x float> %v16) {
; NO16BIT-LABEL: 'fptrunc_f32_to_f16'
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r1 = fptrunc float %s to half
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r2 = fptrunc <2 x float> %v2 to <2 x half>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 9 for instruction: %r3 = fptrunc <3 x float> %v3 to <3 x half>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r4 = fptrunc <4 x float> %v4 to <4 x half>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %r8 = fptrunc <8 x float> %v8 to <8 x half>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %r16 = fptrunc <16 x float> %v16 to <16 x half>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX9-LABEL: 'fptrunc_f32_to_f16'
; GFX9-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r1 = fptrunc float %s to half
; GFX9-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r2 = fptrunc <2 x float> %v2 to <2 x half>
; GFX9-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r3 = fptrunc <3 x float> %v3 to <3 x half>
; GFX9-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %r4 = fptrunc <4 x float> %v4 to <4 x half>
; GFX9-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %r8 = fptrunc <8 x float> %v8 to <8 x half>
; GFX9-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %r16 = fptrunc <16 x float> %v16 to <16 x half>
; GFX9-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX11-FAKE16-LABEL: 'fptrunc_f32_to_f16'
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r1 = fptrunc float %s to half
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r2 = fptrunc <2 x float> %v2 to <2 x half>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r3 = fptrunc <3 x float> %v3 to <3 x half>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %r4 = fptrunc <4 x float> %v4 to <4 x half>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %r8 = fptrunc <8 x float> %v8 to <8 x half>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %r16 = fptrunc <16 x float> %v16 to <16 x half>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX11-TRUE16-LABEL: 'fptrunc_f32_to_f16'
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r1 = fptrunc float %s to half
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r2 = fptrunc <2 x float> %v2 to <2 x half>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %r3 = fptrunc <3 x float> %v3 to <3 x half>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r4 = fptrunc <4 x float> %v4 to <4 x half>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %r8 = fptrunc <8 x float> %v8 to <8 x half>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %r16 = fptrunc <16 x float> %v16 to <16 x half>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX950-LABEL: 'fptrunc_f32_to_f16'
; GFX950-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r1 = fptrunc float %s to half
; GFX950-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r2 = fptrunc <2 x float> %v2 to <2 x half>
; GFX950-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r3 = fptrunc <3 x float> %v3 to <3 x half>
; GFX950-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r4 = fptrunc <4 x float> %v4 to <4 x half>
; GFX950-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r8 = fptrunc <8 x float> %v8 to <8 x half>
; GFX950-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %r16 = fptrunc <16 x float> %v16 to <16 x half>
; GFX950-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX1250-LABEL: 'fptrunc_f32_to_f16'
; GFX1250-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r1 = fptrunc float %s to half
; GFX1250-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %r2 = fptrunc <2 x float> %v2 to <2 x half>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r3 = fptrunc <3 x float> %v3 to <3 x half>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %r4 = fptrunc <4 x float> %v4 to <4 x half>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %r8 = fptrunc <8 x float> %v8 to <8 x half>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %r16 = fptrunc <16 x float> %v16 to <16 x half>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
%r1 = fptrunc float %s to half
%r2 = fptrunc <2 x float> %v2 to <2 x half>
%r3 = fptrunc <3 x float> %v3 to <3 x half>
%r4 = fptrunc <4 x float> %v4 to <4 x half>
%r8 = fptrunc <8 x float> %v8 to <8 x half>
%r16 = fptrunc <16 x float> %v16 to <16 x half>
ret void
}
define void @fptrunc_other(<4 x float> %v4, <4 x double> %d4) {
; NO16BIT-LABEL: 'fptrunc_other'
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %bf4 = fptrunc <4 x float> %v4 to <4 x bfloat>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %h4 = fptrunc <4 x double> %d4 to <4 x half>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f4 = fptrunc <4 x double> %d4 to <4 x float>
; NO16BIT-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX9-LABEL: 'fptrunc_other'
; GFX9-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %bf4 = fptrunc <4 x float> %v4 to <4 x bfloat>
; GFX9-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %h4 = fptrunc <4 x double> %d4 to <4 x half>
; GFX9-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f4 = fptrunc <4 x double> %d4 to <4 x float>
; GFX9-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX11-FAKE16-LABEL: 'fptrunc_other'
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %bf4 = fptrunc <4 x float> %v4 to <4 x bfloat>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %h4 = fptrunc <4 x double> %d4 to <4 x half>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f4 = fptrunc <4 x double> %d4 to <4 x float>
; GFX11-FAKE16-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX11-TRUE16-LABEL: 'fptrunc_other'
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %bf4 = fptrunc <4 x float> %v4 to <4 x bfloat>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %h4 = fptrunc <4 x double> %d4 to <4 x half>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f4 = fptrunc <4 x double> %d4 to <4 x float>
; GFX11-TRUE16-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX950-LABEL: 'fptrunc_other'
; GFX950-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %bf4 = fptrunc <4 x float> %v4 to <4 x bfloat>
; GFX950-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %h4 = fptrunc <4 x double> %d4 to <4 x half>
; GFX950-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f4 = fptrunc <4 x double> %d4 to <4 x float>
; GFX950-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
; GFX1250-LABEL: 'fptrunc_other'
; GFX1250-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %bf4 = fptrunc <4 x float> %v4 to <4 x bfloat>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 10 for instruction: %h4 = fptrunc <4 x double> %d4 to <4 x half>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %f4 = fptrunc <4 x double> %d4 to <4 x float>
; GFX1250-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret void
;
%bf4 = fptrunc <4 x float> %v4 to <4 x bfloat>
%h4 = fptrunc <4 x double> %d4 to <4 x half>
%f4 = fptrunc <4 x double> %d4 to <4 x float>
ret void
}