Hi,
Could gatekeeper help to review this fix? It's for bug 608
(https://bugs.open64.net/show_bug.cgi?id=608). With this patch, open64 supports
vector "/" and "~" operation.
Attached the test case and patch. You can compile it using "opencc simd-2.c" to
reproduce the problem.
Index: osprey/be/cg/x8664/expand.cxx
===================================================================
--- osprey/be/cg/x8664/expand.cxx (revision 3380)
+++ osprey/be/cg/x8664/expand.cxx (working copy)
@@ -2267,10 +2267,21 @@
void Expand_Binary_Complement (TN *dest, TN *src, TYPE_ID mtype, OPS *ops)
{
- if( OP_NEED_PAIR(mtype) )
- Expand_Split_UOP( OPR_BNOT, mtype, dest, src, ops );
- else
- Build_OP( MTYPE_is_size_double(mtype) ? TOP_not64 : TOP_not32, dest, src,
ops );
+ if (MTYPE_is_vector(mtype)) {
+ TCON then = Host_To_Targ(Mtype_vector_elemtype(mtype), -1);
+ TCON now = Create_Simd_Const(mtype, then);
+ ST *sym = New_Const_Sym(Enter_tcon(now), Be_Type_Tbl(TCON_ty(now)));
+ Allocate_Object(sym);
+ TN *sym_tn = Gen_Symbol_TN(sym, 0, 0);
+ TN *result_tn = Build_TN_Of_Mtype(mtype);
+ Exp_Load(mtype, mtype, result_tn, TN_var(sym_tn), TN_offset(sym_tn), ops,
0);
+ Build_OP(TOP_xorps, dest, src, result_tn, ops);
+ } else {
+ if( OP_NEED_PAIR(mtype) )
+ Expand_Split_UOP( OPR_BNOT, mtype, dest, src, ops );
+ else
+ Build_OP( MTYPE_is_size_double(mtype) ? TOP_not64 : TOP_not32, dest,
src, ops );
+ }
}
void Expand_Binary_And (TN *dest, TN *src1, TN *src2, TYPE_ID mtype, OPS *ops)
Index: osprey/be/vho/vho_lower.cxx
===================================================================
--- osprey/be/vho/vho_lower.cxx (revision 3380)
+++ osprey/be/vho/vho_lower.cxx (working copy)
@@ -4440,8 +4440,9 @@
WN *arg0[8], *arg1[8];
split_vector_load ( WN_kid0(wn), block, arg0, orig_type );
split_vector_load ( WN_kid1(wn), block, arg1, orig_type );
+ TYPE_ID comparison_type = Mtype_comparison(elem_type);
for ( int i = 0; i < count; i ++ ) {
- WN* div = WN_Div ( elem_type, arg0[i], arg1[i] );
+ WN* div = WN_Div ( comparison_type, arg0[i], arg1[i] );
WN* stid = WN_Stid( elem_type, i * MTYPE_byte_size(elem_type),
result_st, MTYPE_To_TY(elem_type), div, 0 );
WN_INSERT_BlockLast ( block, stid );
Regards,
Roger
/*
Purpose: Test generic SIMD support, V8HImode. This test should work
regardless of if the target has SIMD instructions.
*/
typedef short __attribute__((vector_size (16))) vecint;
vecint i = { 150, 100, 150, 200, 0, 0, 0, 0 };
vecint j = { 10, 13, 20, 30, 1, 1, 1, 1 };
vecint k;
union {
vecint v;
short i[8];
} res;
/* This should go away once we can use == and != on vector types. */
void
verify (int a1, int a2, int a3, int a4,
int b1, int b2, int b3, int b4)
{
if (a1 != b1
|| a2 != b2
|| a3 != b3
|| a4 != b4)
abort ();
}
int
main ()
{
k = i + j;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3], 160, 113, 170, 230);
k = i * j;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3], 1500, 1300, 3000, 6000);
k = i / j;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3], 15, 7, 7, 6);
k = i & j;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3], 2, 4, 20, 8);
k = i | j;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3], 158, 109, 150, 222);
k = i ^ j;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3], 156, 105, 130, 214);
k = -i;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3],
-150, -100, -150, -200);
k = ~i;
res.v = k;
verify (res.i[0], res.i[1], res.i[2], res.i[3], -151, -101, -151, -201);
exit (0);
}
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel