| 1 |
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -O2 -target-cpu x86-64-v3 -o - | FileCheck %s |
| 2 |
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -O2 -target-cpu x86-64-v3 -fclang-abi-compat=20 -o - | FileCheck --check-prefix CLANG-20 %s |
| 3 |
// RUN: %clang_cc1 %s -triple x86_64-sie-ps4 -emit-llvm -O2 -target-cpu x86-64-v3 -o - | FileCheck --check-prefix CLANG-20 %s |
| 4 |
|
| 5 |
using UInt64x2 = unsigned long long __attribute__((__vector_size__(16), may_alias)); |
| 6 |
using UInt64x4 = unsigned long long __attribute__((__vector_size__(32), may_alias)); |
| 7 |
|
| 8 |
template<int id> |
| 9 |
struct XMM1 { |
| 10 |
UInt64x2 x; |
| 11 |
}; |
| 12 |
|
| 13 |
struct XMM2 : XMM1<0>, XMM1<1> { |
| 14 |
}; |
| 15 |
|
| 16 |
// CHECK: define{{.*}} @_Z3foov({{.*}} [[ARG:%.*]]){{.*}} |
| 17 |
// CLANG-20: define{{.*}} <4 x double> @_Z3foov() |
| 18 |
// CHECK: entry: |
| 19 |
// CHECK-NEXT: store {{.*}}, ptr [[ARG]]{{.*}} |
| 20 |
// CHECK-NEXT: [[TMP1:%.*]] = getelementptr {{.*}}, ptr [[ARG]]{{.*}} |
| 21 |
// CHECK-NEXT: store {{.*}}, ptr [[TMP1]]{{.*}} |
| 22 |
XMM2 foo() { |
| 23 |
XMM2 result; |
| 24 |
((XMM1<0>*)&result)->x = UInt64x2{1, 2}; |
| 25 |
((XMM1<1>*)&result)->x = UInt64x2{3, 4}; |
| 26 |
return result; |
| 27 |
} |
| 28 |
|
| 29 |
template<int id> |
| 30 |
struct YMM1 { |
| 31 |
UInt64x4 x; |
| 32 |
}; |
| 33 |
|
| 34 |
struct YMM2 : YMM1<0>, YMM1<1> { |
| 35 |
}; |
| 36 |
|
| 37 |
// CHECK: define{{.*}} @_Z3barv({{.*}} [[ARG:%.*]]){{.*}} |
| 38 |
// CLANG-20: define{{.*}} <8 x double> @_Z3barv() |
| 39 |
// CHECK: entry: |
| 40 |
// CHECK-NEXT: store {{.*}}, ptr [[ARG]]{{.*}} |
| 41 |
// CHECK-NEXT: [[TMP1:%.*]] = getelementptr {{.*}}, ptr [[ARG]]{{.*}} |
| 42 |
// CHECK-NEXT: store {{.*}}, ptr [[TMP1]]{{.*}} |
| 43 |
YMM2 bar() { |
| 44 |
YMM2 result; |
| 45 |
((YMM1<0>*)&result)->x = UInt64x4{1, 2, 3, 4}; |
| 46 |
((YMM1<1>*)&result)->x = UInt64x4{5, 6, 7, 8}; |
| 47 |
return result; |
| 48 |
} |