r216669 - arm_acle: Fix error in ROR implementation
Yi Kong
Yi.Kong at arm.com
Thu Aug 28 08:25:52 PDT 2014
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));
}
More information about the cfe-commits
mailing list