This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Clean up SPARC target testsuite
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 17 Jun 2007 13:22:48 +0200
- Subject: Clean up SPARC target testsuite
The recent tightening of vector type conversions has uncovered some problems
in the testsuite. A couple of real fixes were also needed.
Tested on SPARC/Solaris 8, 9 and 10, applied to mainline and 4.2 branch and,
for the testsuite chunk, to the 4.1 branch as well.
2007-06-17 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sparc.c (sparc_vis_init_builtins): Retrieve the
return mode from the builtin itself.
(sparc_fold_builtin): Fix cast of zero constant.
2007-06-17 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.target/sparc/align.c: Use 'unsigned char' as element type.
* gcc.target/sparc/combined-2.c: Likewise.
* gcc.target/sparc/fexpand.c : Likewise.
* gcc.target/sparc/fnot.c: Likewise. Fix a couple of prototypes.
* gcc.target/sparc/fpack16.c : Likewise.
* gcc.target/sparc/fpmerge.c : Likewise.
* gcc.target/sparc/fpmul.c : Likewise.
* gcc.target/sparc/noresult.c : Likewise.
* gcc.target/sparc/pdist.c: Likewise.
--
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c (revision 125716)
+++ config/sparc/sparc.c (working copy)
@@ -8029,8 +8029,10 @@ sparc_vis_init_builtins (void)
Expand builtin functions for sparc intrinsics. */
static rtx
-sparc_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
- enum machine_mode tmode, int ignore ATTRIBUTE_UNUSED)
+sparc_expand_builtin (tree exp, rtx target,
+ rtx subtarget ATTRIBUTE_UNUSED,
+ enum machine_mode tmode ATTRIBUTE_UNUSED,
+ int ignore ATTRIBUTE_UNUSED)
{
tree arg;
call_expr_arg_iterator iter;
@@ -8040,14 +8042,13 @@ sparc_expand_builtin (tree exp, rtx targ
enum machine_mode mode[4];
int arg_count = 0;
- mode[arg_count] = tmode;
-
- if (target == 0
- || GET_MODE (target) != tmode
- || ! (*insn_data[icode].operand[0].predicate) (target, tmode))
- op[arg_count] = gen_reg_rtx (tmode);
+ mode[0] = insn_data[icode].operand[0].mode;
+ if (!target
+ || GET_MODE (target) != mode[0]
+ || ! (*insn_data[icode].operand[0].predicate) (target, mode[0]))
+ op[0] = gen_reg_rtx (mode[0]);
else
- op[arg_count] = target;
+ op[0] = target;
FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
{
@@ -8160,11 +8161,11 @@ sparc_fold_builtin (tree fndecl, tree ar
{
tree arg0, arg1, arg2;
tree rtype = TREE_TYPE (TREE_TYPE (fndecl));
-
- if (ignore && DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrsi_vis
+ if (ignore
+ && DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrsi_vis
&& DECL_FUNCTION_CODE (fndecl) != CODE_FOR_alignaddrdi_vis)
- return build_int_cst (rtype, 0);
+ return fold_convert (rtype, integer_zero_node);
switch (DECL_FUNCTION_CODE (fndecl))
{
@@ -8278,6 +8279,7 @@ sparc_fold_builtin (tree fndecl, tree ar
default:
break;
}
+
return NULL_TREE;
}
Index: testsuite/gcc.target/sparc/combined-2.c
===================================================================
--- testsuite/gcc.target/sparc/combined-2.c (revision 125716)
+++ testsuite/gcc.target/sparc/combined-2.c (working copy)
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mcpu=ultrasparc -mvis" } */
-typedef char pixel __attribute__((vector_size(4)));
-typedef char vec8 __attribute__((vector_size(8)));
+typedef unsigned char pixel __attribute__((vector_size(4)));
+typedef unsigned char vec8 __attribute__((vector_size(8)));
typedef short vec16 __attribute__((vector_size(8)));
vec16 foo (pixel a, pixel b) {
Index: testsuite/gcc.target/sparc/fpmul.c
===================================================================
--- testsuite/gcc.target/sparc/fpmul.c (revision 125716)
+++ testsuite/gcc.target/sparc/fpmul.c (working copy)
@@ -2,9 +2,9 @@
/* { dg-options "-mcpu=ultrasparc -mvis" } */
typedef int vec32 __attribute__((vector_size(8)));
typedef short vec16 __attribute__((vector_size(8)));
-typedef char pixel __attribute__((vector_size(4)));
+typedef unsigned char pixel __attribute__((vector_size(4)));
typedef short pixel16 __attribute__((vector_size(4)));
-typedef char vec8 __attribute__((vector_size(8)));
+typedef unsigned char vec8 __attribute__((vector_size(8)));
vec16 foo1 (pixel a, vec16 b) {
return __builtin_vis_fmul8x16 (a, b);
Index: testsuite/gcc.target/sparc/pdist.c
===================================================================
--- testsuite/gcc.target/sparc/pdist.c (revision 125716)
+++ testsuite/gcc.target/sparc/pdist.c (working copy)
@@ -1,8 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mcpu=ultrasparc -mvis" } */
-
typedef long long int64_t;
-typedef char vec8 __attribute__((vector_size(8)));
+typedef unsigned char vec8 __attribute__((vector_size(8)));
int64_t foo (vec8 a, vec8 b) {
int64_t d = 0;
Index: testsuite/gcc.target/sparc/fexpand.c
===================================================================
--- testsuite/gcc.target/sparc/fexpand.c (revision 125716)
+++ testsuite/gcc.target/sparc/fexpand.c (working copy)
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mcpu=ultrasparc -mvis" } */
typedef short vec16 __attribute__((vector_size(8)));
-typedef char vec8 __attribute__((vector_size(4)));
+typedef unsigned char vec8 __attribute__((vector_size(4)));
vec16 foo (vec8 a) {
return __builtin_vis_fexpand (a);
Index: testsuite/gcc.target/sparc/fnot.c
===================================================================
--- testsuite/gcc.target/sparc/fnot.c (revision 125716)
+++ testsuite/gcc.target/sparc/fnot.c (working copy)
@@ -1,8 +1,8 @@
/* { dg-do compile } */
/* { dg-options "-O -mcpu=ultrasparc -mvis" } */
-typedef char vec8 __attribute__((vector_size(8)));
+typedef unsigned char vec8 __attribute__((vector_size(8)));
typedef short vec16 __attribute__((vector_size(8)));
-typedef int vec32 __attribute__((vector_size(8)));
+typedef int vec32 __attribute__((vector_size(8)));
extern vec8 foo1_8(void);
extern void foo2_8(vec8);
@@ -21,7 +21,7 @@ vec8 fun8_2(vec8 a)
#endif
extern vec16 foo1_16(void);
-extern void foo2_16(vec8);
+extern void foo2_16(vec16);
vec16 fun16(void)
@@ -38,7 +38,7 @@ vec16 fun16_2(vec16 a)
#endif
extern vec32 foo1_32(void);
-extern void foo2_32(vec8);
+extern void foo2_32(vec32);
vec32 fun32(void)
{
Index: testsuite/gcc.target/sparc/noresult.c
===================================================================
--- testsuite/gcc.target/sparc/noresult.c (revision 125716)
+++ testsuite/gcc.target/sparc/noresult.c (working copy)
@@ -1,7 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-mcpu=ultrasparc -mvis" } */
typedef short vec16 __attribute__((vector_size(8)));
-typedef char vec8 __attribute__((vector_size(4)));
void foo (vec16 a) {
__builtin_vis_fpack16 (a);
Index: testsuite/gcc.target/sparc/fpmerge.c
===================================================================
--- testsuite/gcc.target/sparc/fpmerge.c (revision 125716)
+++ testsuite/gcc.target/sparc/fpmerge.c (working copy)
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mcpu=ultrasparc -mvis" } */
-typedef char pixel __attribute__((vector_size(8)));
-typedef char vec8 __attribute__((vector_size(4)));
+typedef unsigned char pixel __attribute__((vector_size(8)));
+typedef unsigned char vec8 __attribute__((vector_size(4)));
pixel foo (vec8 a, vec8 b) {
return __builtin_vis_fpmerge (a, b);
Index: testsuite/gcc.target/sparc/align.c
===================================================================
--- testsuite/gcc.target/sparc/align.c (revision 125716)
+++ testsuite/gcc.target/sparc/align.c (working copy)
@@ -1,10 +1,9 @@
/* { dg-do compile } */
/* { dg-options "-mcpu=ultrasparc -mvis" } */
-
typedef long long int64_t;
typedef int vec32 __attribute__((vector_size(8)));
typedef short vec16 __attribute__((vector_size(8)));
-typedef char vec8 __attribute__((vector_size(8)));
+typedef unsigned char vec8 __attribute__((vector_size(8)));
vec16 foo1 (vec16 a, vec16 b) {
return __builtin_vis_faligndatav4hi (a, b);
Index: testsuite/gcc.target/sparc/fpack16.c
===================================================================
--- testsuite/gcc.target/sparc/fpack16.c (revision 125716)
+++ testsuite/gcc.target/sparc/fpack16.c (working copy)
@@ -1,7 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-mcpu=ultrasparc -mvis" } */
typedef short vec16 __attribute__((vector_size(8)));
-typedef char vec8 __attribute__((vector_size(4)));
+typedef unsigned char vec8 __attribute__((vector_size(4)));
vec8 foo (vec16 a) {
return __builtin_vis_fpack16 (a);