// RUN: %clang_cc1 -no-opaque-pointers -triple powerpc64le-unknown-linux-gnu -emit-llvm \
// RUN: -target-cpu pwr9 -target-feature +float128 -o - %s | FileCheck %s
// Test homogeneous fp128 aggregate passing and returning.
;
;
;
;
;
;
;
;
;
;
;
;
// CHECK: define{{.*}} [1 x fp128] @func_f1(fp128 inreg %x.coerce)
struct fp1
// CHECK: define{{.*}} [2 x fp128] @func_f2([2 x fp128] %x.coerce)
struct fp2
// CHECK: define{{.*}} [3 x fp128] @func_f3([3 x fp128] %x.coerce)
struct fp3
// CHECK: define{{.*}} [4 x fp128] @func_f4([4 x fp128] %x.coerce)
struct fp4
// CHECK: define{{.*}} [5 x fp128] @func_f5([5 x fp128] %x.coerce)
struct fp5
// CHECK: define{{.*}} [6 x fp128] @func_f6([6 x fp128] %x.coerce)
struct fp6
// CHECK: define{{.*}} [7 x fp128] @func_f7([7 x fp128] %x.coerce)
struct fp7
// CHECK: define{{.*}} [8 x fp128] @func_f8([8 x fp128] %x.coerce)
struct fp8
// CHECK: define{{.*}} void @func_f9(%struct.fp9* noalias sret(%struct.fp9) align 16 %agg.result, %struct.fp9* noundef byval(%struct.fp9) align 16 %x)
struct fp9
// CHECK: define{{.*}} [2 x fp128] @func_fab([2 x fp128] %x.coerce)
struct fpab
// CHECK: define{{.*}} [3 x fp128] @func_fabc([3 x fp128] %x.coerce)
struct fpabc
// CHECK: define{{.*}} [4 x fp128] @func_f2a2b([4 x fp128] %x.coerce)
struct fp2a2b
// CHECK-LABEL: @call_fp1
// CHECK: %[[TMP:[^ ]+]] = load fp128, fp128* getelementptr inbounds (%struct.fp1, %struct.fp1* @global_f1, i32 0, i32 0, i32 0), align 16
// CHECK: call [1 x fp128] @func_f1(fp128 inreg %[[TMP]])
struct fp1 global_f1;
void
// CHECK-LABEL: @call_fp2
// CHECK: %[[TMP:[^ ]+]] = load [2 x fp128], [2 x fp128]* getelementptr inbounds (%struct.fp2, %struct.fp2* @global_f2, i32 0, i32 0), align 16
// CHECK: call [2 x fp128] @func_f2([2 x fp128] %[[TMP]])
struct fp2 global_f2;
void
// CHECK-LABEL: @call_fp3
// CHECK: %[[TMP:[^ ]+]] = load [3 x fp128], [3 x fp128]* getelementptr inbounds (%struct.fp3, %struct.fp3* @global_f3, i32 0, i32 0), align 16
// CHECK: call [3 x fp128] @func_f3([3 x fp128] %[[TMP]])
struct fp3 global_f3;
void
// CHECK-LABEL: @call_fp4
// CHECK: %[[TMP:[^ ]+]] = load [4 x fp128], [4 x fp128]* getelementptr inbounds (%struct.fp4, %struct.fp4* @global_f4, i32 0, i32 0), align 16
// CHECK: call [4 x fp128] @func_f4([4 x fp128] %[[TMP]])
struct fp4 global_f4;
void
// CHECK-LABEL: @call_fp5
// CHECK: %[[TMP:[^ ]+]] = load [5 x fp128], [5 x fp128]* getelementptr inbounds (%struct.fp5, %struct.fp5* @global_f5, i32 0, i32 0), align 16
// CHECK: call [5 x fp128] @func_f5([5 x fp128] %[[TMP]])
struct fp5 global_f5;
void
// CHECK-LABEL: @call_fp6
// CHECK: %[[TMP:[^ ]+]] = load [6 x fp128], [6 x fp128]* getelementptr inbounds (%struct.fp6, %struct.fp6* @global_f6, i32 0, i32 0), align 16
// CHECK: call [6 x fp128] @func_f6([6 x fp128] %[[TMP]])
struct fp6 global_f6;
void
// CHECK-LABEL: @call_fp7
// CHECK: %[[TMP:[^ ]+]] = load [7 x fp128], [7 x fp128]* getelementptr inbounds (%struct.fp7, %struct.fp7* @global_f7, i32 0, i32 0), align 16
// CHECK: call [7 x fp128] @func_f7([7 x fp128] %[[TMP]])
struct fp7 global_f7;
void
// CHECK-LABEL: @call_fp8
// CHECK: %[[TMP:[^ ]+]] = load [8 x fp128], [8 x fp128]* getelementptr inbounds (%struct.fp8, %struct.fp8* @global_f8, i32 0, i32 0), align 16
// CHECK: call [8 x fp128] @func_f8([8 x fp128] %[[TMP]])
struct fp8 global_f8;
void
// CHECK-LABEL: @call_fp9
// CHECK: %[[TMP1:[^ ]+]] = alloca %struct.fp9, align 16
// CHECK: call void @func_f9(%struct.fp9* sret(%struct.fp9) align 16 %[[TMP2:[^ ]+]], %struct.fp9* noundef byval(%struct.fp9) align 16 @global_f9
// CHECK: %[[TMP3:[^ ]+]] = bitcast %struct.fp9* %[[TMP2]] to i8*
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 bitcast (%struct.fp9* @global_f9 to i8*), i8* align 16 %[[TMP3]], i64 144, i1 false
// CHECK: ret void
struct fp9 global_f9;
void
// CHECK-LABEL: @call_fpab
// CHECK: %[[TMP:[^ ]+]] = load [2 x fp128], [2 x fp128]* bitcast (%struct.fpab* @global_fab to [2 x fp128]*)
// CHECK: call [2 x fp128] @func_fab([2 x fp128] %[[TMP]])
struct fpab global_fab;
void
// CHECK-LABEL: @call_fpabc
// CHECK: %[[TMP:[^ ]+]] = load [3 x fp128], [3 x fp128]* bitcast (%struct.fpabc* @global_fabc to [3 x fp128]*)
// CHECK: call [3 x fp128] @func_fabc([3 x fp128] %[[TMP]])
struct fpabc global_fabc;
void