Skip to content

Commit 72ebcd3

Browse files
committed
[CostModel][X86] Add isnan half/float/double costs tests
1 parent 9cae598 commit 72ebcd3

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2+
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -cost-model -analyze -mattr=+sse2 | FileCheck %s --check-prefixes=SSE
3+
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -cost-model -analyze -mattr=+avx | FileCheck %s --check-prefixes=AVX
4+
; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -cost-model -analyze -mattr=+avx512f | FileCheck %s --check-prefixes=AVX512
5+
6+
declare i1 @llvm.isnan.f16(half)
7+
declare <4 x i1> @llvm.isnan.v4f16(<4 x half>)
8+
declare <8 x i1> @llvm.isnan.v8f16(<8 x half>)
9+
declare <16 x i1> @llvm.isnan.v16f16(<16 x half>)
10+
declare <32 x i1> @llvm.isnan.v32f16(<32 x half>)
11+
12+
declare i1 @llvm.isnan.f32(float)
13+
declare <2 x i1> @llvm.isnan.v2f32(<2 x float>)
14+
declare <4 x i1> @llvm.isnan.v4f32(<4 x float>)
15+
declare <8 x i1> @llvm.isnan.v8f32(<8 x float>)
16+
declare <16 x i1> @llvm.isnan.v16f32(<16 x float>)
17+
18+
declare i1 @llvm.isnan.f64(double)
19+
declare <2 x i1> @llvm.isnan.v2f64(<2 x double>)
20+
declare <4 x i1> @llvm.isnan.v4f64(<4 x double>)
21+
declare <8 x i1> @llvm.isnan.v8f64(<8 x double>)
22+
declare <16 x i1> @llvm.isnan.v16f64(<16 x double>)
23+
24+
define i32 @isnan(i32 %arg) {
25+
; SSE-LABEL: 'isnan'
26+
; SSE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F16 = call i1 @llvm.isnan.f16(half undef)
27+
; SSE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V4F16 = call <4 x i1> @llvm.isnan.v4f16(<4 x half> undef)
28+
; SSE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F16 = call <8 x i1> @llvm.isnan.v8f16(<8 x half> undef)
29+
; SSE-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %V16F16 = call <16 x i1> @llvm.isnan.v16f16(<16 x half> undef)
30+
; SSE-NEXT: Cost Model: Found an estimated cost of 94 for instruction: %V3216 = call <32 x i1> @llvm.isnan.v32f16(<32 x half> undef)
31+
; SSE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F32 = call i1 @llvm.isnan.f32(float undef)
32+
; SSE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V2F32 = call <2 x i1> @llvm.isnan.v2f32(<2 x float> undef)
33+
; SSE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V4F32 = call <4 x i1> @llvm.isnan.v4f32(<4 x float> undef)
34+
; SSE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F32 = call <8 x i1> @llvm.isnan.v8f32(<8 x float> undef)
35+
; SSE-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %V16F32 = call <16 x i1> @llvm.isnan.v16f32(<16 x float> undef)
36+
; SSE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F64 = call i1 @llvm.isnan.f64(double undef)
37+
; SSE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %V2F64 = call <2 x i1> @llvm.isnan.v2f64(<2 x double> undef)
38+
; SSE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %V4F64 = call <4 x i1> @llvm.isnan.v4f64(<4 x double> undef)
39+
; SSE-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F64 = call <8 x i1> @llvm.isnan.v8f64(<8 x double> undef)
40+
; SSE-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %V16F64 = call <16 x i1> @llvm.isnan.v16f64(<16 x double> undef)
41+
; SSE-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
42+
;
43+
; AVX-LABEL: 'isnan'
44+
; AVX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F16 = call i1 @llvm.isnan.f16(half undef)
45+
; AVX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V4F16 = call <4 x i1> @llvm.isnan.v4f16(<4 x half> undef)
46+
; AVX-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F16 = call <8 x i1> @llvm.isnan.v8f16(<8 x half> undef)
47+
; AVX-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16F16 = call <16 x i1> @llvm.isnan.v16f16(<16 x half> undef)
48+
; AVX-NEXT: Cost Model: Found an estimated cost of 66 for instruction: %V3216 = call <32 x i1> @llvm.isnan.v32f16(<32 x half> undef)
49+
; AVX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F32 = call i1 @llvm.isnan.f32(float undef)
50+
; AVX-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V2F32 = call <2 x i1> @llvm.isnan.v2f32(<2 x float> undef)
51+
; AVX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V4F32 = call <4 x i1> @llvm.isnan.v4f32(<4 x float> undef)
52+
; AVX-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F32 = call <8 x i1> @llvm.isnan.v8f32(<8 x float> undef)
53+
; AVX-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16F32 = call <16 x i1> @llvm.isnan.v16f32(<16 x float> undef)
54+
; AVX-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F64 = call i1 @llvm.isnan.f64(double undef)
55+
; AVX-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V2F64 = call <2 x i1> @llvm.isnan.v2f64(<2 x double> undef)
56+
; AVX-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V4F64 = call <4 x i1> @llvm.isnan.v4f64(<4 x double> undef)
57+
; AVX-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F64 = call <8 x i1> @llvm.isnan.v8f64(<8 x double> undef)
58+
; AVX-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16F64 = call <16 x i1> @llvm.isnan.v16f64(<16 x double> undef)
59+
; AVX-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
60+
;
61+
; AVX512-LABEL: 'isnan'
62+
; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F16 = call i1 @llvm.isnan.f16(half undef)
63+
; AVX512-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V4F16 = call <4 x i1> @llvm.isnan.v4f16(<4 x half> undef)
64+
; AVX512-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F16 = call <8 x i1> @llvm.isnan.v8f16(<8 x half> undef)
65+
; AVX512-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16F16 = call <16 x i1> @llvm.isnan.v16f16(<16 x half> undef)
66+
; AVX512-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V3216 = call <32 x i1> @llvm.isnan.v32f16(<32 x half> undef)
67+
; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F32 = call i1 @llvm.isnan.f32(float undef)
68+
; AVX512-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V2F32 = call <2 x i1> @llvm.isnan.v2f32(<2 x float> undef)
69+
; AVX512-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V4F32 = call <4 x i1> @llvm.isnan.v4f32(<4 x float> undef)
70+
; AVX512-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F32 = call <8 x i1> @llvm.isnan.v8f32(<8 x float> undef)
71+
; AVX512-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16F32 = call <16 x i1> @llvm.isnan.v16f32(<16 x float> undef)
72+
; AVX512-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %F64 = call i1 @llvm.isnan.f64(double undef)
73+
; AVX512-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %V2F64 = call <2 x i1> @llvm.isnan.v2f64(<2 x double> undef)
74+
; AVX512-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %V4F64 = call <4 x i1> @llvm.isnan.v4f64(<4 x double> undef)
75+
; AVX512-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %V8F64 = call <8 x i1> @llvm.isnan.v8f64(<8 x double> undef)
76+
; AVX512-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16F64 = call <16 x i1> @llvm.isnan.v16f64(<16 x double> undef)
77+
; AVX512-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef
78+
;
79+
%F16 = call i1 @llvm.isnan.f16(half undef)
80+
%V4F16 = call <4 x i1> @llvm.isnan.v4f16(<4 x half> undef)
81+
%V8F16 = call <8 x i1> @llvm.isnan.v8f16(<8 x half> undef)
82+
%V16F16 = call <16 x i1> @llvm.isnan.v16f16(<16 x half> undef)
83+
%V3216 = call <32 x i1> @llvm.isnan.v32f16(<32 x half> undef)
84+
85+
%F32 = call i1 @llvm.isnan.f32(float undef)
86+
%V2F32 = call <2 x i1> @llvm.isnan.v2f32(<2 x float> undef)
87+
%V4F32 = call <4 x i1> @llvm.isnan.v4f32(<4 x float> undef)
88+
%V8F32 = call <8 x i1> @llvm.isnan.v8f32(<8 x float> undef)
89+
%V16F32 = call <16 x i1> @llvm.isnan.v16f32(<16 x float> undef)
90+
91+
%F64 = call i1 @llvm.isnan.f64(double undef)
92+
%V2F64 = call <2 x i1> @llvm.isnan.v2f64(<2 x double> undef)
93+
%V4F64 = call <4 x i1> @llvm.isnan.v4f64(<4 x double> undef)
94+
%V8F64 = call <8 x i1> @llvm.isnan.v8f64(<8 x double> undef)
95+
%V16F64 = call <16 x i1> @llvm.isnan.v16f64(<16 x double> undef)
96+
97+
ret i32 undef
98+
}

0 commit comments

Comments
 (0)