This is the mail archive of the gcc-patches@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]

[PATCH, spu] change qword from V16QImode to TImode


This patch changes spu specific builtins' parameter type qword from 
V16QImode to TImode.

The background of this change, is that we want to enable vector intrinsics 
in Gfortran, and would call spu backend builtins through Fortran 
ISO-C-Binding functions. But currently Fortran doesn't support vector data 
type, therefore the vector parameters and return values could not be 
matched with any Fortran type. Thus, we would change the spu qword type to 
TImode, which could be mapped to Fortran integer(16), so that the BIND(C) 
calls in Fortran program could work.

Regtested on spu-linux. OK for mainline?

Thanks!
Sa

 Index: gcc/gcc/config/spu/spu-builtins.h
===================================================================
--- gcc.orig/gcc/config/spu/spu-builtins.h
+++ gcc/gcc/config/spu/spu-builtins.h
@@ -32,7 +32,7 @@ enum spu_builtin_type_index
   SPU_BTI_UV4SI,
   SPU_BTI_UV2DI,

-  /* A 16-byte type. (Implemented with V16QI_type_node) */
+  /* A 16-byte type. (Implemented with intTI_type_node) */
   SPU_BTI_QUADWORD,

   /* These all correspond to intSI_type_node */
Index: gcc/gcc/config/spu/spu.c
===================================================================
--- gcc.orig/gcc/config/spu/spu.c
+++ gcc/gcc/config/spu/spu.c
@@ -4480,7 +4480,7 @@ spu_init_builtins (void)
   unsigned_V4SI_type_node = build_vector_type (unsigned_intSI_type_node, 
4);
   unsigned_V2DI_type_node = build_vector_type (unsigned_intDI_type_node, 
2);

-  spu_builtin_types[SPU_BTI_QUADWORD] = V16QI_type_node;
+  spu_builtin_types[SPU_BTI_QUADWORD] = intTI_type_node;

   spu_builtin_types[SPU_BTI_7] = global_trees[TI_INTSI_TYPE];
   spu_builtin_types[SPU_BTI_S7] = global_trees[TI_INTSI_TYPE];
@@ -5375,7 +5375,8 @@ spu_expand_builtin_1 (struct spu_builtin
       if (VECTOR_MODE_P (mode)
          && (GET_CODE (ops[i]) == CONST_INT
              || GET_MODE_CLASS (GET_MODE (ops[i])) == MODE_INT
-             || GET_MODE_CLASS (GET_MODE (ops[i])) == MODE_FLOAT))
+             || GET_MODE_CLASS (GET_MODE (ops[i])) == MODE_FLOAT)
+         && d->parm[i] != SPU_BTI_QUADWORD)
        {
          if (GET_CODE (ops[i]) == CONST_INT)
            ops[i] = spu_const (mode, INTVAL (ops[i]));
Index: gcc/gcc/config/spu/spu_internals.h
===================================================================
--- gcc.orig/gcc/config/spu/spu_internals.h
+++ gcc/gcc/config/spu/spu_internals.h
@@ -51,7 +51,7 @@
  *  Parameters named 'scalar' accept a scalar argument.
  */

-#define qword __vector signed char
+typedef unsigned int qword __attribute__ ((mode(TI)));

 #define si_lqd(ra,imm)       __builtin_si_lqd(ra,imm)
 #define si_lqx(ra,rb)        __builtin_si_lqx(ra,rb)



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