2015-05-06 03:35:52 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
2015-05-06 03:35:52 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-feature +vector \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
2015-05-06 03:35:52 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
2016-10-31 22:38:05 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
2017-07-18 01:45:57 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z14 \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
2017-07-18 01:45:57 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch12 \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
2019-09-21 07:06:03 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z15 \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
2019-07-13 02:14:51 +08:00
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch13 \
|
2020-01-04 07:39:07 +08:00
|
|
|
// RUN: -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,HARD-FLOAT
|
|
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch13 \
|
|
|
|
// RUN: -emit-llvm -o - %s -mfloat-abi soft | FileCheck %s \
|
|
|
|
// RUN: --check-prefixes=CHECK,SOFT-FLOAT
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
// Scalar types
|
|
|
|
|
|
|
|
char pass_char(char arg) { return arg; }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define signext i8 @pass_char(i8 signext %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
short pass_short(short arg) { return arg; }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define signext i16 @pass_short(i16 signext %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
int pass_int(int arg) { return arg; }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define signext i32 @pass_int(i32 signext %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
long pass_long(long arg) { return arg; }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define i64 @pass_long(i64 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
long long pass_longlong(long long arg) { return arg; }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define i64 @pass_longlong(i64 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
__int128 pass_int128(__int128 arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_int128(i128* noalias sret align 16 %{{.*}}, i128* %0)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
float pass_float(float arg) { return arg; }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define float @pass_float(float %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
double pass_double(double arg) { return arg; }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define double @pass_double(double %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
long double pass_longdouble(long double arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_longdouble(fp128* noalias sret align 8 %{{.*}}, fp128* %0)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Complex types
|
|
|
|
|
|
|
|
_Complex char pass_complex_char(_Complex char arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_char({ i8, i8 }* noalias sret align 1 %{{.*}}, { i8, i8 }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex short pass_complex_short(_Complex short arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_short({ i16, i16 }* noalias sret align 2 %{{.*}}, { i16, i16 }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex int pass_complex_int(_Complex int arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_int({ i32, i32 }* noalias sret align 4 %{{.*}}, { i32, i32 }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex long pass_complex_long(_Complex long arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_long({ i64, i64 }* noalias sret align 8 %{{.*}}, { i64, i64 }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex long long pass_complex_longlong(_Complex long long arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_longlong({ i64, i64 }* noalias sret align 8 %{{.*}}, { i64, i64 }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex float pass_complex_float(_Complex float arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_float({ float, float }* noalias sret align 4 %{{.*}}, { float, float }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex double pass_complex_double(_Complex double arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_double({ double, double }* noalias sret align 8 %{{.*}}, { double, double }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex long double pass_complex_longdouble(_Complex long double arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_complex_longdouble({ fp128, fp128 }* noalias sret align 8 %{{.*}}, { fp128, fp128 }* %{{.*}}arg)
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Aggregate types
|
|
|
|
|
|
|
|
struct agg_1byte { char a[1]; };
|
|
|
|
struct agg_1byte pass_agg_1byte(struct agg_1byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_1byte(%struct.agg_1byte* noalias sret align 1 %{{.*}}, i8 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_2byte { char a[2]; };
|
|
|
|
struct agg_2byte pass_agg_2byte(struct agg_2byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_2byte(%struct.agg_2byte* noalias sret align 1 %{{.*}}, i16 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_3byte { char a[3]; };
|
|
|
|
struct agg_3byte pass_agg_3byte(struct agg_3byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_3byte(%struct.agg_3byte* noalias sret align 1 %{{.*}}, %struct.agg_3byte* %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_4byte { char a[4]; };
|
|
|
|
struct agg_4byte pass_agg_4byte(struct agg_4byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_4byte(%struct.agg_4byte* noalias sret align 1 %{{.*}}, i32 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_5byte { char a[5]; };
|
|
|
|
struct agg_5byte pass_agg_5byte(struct agg_5byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_5byte(%struct.agg_5byte* noalias sret align 1 %{{.*}}, %struct.agg_5byte* %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_6byte { char a[6]; };
|
|
|
|
struct agg_6byte pass_agg_6byte(struct agg_6byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_6byte(%struct.agg_6byte* noalias sret align 1 %{{.*}}, %struct.agg_6byte* %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_7byte { char a[7]; };
|
|
|
|
struct agg_7byte pass_agg_7byte(struct agg_7byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_7byte(%struct.agg_7byte* noalias sret align 1 %{{.*}}, %struct.agg_7byte* %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_8byte { char a[8]; };
|
|
|
|
struct agg_8byte pass_agg_8byte(struct agg_8byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_8byte(%struct.agg_8byte* noalias sret align 1 %{{.*}}, i64 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_16byte { char a[16]; };
|
|
|
|
struct agg_16byte pass_agg_16byte(struct agg_16byte arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_16byte(%struct.agg_16byte* noalias sret align 1 %{{.*}}, %struct.agg_16byte* %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Float-like aggregate types
|
|
|
|
|
|
|
|
struct agg_float { float a; };
|
|
|
|
struct agg_float pass_agg_float(struct agg_float arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// HARD-FLOAT-LABEL: define void @pass_agg_float(%struct.agg_float* noalias sret align 4 %{{.*}}, float %{{.*}})
|
|
|
|
// SOFT-FLOAT-LABEL: define void @pass_agg_float(%struct.agg_float* noalias sret align 4 %{{.*}}, i32 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_double { double a; };
|
|
|
|
struct agg_double pass_agg_double(struct agg_double arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// HARD-FLOAT-LABEL: define void @pass_agg_double(%struct.agg_double* noalias sret align 8 %{{.*}}, double %{{.*}})
|
|
|
|
// SOFT-FLOAT-LABEL: define void @pass_agg_double(%struct.agg_double* noalias sret align 8 %{{.*}}, i64 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_longdouble { long double a; };
|
|
|
|
struct agg_longdouble pass_agg_longdouble(struct agg_longdouble arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_longdouble(%struct.agg_longdouble* noalias sret align 8 %{{.*}}, %struct.agg_longdouble* %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_float_a8 { float a __attribute__((aligned (8))); };
|
|
|
|
struct agg_float_a8 pass_agg_float_a8(struct agg_float_a8 arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// HARD-FLOAT-LABEL: define void @pass_agg_float_a8(%struct.agg_float_a8* noalias sret align 8 %{{.*}}, double %{{.*}})
|
|
|
|
// SOFT-FLOAT-LABEL: define void @pass_agg_float_a8(%struct.agg_float_a8* noalias sret align 8 %{{.*}}, i64 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_float_a16 { float a __attribute__((aligned (16))); };
|
|
|
|
struct agg_float_a16 pass_agg_float_a16(struct agg_float_a16 arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_float_a16(%struct.agg_float_a16* noalias sret align 16 %{{.*}}, %struct.agg_float_a16* %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Verify that the following are *not* float-like aggregate types
|
|
|
|
|
|
|
|
struct agg_nofloat1 { float a; float b; };
|
|
|
|
struct agg_nofloat1 pass_agg_nofloat1(struct agg_nofloat1 arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_nofloat1(%struct.agg_nofloat1* noalias sret align 4 %{{.*}}, i64 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_nofloat2 { float a; int b; };
|
|
|
|
struct agg_nofloat2 pass_agg_nofloat2(struct agg_nofloat2 arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_nofloat2(%struct.agg_nofloat2* noalias sret align 4 %{{.*}}, i64 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_nofloat3 { float a; int : 0; };
|
|
|
|
struct agg_nofloat3 pass_agg_nofloat3(struct agg_nofloat3 arg) { return arg; }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @pass_agg_nofloat3(%struct.agg_nofloat3* noalias sret align 4 %{{.*}}, i32 %{{.*}})
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
// Accessing variable argument lists
|
|
|
|
|
|
|
|
int va_int(__builtin_va_list l) { return __builtin_va_arg(l, int); }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define signext i32 @va_int(%struct.__va_list_tag* %{{.*}})
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 20
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to i32*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 4
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to i32*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi i32* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[RET:%[^ ]+]] = load i32, i32* [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret i32 [[RET]]
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
long va_long(__builtin_va_list l) { return __builtin_va_arg(l, long); }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define i64 @va_long(%struct.__va_list_tag* %{{.*}})
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to i64*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to i64*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi i64* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[RET:%[^ ]+]] = load i64, i64* [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret i64 [[RET]]
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
long long va_longlong(__builtin_va_list l) { return __builtin_va_arg(l, long long); }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define i64 @va_longlong(%struct.__va_list_tag* %{{.*}})
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to i64*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to i64*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi i64* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[RET:%[^ ]+]] = load i64, i64* [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret i64 [[RET]]
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
double va_double(__builtin_va_list l) { return __builtin_va_arg(l, double); }
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define double @va_double(%struct.__va_list_tag* %{{.*}})
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 1
|
|
|
|
// SOFT-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 4
|
|
|
|
// SOFT-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 128
|
|
|
|
// SOFT-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to double*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to double*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi double* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[RET:%[^ ]+]] = load double, double* [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret double [[RET]]
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
long double va_longdouble(__builtin_va_list l) { return __builtin_va_arg(l, long double); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_longdouble(fp128* noalias sret align 8 %{{.*}}, %struct.__va_list_tag* %{{.*}})
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to fp128**
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to fp128**
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi fp128** [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[INDIRECT_ARG:%[^ ]+]] = load fp128*, fp128** [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: [[RET:%[^ ]+]] = load fp128, fp128* [[INDIRECT_ARG]]
|
|
|
|
// CHECK: store fp128 [[RET]], fp128* %{{.*}}
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
_Complex char va_complex_char(__builtin_va_list l) { return __builtin_va_arg(l, _Complex char); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_complex_char({ i8, i8 }* noalias sret align 1 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to { i8, i8 }**
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to { i8, i8 }**
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi { i8, i8 }** [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[INDIRECT_ARG:%[^ ]+]] = load { i8, i8 }*, { i8, i8 }** [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_1byte va_agg_1byte(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_1byte); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_1byte(%struct.agg_1byte* noalias sret align 1 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 23
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_1byte*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 7
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_1byte*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_1byte* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_2byte va_agg_2byte(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_2byte); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_2byte(%struct.agg_2byte* noalias sret align 1 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 22
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_2byte*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 6
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_2byte*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_2byte* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_3byte va_agg_3byte(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_3byte); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_3byte(%struct.agg_3byte* noalias sret align 1 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_3byte**
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_3byte**
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_3byte** [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[INDIRECT_ARG:%[^ ]+]] = load %struct.agg_3byte*, %struct.agg_3byte** [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_4byte va_agg_4byte(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_4byte); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_4byte(%struct.agg_4byte* noalias sret align 1 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 20
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_4byte*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 4
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_4byte*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_4byte* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_8byte va_agg_8byte(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_8byte); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_8byte(%struct.agg_8byte* noalias sret align 1 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_8byte*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_8byte*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_8byte* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_float va_agg_float(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_float); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_float(%struct.agg_float* noalias sret align 4 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 1
|
|
|
|
// SOFT-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 4
|
|
|
|
// SOFT-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 128
|
|
|
|
// SOFT-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 20
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_float*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 4
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_float*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_float* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_double va_agg_double(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_double); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_double(%struct.agg_double* noalias sret align 8 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 1
|
|
|
|
// SOFT-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 4
|
|
|
|
// SOFT-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 128
|
|
|
|
// SOFT-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_double*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_double*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_double* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_longdouble va_agg_longdouble(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_longdouble); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_longdouble(%struct.agg_longdouble* noalias sret align 8 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_longdouble**
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_longdouble**
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_longdouble** [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[INDIRECT_ARG:%[^ ]+]] = load %struct.agg_longdouble*, %struct.agg_longdouble** [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_float_a8 va_agg_float_a8(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_float_a8); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_float_a8(%struct.agg_float_a8* noalias sret align 8 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 1
|
|
|
|
// SOFT-FLOAT: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 4
|
|
|
|
// SOFT-FLOAT: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
2020-01-04 07:39:07 +08:00
|
|
|
// HARD-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 128
|
|
|
|
// SOFT-FLOAT: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_float_a8*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_float_a8*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_float_a8* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_float_a16 va_agg_float_a16(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_float_a16); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_float_a16(%struct.agg_float_a16* noalias sret align 16 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_float_a16**
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_float_a16**
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_float_a16** [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: [[INDIRECT_ARG:%[^ ]+]] = load %struct.agg_float_a16*, %struct.agg_float_a16** [[VA_ARG_ADDR]]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_nofloat1 va_agg_nofloat1(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_nofloat1); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_nofloat1(%struct.agg_nofloat1* noalias sret align 4 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_nofloat1*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_nofloat1*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_nofloat1* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_nofloat2 va_agg_nofloat2(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_nofloat2); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_nofloat2(%struct.agg_nofloat2* noalias sret align 4 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 16
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_nofloat2*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 0
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_nofloat2*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_nofloat2* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|
|
|
|
struct agg_nofloat3 va_agg_nofloat3(__builtin_va_list l) { return __builtin_va_arg(l, struct agg_nofloat3); }
|
2020-03-25 00:36:19 +08:00
|
|
|
// CHECK-LABEL: define void @va_agg_nofloat3(%struct.agg_nofloat3* noalias sret align 4 %{{.*}}, %struct.__va_list_tag* %{{.*}}
|
2015-03-31 02:08:50 +08:00
|
|
|
// CHECK: [[REG_COUNT_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 0
|
|
|
|
// CHECK: [[REG_COUNT:%[^ ]+]] = load i64, i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[FITS_IN_REGS:%[^ ]+]] = icmp ult i64 [[REG_COUNT]], 5
|
|
|
|
// CHECK: br i1 [[FITS_IN_REGS]],
|
|
|
|
// CHECK: [[SCALED_REG_COUNT:%[^ ]+]] = mul i64 [[REG_COUNT]], 8
|
|
|
|
// CHECK: [[REG_OFFSET:%[^ ]+]] = add i64 [[SCALED_REG_COUNT]], 20
|
|
|
|
// CHECK: [[REG_SAVE_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 3
|
|
|
|
// CHECK: [[REG_SAVE_AREA:%[^ ]+]] = load i8*, i8** [[REG_SAVE_AREA_PTR:[^ ]+]]
|
|
|
|
// CHECK: [[RAW_REG_ADDR:%[^ ]+]] = getelementptr i8, i8* [[REG_SAVE_AREA]], i64 [[REG_OFFSET]]
|
|
|
|
// CHECK: [[REG_ADDR:%[^ ]+]] = bitcast i8* [[RAW_REG_ADDR]] to %struct.agg_nofloat3*
|
|
|
|
// CHECK: [[REG_COUNT1:%[^ ]+]] = add i64 [[REG_COUNT]], 1
|
|
|
|
// CHECK: store i64 [[REG_COUNT1]], i64* [[REG_COUNT_PTR]]
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA_PTR:%[^ ]+]] = getelementptr inbounds %struct.__va_list_tag, %struct.__va_list_tag* %{{.*}}, i32 0, i32 2
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA:%[^ ]+]] = load i8*, i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[RAW_MEM_ADDR:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 4
|
|
|
|
// CHECK: [[MEM_ADDR:%[^ ]+]] = bitcast i8* [[RAW_MEM_ADDR]] to %struct.agg_nofloat3*
|
|
|
|
// CHECK: [[OVERFLOW_ARG_AREA2:%[^ ]+]] = getelementptr i8, i8* [[OVERFLOW_ARG_AREA]], i64 8
|
|
|
|
// CHECK: store i8* [[OVERFLOW_ARG_AREA2]], i8** [[OVERFLOW_ARG_AREA_PTR]]
|
|
|
|
// CHECK: [[VA_ARG_ADDR:%[^ ]+]] = phi %struct.agg_nofloat3* [ [[REG_ADDR]], %{{.*}} ], [ [[MEM_ADDR]], %{{.*}} ]
|
|
|
|
// CHECK: ret void
|
2015-03-30 21:49:01 +08:00
|
|
|
|