Re: vcond implementation in altivec

2007-03-05 Thread Sa Liu
David Edelsohn <[EMAIL PROTECTED]> wrote on 02.03.2007 19:10:58:

> > Devang Patel writes:
> 
> >> Is there a reason why op0 is V4SF
> Devang> It is destination so, yes this is wrong.
> 
> >> and op1 is V4SI (and not V8HI)?
> 
> Devang> condition should be v4si, but it is not op1. So this is also
> not correct.
> 
> >> And also, why not use if_then_else instead of unspec (in all 
vcond's)?
> 
> Devang> I did not try that path. May be I did not know about it at that 
time.
> 
> 
>Patches welcome.
> 
> David
> 

I am working on the patch and will submit it soon.

Sa


Re: Interoperability of Fortran array and C vector?

2008-03-05 Thread Sa Liu
I noticed that in fortran/convert.c the convert() function calls 
convert_to_vector() if the target type is VECTOR_TYPE. When is that 
function triggered in Fortran frontend? Since Fortran language doesn't 
support vector type, why does it convert something to a vector expression? 


Thanks!
Sa


delete LIBCALL note after split

2007-07-30 Thread Sa Liu
Hi,

I'm working on GCC 4.1.1 on spu target and get following problem:

After splitting an insn with a note REG_LIBCALL, the insn is replaced by 
some other insns, which don't attach REG_LIBCALL note any more, and the 
original one is then deleted. While the insn REG_RETVAL still points to 
the LIBCALL insn, which doesn't exist after the split. After reload it 
tries to delete the LIBCALL insn referenced by RETVAL, but it has been 
deleted already.

The question is how to avoid deleting the LIBCALL note twice? Is it 
possible to have RETVAL note point to the new insn split from LIBCALL 
note? Any idea to solve this problem would be appreciated... 

Thanks!
Sa




C++ frontend can not handle vector pointer constant parameter

2007-08-02 Thread Sa Liu
Hi all,

I have detected a bug in C++ frontend. 

When compiling a function with parameter of a pointer to a vector constant 
type, the compiler calls a recursive function and is not able to get out. 

Concretely, in gcc/cp/mangle.c file, in function write_type:

  if (write_CV_qualifiers_for_type (type) > 0)
/* If TYPE was CV-qualified, we just wrote the qualifiers; now
   mangle the unqualified type.  The recursive call is needed here
   since both the qualified and unqualified types are substitution
   candidates.  */
write_type (TYPE_MAIN_VARIANT (type));

But TYPE_MAIN_VARIANT (type) has been set as type itself in gcc/tree.c 
function make_node_stat:
   case tcc_type:
...
  TYPE_MAIN_VARIANT (t) = t;

Therefor the write_type function runs into a dead recursion.

I have a test case to show the incorrect behavior on Intel:

void bar(
int __attribute__((vector_size(16))) * a,
int __attribute__((vector_size(16))) * const b);

int instance(void)
{
   int __attribute__((vector_size(16))) a[1], b[1];

   bar(a, b);
}

The error also occurs on other machines supporting vector type. I suppose 
that some flags for the qualifier are not properly set. 
Does someone knowing frontend well could provide any help?

Thanks!
Sa 



Re: C++ frontend can not handle vector pointer constant parameter

2007-08-02 Thread Sa Liu
"Andrew Pinski" <[EMAIL PROTECTED]> wrote on 02.08.2007 19:36:30:

> This used to work.  Can you file a bug at the very least?
> 
> Thanks,
> Andrew Pinski

I have opened a bug against it.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32970

Sa


Re: delete LIBCALL note after split

2007-08-03 Thread Sa Liu
Ian Lance Taylor <[EMAIL PROTECTED]> wrote on 03.08.2007 17:24:45:

> Thanks.  The general idea looks right, but the implementation is
> incorrect.
> 

Thank you! I have made the correction:

Index: gcc/emit-rtl.c
===
--- gcc.orig/emit-rtl.c
+++ gcc/emit-rtl.c
@@ -3121,7 +3121,7 @@ try_split (rtx pat, rtx trial, int last)
   rtx before = PREV_INSN (trial);
   rtx after = NEXT_INSN (trial);
   int has_barrier = 0;
-  rtx tem;
+  rtx tem, note_retval;
   rtx note, seq;
   int probability;
   rtx insn_last, insn;
@@ -3257,6 +3257,17 @@ try_split (rtx pat, rtx trial, int last)
  break;
 #endif
 
+   case REG_LIBCALL:
+   /* Relink the insns with REG_LIBCALL note and with REG_RETVAL note 

+  after split.  */
+   REG_NOTES (insn_last) 
+   = gen_rtx_EXPR_LIST (REG_LIBCALL,
+XEXP (note, 0),
+REG_NOTES (insn_last)); 
+   note_retval = find_reg_note (XEXP (note, 0), REG_RETVAL, 
NULL);
+   XEXP (note_retval, 0) = insn_last;
+ break;
+
default:
  break;
}

Sa



Re: delete LIBCALL note after split

2007-08-03 Thread Sa Liu
Ian Lance Taylor <[EMAIL PROTECTED]> wrote on 30.07.2007 18:59:28:

> If the compiler splits an insn with a REG_LIBCALL note, it needs to
> remove the corresponding REG_RETVAL note, or it needs to relink the
> insns.  This looks like a compiler bug, in that try_split doesn't
> handle REG_LIBCALL notes at all.  It's quite unusual to be able to
> split a libcall insn, so it's not surprising that this has not been
> noticed previously.
> 
> Ian

Thanks for replying, Ian!

I have added a piece of code in try_split to handle the links. Not sure 
whether this is O.K. for the other platforms.

Index: gcc/emit-rtl.c
===
--- gcc.orig/emit-rtl.c
+++ gcc/emit-rtl.c
@@ -3121,7 +3121,7 @@ try_split (rtx pat, rtx trial, int last)
   rtx before = PREV_INSN (trial);
   rtx after = NEXT_INSN (trial);
   int has_barrier = 0;
-  rtx tem;
+  rtx tem, note_libcall, note_retval;
   rtx note, seq;
   int probability;
   rtx insn_last, insn;
@@ -3257,6 +3257,17 @@ try_split (rtx pat, rtx trial, int last)
  break;
 #endif
 
+   case REG_LIBCALL:
+   /* Relink the insns with REG_LIBCALL note and with REG_RETVAL note 

+  after split.  */
+   note_libcall 
+= find_reg_note (trial, REG_LIBCALL, NULL); 
+   REG_NOTES (insn_last) = note_libcall;
+   note_retval 
+= find_reg_note (XEXP (note_libcall, 0), REG_RETVAL, 
NULL);
+   XEXP (note_retval, 0) = insn_last;
+ break;
+
default:
  break;
}

Thanks,
Sa


Re: C++ frontend can not handle vector pointer constant parameter

2007-08-07 Thread Sa Liu
"Andrew Pinski" <[EMAIL PROTECTED]> wrote on 02.08.2007 19:36:30:

> On 8/2/07, Sa Liu <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I have detected a bug in C++ frontend.
> 
> This used to work.  Can you file a bug at the very least?
> 

Hi Andrew, 

Do you still remember on which version it used to work?

Thanks,
Sa