1/* { dg-require-effective-target vect_int } */ 2 3#include "tree-vect.h" 4 5#define N 32 6 7extern void abort (void); 8typedef signed char T; 9 10void 11testmax (const T *c, T init, T result) 12{ 13 T lc[N], accum = init; 14 int i; 15 16 __builtin_memcpy (lc, c, sizeof(lc)); 17 18 for (i = 0; i < N; i++) { 19 accum = accum < lc[i] ? lc[i] : accum; 20 } 21 22 if (accum != result) 23 abort (); 24} 25 26void 27testmin (const T *c, T init, T result) 28{ 29 T lc[N], accum = init; 30 int i; 31 32 __builtin_memcpy (lc, c, sizeof(lc)); 33 34 for (i = 0; i < N; i++) { 35 accum = accum > lc[i] ? lc[i] : accum; 36 } 37 38 if (accum != result) 39 abort (); 40} 41 42int main (void) 43{ 44 static signed char const A[N] = { 45 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 46 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 47 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 48 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f 49 }; 50 51 static signed char const B[N] = { 52 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 53 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 54 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 55 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f 56 }; 57 58 static signed char const C[N] = { 59 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 60 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 61 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 62 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 63 }; 64 65 check_vect (); 66 67 testmin (A, 0, 0); 68 testmin (B, 0, 0x80); 69 testmin (C, 0, 0x80); 70 71 testmax (A, 0, 0x7f); 72 testmax (B, 0, 0x7f); 73 testmax (C, 0, 0x77); 74 75 return 0; 76} 77 78/* { dg-final { cleanup-tree-dump "vect" } } */ 79