【发布时间】:2017-10-21 15:24:14
【问题描述】:
我正在针对 Apple Clang 进行测试,但遇到了我过去从未遇到过的错误。代码如下,如果 _mm_set_epi64x 内部缺失,它会替换它。
#if defined(__clang__)
# define GCC_INLINE inline
# define GCC_INLINE_ATTRIB __attribute__((__gnu_inline__, __always_inline__))
#elif (GCC_VERSION >= 30300) || defined(__INTEL_COMPILER)
# define GCC_INLINE __inline
# define GCC_INLINE_ATTRIB __attribute__((__gnu_inline__, __always_inline__, __artificial__))
#else
# define GCC_INLINE inline
# define GCC_INLINE_ATTRIB
# endif
...
GCC_INLINE __m128i GCC_INLINE_ATTRIB
MM_SET_EPI64X(const word64 a, const word64 b)
{
const word64 t[2] = {b,a}; __m128i r;
asm ("movdqu %1, %0" : "=x"(r) : "m"(t));
return r;
}
错误是:
c++ -DNDEBUG -g2 -O2 -c sha.cpp
In file included from sha.cpp:24:
./cpu.h:689:39: error: cannot compile this unexpected cast lvalue yet
asm ("movdqu %1, %0" : "=x"(r) : "m"(t));
Apple Clang 版本是:
$ c++ --version
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
根据Clang Bug 20201,问题已经解决。我对 20201 错误的问题是:
- 不知道是不是同一个问题
- 问题没有解释
- 未提供解决方法
- Apple 已放弃其软件
由于 (4),我必须尝试修复它。由于(2)和(3),我不知道如何解决它。
有什么问题,我该如何解决?
【问题讨论】:
-
我现在无法访问错误数据库,但是查看this post,也许有某种 const 问题?如果从
word64 t[2] = {b,a};中删除const会发生什么? -
谢谢肯。删除
const并没有解决问题。 -
继续我的疯狂猜测,
word64 a1 = a, b1 =b; word64 t[2] = {b1,a1};?或者从原型中删除consts?否则,我完全没有猜测!
标签: c++ macos inline-assembly clang++