0

我正在使用 arm neon 代码研究 SIMD 架构。现在的问题是,在我的函数的一次传递中,我使用了 neon 中可用的所有寄存器,因此在编译时出现以下错误。

nw2.c: In function 'bit_24':
nw2.c:123: error: unable to find a register to spill in class 'GENERAL_REGS'
nw2.c:123: error: this is the insn:
(insn 33 32 34 5 c:\cs\codesourcery\sourcery_g++_lite\bin\../lib/gcc/arm-none-ea
bi/4.3.3/include/arm_neon.h:9246 (parallel [
            (set (reg:CI 178 [ D.19511 ])
                (unspec:CI [
                       (mem:CI (reg/f:SI 177 [ __a.165 ]) [0 S48 A64])
                        (reg:CI 178 [ D.19511 ])
                        (unspec:V16QI [
                                (const_int 0 [0x0])
                            ] 191)
                    ] 106))
            (set (reg/f:SI 177 [ __a.165 ])
                (plus:SI (reg/f:SI 177 [ __a.165 ])
                    (const_int 24 [0x18])))
       ]) 1593 {neon_vld3qav16qi} (nil))
 nw2.c:123: confused by earlier errors, bailing out

现在因为我想最小化寄存器,我想知道如果寄存器最初被声明为 8x16 是否可以使用 16x8。

请帮帮我

4

1 回答 1

0

您绝对可以按照自己的方式使用寄存器。

如果您编写汇编程序,只需对新类型应用加载/处理/存储操作。

如果你写内在函数,那是一样的......实际上。只是重复使用,但要确保在某个时刻,它只以一种方式使用。

您还可以转换“查看”寄存器的方式。一个经典的技巧是在 reg 中加载 4 个字符 - 4 个字符没有 VLD 指令 - 但您可以将 int 加载到 NEON 寄存器中的 4-int reg(4 字节)的通道中,然后转换它。

强制转换只对内在函数有意义,但在 ASM 中,您只需将您知道的操作应用到那里加载的数据上。

于 2012-07-11T06:42:14.840 回答