This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: AltiVec support toasted in HEAD


Am Die, 2002-07-16 um 18.13 schrieb Aldy Hernandez:

> without a testcase it'll be really hard for me to help you.

Woohoo! While trying to synthesize a testcase for my other
problem I created one very similar to the zero vector problem.
All I did was cutting and pasting all altivec examples together
to get enough code to trigger bugs; a few conflicts have
been solved but that's all.... 

This is what I get on powerpc-linux-gnu with an uptodate gcc:
test.c: In function `foo':
test.c:214: error: unrecognizable insn:
(insn:HI 5 18 6 0 (nil) (set (reg/v:V4SI 118)
        (mem/f:V4SI (plus:SI (reg/f:SI 67 ap)
                (const_int 8 [0x8])) [3 b+0 S16 A128])) -1 (nil)
    (nil))
(set (reg/v:V4SI 118)
    (mem/f:V4SI (plus:SI (reg/f:SI 67 ap)
            (const_int 8 [0x8])) [3 b+0 S16 A128]))
(mem/f:V4SI (plus:SI (reg/f:SI 67 ap)
        (const_int 8 [0x8])) [3 b+0 S16 A128])
test.c:214: internal compiler error: Internal compiler error in
extract_insn, at recog.c:2146
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

-- 
Servus,
       Daniel
/* { dg-do run { target powerpc-*-*altivec powerpc-*-*-*altivec } } */
/* { dg-options "-maltivec" } */

/* Program to test PowerPC AltiVec instructions.  */

#include <altivec.h>

extern void abort (void);

vector int a1 = { 100, 200, 300, 400 };
vector int a2 = { 500, 600, 700, 800 };
vector int addi = { 600, 800, 1000, 1200 };
vector int avgi = { 300, 400, 500, 600 };

vector float f1 = { 1.0, 2.0, 3.0, 4.0 };  
vector float f2 = { 5.0, 6.0, 7.0, 8.0 };
vector float f3;
vector float addf = { 6.0, 8.0, 10.0, 12.0 };

vector int k;
vector float f, g, h;

int testf1 ()
{
  k = vec_add (a1, a2);
  if (!vec_all_eq (addi, k))
    abort ();

  k = vec_avg (a1, a2);
  if (!vec_all_eq (k, avgi))
    abort ();

  h = vec_add (f1, f2);
  if (!vec_all_eq (h, addf))
    abort ();

  return 0;
}
/* { dg-do compile { target powerpc-*-* } } */
/* { dg-options "-maltivec" } */

/* Program to test the vector_size attribute.  This needs to run on a
   target that has vectors, so use AltiVec.  */

#define vector __attribute__((vector_size(16)))

vector int foobar;

/* Only floats and integrals allowed.  We don't care if they map to SIs.  */
struct X { int frances; };

/* Arrays of vectors.  */
vector char b[10], ouch;

/* Pointers of vectors.  */
vector short *shoe, polish;

int xxx[sizeof(foobar) == 16 ? 69 : -1];

int nc17[sizeof(shoe) == sizeof (char *) ? 69 : -1];

code ()
{
  *shoe = polish;
  b[1] = ouch;
}

vector short
hoop ()
{
  return polish;
}

typedef int int4 __attribute__ ((mode(V4SI)));
typedef float float4 __attribute__ ((mode(V4SF)));

int4 newa1 = (int4) { 100, 200, 300, 400 };
int4 newa2 = (int4) { 500, 600, 700, 800 };

float4 newf1 = (float4) { 1.0, 2.0, 3.0, 4.0 };  
float4 newf2 = (float4) { 5.0, 6.0, 7.0, 8.0 };

int i3[4] __attribute__((aligned(16)));
int j3[4] __attribute__((aligned(16)));
float h3[4] __attribute__((aligned(16)));
float g3[4] __attribute__((aligned(16)));

#define vec_store(dst, src) \
  __builtin_altivec_st_internal_4si ((int *) dst, (int4) src)

#define vec_add_int4(x, y) \
  __builtin_altivec_vaddsws (x, y)

#define vec_add_float4(x, y) \
  __builtin_altivec_vaddfp (x, y)

#define my_abs(x) (x > 0.0F ? x : -x)

void
compare_int4 (int *a, int *b)
{
  int i;

  for (i = 0; i < 4; ++i)
    if (a[i] != b[i])
      abort ();
}

void
compare_float4 (float *a, float *b)
{
  int i;

  for (i = 0; i < 4; ++i)
    if (my_abs(a[i] - b[i]) >= 1.0e-6)
      abort ();
}

testnewf2 ()
{
  int loc1 = 600, loc2 = 800;
  int4 a3 = (int4) { loc1, loc2, 1000, 1200 };
  int4 itmp;
  double locf = 12.0;
  float4 f3 = (float4) { 6.0, 8.0, 10.0, 12.0 };
  float4 ftmp;

  vec_store (i3, a3);
  itmp = vec_add_int4 (newa1, newa2);
  vec_store (j3, itmp);
  compare_int4 (i3, j3);

  vec_store (g3, f3);
  ftmp = vec_add_float4 (newf1, newf2);
  vec_store (h3, ftmp);
  compare_float4 (g3, h3);

  exit (0);
}
/* { dg-do compile { target powerpc-*-* } } */
/* { dg-options "-maltivec -O0 -Wall" } */

#define vector __attribute__((vector_size(16)))

static int __attribute__((mode(V4SI))) x, y;

static vector signed int i,j;
static vector signed short s,t;
static vector signed char c,d;

static vector unsigned char uc;

static vector signed int *pi;

static int int1, int2;

void
testf4()
{
  __builtin_altivec_vadduwm (x, y);

  /* Make sure the predicates accept correct argument types.  */
  
  int1 = __builtin_altivec_vcmpbfp_p (0, f, g);
  int1 = __builtin_altivec_vcmpeqfp_p (0, f, g);
  int1 = __builtin_altivec_vcmpequb_p (0, c, d);
  int1 = __builtin_altivec_vcmpequh_p (0, s, t);
  int1 = __builtin_altivec_vcmpequw_p (0, i, j);
  int1 = __builtin_altivec_vcmpgefp_p (0, f, g);
  int1 = __builtin_altivec_vcmpgtfp_p (0, f, g);
  int1 = __builtin_altivec_vcmpgtsb_p (0, c, d);
  int1 = __builtin_altivec_vcmpgtsh_p (0, s, t);
  int1 = __builtin_altivec_vcmpgtsw_p (0, i, j);
  int1 = __builtin_altivec_vcmpgtub_p (0, c, d);
  int1 = __builtin_altivec_vcmpgtuh_p (0, s, t);
  int1 = __builtin_altivec_vcmpgtuw_p (0, i, j);

  __builtin_altivec_mtvscr (i);
  __builtin_altivec_dssall ();
  s = __builtin_altivec_mfvscr ();
  __builtin_altivec_dss (3);

  __builtin_altivec_dst (pi, int1 + int2, 3);
  __builtin_altivec_dstst (pi, int1 + int2, 3);
  __builtin_altivec_dststt (pi, int1 + int2, 3);
  __builtin_altivec_dstt (pi, int1 + int2, 3);

  uc = (vector unsigned char) __builtin_altivec_lvsl (int1 + 69, pi);
  uc = (vector unsigned char) __builtin_altivec_lvsr (int1 + 69, pi);

  c = __builtin_altivec_lvebx (int1, pi);
  s = __builtin_altivec_lvehx (int1, pi);
  i = __builtin_altivec_lvewx (int1, pi);
  i = __builtin_altivec_lvxl (int1, pi);
  i = __builtin_altivec_lvx (int1, pi);

  __builtin_altivec_stvx (i, int2, pi);
  __builtin_altivec_stvebx (c, int2, pi);
  __builtin_altivec_stvehx (s, int2, pi);
  __builtin_altivec_stvewx (i, int2, pi);
  __builtin_altivec_stvxl (i, int2, pi);
}
/* { dg-do compile { target powerpc-*-* } } */
/* { dg-options "-maltivec -O2" } */

#define vector __attribute__((vector_size(16)))

void foo (const unsigned long x,
	  vector signed int a, vector signed int b)
{
  unsigned char d[64];

  __builtin_altivec_stvewx (b, 0, d);
}
/* Origin: Aldy Hernandez  <aldyh@redhat.com>  */

/* { dg-do compile { target powerpc-*-* } } */
/* { dg-options "-maltivec" } */


long **longp;
int *var_int;
unsigned long **ulongp;
vector pixel *varpixel;
vector signed char *vecchar;
vector signed long *vecint;
vector signed short *vecshort;
vector unsigned char *vecuchar;
vector unsigned long *vecuint;
vector unsigned short *vecushort;
vector float *vecfloat;

int testf3 ()
{
  *vecfloat++ = vec_andc(vecint[0], vecfloat[1]);
  *vecfloat++ = vec_andc(vecfloat[0], vecint[1]);
  *vecfloat++ = vec_vxor(vecint[0], vecfloat[1]);
  *vecfloat++ = vec_vxor(vecfloat[0], vecint[1]);
  *varpixel++ = vec_packpx(vecuint[0], vecuint[1]);
  *varpixel++ = vec_vpkpx(vecuint[0], vecuint[1]);
  *vecshort++ = vec_vmulosb(vecchar[0], vecchar[1]);
  *vecint++ = vec_ld(var_int[0], longp[1]);
  *vecint++ = vec_lde(var_int[0], longp[1]);
  *vecint++ = vec_ldl(var_int[0], longp[1]);
  *vecint++ = vec_lvewx(var_int[0], longp[1]);
  *vecint++ = vec_unpackh(vecshort[0]);
  *vecint++ = vec_unpackl(vecshort[0]);
  *vecushort++ = vec_andc(vecshort[0], vecushort[1]);
  *vecushort++ = vec_andc(vecushort[0], vecshort[1]);
  *vecushort++ = vec_vxor(vecshort[0], vecushort[1]);
  *vecushort++ = vec_vxor(vecushort[0], vecshort[1]);
  *vecuint++ = vec_ld(var_int[0], ulongp[1]);
  *vecuint++ = vec_lvx(var_int[0], ulongp[1]);
  *vecuint++ = vec_vmsumubm(vecuchar[0], vecuchar[1], vecuint[2]);
  *vecuchar++ = vec_xor(vecuchar[0], vecchar[1]);

  return 0;
}
/* Origin: Aldy Hernandez  <aldyh@redhat.com>  */
/* Test rs6000_legitimate_address.  PRE_INC should be invalid.  */

/* { dg-do compile { target powerpc-*-* } } */
/* { dg-options "-maltivec" } */


vector signed short *hannah;

int
testf5 ()
{
  *hannah++ = __builtin_altivec_vspltish (5);
  *hannah++ = __builtin_altivec_vspltish (6);

  return 0;
}

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]