[all-commits] [llvm/llvm-project] 1c4108: [i386] Modify the alignment of __m128/__m256/__m51...

MorningLiu via All-commits all-commits at lists.llvm.org
Wed Apr 14 01:47:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1c4108ab661d43e21b1d1c804d8a403e5b0cf7d6
      https://github.com/llvm/llvm-project/commit/1c4108ab661d43e21b1d1c804d8a403e5b0cf7d6
  Author: Liu, Chen3 <chen3.liu at intel.com>
  Date:   2021-04-14 (Wed, 14 Apr 2021)

  Changed paths:
    M clang/lib/CodeGen/TargetInfo.cpp
    A clang/test/CodeGen/x86_32-align-linux.c

  Log Message:
  -----------
  [i386] Modify the alignment of __m128/__m256/__m512 vector type according i386 abi.

According to i386 System V ABI:

1. when __m256 are required to be passed on the stack, the stack pointer must be aligned on a 0 mod 32 byte boundary at the time of the call.
2. when __m512 are required to be passed on the stack, the stack pointer must be aligned on a 0 mod 64 byte boundary at the time of the call.

The current method of clang passing __m512 parameter are as follow:

1. when target supports avx512, passing it with 64 byte alignment;
2. when target supports avx, passing it with 32 byte alignment;
3. Otherwise, passing it with 16 byte alignment.

Passing __m256 parameter are as follow:

1. when target supports avx or avx512, passing it with 32 byte alignment;
2. Otherwise, passing it with 16 byte alignment.

This pach will passing __m128/__m256/__m512 following i386 System V ABI and
apply it to Linux only since other System V OS (e.g Darwin, PS4 and FreeBSD) don't
want to spend any effort dealing with the ramifications of ABI breaks at present.

Differential Revision: https://reviews.llvm.org/D78564




More information about the All-commits mailing list