Commit 1c9df37c by Michael Meissner Committed by Michael Meissner

Fix 23983, add proper attributes to the altivec/vsx builtins

From-SVN: r152867
parent 9017096f
2009-10-15 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/23983
* config/rs6000/predicates.md: Update copyright year.
* config/rs6000/altivec.md: Ditto.
* config/rs6000/t-rs6000 (TM_H): Add rs6000-builtin.def.
(MD_INCLUDES): Add a2.md.
* config/rs6000/rs6000.c (rs6000_builtin_decls): Change
RS6000_BUILTIN_COUNT to MAX_RS6000_BUILTINS.
(builtin_classify): New static vector to classify various builtins
to get the tree attributes correct.
(def_builtin): Set the attributes of builtins based on what the
builtin does (i.e. memory operation, floating point, saturation
need special attributes, others are pure functions).
* config/rs6000/rs6000.h (enum rs6000_btc): New enum to classify
the builtins.
(enum rs6000_builtins): Include rs6000-builtin.def to define the
builtins. Change the end marker to MAX_RS6000_BUILTINS from
RS6000_BUILTIN_COUNT.
(rs6000_builtin_decls): Change RS6000_BUILTIN_COUNT to
MAX_RS6000_BUILTINS.
* config/rs6000/rs6000-builtin.def: New file that combines the
builtin enumeration name and attributes.
2009-10-15 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/linux.h (ASM_SPEC): Add --32.
;; AltiVec patterns.
;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008
;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
;; Free Software Foundation, Inc.
;; Contributed by Aldy Hernandez (aldy@quesejoda.com)
......
;; Predicate definitions for POWER and PowerPC.
;; Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;;
;; This file is part of GCC.
;;
......
......@@ -836,6 +836,21 @@ struct processor_costs ppca2_cost = {
};
/* Table that classifies rs6000 builtin functions (pure, const, etc.). */
#undef RS6000_BUILTIN
#undef RS6000_BUILTIN_EQUATE
#define RS6000_BUILTIN(NAME, TYPE) TYPE,
#define RS6000_BUILTIN_EQUATE(NAME, VALUE)
static const enum rs6000_btc builtin_classify[(int)RS6000_BUILTIN_COUNT] =
{
#include "rs6000-builtin.def"
};
#undef RS6000_BUILTIN
#undef RS6000_BUILTIN_EQUATE
static bool rs6000_function_ok_for_sibcall (tree, tree);
static const char *rs6000_invalid_within_doloop (const_rtx);
static bool rs6000_legitimate_address_p (enum machine_mode, rtx, bool);
......@@ -8494,13 +8509,54 @@ def_builtin (int mask, const char *name, tree type, int code)
{
if ((mask & target_flags) || TARGET_PAIRED_FLOAT)
{
tree t;
if (rs6000_builtin_decls[code])
fatal_error ("internal error: builtin function to %s already processed.",
name);
rs6000_builtin_decls[code] =
rs6000_builtin_decls[code] = t =
add_builtin_function (name, type, code, BUILT_IN_MD,
NULL, NULL_TREE);
gcc_assert (code >= 0 && code < (int)RS6000_BUILTIN_COUNT);
switch (builtin_classify[code])
{
default:
gcc_unreachable ();
/* assume builtin can do anything. */
case RS6000_BTC_MISC:
break;
/* const function, function only depends on the inputs. */
case RS6000_BTC_CONST:
TREE_CONSTANT (t) = 1;
TREE_NOTHROW (t) = 1;
break;
/* pure function, function can read global memory. */
case RS6000_BTC_PURE:
DECL_PURE_P (t) = 1;
TREE_NOTHROW (t) = 1;
break;
/* Function is a math function. If rounding mode is on, then treat
the function as not reading global memory, but it can have
arbitrary side effects. If it is off, then assume the function is
a const function. This mimics the ATTR_MATHFN_FPROUNDING
attribute in builtin-attribute.def that is used for the math
functions. */
case RS6000_BTC_FP_PURE:
TREE_NOTHROW (t) = 1;
if (flag_rounding_math)
{
DECL_PURE_P (t) = 1;
DECL_IS_NOVOPS (t) = 1;
}
else
TREE_CONSTANT (t) = 1;
break;
}
}
}
......
......@@ -19,6 +19,8 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
TM_H += $(srcdir)/config/rs6000/rs6000-builtin.def
rs6000.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h \
real.h insn-config.h conditions.h insn-attr.h flags.h $(RECOG_H) \
......@@ -56,6 +58,7 @@ MD_INCLUDES = $(srcdir)/config/rs6000/rios1.md \
$(srcdir)/config/rs6000/power7.md \
$(srcdir)/config/rs6000/cell.md \
$(srcdir)/config/rs6000/xfpu.md \
$(srcdir)/config/rs6000/a2.md \
$(srcdir)/config/rs6000/predicates.md \
$(srcdir)/config/rs6000/constraints.md \
$(srcdir)/config/rs6000/darwin.md \
......
2009-10-15 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/23983
* gcc.target/powerpc/altivec-4.c (b): Make sure altivec builtin
result used.
* g++.dg/ext/altivec-2.C (main): Ditto.
2009-10-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* lib/target-supports.exp (add_options_for_bind_pic_locally): New.
......
......@@ -7,6 +7,8 @@
#include <altivec.h>
vector unsigned char use_lvsl;
int main (int argc, const char * argv[])
{
int i = 0;
......@@ -17,7 +19,7 @@ int main (int argc, const char * argv[])
vec_dst(&cv, i, 0);
v = vec_ld(0, &cv);
v = vec_lde(0, &cf);
vec_lvsl(0, &cf);
use_lvsl = vec_lvsl(0, &cf);
return 0;
}
......@@ -4,7 +4,7 @@
#define vector __attribute__((vector_size(16)))
static int vector x, y;
static int vector x, y, z;
static vector signed int i,j;
static vector signed short s,t;
......@@ -20,7 +20,7 @@ static int int1, int2;
void
b()
{
__builtin_altivec_vadduwm (x, y);
z = __builtin_altivec_vadduwm (x, y);
/* Make sure the predicates accept correct argument types. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment