1  /* { dg-do compile { target powerpc*-*-* } } */
       2  /* { dg-require-effective-target powerpc_altivec_ok } */
       3  /* { dg-options "-O2 -maltivec -mno-vsx -mabi=altivec" } */
       4  /* { dg-final { scan-assembler-not "lvx" } } */
       5  #include <altivec.h>
       6  
       7  void foo (vector int);
       8  void foo_s (vector short);
       9  void foo_c (vector char);
      10  
      11  /* All constants should be loaded into vector register without
      12     load from memory.  */
      13  void
      14  bar (void) 
      15  {
      16    foo ((vector int) {0, 0, 0, 0});
      17    foo ((vector int) {1, 1, 1, 1});
      18    foo ((vector int) {15, 15, 15, 15});
      19    foo ((vector int) {-16, -16, -16, -16});
      20    foo ((vector int) {0x10001, 0x10001, 0x10001, 0x10001});
      21    foo ((vector int) {0xf000f, 0xf000f, 0xf000f, 0xf000f});
      22    foo ((vector int) {0xfff0fff0, 0xfff0fff0, 0xfff0fff0, 0xfff0fff0});
      23    foo ((vector int) {0x1010101, 0x1010101, 0x1010101, 0x1010101});  
      24    foo ((vector int) {0xf0f0f0f, 0xf0f0f0f, 0xf0f0f0f, 0xf0f0f0f});  
      25    foo ((vector int) {0xf0f0f0f0, 0xf0f0f0f0, 0xf0f0f0f0, 0xf0f0f0f0});
      26    foo ((vector int) {0x10101010, 0x10101010, 0x10101010, 0x10101010});
      27    foo ((vector int) {0x1e1e1e1e, 0x1e1e1e1e, 0x1e1e1e1e, 0x1e1e1e1e});
      28    foo ((vector int) {0x100010, 0x100010, 0x100010, 0x100010});
      29    foo ((vector int) {0x1e001e, 0x1e001e, 0x1e001e, 0x1e001e});
      30    foo ((vector int) {0x10, 0x10, 0x10, 0x10});
      31    foo ((vector int) {0x1e, 0x1e, 0x1e, 0x1e});
      32  
      33    foo_s ((vector short int) {0, 0, 0, 0, 0, 0, 0, 0});
      34    foo_s ((vector short int) {1, 1, 1, 1, 1, 1, 1, 1});
      35    foo_s ((vector short int) {15, 15, 15, 15, 15, 15, 15, 15});
      36    foo_s ((vector short int) {-16, -16, -16, -16, -16, -16, -16, -16});
      37    foo_s ((vector short int) {0xf0f0, 0xf0f0, 0xf0f0, 0xf0f0, 
      38  			       0xf0f0, 0xf0f0, 0xf0f0, 0xf0f0});
      39    foo_s ((vector short int) {0xf0f, 0xf0f, 0xf0f, 0xf0f, 
      40  			       0xf0f, 0xf0f, 0xf0f, 0xf0f});
      41    foo_s ((vector short int) {0x1010, 0x1010, 0x1010, 0x1010, 
      42  			       0x1010, 0x1010, 0x1010, 0x1010});
      43    foo_s ((vector short int) {0x1e1e, 0x1e1e, 0x1e1e, 0x1e1e, 
      44  			       0x1e1e, 0x1e1e, 0x1e1e, 0x1e1e});
      45  
      46    foo_c ((vector char) {0, 0, 0, 0, 0, 0, 0, 0,
      47  			  0, 0, 0, 0, 0, 0, 0, 0});
      48    foo_c ((vector char) {1, 1, 1, 1, 1, 1, 1, 1, 
      49  			  1, 1, 1, 1, 1, 1, 1, 1});
      50    foo_c ((vector char) {15, 15, 15, 15, 15, 15, 15, 15,
      51  			  15, 15, 15, 15, 15, 15, 15, 15});
      52    foo_c ((vector char) {-16, -16, -16, -16, -16, -16, -16, -16,
      53  			  -16, -16, -16, -16, -16, -16, -16, -16});
      54    foo_c ((vector char) {16, 16, 16, 16, 16, 16, 16, 16,
      55  			  16, 16, 16, 16, 16, 16, 16, 16});
      56    foo_c ((vector char) {30, 30, 30, 30, 30, 30, 30, 30,
      57  			  30, 30, 30, 30, 30, 30, 30, 30});
      58  
      59  }