1 /* PR target/79941 */
2
3 /* { dg-do run } */
4 /* { dg-require-effective-target powerpc_altivec_ok } */
5 /* { dg-options "-maltivec -O2 -save-temps" } */
6
7 #include <altivec.h>
8
9 __attribute__((noinline)) void
test_eub_char()10 test_eub_char ()
11 {
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 ();
17 }
18
19 __attribute__((noinline)) void
test_oub_char()20 test_oub_char ()
21 {
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 ();
27 }
28
29 __attribute__((noinline)) void
test_euh_short()30 test_euh_short ()
31 {
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 ();
37 }
38
39 __attribute__((noinline)) void
test_ouh_short()40 test_ouh_short ()
41 {
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 ();
47 }
48
main()49 int main ()
50 {
51 test_eub_char();
52 test_oub_char();
53 test_euh_short();
54 test_ouh_short();
55 }
56
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 } } */
61
62