【问题标题】:What is the difference SSE and SSEUP in x86-64-psABI chapter 3.2.3?x86-64-psABI 第 3.2.3 章中的 SSE 和 SSEUP 有什么区别?
【发布时间】:2019-09-09 10:18:57
【问题描述】:

在 x86-64-psABI(https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf) 的 3.2.3 章节中,它定义了一些与 AMD64 寄存器对应的类。

1)SSESSEUP有什么区别? SSEUP 说“该类由适合向量寄存器的类型组成,可以在它的高字节中传递和返回”“可以在它的高字节中传递和返回”是什么意思?

2)X87 X87UPCOMPLEX_X87 有什么区别?他们看起来一模一样。

3.2.3 Parameter Passing

After the argument values have been computed, they are placed either in regis- ters or pushed on the stack. The way how values are passed is described in the following sections.

Definitions We first define a number of classes to classify arguments. The classes are corresponding to AMD64 register classes and defined as:
INTEGER This class consists of integral types that fit into one of the general purpose registers.

SSE The class consists of types that fit into a vector register.

SSEUP Theclassconsistsoftypesthatfitintoavectorregisterandcanbepassed
and returned in the upper bytes of it.

X87, X87UP These classes consists of types that will be returned via the x87 FPU.

COMPLEX_X87 This class consists of types that will be returned via the x87 FPU.

NO_CLASS This class is used as initializer in the algorithms. It will be used for padding and empty structures and unions.
MEMORY This class consists of types that will be passed and returned in memory via the stack.

【问题讨论】:

    标签: parameter-passing x86-64 abi


    【解决方案1】:

    SSE 寄存器已从 128 (xmm) 扩展到 256 (ymm) 和 512 位 (zmm)。

    ABI 不会尝试水平使用它们,而是首先垂直使用它们:如果您有两个 __m128,它们不会在单个 ymm 寄存器中传递,而是在两个寄存器中传递。
    但是,__m256__m512 等类型会在 ymmzmm 中传递。

    SSUP 分类用于对此进行建模,SSE 寄存器的低 128 位是低字节。

    我认为还假设具有 256 或 512 位的 CPU 只能用于具有 256 或 512 位寄存器的 CPU。
    我认为在三个xmm 寄存器中传递__m512 的四个128 位块是不合法的(第一个完全使用,另外两个仅在其上部使用)。
    “适合向量寄存器”的措辞似乎暗示了这一点。

    【讨论】:

    • 也就是说,如果我有两个__m128,则第一个__m128 中的低8 个字节将适合一个xmm 寄存器,其余的将适合同一个xmm 寄存器。由于第二个__m128 有两个类,一个是SSE,另一个是SSEUP,并且前面的xmm 寄存器已经占用,所以第二个__m128 必须使用下一个xmm 寄存器。对吗?
    • 顺便问一下,如果那个 CPU 没有 ymm 或 zmm 寄存器,__m256__m512 如何通过?编译器会抱怨这个吗?
    • @Kevin_xie 每个__m128 获取其xmm 注册。如果 CPU 没有 ymmzmm 寄存器,则您没有 __m256/512 或者它们作为结构传递。
    猜你喜欢
    • 2015-07-28
    • 2019-02-25
    • 2015-01-20
    • 2017-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-31
    相关资源
    最近更新 更多