在"asm"中不可能的约束 [英] impossible constraint in 'asm'

查看:143
本文介绍了在"asm"中不可能的约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一周前编译的第三方库.
今天,我再次坐在办公桌前,再次推动建筑,然后脑袋爆裂.
我被枪杀了这个错误:

I'm using third party library which compiled one week ago.
Today I sat down at the desk again, i pushed build again, then my head blown out.
I've been shot with this error:

"asm"中的不可能约束

impossible constraint in 'asm'

代码是:

static inline unsigned ROLc(unsigned word, const int i)
{
   asm ("roll %2,%0"
      :"=r" (word)
      :"0" (word),"I" (i));
   return word;
}

一些神秘的事情发生了...我现在唯一想的是'WTF?'
平台上装有W32 XP的Intel CoreDuo.

Some mystery things happens...only thing which I'm thinking right now is 'WTF?'
Platform Intel CoreDuo with W32 XP on board.

另外两个问题:

  1. 什么会破坏我的建筑?
  2. 我想asm语法不正确,那么我该如何解决?
  3. 在哪里可以找到'cool'asm参考(我的意思是一些cpp参考,例如通过纯处理器命令列表数据手册/手册)

致谢

更新:
哈哈,我觉得自己像个dump-ass,上周我安装了strawberry perl ...它会在路径上安装并抛出gcc,并且我的构建系统使用默认"编译器....:D
但是我已经使用:

UPDATE:
Haha I feel like dump-ass, last week i've installed strawberry perl...which installs and throws gcc on path and my build system takes 'default' compiler....:D
However i've fixed that using :

return (word << i) | (word >> (32 - i));

推荐答案

  1. 您可能已自动升级到新的编译器,从而改变了语法
  2. 建议使用Ic而不是比我;我没有测试
  3. 不知道您的意思是,对于汇编程序的C ++参考对我而言没有多大意义. 是(旧的)HOWTO gcc和内联汇编,这可能就是您想要的吗?
  1. You might have auto-upgraded to a new compiler, that has changed the syntax
  2. This suggests using Ic rather than I; I didn't test this
  3. Not sure what you mean, a C++ reference for assembly doesn't make a lot of sense to me. This is an (old) HOWTO on gcc and inline assembly, it might be what you're after?

这篇关于在"asm"中不可能的约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆