Skip to content

Commit fec444f

Browse files
committed
Add support for bf16 compiler-rt routines
Not sure how these were missed...
1 parent 582814a commit fec444f

File tree

1 file changed

+26
-1
lines changed
  • third_party/llvm-project/20.1.5/compiler-rt

1 file changed

+26
-1
lines changed

third_party/llvm-project/20.1.5/compiler-rt/BUILD.tpl

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ BUILTINS_GENERIC_SRCS = [
143143
"lib/builtins/clear_cache.c",
144144
]
145145

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+
146154
# Triple float sources
147155
BUILTINS_GENERIC_TF_SRCS = [
148156
"lib/builtins/addtf3.c",
@@ -197,6 +205,11 @@ filegroup(
197205
}),
198206
)
199207

208+
filegroup(
209+
name = "builtins_bf16_sources",
210+
srcs = filter_excludes(BF16_SOURCES),
211+
)
212+
200213
filegroup(
201214
name = "builtins_generic_tf_sources",
202215
srcs = filter_excludes(BUILTINS_GENERIC_TF_SRCS),
@@ -310,6 +323,18 @@ cc_stage2_library(
310323
"lib/builtins/cpu_model/aarch64.h",
311324
],
312325
"//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": [],
313338
}),
314339
copts = [
315340
"-fno-builtin",
@@ -324,7 +349,7 @@ cc_stage2_library(
324349
}),
325350
local_defines = selects.with_or({
326351
(
327-
# The following architectures support float16:
352+
# The following additional architectures support float16:
328353
# - aarch64_be
329354
# - arm
330355
# - armeb

0 commit comments

Comments
 (0)