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]

Re: [PATCH] Constant fold VIEW_CONVERT_EXPR


Roger Sayle wrote:
The following patch teaches the middle-end how to fold/evaluate
VIEW_CONVERT_EXPR of INTEGER_CST, REAL_CST, COMPLEX_CST and VECTOR_CST
at compile-time.  This type of binary reinterpretation can already
be performed (for some of the above constant types) in the RTL optimizers,
and this patch effectively duplicates the logic of simplify-rtx.c's
simplify_immed_subreg in fold, but operating on trees.

Great, thank you very much!


+
+ /* Subroutine of fold_view_convert_expr.  Interpet the contents of

Typo -- Interpret the contents of...


+ return NULL_TREE;

sizeof (tmp) * CHAR_BIT maybe?


+ for (i = 0; i < bitsize; i += 8)

CHAR_BIT here as well?


+ tmp[ibase / 32] |= (long) (*ptr++) << (i & 31);

What's happening on I32LP64 hosts? (I just don't know the answer).


+ static tree
+ fold_view_convert_expr (tree type, tree expr)
+ {
+   /* We support up to 512-bit values (for V8DFmode).  */
+   enum {
+     max_bitsize = 512
+   };
+   unsigned char buffer[max_bitsize / 8];

And similarly, you could hard code 512 here and later...


+ if (isize > max_bitsize)

... use isize > sizeof (buffer) / CHAR_BIT.


Paolo


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