llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.57k stars 11.81k forks source link

[ARM]: Incorrect ARMHF vector_size ABI for VFP-only #63320

Open easyaspi314 opened 1 year ago

easyaspi314 commented 1 year ago

Related to #62994.

According to the EABI documentation, the hard float ABI passes 64-bit and 128-bit containerized vectors in aligned VFP registers, regardless of whether vectors are available. This is what GCC does, even if it can't legalize the vector type.

However, on hard float without NEON (e.g. Raspbian), Clang unpacks them into individual arguments.

This results in integer vectors being passed in r0-r3, and float/double registers to not be aligned to doubleword or quadword register pairs.

args AAPCS Clang VFP
i32x2 a d0 (s0-s1) r0-r1
i32x4 a q0 (s0-s3) r0-r3
f32 a, i32x2 b s0, d1 (s2-s3) s0, r0-r1
f32 a, i32x4 b s0, q1 (s4-s7) s0, r0-r3
f32 a, f32x2 b s0, d1 (s2-s3) s0, s1-s2
f32 a, f32x4 b s0. q1 (s4-s7) s0. s1-s4
f32 a, f64x2 b s0, q1 (s4-s7) s0, d1-d2 (s2-s5)

https://godbolt.org/z/73Kjc5zaM

llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-arm