Clang Project

clang_source_code/test/CodeGen/x86-builtins-vector-width.c
1// RUN: %clang_cc1 -triple i686-linux-gnu -target-cpu i686 -emit-llvm %s -o - | FileCheck %s
2
3typedef signed long long V2LLi __attribute__((vector_size(16)));
4typedef signed long long V4LLi __attribute__((vector_size(32)));
5
6// Make sure builtin forces a min-legal-width attribute
7void foo(void) {
8  V2LLi  tmp_V2LLi;
9
10  tmp_V2LLi = __builtin_ia32_undef128();
11}
12
13// Make sure explicit attribute larger than builtin wins.
14void goo(void) __attribute__((__min_vector_width__(256))) {
15  V2LLi  tmp_V2LLi;
16
17  tmp_V2LLi = __builtin_ia32_undef128();
18}
19
20// Make sure builtin larger than explicit attribute wins.
21void hoo(void) __attribute__((__min_vector_width__(128))) {
22  V4LLi  tmp_V4LLi;
23
24  tmp_V4LLi = __builtin_ia32_undef256();
25}
26
27// CHECK: foo{{.*}} #0
28// CHECK: goo{{.*}} #1
29// CHECK: hoo{{.*}} #1
30
31// CHECK: #0 = {{.*}}"min-legal-vector-width"="128"
32// CHECK: #1 = {{.*}}"min-legal-vector-width"="256"
33