aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/vec-shift.c
blob: 80b59a2d3e7b22fdb83aed7076331863f4a02226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile { target { powerpc*-*-* } } } */
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
/* { dg-options "-mcpu=power7 -O2" } */

/* This used to ICE.  During gimplification, "i" is widened to an unsigned
   int.  We used to fail at expand time as we tried to cram an SImode item
   into a QImode memory slot.  This has been fixed to properly truncate the
   shift amount when splatting it into a vector.  */

typedef unsigned char v16ui __attribute__((vector_size(16)));

v16ui vslb(v16ui v, unsigned char i)
{
	return v << i;
}

/* { dg-final { scan-assembler "vspltb" } } */
/* { dg-final { scan-assembler "vslb" } } */