llvm.org GIT mirror llvm / 11ebe3d
Also match negative offsets for addrmode3 and addrmode5. Math is hard, and isScaledConstantInRange() always returned false for negative constants. It was doing unsigned division of negative numbers before casting back to signed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140425 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 8 years ago
2 changed file(s) with 20 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
304304 /// (N * Scale) where (N in [\arg RangeMin, \arg RangeMax).
305305 ///
306306 /// \param ScaledConstant [out] - On success, the pre-scaled constant value.
307 static bool isScaledConstantInRange(SDValue Node, unsigned Scale,
307 static bool isScaledConstantInRange(SDValue Node, int Scale,
308308 int RangeMin, int RangeMax,
309309 int &ScaledConstant) {
310 assert(Scale && "Invalid scale!");
310 assert(Scale > 0 && "Invalid scale!");
311311
312312 // Check that this is a constant.
313313 const ConstantSDNode *C = dyn_cast(Node);
1313 ret float %tmp1
1414 }
1515
16 define float @f2offset(float* %v, float %u) {
17 ; CHECK: f2offset:
18 ; CHECK: vldr.32{{.*}}, #4]
19 %addr = getelementptr float* %v, i32 1
20 %tmp = load float* %addr
21 %tmp1 = fadd float %tmp, %u
22 ret float %tmp1
23 }
24
25 define float @f2noffset(float* %v, float %u) {
26 ; CHECK: f2noffset:
27 ; CHECK: vldr.32{{.*}}, #-4]
28 %addr = getelementptr float* %v, i32 -1
29 %tmp = load float* %addr
30 %tmp1 = fadd float %tmp, %u
31 ret float %tmp1
32 }
33
1634 define void @f3(float %a, float %b, float* %v) {
1735 ; CHECK: f3:
1836 ; CHECK: vstr.32{{.*}}[