[PATCH] D24752: [Modules] Add missing dependencies to clang builtins modulemap

Elad Cohen via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 00:03:40 PDT 2016

eladcohen added inline comments.

Comment at: lib/Headers/module.modulemap:133
@@ -131,2 +132,3 @@
     explicit module aes {
+      export sse2
       header "__wmmintrin_aes.h"
bruno wrote:
> The mmx case above makes sense to me, but I find conceptually odd that we need to re-export sse2 in aes module, why not explicitly #include <emmintrin.h> in the source file?
emmintrin.h is already included explicitly in wmmintrin.h & __wmmintrin_aes.h.

If a user includes <x86intrin.h>/<immintrin.h> there is no problem, since the intel submodule has an 'export *' directive and both aes & sse2 will be imported.

However, if the user only includes <wmmintrin.h> (like in the 2nd half of the test I added), and uses modules, then any use of the '___m128i' type (which is used in the aes intrinsics and declared in sse2) will result with the error:
"File tst.c Line 11: missing '#include <emmintrin.h>'; declaration of '___m128i' must be imported from module '_Builtin_intrinsics.intel.sse2' before it is required"

IIUC the possible fixes for this are adding 'export *' or 'export sse2' to the aes submodule.


More information about the cfe-commits mailing list