public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* New and undocumented target hooks (cf. PR3386, a regression)
@ 2004-12-03 13:16 Steven Bosscher
  2004-12-03 23:16 ` Richard Henderson
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Steven Bosscher @ 2004-12-03 13:16 UTC (permalink / raw)
  To: dorit, fjahanian, bonzini, echristo, rth, kkojima, roger, zack; +Cc: gcc

Hi,

Here is a list of people who have added target hooks in target.h
but who have not added the necessary documentation to doc/tm.texi:

2004-09-23  Dorit Naishlos <dorit@il.ibm.com>
TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD
TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE
TARGET_VECTORIZE_MISALIGNED_MEM_OK                                                                                                   

2004-08-16  Fariborz Jahanian <fjahanian@apple.com>
TARGET_EH_RETURN_FILTER_MODE
                                                                                                   
2004-09-24  Paolo Bonzini  <bonzini@gnu.org>
TARGET_FOLD_BUILTIN
                                                                                                   
2002-10-11  Eric Christopher  <echristo@redhat.com>
TARGET_VALID_POINTER_MODE
                                                                                                   
2002-12-09  Richard Henderson  <rth@redhat.com>
TARGET_CANNOT_FORCE_CONST_MEM
                                                                                                   
2003-10-29  Richard Henderson  <rth@redhat.com>
TARGET_BUILD_BUILTIN_VA_LIST
                                                                                                   
2003-02-18  Kaz Kojima  <kkojima@gcc.gnu.org>
TARGET_CANNOT_COPY_INSN_P
                                                                                                   
2003-02-03  Roger Sayle  <roger@eyesopen.com>
TARGET_DELEGITIMIZE_ADDRESS
                                                                                                   
2004-06-20  Zack Weinberg  <zack@codesourcery.com>
TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME
TARGET_HANDLE_PRAGMA_EXTERN_PREFIX

Can y'all please add documentation for these target hooks?

Gr.
Steven


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Document target_fold_builtin
       [not found] ` <003101c4d93c$8902e530$9641af83@tequila>
@ 2004-12-03 15:12   ` Roger Sayle
  2004-12-03 23:17   ` Richard Henderson
  1 sibling, 0 replies; 11+ messages in thread
From: Roger Sayle @ 2004-12-03 15:12 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: gcc, gcc-patches


On Fri, 3 Dec 2004, Paolo Bonzini wrote:
> 2004-12-03  Paolo Bonzini  <bonzini@gnu.org>
>
>         * doc/tm.texi (Misc): Document TARGET_FOLD_BUILTIN.

This is OK for mainline, with the obvious correction that the
"ignore" argument is now of type "bool".  As a consequence,
might I suggest a tweak to the final sentence;

If @var{ignore} is true the return value is to be ignored.

Thanks,

Roger
--

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-03 13:16 New and undocumented target hooks (cf. PR3386, a regression) Steven Bosscher
@ 2004-12-03 23:16 ` Richard Henderson
       [not found] ` <003101c4d93c$8902e530$9641af83@tequila>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2004-12-03 23:16 UTC (permalink / raw)
  To: Steven Bosscher
  Cc: dorit, fjahanian, bonzini, echristo, kkojima, roger, zack, gcc

On Fri, Dec 03, 2004 at 02:16:16PM +0100, Steven Bosscher wrote:
> 2002-12-09  Richard Henderson  <rth@redhat.com>
> TARGET_CANNOT_FORCE_CONST_MEM
> 2003-10-29  Richard Henderson  <rth@redhat.com>
> TARGET_BUILD_BUILTIN_VA_LIST

Done.


r~



Index: tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.400
diff -c -p -d -r1.400 tm.texi
*** tm.texi	3 Dec 2004 15:37:14 -0000	1.400
--- tm.texi	3 Dec 2004 23:13:38 -0000
*************** The default value of this hook is @code{
*** 3925,3930 ****
--- 3925,3935 ----
  false.
  @end deftypefn
  
+ @deftypefn {Target Hook} tree TARGET_BUILD_BUILTIN_VA_LIST (void)
+ This hook returns a type node for @code{va_list} for the target.
+ The default version of the hook returns @code{void*}.
+ @end deftypefn
+ 
  @deftypefn {Target Hook} tree TARGET_GIMPLIFY_VA_ARG_EXPR (tree @var{valist}, tree @var{type}, tree *@var{pre_p}, tree *@var{post_p})
  This hook performs target-specific gimplification of
  @code{VA_ARG_EXPR}.  The first two parameters correspond to the
*************** an immediate operand on the target machi
*** 5151,5156 ****
--- 5156,5173 ----
  anything @code{CONSTANT_P} is valid.
  @end defmac
  
+ @deftypefn {Target Hook} bool TARGET_CANNOT_FORCE_CONST_MEM (rtx @var{x})
+ This hook should return true if @var{x} is of a form that cannot (or
+ should not) be spilled to the constant pool.  The default version of
+ this hook returns false.
+ 
+ The primary reason to define this hook is to prevent reload from
+ deciding that a non-legitimate constant would be better reloaded
+ from the constant pool instead of spilling and reloading a register
+ holding the constant.  This restriction is often true of addresses
+ of TLS symbols for various targets.
+ @end deftypefn
+ 
  @node Condition Code
  @section Condition Code Status
  @cindex condition code status

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] Document target_fold_builtin
       [not found] ` <003101c4d93c$8902e530$9641af83@tequila>
  2004-12-03 15:12   ` [PATCH] Document target_fold_builtin Roger Sayle
@ 2004-12-03 23:17   ` Richard Henderson
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2004-12-03 23:17 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Steven Bosscher, dorit, fjahanian, bonzini, echristo, kkojima,
	roger, zack, gcc

On Fri, Dec 03, 2004 at 02:32:15PM +0100, Paolo Bonzini wrote:
>         * doc/tm.texi (Misc): Document TARGET_FOLD_BUILTIN.

Ok.


r~

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-03 13:16 New and undocumented target hooks (cf. PR3386, a regression) Steven Bosscher
  2004-12-03 23:16 ` Richard Henderson
       [not found] ` <003101c4d93c$8902e530$9641af83@tequila>
@ 2004-12-04  0:08 ` Roger Sayle
  2004-12-04  0:21   ` Eric Botcazou
  2004-12-04  0:26   ` Richard Henderson
  2004-12-06 19:47 ` Dorit Naishlos
  3 siblings, 2 replies; 11+ messages in thread
From: Roger Sayle @ 2004-12-04  0:08 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: rth, gcc, gcc-patches


On Fri, 3 Dec 2004, Steven Bosscher wrote:
> 2003-02-03  Roger Sayle  <roger@eyesopen.com>
> TARGET_DELEGITIMIZE_ADDRESS

And here's my contribution, tested with "make dvi" on i686-pc-linux-gnu.
Ok for mainline?


2004-12-03  Roger Sayle  <roger@eyesopen.com>

	* doc/tm.texi (TARGET_DELEGITIMIZE_ADDRESS): Document target hook.


Index: tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.401
diff -c -3 -p -r1.401 tm.texi
*** tm.texi	3 Dec 2004 23:15:15 -0000	1.401
--- tm.texi	3 Dec 2004 23:57:20 -0000
*************** an immediate operand on the target machi
*** 5156,5161 ****
--- 5156,5171 ----
  anything @code{CONSTANT_P} is valid.
  @end defmac

+ @deftypefn {Target Hook} rtx TARGET_DELEGITIMIZE_ADDRESS (rtx @var{x})
+ This hook is used to undo the possibly obfuscating effects of the
+ @code{LEGITIMIZE_ADDRESS} and @code{LEGITIMIZE_RELOAD_ADDRESS} target
+ macros.  Some backend implementations of these macros wrap symbol
+ references inside an @code{UNSPEC} rtx to represent PIC or similar
+ addressing modes.  This target hook allows GCC's optimizers to understand
+ the semantics of these opaque @code{UNSPEC}s by converting them back
+ into their original form.
+ @end deftypefn
+
  @deftypefn {Target Hook} bool TARGET_CANNOT_FORCE_CONST_MEM (rtx @var{x})
  This hook should return true if @var{x} is of a form that cannot (or
  should not) be spilled to the constant pool.  The default version of

Roger
--

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-04  0:08 ` New and undocumented target hooks (cf. PR3386, a regression) Roger Sayle
@ 2004-12-04  0:21   ` Eric Botcazou
  2004-12-04  0:26   ` Richard Henderson
  1 sibling, 0 replies; 11+ messages in thread
From: Eric Botcazou @ 2004-12-04  0:21 UTC (permalink / raw)
  To: Roger Sayle; +Cc: gcc, Steven Bosscher, rth, gcc-patches

> + @deftypefn {Target Hook} rtx TARGET_DELEGITIMIZE_ADDRESS (rtx @var{x})
> + This hook is used to undo the possibly obfuscating effects of the
> + @code{LEGITIMIZE_ADDRESS} and @code{LEGITIMIZE_RELOAD_ADDRESS} target
> + macros.  Some backend implementations of these macros wrap symbol
> + references inside an @code{UNSPEC} rtx to represent PIC or similar
> + addressing modes.  This target hook allows GCC's optimizers to understand
> + the semantics of these opaque @code{UNSPEC}s by converting them back
> + into their original form.
> + @end deftypefn

Let me say that I now understand why you weren't advertising it before. ;-)

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-04  0:08 ` New and undocumented target hooks (cf. PR3386, a regression) Roger Sayle
  2004-12-04  0:21   ` Eric Botcazou
@ 2004-12-04  0:26   ` Richard Henderson
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2004-12-04  0:26 UTC (permalink / raw)
  To: Roger Sayle; +Cc: Steven Bosscher, gcc, gcc-patches

On Fri, Dec 03, 2004 at 03:49:55PM -0700, Roger Sayle wrote:
> 	* doc/tm.texi (TARGET_DELEGITIMIZE_ADDRESS): Document target hook.

Ok.


r~

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-03 13:16 New and undocumented target hooks (cf. PR3386, a regression) Steven Bosscher
                   ` (2 preceding siblings ...)
  2004-12-04  0:08 ` New and undocumented target hooks (cf. PR3386, a regression) Roger Sayle
@ 2004-12-06 19:47 ` Dorit Naishlos
  2004-12-06 20:52   ` Richard Henderson
  3 siblings, 1 reply; 11+ messages in thread
From: Dorit Naishlos @ 2004-12-06 19:47 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: rth, gcc, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2881 bytes --]





> 2004-09-23  Dorit Naishlos <dorit@il.ibm.com>
> TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD
> TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE
> TARGET_VECTORIZE_MISALIGNED_MEM_OK

Here are mine, tested on ppc-darwin.

TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE is actually not yet used by the
vectorizer -
shall I remove its occurrences for now, or leave it as an indication of
what is to come?

dorit

Changelog:

      * doc/tm.texi (TARGET_VECTORIZE_MISALIGNED_MEM_OK): Document target
hook.
      (TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD): Document target hook.
      (TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE): Document target hook.

Patch:

(See attached file: doc.patch)





                                                                                                                                                  
                      Steven Bosscher                                                                                                             
                      <stevenb@suse.de>        To:       Dorit Naishlos/Haifa/IBM@IBMIL, fjahanian@apple.com, bonzini@gnu.org,                    
                                                echristo@redhat.com, rth@redhat.com, kkojima@gcc.gnu.org, roger@eyesopen.com,                     
                      03/12/2004 15:16          zack@codesourcery.com                                                                             
                                               cc:       gcc@gcc.gnu.org                                                                          
                                               Subject:  New and undocumented target hooks (cf. PR3386, a regression)                             
                                                                                                                                                  




Hi,

Here is a list of people who have added target hooks in target.h
but who have not added the necessary documentation to doc/tm.texi:

2004-09-23  Dorit Naishlos <dorit@il.ibm.com>
TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD
TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE
TARGET_VECTORIZE_MISALIGNED_MEM_OK


2004-08-16  Fariborz Jahanian <fjahanian@apple.com>
TARGET_EH_RETURN_FILTER_MODE

2004-09-24  Paolo Bonzini  <bonzini@gnu.org>
TARGET_FOLD_BUILTIN

2002-10-11  Eric Christopher  <echristo@redhat.com>
TARGET_VALID_POINTER_MODE

2002-12-09  Richard Henderson  <rth@redhat.com>
TARGET_CANNOT_FORCE_CONST_MEM

2003-10-29  Richard Henderson  <rth@redhat.com>
TARGET_BUILD_BUILTIN_VA_LIST

2003-02-18  Kaz Kojima  <kkojima@gcc.gnu.org>
TARGET_CANNOT_COPY_INSN_P

2003-02-03  Roger Sayle  <roger@eyesopen.com>
TARGET_DELEGITIMIZE_ADDRESS

2004-06-20  Zack Weinberg  <zack@codesourcery.com>
TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME
TARGET_HANDLE_PRAGMA_EXTERN_PREFIX

Can y'all please add documentation for these target hooks?

Gr.
Steven



[-- Attachment #2: doc.patch --]
[-- Type: application/octet-stream, Size: 4355 bytes --]

? \
? doc.patch
? tm.texi.dn
Index: tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.402
diff -c -3 -p -r1.402 tm.texi
*** tm.texi	4 Dec 2004 00:34:43 -0000	1.402
--- tm.texi	6 Dec 2004 19:29:05 -0000
*************** holding the constant.  This restriction 
*** 5178,5183 ****
--- 5178,5251 ----
  of TLS symbols for various targets.
  @end deftypefn
  
+ @deftypefn {Target Hook} bool TARGET_VECTORIZE_MISALIGNED_MEM_OK (@var{mode})
+ This hook should return true if a move* pattern to/from memory
+ can be generated for machine_mode @var{mode} even if the memory location 
+ is unaligned.
+ If a move* of data to/from unaligned memory locations is not supported for
+ machine_mode @var{mode}, the hook should return false.  
+ This hook is used by the autovectorizer, and when expanding a 
+ @code{MISALIGNED_INDIRECT_REF} expression.
+ @end deftypefn
+ 
+ @deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD (void)
+ This hook should return the DECL of a function @var{f} that given an
+ address @var{addr} as an argument returns a mask @var{m} that can be
+ used to extract from two vectors the relevant data that resides in 
+ @var{addr} in case @var{addr} is not properly aligned.
+ 
+ The autovectrizer, when vectorizing a load operation from an address
+ @var{addr} that may be unaligned, will generate two vector loads from
+ the two aligned addresses around @var{addr}. It then generates a
+ @code{REALIGN_LOAD} operation to extract the relevant data from the
+ two loaded vectors. The first two arguments to @code{REALIGN_LOAD},
+ @var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, and
+ the third argument, @var{OFF}, defines how the data will be extracted
+ from these two vectors: if @var{OFF} is 0, then the returned vector is
+ @var{v2}; otherwise, the returned vector is composed from the last 
+ @var{VS}-@var{OFF} elements of @var{v1} concatenated to the first 
+ @var{OFF} elements of @var{v2}.
+ 
+ If this hook is defined, the autovectorizer will generate a call
+ to @var{f} (using the DECL tree that this hook returns) and will
+ use the return value of @var{f} as the argument @var{OFF} to
+ @code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f}
+ should comply with the semantics expected by @code{REALIGN_LOAD} 
+ described above.
+ If this hook is not defined, then @var{addr} will be used as
+ the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low
+ log2(@var{VS})-1 bits of @var{addr} will be considered.
+ @end deftypefn
+ 
+ @deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE (void)
+ This hook should return the DECL of a function @var{f} that given an
+ address @var{addr} as an argument returns a mask @var{m} that can be
+ used to extract from two vectors the relevant data to be stored to @var{addr}
+ in case @var{addr} is not properly aligned.
+ 
+ The autovectrizer, when vectorizing a store operation to an address
+ @var{addr} that may be unaligned, will create two vectors from which
+ data is to be stored into address @var{addr}. It then generates a
+ @code{REALIGN_STORE} operation to extract the relevant data from
+ these two vectors. The first two arguments of @code{REALIGN_STORE},
+ @var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, and
+ the third argument, @var{OFF}, defines how the data will be extracted
+ from these two vectors: if @var{OFF} is 0, then the returned vector is
+ @var{v1}; otherwise, the returned vector is composed from the last 
+ @var{OFF} elements of @var{v1} concatenated to the first
+ @var{VS}-@var{OFF} elements of @var{v2}.
+ 
+ If this hook is defined, the autovectorizer will generate a call
+ to @var{f} (using the DECL tree that this hook returns) and will
+ use the return value of @var{f} as the argument @var{OFF} to
+ @code{REALIGN_STORE}. Therefore, the mask @var{m} returned by @var{f}
+ should comply with the semantics expected by @code{REALIGN_STORE}
+ described above.
+ If this hook is not defined, then @var{addr}
+ will be used as the argument @var{OFF} to @code{REALIGN_STORE}, in which
+  case the low log2(@var{VS})-1 bits of @var{addr} will be considered.
+ @end deftypefn
+ 
  @node Condition Code
  @section Condition Code Status
  @cindex condition code status

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-06 19:47 ` Dorit Naishlos
@ 2004-12-06 20:52   ` Richard Henderson
  2004-12-07 16:09     ` Dorit Naishlos
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Henderson @ 2004-12-06 20:52 UTC (permalink / raw)
  To: Dorit Naishlos; +Cc: Steven Bosscher, gcc, gcc-patches

On Mon, Dec 06, 2004 at 09:41:51PM +0200, Dorit Naishlos wrote:
> TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE is actually not yet used by the
> vectorizer - shall I remove its occurrences for now, or leave it as an
> indication of what is to come?

Unless you think this bit will get done for 4.0, take it out.


r~

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-06 20:52   ` Richard Henderson
@ 2004-12-07 16:09     ` Dorit Naishlos
  2004-12-07 17:50       ` Richard Henderson
  0 siblings, 1 reply; 11+ messages in thread
From: Dorit Naishlos @ 2004-12-07 16:09 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Steven Bosscher, gcc, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2230 bytes --]





Here's the documentation with removal of the unused
target-hook/optab/tree-code.
Bootstrapped and tested on powerpc-darwin.

ok for mainline?

Changelog:

        * genopinit.c (vec_realign_store_optab): Initialization removed.
        * optabs.c (optab_for_tree_code): REALIGN_STORE_EXPR case removed.
        * optabs.h (optab_index): OTI_vec_realign_store Removed.
        (vec_realign_store_optab): Removed.
        * target-def.h (TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE): Removed.
        * target.h (builtin_mask_for_store): Removed.
        * tree.def (REALIGN_STORE_EXPR): Removed.
        * config/rs6000/rs6000.c (rs6000_builtin_mask_for_store): Removed.
        (altivec_builtin_mask_for_store): Removed.
        (altivec_init_builtins): Removed initialization of
        altivec_builtin_mask_for_store.
        * doc/tm.texi (TARGET_VECTORIZE_MISALIGNED_MEM_OK): Document target
hook.
        (TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD): Document target hook.

Patch:

(See attached file: doc.patch)




                                                                                                                               
                      Richard Henderson                                                                                        
                      <rth@redhat.com>         To:       Dorit Naishlos/Haifa/IBM@IBMIL                                        
                                               cc:       Steven Bosscher <stevenb@suse.de>, gcc@gcc.gnu.org,                   
                      06/12/2004 22:52          gcc-patches@gcc.gnu.org                                                        
                                               Subject:  Re: New and undocumented target hooks (cf. PR3386, a regression)      
                                                                                                                               




On Mon, Dec 06, 2004 at 09:41:51PM +0200, Dorit Naishlos wrote:
> TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE is actually not yet used by the
> vectorizer - shall I remove its occurrences for now, or leave it as an
> indication of what is to come?

Unless you think this bit will get done for 4.0, take it out.


r~

[-- Attachment #2: doc.patch --]
[-- Type: application/octet-stream, Size: 12282 bytes --]

Index: genopinit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/genopinit.c,v
retrieving revision 1.82
diff -c -3 -p -r1.82 genopinit.c
*** genopinit.c	28 Sep 2004 00:13:11 -0000	1.82
--- genopinit.c	6 Dec 2004 21:41:18 -0000
*************** static const char * const optabs[] =
*** 170,176 ****
    "vec_set_optab->handlers[$A].insn_code = CODE_FOR_$(vec_set$a$)",
    "vec_extract_optab->handlers[$A].insn_code = CODE_FOR_$(vec_extract$a$)",
    "vec_init_optab->handlers[$A].insn_code = CODE_FOR_$(vec_init$a$)",
-   "vec_realign_store_optab->handlers[$A].insn_code = CODE_FOR_$(vec_realign_store_$a$)",
    "vec_realign_load_optab->handlers[$A].insn_code = CODE_FOR_$(vec_realign_load_$a$)",
    "vcond_gen_code[$A] = CODE_FOR_$(vcond$a$)",
    "vcondu_gen_code[$A] = CODE_FOR_$(vcondu$a$)" };
--- 170,175 ----
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.251
diff -c -3 -p -r1.251 optabs.c
*** optabs.c	2 Dec 2004 18:31:26 -0000	1.251
--- optabs.c	6 Dec 2004 21:41:19 -0000
*************** optab_for_tree_code (enum tree_code code
*** 294,302 ****
      case MIN_EXPR:
        return TYPE_UNSIGNED (type) ? umin_optab : smin_optab;
  
-     case REALIGN_STORE_EXPR:
-       return vec_realign_store_optab;
- 
      case REALIGN_LOAD_EXPR:
        return vec_realign_load_optab;
  
--- 294,299 ----
Index: optabs.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.h,v
retrieving revision 1.41
diff -c -3 -p -r1.41 optabs.h
*** optabs.h	24 Nov 2004 18:50:20 -0000	1.41
--- optabs.h	6 Dec 2004 21:41:19 -0000
*************** enum optab_index
*** 228,235 ****
    OTI_vec_extract,
    /* Initialize vector operand.  */
    OTI_vec_init,
-   /* Extract specified elements from vectors, for vector store.  */
-   OTI_vec_realign_store,
    /* Extract specified elements from vectors, for vector load.  */
    OTI_vec_realign_load,
  
--- 228,233 ----
*************** extern GTY(()) optab optab_table[OTI_MAX
*** 334,340 ****
  #define vec_set_optab (optab_table[OTI_vec_set])
  #define vec_extract_optab (optab_table[OTI_vec_extract])
  #define vec_init_optab (optab_table[OTI_vec_init])
- #define vec_realign_store_optab (optab_table[OTI_vec_realign_store])
  #define vec_realign_load_optab (optab_table[OTI_vec_realign_load])
  
  /* Conversion optabs have their own table and indexes.  */
--- 332,337 ----
Index: target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.108
diff -c -3 -p -r1.108 target-def.h
*** target-def.h	26 Nov 2004 19:21:14 -0000	1.108
--- target-def.h	6 Dec 2004 21:41:19 -0000
*************** Foundation, 59 Temple Place - Suite 330,
*** 277,288 ****
  #define TARGET_VECTORIZE_MISALIGNED_MEM_OK default_vect_misaligned_mem_ok
  #endif
  #define TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD 0
- #define TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE 0
  
  #define TARGET_VECTORIZE                                                \
    {TARGET_VECTORIZE_MISALIGNED_MEM_OK,                                  \
!    TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD,				\
!    TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE}
  
  /* In except.c */
  #define TARGET_EH_RETURN_FILTER_MODE  default_eh_return_filter_mode
--- 277,286 ----
  #define TARGET_VECTORIZE_MISALIGNED_MEM_OK default_vect_misaligned_mem_ok
  #endif
  #define TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD 0
  
  #define TARGET_VECTORIZE                                                \
    {TARGET_VECTORIZE_MISALIGNED_MEM_OK,                                  \
!    TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD}
  
  /* In except.c */
  #define TARGET_EH_RETURN_FILTER_MODE  default_eh_return_filter_mode
Index: target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.120
diff -c -3 -p -r1.120 target.h
*** target.h	26 Nov 2004 19:21:14 -0000	1.120
--- target.h	6 Dec 2004 21:41:19 -0000
*************** struct gcc_target
*** 286,302 ****
    struct vectorize
    {
      /* The following member value is a pointer to a function called
!        by the vectorizer, and when expanding a MISALIGNED_INDIREC_REF
         expression.  If the hook returns true (false) then a move* pattern
         to/from memory can (cannot) be generated for this mode even if the
         memory location is unaligned.  */
      bool (* misaligned_mem_ok) (enum machine_mode);
  
!     /* The following member values are pointers to functions called
         by the vectorizer, and return the decl of the target builtin
         function.  */
      tree (* builtin_mask_for_load) (void);
-     tree (* builtin_mask_for_store) (void);
    } vectorize;
  
    /* Return machine mode for filter value.  */
--- 286,301 ----
    struct vectorize
    {
      /* The following member value is a pointer to a function called
!        by te vectorizer, and when expanding a MISALIGNED_INDIRECT_REF
         expression.  If the hook returns true (false) then a move* pattern
         to/from memory can (cannot) be generated for this mode even if the
         memory location is unaligned.  */
      bool (* misaligned_mem_ok) (enum machine_mode);
  
!     /* The following member value is a pointer to a function called
         by the vectorizer, and return the decl of the target builtin
         function.  */
      tree (* builtin_mask_for_load) (void);
    } vectorize;
  
    /* Return machine mode for filter value.  */
Index: tree.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.def,v
retrieving revision 1.104
diff -c -3 -p -r1.104 tree.def
*** tree.def	24 Nov 2004 11:41:33 -0000	1.104
--- tree.def	6 Dec 2004 21:41:19 -0000
*************** DEFTREECODE (WITH_SIZE_EXPR, "with_size_
*** 898,914 ****
     generated by the builtin targetm.vectorize.mask_for_load_builtin_decl.  */
  DEFTREECODE (REALIGN_LOAD_EXPR, "realign_load", tcc_expression, 3)
  
- /* Extract elements from two input vectors Operand 0 and Operand 1
-    size VS, according to the offset OFF defined by Operand 2 as
-    follows:
-    If OFF > 0, the last OFF elements of vector OP0 are concatenated to
-    the first VS - OFF elements of the vector OP1.
-    If OFF == 0, then the returned vector is OP0.
-    On different targets OFF may take different forms; It can be an address, in 
-    which case its low log2(VS)-1 bits define the offset, or it can be a mask 
-    generated by the builtin targetm.vectorize.mask_for_store_builtin_decl.  */
- DEFTREECODE (REALIGN_STORE_EXPR, "realign_store", tcc_expression, 3)
- 
  /*
  Local variables:
  mode:c
--- 898,903 ----
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.763
diff -c -3 -p -r1.763 rs6000.c
*** config/rs6000/rs6000.c	3 Dec 2004 15:47:44 -0000	1.763
--- config/rs6000/rs6000.c	6 Dec 2004 21:41:23 -0000
*************** enum rs6000_nop_insertion rs6000_sched_i
*** 147,154 ****
  
  /* Support targetm.vectorize.builtin_mask_for_load.  */
  static GTY(()) tree altivec_builtin_mask_for_load;
- /* Support targetm.vectorize.builtin_mask_for_store.  */
- static GTY(()) tree altivec_builtin_mask_for_store;
  
  /* Size of long double */
  const char *rs6000_long_double_size_string;
--- 147,152 ----
*************** static int pad_groups (FILE *, int, rtx,
*** 693,699 ****
  static void rs6000_sched_finish (FILE *, int);
  static int rs6000_use_sched_lookahead (void);
  static tree rs6000_builtin_mask_for_load (void);
- static tree rs6000_builtin_mask_for_store (void);
  
  static void rs6000_init_builtins (void);
  static rtx rs6000_expand_unop_builtin (enum insn_code, tree, rtx);
--- 691,696 ----
*************** static const char alt_reg_names[][8] =
*** 933,941 ****
  #undef TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD
  #define TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD rs6000_builtin_mask_for_load
  
- #undef TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE
- #define TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE rs6000_builtin_mask_for_store
- 
  #undef TARGET_INIT_BUILTINS
  #define TARGET_INIT_BUILTINS rs6000_init_builtins
  
--- 930,935 ----
*************** rs6000_builtin_mask_for_load (void)
*** 1592,1607 ****
      return 0;
  }
  
- /* Implement targetm.vectorize.builtin_mask_for_store.  */
- static tree
- rs6000_builtin_mask_for_store (void)
- {
-   if (TARGET_ALTIVEC)
-     return altivec_builtin_mask_for_store;
-   else
-     return 0;
- }
- 
  /* Handle generic options of the form -mfoo=yes/no.
     NAME is the option name.
     VALUE is the option value.
--- 1586,1591 ----
*************** altivec_init_builtins (void)
*** 8308,8324 ****
                                 BUILT_IN_MD, NULL, NULL_TREE);
        /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
        altivec_builtin_mask_for_load = decl;
- 
- 
-       /* Initialize target builtin that implements
-          targetm.vectorize.builtin_mask_for_store.  */
- 
-       decl = lang_hooks.builtin_function ("__builtin_altivec_mask_for_store",
-                                v16qi_ftype_long_pcvoid,
-                                ALTIVEC_BUILTIN_MASK_FOR_STORE,
-                                BUILT_IN_MD, NULL, NULL_TREE);
-       /* Record the decl. Will be used by rs6000_builtin_mask_for_store.  */
-       altivec_builtin_mask_for_store = decl;
      }
  }
  
--- 8292,8297 ----
Index: doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.402
diff -c -3 -p -r1.402 tm.texi
*** doc/tm.texi	4 Dec 2004 00:34:43 -0000	1.402
--- doc/tm.texi	6 Dec 2004 21:41:25 -0000
*************** holding the constant.  This restriction 
*** 5178,5183 ****
--- 5178,5222 ----
  of TLS symbols for various targets.
  @end deftypefn
  
+ @deftypefn {Target Hook} bool TARGET_VECTORIZE_MISALIGNED_MEM_OK (@var{mode})
+ This hook should return true if a move* pattern to/from memory
+ can be generated for machine_mode @var{mode} even if the memory location 
+ is unaligned.
+ If a move* of data to/from unaligned memory locations is not supported for
+ machine_mode @var{mode}, the hook should return false.  
+ This hook is used by the autovectorizer, and when expanding a 
+ @code{MISALIGNED_INDIRECT_REF} expression.
+ @end deftypefn
+ 
+ @deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD (void)
+ This hook should return the DECL of a function @var{f} that given an
+ address @var{addr} as an argument returns a mask @var{m} that can be
+ used to extract from two vectors the relevant data that resides in 
+ @var{addr} in case @var{addr} is not properly aligned.
+ 
+ The autovectrizer, when vectorizing a load operation from an address
+ @var{addr} that may be unaligned, will generate two vector loads from
+ the two aligned addresses around @var{addr}. It then generates a
+ @code{REALIGN_LOAD} operation to extract the relevant data from the
+ two loaded vectors. The first two arguments to @code{REALIGN_LOAD},
+ @var{v1} and @var{v2}, are the two vectors, each of size @var{VS}, and
+ the third argument, @var{OFF}, defines how the data will be extracted
+ from these two vectors: if @var{OFF} is 0, then the returned vector is
+ @var{v2}; otherwise, the returned vector is composed from the last 
+ @var{VS}-@var{OFF} elements of @var{v1} concatenated to the first 
+ @var{OFF} elements of @var{v2}.
+ 
+ If this hook is defined, the autovectorizer will generate a call
+ to @var{f} (using the DECL tree that this hook returns) and will
+ use the return value of @var{f} as the argument @var{OFF} to
+ @code{REALIGN_LOAD}. Therefore, the mask @var{m} returned by @var{f}
+ should comply with the semantics expected by @code{REALIGN_LOAD} 
+ described above.
+ If this hook is not defined, then @var{addr} will be used as
+ the argument @var{OFF} to @code{REALIGN_LOAD}, in which case the low
+ log2(@var{VS})-1 bits of @var{addr} will be considered.
+ @end deftypefn
+ 
  @node Condition Code
  @section Condition Code Status
  @cindex condition code status

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: New and undocumented target hooks (cf. PR3386, a regression)
  2004-12-07 16:09     ` Dorit Naishlos
@ 2004-12-07 17:50       ` Richard Henderson
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2004-12-07 17:50 UTC (permalink / raw)
  To: Dorit Naishlos; +Cc: Steven Bosscher, gcc, gcc-patches

On Tue, Dec 07, 2004 at 06:09:29PM +0200, Dorit Naishlos wrote:
>         * genopinit.c (vec_realign_store_optab): Initialization removed.
>         * optabs.c (optab_for_tree_code): REALIGN_STORE_EXPR case removed.
>         * optabs.h (optab_index): OTI_vec_realign_store Removed.
>         (vec_realign_store_optab): Removed.
>         * target-def.h (TARGET_VECTORIZE_BUILTIN_MASK_FOR_STORE): Removed.
>         * target.h (builtin_mask_for_store): Removed.
>         * tree.def (REALIGN_STORE_EXPR): Removed.
>         * config/rs6000/rs6000.c (rs6000_builtin_mask_for_store): Removed.
>         (altivec_builtin_mask_for_store): Removed.
>         (altivec_init_builtins): Removed initialization of
>         altivec_builtin_mask_for_store.
>         * doc/tm.texi (TARGET_VECTORIZE_MISALIGNED_MEM_OK): Document target
> hook.
>         (TARGET_VECTORIZE_BUILTIN_MASK_FOR_LOAD): Document target hook.

Ok.


r~

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-12-07 17:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-03 13:16 New and undocumented target hooks (cf. PR3386, a regression) Steven Bosscher
2004-12-03 23:16 ` Richard Henderson
     [not found] ` <003101c4d93c$8902e530$9641af83@tequila>
2004-12-03 15:12   ` [PATCH] Document target_fold_builtin Roger Sayle
2004-12-03 23:17   ` Richard Henderson
2004-12-04  0:08 ` New and undocumented target hooks (cf. PR3386, a regression) Roger Sayle
2004-12-04  0:21   ` Eric Botcazou
2004-12-04  0:26   ` Richard Henderson
2004-12-06 19:47 ` Dorit Naishlos
2004-12-06 20:52   ` Richard Henderson
2004-12-07 16:09     ` Dorit Naishlos
2004-12-07 17:50       ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).