File: attr-mode-vector-types-tmpl.cpp

package info (click to toggle)
llvm-toolchain-6.0 1%3A6.0.1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 598,080 kB
  • sloc: cpp: 3,046,253; ansic: 595,057; asm: 271,965; python: 128,926; objc: 106,554; sh: 21,906; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,227; cs: 2,027; xml: 686; php: 212; csh: 117
file content (108 lines) | stat: -rw-r--r-- 3,387 bytes parent folder | download | duplicates (31)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu %s -emit-llvm -o - | FileCheck %s

template <class T>
void CheckIntScalarTypes() {
  // T will be substituted with 'int' and 'enum' types.

  typedef T __attribute__((mode(QI))) T1;
  typedef T __attribute__((mode(HI))) T2;
  typedef T __attribute__((mode(SI))) T3;
  typedef T __attribute__((mode(DI))) T4;

  T1 a1;
  T2 a2;
  T3 a3;
  T4 a4;
}

template <class T>
void CheckIntVectorTypes() {
  // T will be substituted with 'int'.

  typedef int __attribute__((mode(QI))) __attribute__((vector_size(8)))  VT_11;
  typedef T   __attribute__((mode(V8QI)))                                VT_12;
  typedef int __attribute__((mode(SI))) __attribute__((vector_size(16))) VT_21;
  typedef T   __attribute__((mode(V4SI)))                                VT_22;
  typedef int __attribute__((mode(DI))) __attribute__((vector_size(64))) VT_31;
  typedef T   __attribute__((mode(V8DI)))                                VT_32;

  VT_11 v11;
  VT_12 v12;

  VT_21 v21;
  VT_22 v22;

  VT_31 v31;
  VT_32 v32;
}

template <class T>
void CheckFloatVectorTypes() {
  // T will be substituted with 'float'.

  typedef float __attribute__((mode(SF))) __attribute__((vector_size(128))) VT_41;
  typedef T     __attribute__((mode(V32SF)))                                VT_42;
  typedef float __attribute__((mode(DF))) __attribute__((vector_size(256))) VT_51;
  typedef T     __attribute__((mode(V32DF)))                                VT_52;

  VT_41 v41;
  VT_42 v42;

  VT_51 v51;
  VT_52 v52;
}

template <class T>
void CheckInstantiationWithModedType() {
  T x1;
}

typedef enum { A1, B1 }                       EnumTy;
typedef int __attribute__((mode(DI)))         Int64Ty1;
typedef enum __attribute__((mode(DI))) { A2 } Int64Ty2;
typedef int __attribute__((mode(V8HI)))       IntVecTy1;

void test() {

  // CHECK: define {{.*}} void @_Z19CheckIntScalarTypesIiEvv()
  // CHECK: %{{.+}} = alloca i8
  // CHECK: %{{.+}} = alloca i16
  // CHECK: %{{.+}} = alloca i32
  // CHECK: %{{.+}} = alloca i64
  CheckIntScalarTypes<int>();

  // CHECK: define {{.*}} void @_Z19CheckIntScalarTypesI6EnumTyEvv()
  // CHECK: %{{.+}} = alloca i8
  // CHECK: %{{.+}} = alloca i16
  // CHECK: %{{.+}} = alloca i32
  // CHECK: %{{.+}} = alloca i64
  CheckIntScalarTypes<EnumTy>();

  // CHECK: define {{.*}} void @_Z19CheckIntVectorTypesIiEvv()
  // CHECK: %{{.+}} = alloca <8 x i8>
  // CHECK: %{{.+}} = alloca <8 x i8>
  // CHECK: %{{.+}} = alloca <4 x i32>
  // CHECK: %{{.+}} = alloca <4 x i32>
  // CHECK: %{{.+}} = alloca <8 x i64>
  // CHECK: %{{.+}} = alloca <8 x i64>
  CheckIntVectorTypes<int>();

  // CHECK: define {{.*}} void @_Z21CheckFloatVectorTypesIfEvv()
  // CHECK: %{{.+}} = alloca <32 x float>
  // CHECK: %{{.+}} = alloca <32 x float>
  // CHECK: %{{.+}} = alloca <32 x double>
  // CHECK: %{{.+}} = alloca <32 x double>
  CheckFloatVectorTypes<float>();

  // CHECK: define {{.*}} void @_Z31CheckInstantiationWithModedTypeIlEvv()
  // CHECK: [[X1:%.+]] = alloca i64
  CheckInstantiationWithModedType<Int64Ty1>();

  // CHECK: define {{.*}} void @_Z31CheckInstantiationWithModedTypeI8Int64Ty2Evv()
  // CHECK: [[X1]] = alloca i64
  CheckInstantiationWithModedType<Int64Ty2>();

  // CHECK: define {{.*}} void @_Z31CheckInstantiationWithModedTypeIDv8_sEvv()
  // CHECK: [[X1]] = alloca <8 x i16>
  CheckInstantiationWithModedType<IntVecTy1>();
}