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]

testing altivec


for those who wanted to play around with altivec... i'm coding the
testsuite examples, but in the meantime...

    motobooke:/tmp/aldyh-test/gcc$ ./xgcc  a.c -maltivec  -mabi=altivec -B./ 
    motobooke:/tmp/aldyh-test/gcc$ ./a.out
    20000 20000 20002 20000
    
here is the program (a.c) and further below is another patch which is
currently being tested on aix.

typedef int __v4si __attribute__ ((mode(V4SI)));
    
int   a1[4] __attribute__((aligned(16))) = { 10000, 10000, 10002, 10000 };
int   a2[4] __attribute__((aligned(16))) = { 10000, 10000, 10000, 10000 };
    
__v4si i,j,k;
    
    
main ()
{ 
  i = __builtin_altivec_ld_internal (a1);
  j = __builtin_altivec_ld_internal (a2);
  k = __builtin_altivec_vadduws (i, j);
  __builtin_altivec_st_internal (a1, k);
  printf("%d %d %d %d\n", a1[0], a1[1], a1[2], a1[3]);
}

and below is the patch you need.

enjoy.
aldy

2001-11-08  Aldy Hernandez  <aldyh@redhat.com>

	* rs6000.h (REG_CLASS_CONTENTS): Add VRSAVE bit to ALL_REGS.
	(CONDITIONAL_REGISTER_USAGE): VRSAVE is always fixed and
	call_used.
	(CONDITIONAL_REGISTER_USAGE): Disable AltiVec registers unless
	generating altivec code.

	* rs6000.c (rs6000_reg_names): Prepend % to altivec registers.



Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.134
diff -c -p -r1.134 rs6000.h
*** rs6000.h	2001/11/08 22:46:23	1.134
--- rs6000.h	2001/11/09 00:51:29
*************** extern int rs6000_debug_arg;		/* debug a
*** 923,934 ****
      global_regs[PIC_OFFSET_TABLE_REGNUM]				\
        = fixed_regs[PIC_OFFSET_TABLE_REGNUM]				\
          = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;			\
    if (TARGET_ALTIVEC_ABI)						\
!     {									\
!       fixed_regs[VRSAVE_REGNO] = call_used_regs[VRSAVE_REGNO] = 1;	\
!       for (i = FIRST_ALTIVEC_REGNO; i < FIRST_ALTIVEC_REGNO + 20; ++i)	\
!         call_used_regs[i] = 1;						\
!     }									\
  }
  
  /* Specify the registers used for certain standard purposes.
--- 923,935 ----
      global_regs[PIC_OFFSET_TABLE_REGNUM]				\
        = fixed_regs[PIC_OFFSET_TABLE_REGNUM]				\
          = call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;			\
+   fixed_regs[VRSAVE_REGNO] = call_used_regs[VRSAVE_REGNO] = 1;		\
+   if (! TARGET_ALTIVEC)							\
+     for (i = FIRST_ALTIVEC_REGNO; i <= LAST_ALTIVEC_REGNO; ++i)		\
+       fixed_regs[i] = call_used_regs[i] = 1;				\
    if (TARGET_ALTIVEC_ABI)						\
!     for (i = FIRST_ALTIVEC_REGNO; i < FIRST_ALTIVEC_REGNO + 20; ++i)	\
!       call_used_regs[i] = 1;						\
  }
  
  /* Specify the registers used for certain standard purposes.
*************** enum reg_class
*** 1068,1074 ****
    { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */	     \
    { 0xffffffff, 0x00000000, 0x0000ffff, 0x00000000 }, /* NON_FLOAT_REGS */   \
    { 0x00000000, 0x00000000, 0x00010000, 0x00000000 }, /* XER_REGS */	     \
!   { 0xffffffff, 0xffffffff, 0xffffffff, 0x0001ffff }  /* ALL_REGS */	     \
  }
  
  /* The same information, inverted:
--- 1069,1075 ----
    { 0x00000000, 0x00000000, 0x00000ff0, 0x00000000 }, /* CR_REGS */	     \
    { 0xffffffff, 0x00000000, 0x0000ffff, 0x00000000 }, /* NON_FLOAT_REGS */   \
    { 0x00000000, 0x00000000, 0x00010000, 0x00000000 }, /* XER_REGS */	     \
!   { 0xffffffff, 0xffffffff, 0xffffffff, 0x0003ffff }  /* ALL_REGS */	     \
  }
  
  /* The same information, inverted:
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/uberbaum/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.230
diff -c -p -r1.230 rs6000.c
*** rs6000.c	2001/11/07 20:49:41	1.230
--- rs6000.c	2001/11/09 00:51:31
*************** char rs6000_reg_names[][8] =
*** 172,181 ****
        "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
        "xer",
        /* AltiVec registers.  */
!       "v0",  "v1",  "v2",  "v3",  "v4",  "v5",  "v6", "v7",
!       "v8",  "v9",  "v10", "v11", "v12", "v13", "v14", "v15",
!       "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
!       "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
        "vrsave"
  };
  
--- 172,181 ----
        "0",  "1",  "2",  "3",  "4",  "5",  "6",  "7",
        "xer",
        /* AltiVec registers.  */
!       "%v0",  "%v1",  "%v2",  "%v3",  "%v4",  "%v5",  "%v6", "%v7",
!       "%v8",  "%v9",  "%v10", "%v11", "%v12", "%v13", "%v14", "%v15",
!       "%v16", "%v17", "%v18", "%v19", "%v20", "%v21", "%v22", "%v23",
!       "%v24", "%v25", "%v26", "%v27", "%v28", "%v29", "%v30", "%v31",
        "vrsave"
  };
  


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