Author: kongyi
Date: Thu Aug 28 10:25:52 2014
New Revision: 216669

URL: http://llvm.org/viewvc/llvm-project?rev=216669&view=rev
Log:
arm_acle: Fix error in ROR implementation

The logic in calculating the rotate amount was flawed.

Thanks Pasi Parviainen for pointing out!

Modified:
    cfe/trunk/lib/Headers/arm_acle.h

Modified: cfe/trunk/lib/Headers/arm_acle.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/arm_acle.h?rev=216669&r1=216668&r2=216669&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/arm_acle.h (original)
+++ cfe/trunk/lib/Headers/arm_acle.h Thu Aug 28 10:25:52 2014
@@ -111,15 +111,15 @@ static __inline__ void __attribute__((al
 /* ROR */
 static __inline__ uint32_t __attribute__((always_inline, nodebug))
   __ror(uint32_t x, uint32_t y) {
-  if (y == 0)  return y;
-  if (y >= 32) y %= 32;
+  y %= 32;
+  if (y == 0)  return x;
   return (x >> y) | (x << (32 - y));
 }
 
 static __inline__ uint64_t __attribute__((always_inline, nodebug))
   __rorll(uint64_t x, uint32_t y) {
-  if (y == 0)  return y;
-  if (y >= 64) y %= 64;
+  y %= 64;
+  if (y == 0)  return x;
   return (x >> y) | (x << (64 - y));
 }
 


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to