AIX pthread and reg_or_arith_cint_operand predicate

David Edelsohn dje@watson.ibm.com
Mon Jun 12 13:15:00 GMT 2000


	The following patch changes the commandline switch for pthread
support on AIX from -mthreads to -pthread.  The patch also adds a new
reg_or_arith_cint_operand predicate.

David


        * aix41.h (SUBTARGET_SWITCHES): Delete threads.
        (CPP_SPEC): Change mthreads to pthread.
        (LIB_SPEC): Likewise.
        (STARTFILE_SPEC): Likewise.
        * aix43.h (SUBTARGET_SWITCHES): Delete threads.
        (CPP_SPEC): Change mthreads to pthread.
        (LIB_SPEC): Likewise.
        (STARTFILE_SPEC): Likewise.
        * rs6000-protos.h (reg_or_arith_cint_operand): New.
        * rs6000.c (reg_or_arith_cint_operand): New.
        (num_insns_constant_wide): Decorate unsigned constant.
        * rs6000.h (PREDICATE_CODES): Add reg_or_arith_cint_operand.
        * rs6000.md (addsi3): Use new predicate.
        (subsi3, adddi3, subdi3): Likewise.

Index: aix41.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/aix41.h,v
retrieving revision 1.10
diff -c -p -r1.10 aix41.h
*** aix41.h	2000/03/29 04:06:13	1.10
--- aix41.h	2000/06/12 19:55:05
*************** Boston, MA 02111-1307, USA.  */
*** 27,35 ****
  
  #undef  SUBSUBTARGET_SWITCHES
  #define SUBSUBTARGET_SWITCHES		\
!   {"threads",		0,						\
!    "Use the thread library and reentrant C library" },			\
!   {"pe",		0,						\
     "Support message passing with the Parallel Environment" },
  
  #undef ASM_SPEC
--- 27,33 ----
  
  #undef  SUBSUBTARGET_SWITCHES
  #define SUBSUBTARGET_SWITCHES		\
!   {"pe",		0,					\
     "Support message passing with the Parallel Environment" },
  
  #undef ASM_SPEC
*************** Boston, MA 02111-1307, USA.  */
*** 46,52 ****
  #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
     %{ansi: -D_ANSI_C_SOURCE}\
     %{mpe: -I/usr/lpp/ppe.poe/include}\
!    %{mthreads: -D_THREAD_SAFE}\
     %(cpp_cpu)"
  
  #undef	CPP_DEFAULT_SPEC
--- 44,50 ----
  #define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\
     %{ansi: -D_ANSI_C_SOURCE}\
     %{mpe: -I/usr/lpp/ppe.poe/include}\
!    %{pthread: -D_THREAD_SAFE}\
     %(cpp_cpu)"
  
  #undef	CPP_DEFAULT_SPEC
*************** Boston, MA 02111-1307, USA.  */
*** 74,81 ****
  #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
     %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}}\
     %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
!    %{mthreads: -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\
!    %{!mthreads: -lc}"
  
  #undef LINK_SPEC
  #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
--- 72,79 ----
  #define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\
     %{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}}\
     %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
!    %{pthread: -L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\
!    %{!pthread: -lc}"
  
  #undef LINK_SPEC
  #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
*************** Boston, MA 02111-1307, USA.  */
*** 88,95 ****
           %{!pg:%{p:/usr/lpp/ppe.poe/lib/mcrt0.o}\
                 %{!p:/usr/lpp/ppe.poe/lib/crt0.o}}}\
     %{!mpe:\
!      %{mthreads:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
!      %{!mthreads:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}"
  
  /* AIX 4 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC
     and "cror 31,31,31" for POWER architecture.  */
--- 86,93 ----
           %{!pg:%{p:/usr/lpp/ppe.poe/lib/mcrt0.o}\
                 %{!p:/usr/lpp/ppe.poe/lib/crt0.o}}}\
     %{!mpe:\
!      %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
!      %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}"
  
  /* AIX 4 uses PowerPC nop (ori 0,0,0) instruction as call glue for PowerPC
     and "cror 31,31,31" for POWER architecture.  */
Index: aix43.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/aix43.h,v
retrieving revision 1.12
diff -c -p -r1.12 aix43.h
*** aix43.h	2000/05/06 04:31:16	1.12
--- aix43.h	2000/06/12 19:55:05
*************** Boston, MA 02111-1307, USA.  */
*** 31,38 ****
     "Compile for 64-bit pointers" },					\
    {"aix32",		- (MASK_64BIT | MASK_POWERPC64),		\
     "Compile for 32-bit pointers" },					\
-   {"threads",		0,						\
-    "Use the thread library and reentrant C library" },			\
    {"pe",		0,						\
     "Support message passing with the Parallel Environment" },
  
--- 31,36 ----
*************** do {									\
*** 112,118 ****
     %{ansi: -D_ANSI_C_SOURCE}\
     %{maix64: -D__64BIT__ -D_ARCH_PPC}\
     %{mpe: -I/usr/lpp/ppe.poe/include}\
!    %{mthreads: -D_THREAD_SAFE}\
     %(cpp_cpu)"
  
  /* Common CPP definitions used by CPP_SPEC among the various targets
--- 110,116 ----
     %{ansi: -D_ANSI_C_SOURCE}\
     %{maix64: -D__64BIT__ -D_ARCH_PPC}\
     %{mpe: -I/usr/lpp/ppe.poe/include}\
!    %{pthread: -D_THREAD_SAFE}\
     %(cpp_cpu)"
  
  /* Common CPP definitions used by CPP_SPEC among the various targets
*************** do {									\
*** 172,179 ****
     %{p:-L/lib/profiled -L/usr/lib/profiled}\
     %{!maix64:%{!shared:%{g*:-lg}}}\
     %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
!    %{mthreads:-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\
!    %{!mthreads:-lc}"
  
  #undef LINK_SPEC
  #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
--- 170,177 ----
     %{p:-L/lib/profiled -L/usr/lib/profiled}\
     %{!maix64:%{!shared:%{g*:-lg}}}\
     %{mpe:-L/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
!    %{pthread:-L/usr/lib/threads -lpthreads -lc_r /usr/lib/libc.a}\
!    %{!pthread:-lc}"
  
  #undef LINK_SPEC
  #define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro} -bnodelcsect\
*************** do {									\
*** 188,195 ****
     %{!mpe:\
       %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\
       %{!maix64:\
!        %{mthreads:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
!        %{!mthreads:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}}"
  
  /* AIX 4.3 typedefs ptrdiff_t as "long" while earlier releases used "int".  */
  
--- 186,193 ----
     %{!mpe:\
       %{maix64:%{pg:gcrt0_64%O%s}%{!pg:%{p:mcrt0_64%O%s}%{!p:crt0_64%O%s}}}\
       %{!maix64:\
!        %{pthread:%{pg:gcrt0_r%O%s}%{!pg:%{p:mcrt0_r%O%s}%{!p:crt0_r%O%s}}}\
!        %{!pthread:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}}}}"
  
  /* AIX 4.3 typedefs ptrdiff_t as "long" while earlier releases used "int".  */
  
Index: rs6000-protos.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000-protos.h,v
retrieving revision 1.5
diff -c -p -r1.5 rs6000-protos.h
*** rs6000-protos.h	2000/05/27 02:24:32	1.5
--- rs6000-protos.h	2000/06/12 19:55:05
*************** extern int reg_or_short_operand PARAMS (
*** 41,46 ****
--- 41,47 ----
  extern int reg_or_neg_short_operand PARAMS ((rtx, enum machine_mode));
  extern int reg_or_u_short_operand PARAMS ((rtx, enum machine_mode));
  extern int reg_or_cint_operand PARAMS ((rtx, enum machine_mode));
+ extern int reg_or_arith_cint_operand PARAMS ((rtx, enum machine_mode));
  extern int reg_or_logical_cint_operand PARAMS ((rtx, enum machine_mode));
  extern int got_operand PARAMS ((rtx, enum machine_mode));
  extern int got_no_const_operand PARAMS ((rtx, enum machine_mode));
Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.127
diff -c -p -r1.127 rs6000.c
*** rs6000.c	2000/05/29 05:18:03	1.127
--- rs6000.c	2000/06/12 19:55:06
*************** reg_or_cint_operand (op, mode)
*** 650,660 ****
      register rtx op;
      enum machine_mode mode;
  {
!      return (GET_CODE (op) == CONST_INT
! 	     || gpc_reg_operand (op, mode));
  }
  
  /* Return 1 is the operand is either a non-special register or ANY
     32-bit unsigned constant integer.  */
  
  int
--- 650,676 ----
      register rtx op;
      enum machine_mode mode;
  {
!      return (GET_CODE (op) == CONST_INT || gpc_reg_operand (op, mode));
  }
  
  /* Return 1 is the operand is either a non-special register or ANY
+    32-bit signed constant integer.  */
+ 
+ int
+ reg_or_arith_cint_operand (op, mode)
+     register rtx op;
+     enum machine_mode mode;
+ {
+      return (gpc_reg_operand (op, mode)
+ 	     || (GET_CODE (op) == CONST_INT
+ #if HOST_BITS_PER_WIDE_INT != 32
+ 		 && ((unsigned HOST_WIDE_INT) (INTVAL (op) + 0x80000000)
+ 		     < 0x100000000u)
+ #endif
+ 		 ));
+ }
+ 
+ /* Return 1 is the operand is either a non-special register or ANY
     32-bit unsigned constant integer.  */
  
  int
*************** num_insns_constant_wide (value)
*** 729,735 ****
  #if HOST_BITS_PER_WIDE_INT == 64
    else if (TARGET_POWERPC64)
      {
!       HOST_WIDE_INT low  = value & 0xffffffff;
        HOST_WIDE_INT high = value >> 32;
  
        if (high == 0 && (low & 0x80000000u) == 0)
--- 745,751 ----
  #if HOST_BITS_PER_WIDE_INT == 64
    else if (TARGET_POWERPC64)
      {
!       unsigned HOST_WIDE_INT low  = value & 0xffffffffu;
        HOST_WIDE_INT high = value >> 32;
  
        if (high == 0 && (low & 0x80000000u) == 0)
Index: rs6000.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.82
diff -c -p -r1.82 rs6000.h
*** rs6000.h	2000/05/27 02:24:32	1.82
--- rs6000.h	2000/06/12 19:55:07
*************** do {									\
*** 2713,2718 ****
--- 2713,2719 ----
    {"reg_or_neg_short_operand", {SUBREG, REG, CONST_INT}},	\
    {"reg_or_u_short_operand", {SUBREG, REG, CONST_INT}}, 	\
    {"reg_or_cint_operand", {SUBREG, REG, CONST_INT}}, 		\
+   {"reg_or_arith_cint_operand", {SUBREG, REG, CONST_INT}}, 	\
    {"reg_or_logical_cint_operand", {SUBREG, REG, CONST_INT, CONST_DOUBLE}}, \
    {"got_operand", {SYMBOL_REF, CONST, LABEL_REF}},		\
    {"got_no_const_operand", {SYMBOL_REF, LABEL_REF}},		\
Index: rs6000.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.91
diff -c -p -r1.91 rs6000.md
*** rs6000.md	2000/05/28 02:59:35	1.91
--- rs6000.md	2000/06/12 19:55:08
***************
*** 1386,1392 ****
  (define_expand "addsi3"
    [(set (match_operand:SI 0 "gpc_reg_operand" "")
  	(plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
! 		 (match_operand:SI 2 "reg_or_cint_operand" "")))]
    ""
    "
  {
--- 1386,1392 ----
  (define_expand "addsi3"
    [(set (match_operand:SI 0 "gpc_reg_operand" "")
  	(plus:SI (match_operand:SI 1 "gpc_reg_operand" "")
! 		 (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
    ""
    "
  {
***************
*** 1673,1679 ****
  (define_expand "subsi3"
    [(set (match_operand:SI 0 "gpc_reg_operand" "")
  	(minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
! 		  (match_operand:SI 2 "reg_or_cint_operand" "")))]
    ""
    "
  {
--- 1673,1679 ----
  (define_expand "subsi3"
    [(set (match_operand:SI 0 "gpc_reg_operand" "")
  	(minus:SI (match_operand:SI 1 "reg_or_short_operand" "")
! 		  (match_operand:SI 2 "reg_or_arith_cint_operand" "")))]
    ""
    "
  {
***************
*** 5765,5771 ****
  (define_expand "adddi3"
    [(set (match_operand:DI 0 "gpc_reg_operand" "")
  	(plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
! 		 (match_operand:DI 2 "reg_or_cint_operand" "")))]
    ""
    "
  {
--- 5765,5771 ----
  (define_expand "adddi3"
    [(set (match_operand:DI 0 "gpc_reg_operand" "")
  	(plus:DI (match_operand:DI 1 "gpc_reg_operand" "")
! 		 (match_operand:DI 2 "reg_or_arith_cint_operand" "")))]
    ""
    "
  {
***************
*** 6016,6022 ****
  (define_expand "subdi3"
    [(set (match_operand:DI 0 "gpc_reg_operand" "")
  	(minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
! 		  (match_operand:DI 2 "reg_or_cint_operand" "")))]
    ""
    "
  {
--- 6016,6022 ----
  (define_expand "subdi3"
    [(set (match_operand:DI 0 "gpc_reg_operand" "")
  	(minus:DI (match_operand:DI 1 "reg_or_short_operand" "")
! 		  (match_operand:DI 2 "reg_or_arith_cint_operand" "")))]
    ""
    "
  {


More information about the Gcc-patches mailing list