URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [powerpc/] [altivec-12.c] - Rev 322
Compare with Previous | Blame | View Log
/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-maltivec" } */ /* Program to test PowerPC AltiVec instructions. */ #include <altivec.h> extern void abort (void); #define CHECK_IF(E) if(!(E)) abort() vector int a1 = (vector int){ 100, 200, 300, 400 }; vector int a2 = (vector int){ 500, 600, 700, 800 }; vector int addi = (vector int){ 600, 800, 1000, 1200 }; vector int avgi = (vector int){ 300, 400, 500, 600 }; vector float f1 = (vector float){ 1.0, 2.0, 3.0, 4.0 }; vector float f2 = (vector float){ 5.0, 6.0, 7.0, 8.0 }; vector float f3; vector float addf1 = (vector float){ 6.0, 8.0, 10.0, 12.0 }; vector float addf2 = (vector float){ 6.1, 8.1, 10.1, 12.1 }; vector float addf3 = (vector float){ 6.0, 8.0, 9.9, 12.1 }; vector int k; vector float f, g, h; int main () { k = vec_add (a1, a2); CHECK_IF (vec_all_eq (addi, k)); CHECK_IF (vec_all_ge (addi, k)); CHECK_IF (vec_all_le (addi, k)); CHECK_IF (vec_any_eq (addi, k)); CHECK_IF (vec_any_ge (addi, k)); CHECK_IF (vec_any_le (addi, k)); CHECK_IF (!vec_any_ne (addi, k)); CHECK_IF (!vec_any_lt (addi, k)); CHECK_IF (!vec_any_gt (addi, k)); CHECK_IF (!vec_any_ne (addi, k)); CHECK_IF (!vec_any_lt (addi, k)); CHECK_IF (!vec_any_gt (addi, k)); k = vec_avg (a1, a2); CHECK_IF (vec_all_eq (k, avgi)); h = vec_add (f1, f2); CHECK_IF (vec_all_eq (h, addf1)); CHECK_IF (vec_all_ge (h, addf1)); CHECK_IF (vec_all_le (h, addf1)); CHECK_IF (vec_any_eq (h, addf1)); CHECK_IF (vec_any_ge (h, addf1)); CHECK_IF (vec_any_le (h, addf1)); CHECK_IF (!vec_any_ne (h, addf1)); CHECK_IF (!vec_any_lt (h, addf1)); CHECK_IF (!vec_any_gt (h, addf1)); CHECK_IF (!vec_any_ne (h, addf1)); CHECK_IF (!vec_any_lt (h, addf1)); CHECK_IF (!vec_any_gt (h, addf1)); CHECK_IF (vec_all_gt (addf2, addf1)); CHECK_IF (vec_any_gt (addf2, addf1)); CHECK_IF (vec_all_ge (addf2, addf1)); CHECK_IF (vec_any_ge (addf2, addf1)); CHECK_IF (vec_all_ne (addf2, addf1)); CHECK_IF (vec_any_ne (addf2, addf1)); CHECK_IF (!vec_all_lt (addf2, addf1)); CHECK_IF (!vec_any_lt (addf2, addf1)); CHECK_IF (!vec_all_le (addf2, addf1)); CHECK_IF (!vec_any_le (addf2, addf1)); CHECK_IF (!vec_all_eq (addf2, addf1)); CHECK_IF (!vec_any_eq (addf2, addf1)); CHECK_IF (vec_any_eq (addf3, addf1)); CHECK_IF (vec_any_ne (addf3, addf1)); CHECK_IF (vec_any_lt (addf3, addf1)); CHECK_IF (vec_any_le (addf3, addf1)); CHECK_IF (vec_any_gt (addf3, addf1)); CHECK_IF (vec_any_ge (addf3, addf1)); CHECK_IF (!vec_all_eq (addf3, addf1)); CHECK_IF (!vec_all_ne (addf3, addf1)); CHECK_IF (!vec_all_lt (addf3, addf1)); CHECK_IF (!vec_all_le (addf3, addf1)); CHECK_IF (!vec_all_gt (addf3, addf1)); CHECK_IF (!vec_all_ge (addf3, addf1)); CHECK_IF (vec_all_numeric (addf3)); CHECK_IF (vec_all_in (addf1, addf2)); CHECK_IF (vec_step (vector bool char) == 16); CHECK_IF (vec_step (addf3) == 4); return 0; }