Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / fold-vec-mule-misc.c
blob9b89118a0fa7840facea19b0688d6c97306ee374
1 /* PR target/79941 */
3 /* { dg-do run } */
4 /* { dg-require-effective-target powerpc_altivec_ok } */
5 /* { dg-options "-maltivec -O2 -save-temps" } */
7 #include <altivec.h>
9 __attribute__((noinline)) void
10 test_eub_char ()
12 volatile vector unsigned char v0 = {1, 0, 0, 0, 0, 0, 0, 0};
13 volatile vector unsigned char v1 = {0xff, 0, 0, 0, 0, 0, 0, 0};
14 vector unsigned short res = vec_vmuleub (v0, v1);
15 if (res[0] != (unsigned short)v0[0] * (unsigned short)v1[0])
16 __builtin_abort ();
19 __attribute__((noinline)) void
20 test_oub_char ()
22 volatile vector unsigned char v0 = {0, 1, 0, 0, 0, 0, 0, 0};
23 volatile vector unsigned char v1 = {0, 0xff, 0, 0, 0, 0, 0, 0};
24 vector unsigned short res = vec_vmuloub (v0, v1);
25 if (res[0] != (unsigned short)v0[1] * (unsigned short)v1[1])
26 __builtin_abort ();
29 __attribute__((noinline)) void
30 test_euh_short ()
32 volatile vector unsigned short v0 = {1, 0, 0, 0};
33 volatile vector unsigned short v1 = {0xff, 0, 0, 0};
34 vector unsigned int res = vec_vmuleuh (v0, v1);
35 if (res[0] != (unsigned int)v0[0] * (unsigned int)v1[0])
36 __builtin_abort ();
39 __attribute__((noinline)) void
40 test_ouh_short ()
42 volatile vector unsigned short v0 = {0, 1, 0, 0};
43 volatile vector unsigned short v1 = {0, 0xff, 0, 0};
44 vector unsigned int res = vec_vmulouh (v0, v1);
45 if (res[0] != (unsigned int)v0[1] * (unsigned int)v1[1])
46 __builtin_abort ();
49 int main ()
51 test_eub_char();
52 test_oub_char();
53 test_euh_short();
54 test_ouh_short();
57 /* { dg-final { scan-assembler-times "vmuleub" 1 } } */
58 /* { dg-final { scan-assembler-times "vmuloub" 1 } } */
59 /* { dg-final { scan-assembler-times "vmuleuh" 1 } } */
60 /* { dg-final { scan-assembler-times "vmulouh" 1 } } */