Skip to content

Commit

Permalink
Update GNU assembler bug detection (#278)
Browse files Browse the repository at this point in the history
* Update GNU assembler bug detection

* Cosmetic enhancement to suppress spurious warnings during GAS bug test

* Fix test error code
  • Loading branch information
lgarrison authored Sep 15, 2022
1 parent 1701264 commit 618a9ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Fixes
-----
- Add additional check to tell if it's safe to redirect stdout/err [#270]
- Check and fix ``z`` vs ``cz`` in ``DDrppi_mocks`` and ``DDsmu_mocks`` only if comoving distance flag is not set [#275]
- Update GNU assembler bug detection [#278]


2.4.0 (2021-09-30)
Expand Down
8 changes: 3 additions & 5 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,10 @@ ifeq ($(DO_CHECKS), 1)
CLINK += -lm
endif #not icc

# The GNU Assembler (GAS) has an AVX-512 bug in versions 2.30 to 2.31.1
# So we turn off AVX-512 if the compiler reports it is using one of these versions.
# This works for gcc and icc.
# clang typically uses its own assembler, but if it is using the system assembler, this will also detect that.
# The GNU Assembler (GAS) has an AVX-512 bug in some versions (originally 2.30 to 2.31.1)
# So we compile a test program and check the assembly for the correct output.
# See: https://github.com/manodeep/Corrfunc/issues/193
GAS_BUG_DISABLE_AVX512 := $(shell $(CC) $(CFLAGS) -xc -Wa,-v -c /dev/null -o /dev/null 2>&1 | \grep -Ecm1 'GNU assembler version (2\.30|2\.31|2\.31\.1)')
GAS_BUG_DISABLE_AVX512 := $(shell echo 'vmovaps 64(,%rax), %zmm0' | $(CC) $(CFLAGS) -xassembler -c - -oa.out 2>/dev/null && objdump -dw a.out | \grep -q 'vmovaps 0x40(,%rax,1),%zmm0'; RET=$$?; rm -f a.out; echo $$RET)

ifeq ($(GAS_BUG_DISABLE_AVX512),1)
# Did the compiler support AVX-512 in the first place? Otherwise no need to disable it!
Expand Down

0 comments on commit 618a9ad

Please sign in to comment.