File: builtins-bcd-transform.c

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (30 lines) | stat: -rw-r--r-- 1,733 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
// Testfile to verify the semantics and the error handling for BCD builtins national2packed, packed2zoned and zoned2packed.
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown -fsyntax-only -verify %s
// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-unknown -fsyntax-only -verify %s
// RUN: %clang_cc1 -target-feature +altivec -triple powerpc-unknown-unknown -fsyntax-only -verify %s

#include <altivec.h>
vector unsigned char test_national2packed(void)
{
  vector unsigned char a = {1,2,3,4};
  vector unsigned char res_a = __builtin_ppc_national2packed(a, 2);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned char res_b = __builtin_ppc_national2packed(a, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  return __builtin_ppc_national2packed(a, 0);
}

vector unsigned char test_packed2zoned(void)
{
  vector unsigned char a = {1,2,3,4};
  vector unsigned char res_a = __builtin_ppc_packed2zoned(a,2);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned char res_b = __builtin_ppc_packed2zoned(a, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  return __builtin_ppc_packed2zoned(a,1);
}

vector unsigned char test_zoned2packed(void)
{
  vector unsigned char a = {1,2,3,4};
  vector unsigned char res_a = __builtin_ppc_zoned2packed(a,2);  // expected-error-re {{argument value {{.*}} is outside the valid range}}
  vector unsigned char res_b = __builtin_ppc_zoned2packed(a, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
  return __builtin_ppc_zoned2packed(a,0);
}