【问题标题】:clang O3/O2 error for Linpack with NEON instructions带有 NEON 指令的 Linpack 的 clang O3/O2 错误
【发布时间】:2016-03-08 07:35:34
【问题描述】:

我正在使用来自的代码 Neonlinpack 代码, [http://www.roylongbottom.org.uk/Raspberry_Pi_Benchmarks.zip][1]

当我使用没有任何优化标志的 clang 编译它时,它运行正常。但是当我在命令中使用 O3/O2 标志时,

clang -target armv7a-linux-gnueabihf -mfpu=neon -mfloat-abi=hard linpackneon.c cpuidc.c -O3 -o linpackneon

我收到以下错误

In file included from cpuidc.c:13:
In file included from /usr/include/math.h:426:
/usr/include/bits/mathinline.h:756:25: error: invalid output constraint '=&q' in
      asm
                    : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp),       \
                                      ^
/usr/include/bits/mathinline.h:756:25: error: invalid output constraint '=&q' in
      asm
/usr/include/bits/mathinline.h:756:25: error: invalid output constraint '=&q' in
      asm
/usr/include/bits/mathinline.h:774:25: error: invalid output constraint '=&q' in
      asm
                    : "=t" (__value), "=&q" (__ignore), "=m" (__cwtmp),       \
                                      ^
/usr/include/bits/mathinline.h:774:25: error: invalid output constraint '=&q' in
      asm
/usr/include/bits/mathinline.h:774:25: error: invalid output constraint '=&q' in
      asm
/usr/include/bits/mathinline.h:881:3: error: unknown register name 'st' in asm
  __lrint_code;
  ^
/usr/include/bits/mathinline.h:876:40: note: expanded from macro '__lrint_code'
     : "=m" (__lrintres) : "t" (__x) : "st");

这些错误背后的原因是什么。我没有遇到 GCC 的此类错误。

【问题讨论】:

  • 你的问题是什么?
  • @FUZxxl 我已编辑。谢谢。

标签: c arm clang


【解决方案1】:

cpuid.c 所做的只是从 Linux 获取时间/时序和配置详细信息。要么单独编译它而不进行优化,要么根据需要注释掉语句。只需要时间数据。

【讨论】:

  • 我已经这样做了,但 linpackneon.c 在第 69 行也有 math.h,这在 clang 中给出了与 O2 和 O3 相同的错误。
  • 使用 armclang 编译器(内置于 DS-5)我面临同样的错误。只有 gcc 在这里没有报错。
猜你喜欢
  • 2021-11-17
  • 1970-01-01
  • 1970-01-01
  • 2014-05-23
  • 1970-01-01
  • 1970-01-01
  • 2016-11-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多