Kelvin Nilsen | 83a67c0 | 2019-01-30 15:01:40 +0000 | [diff] [blame] | 1 | /* Test to verify that the vec_extract from a vector of |
| 2 | unsigned chars remains unsigned. */ |
| 3 | /* { dg-do run } */ |
Segher Boessenkool | 5234d2e | 2019-03-01 19:04:31 +0100 | [diff] [blame] | 4 | /* { dg-options "-ansi -mdejagnu-cpu=power8 " } */ |
Kelvin Nilsen | cff2ddc | 2019-02-05 15:34:34 +0000 | [diff] [blame] | 5 | /* { dg-require-effective-target p8vector_hw } */ |
Kelvin Nilsen | 83a67c0 | 2019-01-30 15:01:40 +0000 | [diff] [blame] | 6 | |
| 7 | #include <altivec.h> |
| 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> |
| 10 | |
| 11 | int test1(unsigned char uc) { |
| 12 | int uce; |
| 13 | |
| 14 | vector unsigned char v = vec_splats(uc); |
| 15 | uce = vec_extract(v,0); |
| 16 | |
| 17 | if (uce != uc) |
| 18 | abort(); |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | int main() |
| 23 | { |
| 24 | test1 (0xf6); |
| 25 | test1 (0x76); |
| 26 | test1 (0x06); |
| 27 | return 0; |
| 28 | } |