| 1 |
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s |
| 2 |
|
| 3 |
template <class T> |
| 4 |
void CheckIntScalarTypes() { |
| 5 |
// T will be substituted with 'int' and 'enum' types. |
| 6 |
|
| 7 |
typedef T __attribute__((mode(QI))) T1; |
| 8 |
typedef T __attribute__((mode(HI))) T2; |
| 9 |
typedef T __attribute__((mode(SI))) T3; |
| 10 |
typedef T __attribute__((mode(DI))) T4; |
| 11 |
|
| 12 |
T1 a1; |
| 13 |
T2 a2; |
| 14 |
T3 a3; |
| 15 |
T4 a4; |
| 16 |
} |
| 17 |
|
| 18 |
template <class T> |
| 19 |
void CheckIntVectorTypes() { |
| 20 |
// T will be substituted with 'int'. |
| 21 |
|
| 22 |
typedef int __attribute__((mode(QI))) __attribute__((vector_size(8))) VT_11; |
| 23 |
typedef T __attribute__((mode(V8QI))) VT_12; |
| 24 |
typedef int __attribute__((mode(SI))) __attribute__((vector_size(16))) VT_21; |
| 25 |
typedef T __attribute__((mode(V4SI))) VT_22; |
| 26 |
typedef int __attribute__((mode(DI))) __attribute__((vector_size(64))) VT_31; |
| 27 |
typedef T __attribute__((mode(V8DI))) VT_32; |
| 28 |
|
| 29 |
VT_11 v11; |
| 30 |
VT_12 v12; |
| 31 |
|
| 32 |
VT_21 v21; |
| 33 |
VT_22 v22; |
| 34 |
|
| 35 |
VT_31 v31; |
| 36 |
VT_32 v32; |
| 37 |
} |
| 38 |
|
| 39 |
template <class T> |
| 40 |
void CheckFloatVectorTypes() { |
| 41 |
// T will be substituted with 'float'. |
| 42 |
|
| 43 |
typedef float __attribute__((mode(SF))) __attribute__((vector_size(128))) VT_41; |
| 44 |
typedef T __attribute__((mode(V32SF))) VT_42; |
| 45 |
typedef float __attribute__((mode(DF))) __attribute__((vector_size(256))) VT_51; |
| 46 |
typedef T __attribute__((mode(V32DF))) VT_52; |
| 47 |
|
| 48 |
VT_41 v41; |
| 49 |
VT_42 v42; |
| 50 |
|
| 51 |
VT_51 v51; |
| 52 |
VT_52 v52; |
| 53 |
} |
| 54 |
|
| 55 |
template <class T> |
| 56 |
void CheckInstantiationWithModedType() { |
| 57 |
T x1; |
| 58 |
} |
| 59 |
|
| 60 |
typedef enum { A1, B1 } EnumTy; |
| 61 |
typedef int __attribute__((mode(DI))) Int64Ty1; |
| 62 |
typedef enum __attribute__((mode(DI))) { A2 } Int64Ty2; |
| 63 |
typedef int __attribute__((mode(V8HI))) IntVecTy1; |
| 64 |
|
| 65 |
void test() { |
| 66 |
|
| 67 |
// CHECK: define {{.*}} void @_Z19CheckIntScalarTypesIiEvv() |
| 68 |
// CHECK: %{{.+}} = alloca i8 |
| 69 |
// CHECK: %{{.+}} = alloca i16 |
| 70 |
// CHECK: %{{.+}} = alloca i32 |
| 71 |
// CHECK: %{{.+}} = alloca i64 |
| 72 |
CheckIntScalarTypes<int>(); |
| 73 |
|
| 74 |
// CHECK: define {{.*}} void @_Z19CheckIntScalarTypesI6EnumTyEvv() |
| 75 |
// CHECK: %{{.+}} = alloca i8 |
| 76 |
// CHECK: %{{.+}} = alloca i16 |
| 77 |
// CHECK: %{{.+}} = alloca i32 |
| 78 |
// CHECK: %{{.+}} = alloca i64 |
| 79 |
CheckIntScalarTypes<EnumTy>(); |
| 80 |
|
| 81 |
// CHECK: define {{.*}} void @_Z19CheckIntVectorTypesIiEvv() |
| 82 |
// CHECK: %{{.+}} = alloca <8 x i8> |
| 83 |
// CHECK: %{{.+}} = alloca <8 x i8> |
| 84 |
// CHECK: %{{.+}} = alloca <4 x i32> |
| 85 |
// CHECK: %{{.+}} = alloca <4 x i32> |
| 86 |
// CHECK: %{{.+}} = alloca <8 x i64> |
| 87 |
// CHECK: %{{.+}} = alloca <8 x i64> |
| 88 |
CheckIntVectorTypes<int>(); |
| 89 |
|
| 90 |
// CHECK: define {{.*}} void @_Z21CheckFloatVectorTypesIfEvv() |
| 91 |
// CHECK: %{{.+}} = alloca <32 x float> |
| 92 |
// CHECK: %{{.+}} = alloca <32 x float> |
| 93 |
// CHECK: %{{.+}} = alloca <32 x double> |
| 94 |
// CHECK: %{{.+}} = alloca <32 x double> |
| 95 |
CheckFloatVectorTypes<float>(); |
| 96 |
|
| 97 |
// CHECK: define {{.*}} void @_Z31CheckInstantiationWithModedTypeIlEvv() |
| 98 |
// CHECK: [[X1:%.+]] = alloca i64 |
| 99 |
CheckInstantiationWithModedType<Int64Ty1>(); |
| 100 |
|
| 101 |
// CHECK: define {{.*}} void @_Z31CheckInstantiationWithModedTypeI8Int64Ty2Evv() |
| 102 |
// CHECK: [[X1]] = alloca i64 |
| 103 |
CheckInstantiationWithModedType<Int64Ty2>(); |
| 104 |
|
| 105 |
// CHECK: define {{.*}} void @_Z31CheckInstantiationWithModedTypeIDv8_sEvv() |
| 106 |
// CHECK: [[X1]] = alloca <8 x i16> |
| 107 |
CheckInstantiationWithModedType<IntVecTy1>(); |
| 108 |
} |