30 lines · c
1// Testfile to verify the semantics and the error handling for BCD builtins national2packed, packed2zoned and zoned2packed.2// REQUIRES: powerpc-registered-target3// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown -fsyntax-only -verify %s4// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-unknown -fsyntax-only -verify %s5// RUN: %clang_cc1 -target-feature +altivec -triple powerpc-unknown-unknown -fsyntax-only -verify %s6 7#include <altivec.h>8vector unsigned char test_national2packed(void)9{10 vector unsigned char a = {1,2,3,4};11 vector unsigned char res_a = __builtin_ppc_national2packed(a, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}12 vector unsigned char res_b = __builtin_ppc_national2packed(a, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}13 return __builtin_ppc_national2packed(a, 0);14}15 16vector unsigned char test_packed2zoned(void)17{18 vector unsigned char a = {1,2,3,4};19 vector unsigned char res_a = __builtin_ppc_packed2zoned(a,2); // expected-error-re {{argument value {{.*}} is outside the valid range}}20 vector unsigned char res_b = __builtin_ppc_packed2zoned(a, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}21 return __builtin_ppc_packed2zoned(a,1);22}23 24vector unsigned char test_zoned2packed(void)25{26 vector unsigned char a = {1,2,3,4};27 vector unsigned char res_a = __builtin_ppc_zoned2packed(a,2); // expected-error-re {{argument value {{.*}} is outside the valid range}}28 vector unsigned char res_b = __builtin_ppc_zoned2packed(a, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}29 return __builtin_ppc_zoned2packed(a,0);30}