Hello Kalin,

Looks like you missed another place in Simd_Finalize_Loops that may require a 
similar fix.

-Mei

________________________________
From: Ju, Roy
Sent: Wednesday, August 11, 2010 3:11 PM
To: Ye, Mei
Subject: FW: [Open64-devel] Simd_Finalize_Loops bug in handling unsigned 
comparison loop end

Mei,
See if you can review this changelist. Thanks.

Roy

From: Hui Shi [mailto:]
Sent: Sunday, August 08, 2010 7:46 PM
To:
Subject: [Open64-devel] Simd_Finalize_Loops bug in handling unsigned comparison 
loop end

Hi, All

Can LNO gatekeeper help review this fix?

This bug happens in -m32 on x8664 linux.
Attached is the test case and patch.
command line is
opencc -O3 unsigned_loop_end.c -INLINE:ne=foo:ne=init:ne=check 
-OPT:unroll_times_max=1 -m32

The bug happens when vectorization is happend on following loop.
   int a[100]
   int start;
   unsigned i, end;
   for( i = start; i < end; i++) {
     a[i] = a[i+1];
   }
with -m64 unsigned comparison is transformed to signed comparison in 
STD_Canonicalize_Upper_Bound.
with -m32 unsigned comparison is kept in LNO.

will update loop_end align to vecotrize factor (vect)
i <= start + (((end - start + 1) / vect) * vect) -1
suppose start is 0, end is 2, vect is 4, original serial loop is
for( i = 0; i < 2; i++)
after Simd_Finalize_Loops transformation, simd loop becomes
for(i = 0, i <= -1; i++),
This loop will itreate 0xffffffff times.

The fix is change loop end to following form when compraion is unsigned.
i < start + (((end - start + 1) / vect) * vect)


As discussed with Shuxin, we also doubt why SIMD loop's upper need aligned with 
vecotrized factor. Can SIMD only update loop's step?
like  for(i = start, i <= end-1; i+= vector_factor)?


Best Regards
Shi, Hui
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to