@@ -143,6 +143,14 @@ BUILTINS_GENERIC_SRCS = [
143
143
"lib/builtins/clear_cache.c",
144
144
]
145
145
146
+ BF16_SOURCES = [
147
+ "lib/builtins/extendbfsf2.c",
148
+ "lib/builtins/truncdfbf2.c",
149
+ "lib/builtins/truncxfbf2.c",
150
+ "lib/builtins/truncsfbf2.c",
151
+ "lib/builtins/trunctfbf2.c",
152
+ ]
153
+
146
154
# Triple float sources
147
155
BUILTINS_GENERIC_TF_SRCS = [
148
156
"lib/builtins/addtf3.c",
@@ -197,6 +205,11 @@ filegroup(
197
205
} ),
198
206
)
199
207
208
+ filegroup(
209
+ name = "builtins_bf16_sources",
210
+ srcs = filter_excludes(BF16_SOURCES),
211
+ )
212
+
200
213
filegroup(
201
214
name = "builtins_generic_tf_sources",
202
215
srcs = filter_excludes(BUILTINS_GENERIC_TF_SRCS),
@@ -310,6 +323,18 @@ cc_stage2_library(
310
323
" lib/builtins/cpu_model/aarch64.h" ,
311
324
],
312
325
" //conditions:default" : [],
326
+ } ) + selects.with_or({
327
+ (
328
+ # The following additional architectures support float16:
329
+ # - aarch64_be
330
+ # - riscv32
331
+ # - riscv64
332
+ " @platforms//cpu:aarch64" ,
333
+ " @platforms//cpu:x86_64" ,
334
+ ): [
335
+ " :builtins_bf16_sources" ,
336
+ ],
337
+ " //conditions:default" : [],
313
338
} ),
314
339
copts = [
315
340
"-fno-builtin",
@@ -324,7 +349,7 @@ cc_stage2_library(
324
349
} ),
325
350
local_defines = selects.with_or({
326
351
(
327
- # The following architectures support float16:
352
+ # The following additional architectures support float16:
328
353
# - aarch64_be
329
354
# - arm
330
355
# - armeb
0 commit comments