File: vector-bool-pixel-altivec-init.c

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (92 lines) | stat: -rw-r--r-- 4,189 bytes parent folder | download | duplicates (3)
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
// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
// RUN:   -faltivec-src-compat=mixed -triple powerpc-unknown-unknown -S \
// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=MIXED
// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
// RUN:   -faltivec-src-compat=mixed -triple powerpc64le-unknown-unknown -S \
// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=MIXED
// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
// RUN:   -faltivec-src-compat=xl -triple powerpc-unknown-unknown -S \
// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
// RUN: %clang_cc1 -target-feature +altivec -target-feature +vsx \
// RUN:   -faltivec-src-compat=xl -triple powerpc64le-unknown-unknown -S \
// RUN:   -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
// RUN: %clang -mcpu=pwr8 -faltivec-src-compat=mixed --target=powerpc-unknown-unknown \
// RUN:   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=MIXED
// RUN: %clang -mcpu=pwr9 -faltivec-src-compat=mixed --target=powerpc-unknown-unknown \
// RUN:   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=MIXED
// RUN: %clang -mcpu=pwr8 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \
// RUN:   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL
// RUN: %clang -mcpu=pwr9 -faltivec-src-compat=xl --target=powerpc-unknown-unknown \
// RUN:   -S -emit-llvm %s -o - | FileCheck %s --check-prefix=XL

// Vector bool type
vector bool char vbi8_1;
vector bool char vbi8_2;

vector bool short vbi16_1;
vector bool short vbi16_2;

vector bool int vbi32_1;
vector bool int vbi32_2;

vector bool long long vbi64_1;
vector bool long long vbi64_2;

// Vector pixel type
vector pixel p1;

////////////////////////////////////////////////////////////////////////////////
void test_vector_bool_pixel_init() {
  // vector bool char initialization
  vbi8_1 = (vector bool char)('a');
  // MIXED: <i8 97, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0, i8 0>
  // XL: <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
  char c = 'c';
  vbi8_2 = (vector bool char)(c);
  // MIXED: [[INS:%.*]] = insertelement <16 x i8>
  // MIXED: store <16 x i8> [[INS:%.*]]
  // XL: [[INS_ELT:%.*]] = insertelement <16 x i8>
  // XL: [[SHUFF:%.*]] = shufflevector <16 x i8> [[INS_ELT]], <16 x i8> poison, <16 x i32> zeroinitializer
  // XL: store <16 x i8> [[SHUFF]]

  // vector bool short initialization
  vbi16_1 = (vector bool short)(5);
  // MIXED: <i16 5, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
  // XL: <i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5, i16 5>
  short si16 = 55;
  vbi16_2 = (vector bool short)(si16);
  // MIXED: [[INS:%.*]] = insertelement <8 x i16>
  // MIXED: store <8 x i16> [[INS:%.*]]
  // XL: [[INS_ELT:%.*]] = insertelement <8 x i16>
  // XL: [[SHUFF:%.*]] = shufflevector <8 x i16> [[INS_ELT]], <8 x i16> poison, <8 x i32> zeroinitializer
  // XL: store <8 x i16> [[SHUFF]]

  // vector bool int initialization
  vbi32_1 = (vector bool int)(9);
  // MIXED: <i32 9, i32 0, i32 0, i32 0>
  // XL: <i32 9, i32 9, i32 9, i32 9>
  int si32 = 99;
  vbi32_2 = (vector bool int)(si32);
  // MIXED: [[INS:%.*]] = insertelement <4 x i32>
  // MIXED: store <4 x i32> [[INS:%.*]]
  // XL: [[INS_ELT:%.*]] = insertelement <4 x i32>
  // XL: [[SHUFF:%.*]] = shufflevector <4 x i32> [[INS_ELT]], <4 x i32> poison, <4 x i32> zeroinitializer
  // XL: store <4 x i32> [[SHUFF]]

  // vector bool long long initialization
  vbi64_1 = (vector bool long long)(13);
  // MIXED: <i64 13, i64 0>
  // XL: <i64 13, i64 13>
  long long si64 = 1313;
  vbi64_2 = (vector bool long long)(si64);
  // MIXED: [[INS:%.*]] = insertelement <2 x i64>
  // MIXED: store <2 x i64> [[INS:%.*]]
  // XL: [[INS_ELT:%.*]] = insertelement <2 x i64>
  // XL: [[SHUFF:%.*]] = shufflevector <2 x i64> [[INS_ELT]], <2 x i64> poison, <2 x i32> zeroinitializer
  // XL: store <2 x i64> [[SHUFF]]

  // vector pixel initialization
  p1 = (vector pixel)(1);
  // MIXED: <i16 1, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>
  // XL: <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>
}