- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我们在默认配置中使用 Clang。在默认配置中,使用 Clang 的集成汇编程序(而不是系统汇编程序,如 GAS)。我无法确定以下问题的确切问题(并修复):
$ make
clang++ -DNDEBUG -g2 -O3 -Wall -fPIC -march=native -pipe -c gcm.cpp
...
gcm.cpp:676:3: error: invalid operand for instruction
AS2( movd WORD_REG(di), xmm...
^
./cpu.h:221:20: note: expanded from macro 'AS2'
#define AS2(x, y) GNU_AS2(x, y)
^
./cpu.h:216:27: note: expanded from macro 'GNU_AS2'
#define GNU_AS2(x, y) "\n\t" #x ", " #y ";"
^
<inline asm>:110:12: note: instantiated into assembly here
movd rdi, xmm0;
^~~~~
gcm.cpp:685:3: error: invalid operand for instruction
AS2( movd WORD_REG(di), xmm...
^
./cpu.h:221:20: note: expanded from macro 'AS2'
#define AS2(x, y) GNU_AS2(x, y)
^
./cpu.h:216:27: note: expanded from macro 'GNU_AS2'
#define GNU_AS2(x, y) "\n\t" #x ", " #y ";"
^
<inline asm>:117:12: note: instantiated into assembly here
movd rdi, xmm1;
^~~~~
我认为以上错误可能与Inline Assembly and Compatibility有关.但据我所知,rdi
是 64 位的,xmm1
是 128 位的,而 movd
指定了操作数的大小,所以兼容性问题不应适用。
上面的代码有什么问题?
您可以在 Crypto++ gcm.cpp Source File 在线检查源文件.如果您安装了 Clang,这个问题应该很容易重现:
git clone https://github.com/weidai11/cryptopp.git cryptopp-asm
cd cryptopp-asm
export CXX=clang++
make GAS210_OR_LATER=1 GAS219_OR_LATER=1 GAS219_OR_LATER=1
或者:
# Try to make just gcm.o
make GAS210_OR_LATER=1 GAS219_OR_LATER=1 GAS219_OR_LATER=1 gcm.o
奇怪的 make
行是由于 LLVM Bug 24200 - With integrated assembler enabled, failed to fetch version string of assembler .
最佳答案
r/m64, xmm
未在英特尔软件开发人员手册中列为 MOVD
指令的有效操作数组合。但是,支持以下两种形式:
MOVD r/m32, xmm
SSE2 Move doubleword from xmm register to r/m32.
MOVQ r/m64, xmm
SSE2 Move quadword from xmm register to r/m64.
这让我怀疑在为 64 位目标构建时 MOVD
指令需要是 MOVQ
,或者 rdi
应该是替换为 edi
(尽管这可能会影响依赖于 rdi
前 32 位的代码的其他部分)。
关于Clang 集成汇编器和 "invalid operand for instruction",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31558916/
我正在尝试为一个简单的数学 Vector 类重载 += 运算符,以对两个 vector 的元素求和,如下所示: vector1 += vector2 部分Vector2D.h: #ifndef _VE
我正在尝试在 ASM 中编写一个简单的 for 循环。我需要访问两个数组,它们是在 C++ 代码片段之外编写的(即 OrigChars 和 EncrChars) char temporary_
Qt 版本 5.01 平台 windows 64 位 问题:错误:没有操作数“ #include #include #include namespace { std::ost
#include #include #define SIGBAD(signo) ((signo) = NSIG) int sigaddset(sigset_t *set, int signo
请看下面的代码。我正在使用 Apache Derby 作为嵌入式数据库 public List getDetails(String name) { List details =
我和我的讲师/实验室助理都被难住了。 出于某种原因,以下 HLSL 代码在输出窗口中返回: error X8000 : D3D11 Internal Compiler error : Invalid
我有一个创建时间跟踪器的 NPM 包,它使用 for in 来定位 MD 文件的标题,然后将其转换为跟踪器。目前,在 Mac 上运行它时工作正常,在 Windows 上我收到 dirname:miss
请注意这个问题是不是 this 的副本或 this ,因为其他问题没有运算符(operator) 组件,不要询问我正在询问的参数和参数的详细信息。 我将使用 vb.net 教授第一门编程类(class
输入 sudo apt autoremove 后出现此错误在终端 readlink: missing operand Try 'readlink --help' for more informatio
为什么 GCC 给我这个错误?我在这里做错了什么? temp.c: In function main: temp.c:6: error: invalid operands to binary +
我对此很陌生,我正在尝试将值从一个数组移动到另一个数组, 它假设是: vec1 = 1, 2, 3, 4, 5 vec2 = 5, 4, 3, 2, 1 但我收到一个错误:“指令操作数必须是相同的大小
我有一个 OR 表达式,它应该返回不是 NaN 的操作数: (1 || NaN) // evaluates to 1 (NaN || 1) // evaluates to 1 但是当另一个操作数也是一
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 4 年前。 Improve th
这道题是基于 Javascript 的,但适用于一般的逻辑运算 拿代码举例 if (baseText[i] == "."){ /*splice array*/;} if (baseText[
我似乎无法找到使程序运行的问题。 C 告诉我“错误:二进制操作数无效!= 'grocerylist'(又名 structgrocerylist)和 'int' 当我尝试解决此问题时,会弹出其他错误,除
我正在查看 the docs并尝试了解运算符的实际工作方式。 The increment operator (++) increments its operand by 1. The incremen
我有一个很长的 json 字符串,"attributeName":"Loc ID"},"operands":["10000"]}],"Frequency":{"type":" 这个只是其中的一部分,我
目前,我尝试编译 OpenVDB,它依赖于 Threading Building Blocks。我收到以下错误: In file included from /usr/include/tbb/enum
我收到的错误: /usr/include/c++/7/bits/stl_function.h:386: error: no operator " NearestNeighbor::nearest_pa
我有一个类Color , 那有 friend std::ostream& operator void print_head(const T& head, sost& o) { o (rsym,
我是一名优秀的程序员,十分优秀!