| 1 |
// RUN: %clang_cc1 -triple x86_64-linux -emit-llvm -target-feature +sse2 < %s | FileCheck %s --check-prefixes=CHECK |
| 2 |
|
| 3 |
struct bfloat1 { |
| 4 |
__bf16 a; |
| 5 |
}; |
| 6 |
|
| 7 |
struct bfloat1 h1(__bf16 a) { |
| 8 |
// CHECK: define{{.*}}bfloat @ |
| 9 |
struct bfloat1 x; |
| 10 |
x.a = a; |
| 11 |
return x; |
| 12 |
} |
| 13 |
|
| 14 |
struct bfloat2 { |
| 15 |
__bf16 a; |
| 16 |
__bf16 b; |
| 17 |
}; |
| 18 |
|
| 19 |
struct bfloat2 h2(__bf16 a, __bf16 b) { |
| 20 |
// CHECK: define{{.*}}<2 x bfloat> @ |
| 21 |
struct bfloat2 x; |
| 22 |
x.a = a; |
| 23 |
x.b = b; |
| 24 |
return x; |
| 25 |
} |
| 26 |
|
| 27 |
struct bfloat3 { |
| 28 |
__bf16 a; |
| 29 |
__bf16 b; |
| 30 |
__bf16 c; |
| 31 |
}; |
| 32 |
|
| 33 |
struct bfloat3 h3(__bf16 a, __bf16 b, __bf16 c) { |
| 34 |
// CHECK: define{{.*}}<4 x bfloat> @ |
| 35 |
struct bfloat3 x; |
| 36 |
x.a = a; |
| 37 |
x.b = b; |
| 38 |
x.c = c; |
| 39 |
return x; |
| 40 |
} |
| 41 |
|
| 42 |
struct bfloat4 { |
| 43 |
__bf16 a; |
| 44 |
__bf16 b; |
| 45 |
__bf16 c; |
| 46 |
__bf16 d; |
| 47 |
}; |
| 48 |
|
| 49 |
struct bfloat4 h4(__bf16 a, __bf16 b, __bf16 c, __bf16 d) { |
| 50 |
// CHECK: define{{.*}}<4 x bfloat> @ |
| 51 |
struct bfloat4 x; |
| 52 |
x.a = a; |
| 53 |
x.b = b; |
| 54 |
x.c = c; |
| 55 |
x.d = d; |
| 56 |
return x; |
| 57 |
} |
| 58 |
|
| 59 |
struct floatbfloat { |
| 60 |
float a; |
| 61 |
__bf16 b; |
| 62 |
}; |
| 63 |
|
| 64 |
struct floatbfloat fh(float a, __bf16 b) { |
| 65 |
// CHECK: define{{.*}}<4 x half> @ |
| 66 |
struct floatbfloat x; |
| 67 |
x.a = a; |
| 68 |
x.b = b; |
| 69 |
return x; |
| 70 |
} |
| 71 |
|
| 72 |
struct floatbfloat2 { |
| 73 |
float a; |
| 74 |
__bf16 b; |
| 75 |
__bf16 c; |
| 76 |
}; |
| 77 |
|
| 78 |
struct floatbfloat2 fh2(float a, __bf16 b, __bf16 c) { |
| 79 |
// CHECK: define{{.*}}<4 x half> @ |
| 80 |
struct floatbfloat2 x; |
| 81 |
x.a = a; |
| 82 |
x.b = b; |
| 83 |
x.c = c; |
| 84 |
return x; |
| 85 |
} |
| 86 |
|
| 87 |
struct bfloatfloat { |
| 88 |
__bf16 a; |
| 89 |
float b; |
| 90 |
}; |
| 91 |
|
| 92 |
struct bfloatfloat hf(__bf16 a, float b) { |
| 93 |
// CHECK: define{{.*}}<4 x half> @ |
| 94 |
struct bfloatfloat x; |
| 95 |
x.a = a; |
| 96 |
x.b = b; |
| 97 |
return x; |
| 98 |
} |
| 99 |
|
| 100 |
struct bfloat2float { |
| 101 |
__bf16 a; |
| 102 |
__bf16 b; |
| 103 |
float c; |
| 104 |
}; |
| 105 |
|
| 106 |
struct bfloat2float h2f(__bf16 a, __bf16 b, float c) { |
| 107 |
// CHECK: define{{.*}}<4 x bfloat> @ |
| 108 |
struct bfloat2float x; |
| 109 |
x.a = a; |
| 110 |
x.b = b; |
| 111 |
x.c = c; |
| 112 |
return x; |
| 113 |
} |
| 114 |
|
| 115 |
struct floatbfloat3 { |
| 116 |
float a; |
| 117 |
__bf16 b; |
| 118 |
__bf16 c; |
| 119 |
__bf16 d; |
| 120 |
}; |
| 121 |
|
| 122 |
struct floatbfloat3 fh3(float a, __bf16 b, __bf16 c, __bf16 d) { |
| 123 |
// CHECK: define{{.*}}{ <4 x half>, bfloat } @ |
| 124 |
struct floatbfloat3 x; |
| 125 |
x.a = a; |
| 126 |
x.b = b; |
| 127 |
x.c = c; |
| 128 |
x.d = d; |
| 129 |
return x; |
| 130 |
} |
| 131 |
|
| 132 |
struct bfloat5 { |
| 133 |
__bf16 a; |
| 134 |
__bf16 b; |
| 135 |
__bf16 c; |
| 136 |
__bf16 d; |
| 137 |
__bf16 e; |
| 138 |
}; |
| 139 |
|
| 140 |
struct bfloat5 h5(__bf16 a, __bf16 b, __bf16 c, __bf16 d, __bf16 e) { |
| 141 |
// CHECK: define{{.*}}{ <4 x bfloat>, bfloat } @ |
| 142 |
struct bfloat5 x; |
| 143 |
x.a = a; |
| 144 |
x.b = b; |
| 145 |
x.c = c; |
| 146 |
x.d = d; |
| 147 |
x.e = e; |
| 148 |
return x; |
| 149 |
} |