[PATCH] AArch64: Fold immediate into the immediate field of logical instructions
Tim Northover
t.p.northover at gmail.com
Wed Oct 22 12:55:52 PDT 2014
Hi Akira,
I've got a couple of comments:
================
Comment at: include/llvm/Target/TargetLowering.h:2058
@@ +2057,3 @@
+ /// node was created.
+ virtual bool OptimizeConstant(SDValue Op, const APInt &Demanded,
+ TargetLoweringOpt &TLO) const;
----------------
Functions should usually start with a lower-case letter.
================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:693-694
@@ +692,4 @@
+
+ // Try sign-extending the immediate and see if we can turn it into a bimm32
+ // or bimm64.
+ unsigned LZ = Demanded.countLeadingZeros() + (64 - Demanded.getBitWidth());
----------------
OK, so we've got an immediate "ab...iJK..Z" where lower-case digits aren't used. Sign extending converts this to "JJ...JJK...Z". Is there any particular reason to expect that's representable? It seems like a bit of a shot in the dark.
================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:700
@@ +699,3 @@
+
+ int64_t NewImm = (Imm << LZ) >> LZ;
+
----------------
Shifting a negative number left is undefined behaviour.
http://reviews.llvm.org/D5591
More information about the llvm-commits
mailing list