Skip to content

POWER: pass assembler CPU flags for more cores with clang on FreeBSD - #6018

Open
pkubaj wants to merge 1 commit into
OpenMathLib:developfrom
pkubaj:ppc64-clang-freebsd-fix
Open

POWER: pass assembler CPU flags for more cores with clang on FreeBSD#6018
pkubaj wants to merge 1 commit into
OpenMathLib:developfrom
pkubaj:ppc64-clang-freebsd-fix

Conversation

@pkubaj

@pkubaj pkubaj commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

clang with -fno-integrated-as does not translate -mcpu into CPU
selection flags for the external assembler the way GCC's ASM_CPU_SPEC
does, so GNU as runs with bare defaults and rejects AltiVec/VSX
mnemonics, both in the hand-written kernels and in clang's own
vectorized output. This is already handled for POWER9/POWER10 via
-Wa,-mpwr10; do the equivalent for the remaining 64-bit cores:

POWER8: -Wa,-mpwr8
POWER6: -Wa,-mpwr6 -Wa,-maltivec
PPC970: -Wa,-mpwr4 -Wa,-maltivec

The POWER6/PPC970 spellings match what GCC passes to the assembler
for -mcpu=power6 and -mcpu=970. Note a lone -Wa,-maltivec is not
enough: an explicit -m option replaces the assembler's implicit
64-bit default, making it reject even lwa/mulld.

Tested on FreeBSD/powerpc64 (big-endian) with clang 19.1.7:
TARGET=PPC970 and TARGET=POWER8 both build and pass the BLAS test
suite.

clang with -fno-integrated-as does not translate -mcpu into CPU
selection flags for the external assembler the way GCC's ASM_CPU_SPEC
does, so GNU as runs with bare defaults and rejects AltiVec/VSX
mnemonics, both in the hand-written kernels and in clang's own
vectorized output.  This is already handled for POWER9/POWER10 via
-Wa,-mpwr10; do the equivalent for the remaining 64-bit cores:

  POWER8:  -Wa,-mpwr8
  POWER6:  -Wa,-mpwr6 -Wa,-maltivec
  PPC970:  -Wa,-mpwr4 -Wa,-maltivec

The POWER6/PPC970 spellings match what GCC passes to the assembler
for -mcpu=power6 and -mcpu=970.  Note a lone -Wa,-maltivec is not
enough: an explicit -m option replaces the assembler's implicit
64-bit default, making it reject even lwa/mulld.

Tested on FreeBSD/powerpc64 (big-endian) with clang 19.1.7:
TARGET=PPC970 and TARGET=POWER8 both build and pass the BLAS test
suite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant