iphone dev:内联asm的问题

发布于 2024-07-25 23:35:05 字数 621 浏览 6 评论 0原文

我阅读了处理此类问题的不同主题,但我仍然没有答案。 这是我的问题:

在我的头文件中,我有这个:

  int cl, ch, _a = a, _b = b;\
  __asm__ ("smull %0, %1, %2, %3\n"         
   "mov %0, %0, lsr %4\n"           
   "orr %0, %0, %1, lsl %5\n"           
   : "=&r" (cl), "=&r" (ch)         
   : "r" (_a), "r" (_b), "i" (r), "i" (32-(r)));
  cl; })

在我的项目设置中,我验证了以下选项已被检查 链接文本

但我有一个控制台错误:

{标准输入}:242:selected处理器不支持 -- smull r0,r1,r2,r3' {标准输入}:244:需要未移位的寄存器 --orr r0,r0,r1,lsl#20'

你能帮我吗?

I read the different topics that deal with that kind of problem, but I still have no answer.
Here is my problem :

In my header file, i have this :

  int cl, ch, _a = a, _b = b;\
  __asm__ ("smull %0, %1, %2, %3\n"         
   "mov %0, %0, lsr %4\n"           
   "orr %0, %0, %1, lsl %5\n"           
   : "=&r" (cl), "=&r" (ch)         
   : "r" (_a), "r" (_b), "i" (r), "i" (32-(r)));
  cl; })

In my project settings, I verified that these following options was ckecked
link text

But I have a console error :

{standard input}:242:selected processor doesn't support -- smull r0,r1,r2,r3'
{standard input}:244:unshifted register required --
orr r0,r0,r1,lsl#20'

Could you help me ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦途 2024-08-01 23:35:05

你正在为arm编译文件吗? 默认情况下,iPhone 代码是针对拇指编译的(除非您正在进行浮点数学运算,否则通常更可取)。 你列出的ASM是arm。 您需要设置使用该标头的任何文件来编译为arm,因为GCC不允许您在单个编译单元内切换后端。 您可以通过取消选择“GCC 4.x 代码生成”下的“Compile for Thumb”来更改它。

将整个项目编译为 arm 很可能会对内存使用和代理性能产生重大(负面)影响。 通过宏在标头中包含 ASM 在 iPhone 上会变得非常混乱。 一般来说,您最好将所有 ASM 放在一个文件中,并将该文件编译为arm,但对于只有 3 个指令序列的情况来说,这可能也不值得。

Are you compiling the file for arm? By default code for the iPhone is compiled for thumb (which is usually preferable unless you are doing floating point math). The ASM you listed is arm. You will need to set any file that uses that header to compile as arm, since GCC does not allow you to switch backends inside a single compilation unit. You can change it by deselecting "Compile for Thumb" under "GCC 4.x Code Generation."

Compiling your entire project as arm will most likely have a significant (negative) impact on memory usage, and by proxy performance. Including ASM via a macro in a header like that is going to prove very messy on the iPhone. In general you are better off putting all your ASM in a single file and compiling that one file as arm, but for what is only a 3 instruction sequence that will probably not be worth while either.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文