brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 0e11881 Raw
59 lines · c
1// RUN: %clang_cc1 -triple aarch64 -target-feature +fp-armv8 -target-abi aapcs -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD2// RUN: %clang_cc1 -triple aarch64 -target-feature -fp-armv8 -target-abi aapcs-soft -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,SOFT3 4// See also llvm/test/CodeGen/AArch64/soft-float-abi.ll, which checks the LLVM5// backend parts of the soft-float ABI.6 7// The va_list type does not change between the ABIs8// CHECK: %struct.__va_list = type { ptr, ptr, ptr, i32, i32 }9 10// Floats are passed in integer registers, this will be handled by the backend.11// CHECK: define dso_local half @test0(half noundef %a)12// CHECK: define dso_local bfloat @test1(bfloat noundef %a)13// CHECK: define dso_local float @test2(float noundef %a)14// CHECK: define dso_local double @test3(double noundef %a)15// CHECK: define dso_local fp128 @test4(fp128 noundef %a)16__fp16 test0(__fp16 a) { return a; }17__bf16 test1(__bf16 a) { return a; }18float test2(float a) { return a; }19double test3(double a) { return a; }20long double test4(long double a) { return a; }21 22// No types are considered to be HFAs or HVAs by the soft-float PCS, so these23// are converted to integer types.24struct A {25  float x;26};27// SOFT: define dso_local i32 @test10(i64 %a.coerce)28// HARD: define dso_local %struct.A @test10([1 x float] alignstack(8) %a.coerce)29struct A test10(struct A a) { return a; }30 31struct B {32  double x;33  double y;34};35// SOFT: define dso_local [2 x i64] @test11([2 x i64] %a.coerce)36// HARD: define dso_local %struct.B @test11([2 x double] alignstack(8) %a.coerce)37struct B test11(struct B a) { return a; }38 39#include <stdarg.h>40 41// The layout of the va_list struct is unchanged between the ABIs, but for42// aapcs-soft, floating-point arguments will be retreived from the GPR save43// area, as if they were an integer type of the same size.44// CHECK-LABEL: define dso_local double @test20(i32 noundef %a, ...)45// CHECK: %vl = alloca %struct.__va_list, align 846// SOFT: %gr_offs_p = getelementptr inbounds nuw %struct.__va_list, ptr %vl, i32 0, i32 347// SOFT: %reg_top_p = getelementptr inbounds nuw %struct.__va_list, ptr %vl, i32 0, i32 148// HARD: %vr_offs_p = getelementptr inbounds nuw %struct.__va_list, ptr %vl, i32 0, i32 449// HARD: %reg_top_p = getelementptr inbounds nuw %struct.__va_list, ptr %vl, i32 0, i32 250double test20(int a, ...) {51  va_list vl;52  va_start(vl, a);53  return va_arg(vl, double);54}55 56// Vector types are only available for targets with the correct hardware, and57// their calling-convention is left undefined by the soft-float ABI, so they58// aren't tested here.59