sve-fixed-length-fp-converts.ll
6.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
; RUN: llc -aarch64-sve-vector-bits-min=128 -asm-verbose=0 < %s | FileCheck %s -check-prefix=NO_SVE
; RUN: llc -aarch64-sve-vector-bits-min=256 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK
; RUN: llc -aarch64-sve-vector-bits-min=384 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK
; RUN: llc -aarch64-sve-vector-bits-min=512 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
; RUN: llc -aarch64-sve-vector-bits-min=640 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
; RUN: llc -aarch64-sve-vector-bits-min=768 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
; RUN: llc -aarch64-sve-vector-bits-min=896 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
; RUN: llc -aarch64-sve-vector-bits-min=1024 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=1152 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=1280 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=1408 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=1536 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=1664 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=1792 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=1920 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024
; RUN: llc -aarch64-sve-vector-bits-min=2048 -asm-verbose=0 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512,VBITS_GE_1024,VBITS_GE_2048
target triple = "aarch64-unknown-linux-gnu"
; Don't use SVE when its registers are no bigger than NEON.
; NO_SVE-NOT: z{0-9}
; NOTE: fptrunc operations bigger than NEON are expanded. These tests just
; ensure we've correctly set the operation action for fixed length vector types
; that require SVE. They'll be updated to protect their expected code generation
; when lowering it implemented.
;
; fptrunc f32 -> f16
;
define <8 x half> @fptrunc_v8f32_v8f16(<8 x float>* %in) #0 {
; CHECK-LABEL: fptrunc_v8f32_v8f16:
; CHECK-COUNT-8: fcvt h{{[0-9]}}, s{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <8 x float>, <8 x float>* %in
%b = fptrunc <8 x float> %a to <8 x half>
ret <8 x half> %b
}
define void @fptrunc_v16f32_v16f16(<16 x float>* %in, <16 x half>* %out) #0 {
; CHECK-LABEL: fptrunc_v16f32_v16f16:
; CHECK-COUNT-16: fcvt h{{[0-9]}}, s{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <16 x float>, <16 x float>* %in
%b = fptrunc <16 x float> %a to <16 x half>
store <16 x half> %b, <16 x half>* %out
ret void
}
define void @fptrunc_v32f32_v32f16(<32 x float>* %in, <32 x half>* %out) #0 {
; CHECK-LABEL: fptrunc_v32f32_v32f16:
; CHECK-COUNT-32: fcvt h{{[0-9]}}, s{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <32 x float>, <32 x float>* %in
%b = fptrunc <32 x float> %a to <32 x half>
store <32 x half> %b, <32 x half>* %out
ret void
}
define void @fptrunc_v64f32_v64f16(<64 x float>* %in, <64 x half>* %out) #0 {
; CHECK-LABEL: fptrunc_v64f32_v64f16:
; CHECK-COUNT-64: fcvt h{{[0-9]}}, s{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <64 x float>, <64 x float>* %in
%b = fptrunc <64 x float> %a to <64 x half>
store <64 x half> %b, <64 x half>* %out
ret void
}
;
; fptrunc f64 -> f16
;
define <4 x half> @fptrunc_v4f64_v4f16(<4 x double>* %in) #0 {
; CHECK-LABEL: fptrunc_v4f64_v4f16:
; CHECK-COUNT-4: fcvt h{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <4 x double>, <4 x double>* %in
%b = fptrunc <4 x double> %a to <4 x half>
ret <4 x half> %b
}
define <8 x half> @fptrunc_v8f64_v8f16(<8 x double>* %in) #0 {
; CHECK-LABEL: fptrunc_v8f64_v8f16:
; CHECK-COUNT-8: fcvt h{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <8 x double>, <8 x double>* %in
%b = fptrunc <8 x double> %a to <8 x half>
ret <8 x half> %b
}
define void @fptrunc_v16f64_v16f16(<16 x double>* %in, <16 x half>* %out) #0 {
; CHECK-LABEL: fptrunc_v16f64_v16f16:
; CHECK-COUNT-16: fcvt h{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <16 x double>, <16 x double>* %in
%b = fptrunc <16 x double> %a to <16 x half>
store <16 x half> %b, <16 x half>* %out
ret void
}
define void @fptrunc_v32f64_v32f16(<32 x double>* %in, <32 x half>* %out) #0 {
; CHECK-LABEL: fptrunc_v32f64_v32f16:
; CHECK-COUNT-32: fcvt h{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <32 x double>, <32 x double>* %in
%b = fptrunc <32 x double> %a to <32 x half>
store <32 x half> %b, <32 x half>* %out
ret void
}
;
; fptrunc f64 -> f32
;
define <4 x float> @fptrunc_v4f64_v4f32(<4 x double>* %in) #0 {
; CHECK-LABEL: fptrunc_v4f64_v4f32:
; CHECK-COUNT-4: fcvt s{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <4 x double>, <4 x double>* %in
%b = fptrunc <4 x double> %a to <4 x float>
ret <4 x float> %b
}
define void @fptrunc_v8f64_v8f32(<8 x double>* %in, <8 x float>* %out) #0 {
; CHECK-LABEL: fptrunc_v8f64_v8f32:
; CHECK-COUNT-8: fcvt s{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <8 x double>, <8 x double>* %in
%b = fptrunc <8 x double> %a to <8 x float>
store <8 x float> %b, <8 x float>* %out
ret void
}
define void @fptrunc_v16f64_v16f32(<16 x double>* %in, <16 x float>* %out) #0 {
; CHECK-LABEL: fptrunc_v16f64_v16f32:
; CHECK-COUNT-16: fcvt s{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <16 x double>, <16 x double>* %in
%b = fptrunc <16 x double> %a to <16 x float>
store <16 x float> %b, <16 x float>* %out
ret void
}
define void @fptrunc_v32f64_v32f32(<32 x double>* %in, <32 x float>* %out) #0 {
; CHECK-LABEL: fptrunc_v32f64_v32f32:
; CHECK-COUNT-32: fcvt s{{[0-9]}}, d{{[0-9]}}
; CHECK-NOT: fcvt
; CHECK: ret
%a = load <32 x double>, <32 x double>* %in
%b = fptrunc <32 x double> %a to <32 x float>
store <32 x float> %b, <32 x float>* %out
ret void
}
attributes #0 = { nounwind "target-features"="+sve" }