[PATCH] Make processLogicalImmediate in AArch64AddressingModes.h more efficient

Tim Northover t.p.northover at gmail.com
Mon Nov 3 14:30:35 PST 2014


Hi,

I think it'd be good to convert this function to LLVM style (mainly local variables begin with a capital letter) since we're already changing so much of it.

Other than that, a couple of minor nits:

================
Comment at: lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h:224
@@ -236,1 +223,3 @@
+    size /= 2;
+    uint64_t mask = (1LL << size) - 1;
 
----------------
This is undefined behaviour if size > 62. I think "(1ULL << size) - 1" is OK.

================
Comment at: lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h:226
@@ -236,3 +225,3 @@
 
-    if (allMatched) {
-      eltVal = lowestEltVal;
+    if (((imm ^ imm >> size) & mask) != 0) {
+      size *= 2;
----------------
This is an equality comparison: I think "(Imm & Mask) != (Imm >> Size) & Mask" is clearer.

http://reviews.llvm.org/D6062






More information about the llvm-commits mailing list