@@ -149,10 +149,7 @@ BUILTINS_BF16_SRCS_PATTERNS = [
149149# Source files for the 16-bit Brain floating-point number builtins. 
150150filegroup (
151151    name  =  "builtins_bf16_srcs" ,
152-     srcs  =  glob (
153-         BUILTINS_BF16_SRCS_PATTERNS ,
154-         allow_empty  =  True ,
155-     ),
152+     srcs  =  glob (BUILTINS_BF16_SRCS_PATTERNS ),
156153)
157154
158155BUILTINS_X86_FP80_SRCS_PATTERNS  =  [
@@ -168,7 +165,6 @@ filegroup(
168165    name  =  "builtins_x86_fp80_srcs" ,
169166    srcs  =  glob (
170167        BUILTINS_X86_FP80_SRCS_PATTERNS ,
171-         allow_empty  =  True ,
172168        exclude  =  BUILTINS_BF16_SRCS_PATTERNS ,
173169    ),
174170)
@@ -192,22 +188,43 @@ filegroup(
192188    name  =  "builtins_tf_srcs" ,
193189    srcs  =  glob (
194190        BUILTINS_TF_SRCS_PATTERNS ,
195-         allow_empty  =  True ,
196191        exclude  =  BUILTINS_TF_EXCLUDES ,
197192    ),
198193)
199194
195+ BUILTNS_ATOMICS_SRCS  =  ["lib/builtins/atomic.c" ]
196+ 
197+ filegroup (
198+     name  =  "builtins_atomics_srcs" ,
199+     srcs  =  BUILTNS_ATOMICS_SRCS  +  ["lib/builtins/assembly.h" ],
200+ )
201+ 
200202BUILTINS_MACOS_ATOMIC_SRCS_PATTERNS  =  [
201203    "lib/builtins/atomic_*.c" ,
202204]
203205
204206# Source files for macOS atomic builtins. 
205207filegroup (
206208    name  =  "builtins_macos_atomic_srcs" ,
207-     srcs  =  glob (
208-         BUILTINS_MACOS_ATOMIC_SRCS_PATTERNS ,
209-         allow_empty  =  True ,
210-     ),
209+     srcs  =  glob (BUILTINS_MACOS_ATOMIC_SRCS_PATTERNS ),
210+ )
211+ 
212+ # Apple-platform specific SME source file. 
213+ filegroup (
214+     name  =  "builtins_aarch64_apple_sme_srcs" ,
215+     srcs  =  ["lib/builtins/aarch64/arm_apple_sme_abi.s" ],
216+ )
217+ 
218+ # Non-Apple platform SME sources. These sources assume function 
219+ # multi-versioning, `-fno-builtin`, `__ARM_UNALIGNED` feature support, and FP 
220+ # availability. Other configurations will need to add a new filegroup if 
221+ # desired. 
222+ filegroup (
223+     name  =  "builtins_aarch64_sme_srcs" ,
224+     srcs  =  [
225+         "lib/builtins/aarch64/sme-abi.S" ,
226+         "lib/builtins/aarch64/sme-abi-assert.c" ,
227+     ] +  glob (["lib/builtins/aarch64/sme-libc-opt-*.S" ]),
211228)
212229
213230# A list of (pat, size, model) tuples for AArch64's outline atomics. 
@@ -237,7 +254,7 @@ AARCH64_OUTLINE_ATOMICS = [
237254    if  pat  ==  "cas"  or  size  !=  "16" 
238255]
239256
240- AARCH64_OUTLINE_ATOMICS_FMT  =  "lib/builtins/aarch64/outline_atomic_{0}_ {1}_{2}.S" 
257+ AARCH64_OUTLINE_ATOMICS_FMT  =  "lib/builtins/aarch64/outline_atomic_{0}{1}_{2}.S" 
241258
242259# lse.S is compiled multiple times with different macros as the input. Model 
243260# this as a genrule producing individual files with the macros at the start. 
@@ -275,6 +292,8 @@ filegroup(
275292            # This file isn't intended to directly compile, and instead is used 
276293            # above to generate a collection of outline atomic helpers. 
277294            "lib/builtins/aarch64/lse.S" ,
295+             # These files are provided by SME-specific file groups above. 
296+             "lib/builtins/aarch64/*sme*" ,
278297        ],
279298    ),
280299)
@@ -349,9 +368,9 @@ filegroup(
349368    name  =  "builtins_x86_64_srcs" ,
350369    srcs  =  glob (
351370        [
371+             "lib/builtins/x86_64/*.S" ,
352372            "lib/builtins/x86_64/*.c" ,
353373            "lib/builtins/x86_64/*.cpp" ,
354-             "lib/builtins/x86_64/*.S" ,
355374        ],
356375        allow_empty  =  True ,
357376    ),
@@ -391,6 +410,7 @@ filegroup(
391410            BUILTINS_CRTEND_SRCS  + 
392411            BUILTINS_TF_EXCLUDES  + 
393412            BUILTINS_TF_SRCS_PATTERNS  + 
413+             BUILTNS_ATOMICS_SRCS  + 
394414            BUILTINS_MACOS_ATOMIC_SRCS_PATTERNS 
395415        ),
396416    ),
0 commit comments