brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · 1856f1e Raw
249 lines · c
1// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm  -target-feature +avx512fp16 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-C2// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm  -target-feature +avx512fp16 -x c++ -std=c++11 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-CPP3 4struct half1 {5  _Float16 a;6};7 8struct half1 h1(_Float16 a) {9  // CHECK: define{{.*}}half @10  struct half1 x;11  x.a = a;12  return x;13}14 15struct half2 {16  _Float16 a;17  _Float16 b;18};19 20struct half2 h2(_Float16 a, _Float16 b) {21  // CHECK: define{{.*}}<2 x half> @22  struct half2 x;23  x.a = a;24  x.b = b;25  return x;26}27 28struct half3 {29  _Float16 a;30  _Float16 b;31  _Float16 c;32};33 34struct half3 h3(_Float16 a, _Float16 b, _Float16 c) {35  // CHECK: define{{.*}}<4 x half> @36  struct half3 x;37  x.a = a;38  x.b = b;39  x.c = c;40  return x;41}42 43struct half4 {44  _Float16 a;45  _Float16 b;46  _Float16 c;47  _Float16 d;48};49 50struct half4 h4(_Float16 a, _Float16 b, _Float16 c, _Float16 d) {51  // CHECK: define{{.*}}<4 x half> @52  struct half4 x;53  x.a = a;54  x.b = b;55  x.c = c;56  x.d = d;57  return x;58}59 60struct floathalf {61  float a;62  _Float16 b;63};64 65struct floathalf fh(float a, _Float16 b) {66  // CHECK: define{{.*}}<4 x half> @67  struct floathalf x;68  x.a = a;69  x.b = b;70  return x;71}72 73struct floathalf2 {74  float a;75  _Float16 b;76  _Float16 c;77};78 79struct floathalf2 fh2(float a, _Float16 b, _Float16 c) {80  // CHECK: define{{.*}}<4 x half> @81  struct floathalf2 x;82  x.a = a;83  x.b = b;84  x.c = c;85  return x;86}87 88struct halffloat {89  _Float16 a;90  float b;91};92 93struct halffloat hf(_Float16 a, float b) {94  // CHECK: define{{.*}}<4 x half> @95  struct halffloat x;96  x.a = a;97  x.b = b;98  return x;99}100 101struct half2float {102  _Float16 a;103  _Float16 b;104  float c;105};106 107struct half2float h2f(_Float16 a, _Float16 b, float c) {108  // CHECK: define{{.*}}<4 x half> @109  struct half2float x;110  x.a = a;111  x.b = b;112  x.c = c;113  return x;114}115 116struct floathalf3 {117  float a;118  _Float16 b;119  _Float16 c;120  _Float16 d;121};122 123struct floathalf3 fh3(float a, _Float16 b, _Float16 c, _Float16 d) {124  // CHECK: define{{.*}}{ <4 x half>, half } @125  struct floathalf3 x;126  x.a = a;127  x.b = b;128  x.c = c;129  x.d = d;130  return x;131}132 133struct half5 {134  _Float16 a;135  _Float16 b;136  _Float16 c;137  _Float16 d;138  _Float16 e;139};140 141struct half5 h5(_Float16 a, _Float16 b, _Float16 c, _Float16 d, _Float16 e) {142  // CHECK: define{{.*}}{ <4 x half>, half } @143  struct half5 x;144  x.a = a;145  x.b = b;146  x.c = c;147  x.d = d;148  x.e = e;149  return x;150}151 152struct float2 {153  struct {} s;154  float a;155  float b;156};157 158float pr51813(struct float2 s) {159  // CHECK-C: define{{.*}} @pr51813(<2 x float>160  // CHECK-CPP: define{{.*}} @_Z7pr518136float2(double {{.*}}, float161  return s.a;162}163 164struct float3 {165  float a;166  struct {} s;167  float b;168};169 170float pr51813_2(struct float3 s) {171  // CHECK-C: define{{.*}} @pr51813_2(<2 x float>172  // CHECK-CPP: define{{.*}} @_Z9pr51813_26float3(double {{.*}}, float173  return s.a;174}175 176struct shalf2 {177  struct {} s;178  _Float16 a;179  _Float16 b;180};181 182_Float16 sf2(struct shalf2 s) {183  // CHECK-C: define{{.*}} @sf2(<2 x half>184  // CHECK-CPP: define{{.*}} @_Z3sf26shalf2(double {{.*}}185  return s.a;186};187 188struct halfs2 {189  _Float16 a;190  struct {} s1;191  _Float16 b;192  struct {} s2;193};194 195_Float16 fs2(struct shalf2 s) {196  // CHECK-C: define{{.*}} @fs2(<2 x half>197  // CHECK-CPP: define{{.*}} @_Z3fs26shalf2(double {{.*}}198  return s.a;199};200 201struct fsd {202  float a;203  struct {};204  double b;205};206 207struct fsd pr52011(void) {208  // CHECK: define{{.*}} { float, double } @209  struct fsd x;210  return x;211}212 213struct hsd {214  _Float16 a;215  struct {};216  double b;217};218 219struct hsd pr52011_2(void) {220  // CHECK: define{{.*}} { half, double } @221  struct hsd x;222  return x;223}224 225struct hsf {226  _Float16 a;227  struct {};228  float b;229};230 231struct hsf pr52011_3(void) {232  // CHECK: define{{.*}} <4 x half> @233  struct hsf x;234  return x;235}236 237struct fds {238  float a;239  double b;240  struct {};241};242 243struct fds pr52011_4(void) {244  // CHECK-C: define{{.*}} { float, double } @pr52011_4245  // CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret246  struct fds x;247  return x;248}249