Bug 276794 - The PPC-specific header /usr/lib/clang/16/include/ppc_wrappers/mmintrin.h asks to define the x86-specific variable NO_WARN_X86_INTRINSICS (port audio/surge-synthesizer-lv2 on powerpc64le)
Summary: The PPC-specific header /usr/lib/clang/16/include/ppc_wrappers/mmintrin.h ask...
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 14.0-STABLE
Hardware: powerpc Any
: --- Affects Only Me
Assignee: Yuri Victorovich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-03 08:55 UTC by Yuri Victorovich
Modified: 2024-02-03 19:04 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2024-02-03 08:55:02 UTC
The port audio/surge-synthesizer-lv2 fails with the message:
In file included from /wrkdirs/usr/ports/audio/surge-synthesizer-lv2/work/surge-release_1.9.0/src/common/dsp/effect/BBDEnsembleEffect.cpp:16:
In file included from /wrkdirs/usr/ports/audio/surge-synthesizer-lv2/work/surge-release_1.9.0/src/common/dsp/effect/BBDEnsembleEffect.h:22:
In file included from /wrkdirs/usr/ports/audio/surge-synthesizer-lv2/work/surge-release_1.9.0/src/common/dsp/VectorizedSvfFilter.h:3:
In file included from /wrkdirs/usr/ports/audio/surge-synthesizer-lv2/work/surge-release_1.9.0/src/common/vt_dsp/portable_intrinsics.h:4:
In file included from /usr/lib/clang/16/include/ppc_wrappers/immintrin.h:15:
/usr/lib/clang/16/include/ppc_wrappers/mmintrin.h:31:2: error: "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."


Log: https://pkg-status.freebsd.org/foul2/data/140releng-powerpc64le-quarterly/68593b1d8800/logs/surge-synthesizer-lv2-1.9.0_1.log

PPC-specific headers aren't supposed to recommend to set x86-specific defines.
Comment 1 Mark Millard 2024-02-03 18:16:01 UTC
I'm confused. stable/14 had LLVM 17 commited back on 2024-Jan-07 or so
but this report is for the older llvm 16 context ("/usr/lib/clang/16/").
The __FreeBSD_version bump for the LLVM commit was on 2024-Jan-07:

author	Dimitry Andric <dim@FreeBSD.org>	2023-12-08 17:36:40 +0000
committer	Dimitry Andric <dim@FreeBSD.org>	2024-01-07 17:46:20 +0000
commit	68584c97ecfb3046de7fb1b16c2caa785392237c (patch)
. . .
PR:		273753
MFC after:	1 month

(cherry picked from commit c711af7727824da79d87f375f3d6829feec3799a)
Diffstat
-rw-r--r--	sys/sys/param.h	2	
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 7ceae8fa8365..fc684f525aaf 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -75,7 +75,7 @@
  * cannot include sys/param.h and should only be updated here.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1400503
+#define __FreeBSD_version 1400504
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,


Does LLVM 17 have the same problem? Or is it really a 14.0-RELEASE issue
(that will always be LLVM 16 based but will be replaced by 14.1-RELEASE
at some point).
Comment 2 Mark Millard 2024-02-03 18:23:43 UTC
Going in a different direction: the comments indicate the code is
designed to help with converting x86_64 code to powerpc64/powerpc64le
and it is deliberately using x86-specific defines:

#ifndef NO_WARN_X86_INTRINSICS
/* This header file is to help porting code using Intel intrinsics
   explicitly from x86_64 to powerpc64/powerpc64le.

   Since PowerPC target doesn't support native 64-bit vector type, we
   typedef __m64 to 64-bit unsigned long long in MMX intrinsics, which
   works well for _si64 and some _pi32 operations.

   For _pi16 and _pi8 operations, it's better to transfer __m64 into
   128-bit PowerPC vector first. Power8 introduced direct register
   move instructions which helps for more efficient implementation.

   It's user's responsibility to determine if the results of such port
   are acceptable or further changes are needed. Please note that much
   code using Intel intrinsics CAN BE REWRITTEN in more portable and
   efficient standard C or GNU C extensions with 64-bit scalar
   operations, or 128-bit SSE/Altivec operations, which are more
   recommended. */
#error                                                                         \
    "Please read comment above.  Use -DNO_WARN_X86_INTRINSICS to disable this error."
#endif

"PPC-specific headers aren't supposed to recommend to set x86-specific defines."
looks to be just wrong about this code.

(I'm not claiming that the code works overall.)
Comment 3 Mark Millard 2024-02-03 18:29:06 UTC
By the way: LLVM 17 has the same way of doing things. That is where I copied
the text from since I did not have a LLVM 16 based FreeBDS handy.
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2024-02-03 19:04:09 UTC
If this is normal - this can be closed them.


Thank you, Mark, for your analysis.