case AArch64::STRWui:
case AArch64::STURWi:
case AArch64::LDPSi:
+ case AArch64::LDPSWi:
case AArch64::LDPWi:
case AArch64::STPSi:
case AArch64::STPWi:
return AArch64::LDRSWpre;
case AArch64::LDPSi:
return AArch64::LDPSpre;
+ case AArch64::LDPSWi:
+ return AArch64::LDPSWpre;
case AArch64::LDPDi:
return AArch64::LDPDpre;
case AArch64::LDPQi:
return AArch64::LDRSWpost;
case AArch64::LDPSi:
return AArch64::LDPSpost;
+ case AArch64::LDPSWi:
+ return AArch64::LDPSWpost;
case AArch64::LDPDi:
return AArch64::LDPDpost;
case AArch64::LDPQi:
default:
return false;
case AArch64::LDPSi:
+ case AArch64::LDPSWi:
case AArch64::LDPDi:
case AArch64::LDPQi:
case AArch64::LDPWi:
case AArch64::LDURXi:
// Paired instructions.
case AArch64::LDPSi:
+ case AArch64::LDPSWi:
case AArch64::LDPDi:
case AArch64::LDPQi:
case AArch64::LDPWi:
int Value =
MI->getOperand(isPairedLdSt(MI) ? 3 : 2).getImm() * getMemScale(MI);
- // FIXME: The immediate in the load/store should be scaled by the size of
- // the memory operation, not the size of the register being loaded/stored.
- // This works in general, but does not work for the LDPSW instruction,
- // which defines two 64-bit registers, but loads 32-bit values.
-
// Look forward to try to find a post-index instruction. For example,
// ldr x1, [x0, #64]
// add x0, x0, #64
%tmp3 = add i64 %sexttmp1, %sexttmp2
ret i64 %tmp3
}
+
+declare void @use-ptr(i32*)
+
+; CHECK: ldp_sext_int_pre
+; CHECK: ldpsw x{{[0-9]+}}, x{{[0-9]+}}, [x0, #8]
+define i64 @ldp_sext_int_pre(i32* %p) nounwind {
+ %ptr = getelementptr inbounds i32, i32* %p, i64 2
+ call void @use-ptr(i32* %ptr)
+ %add.ptr = getelementptr inbounds i32, i32* %ptr, i64 0
+ %tmp = load i32, i32* %add.ptr, align 4
+ %add.ptr1 = getelementptr inbounds i32, i32* %ptr, i64 1
+ %tmp1 = load i32, i32* %add.ptr1, align 4
+ %sexttmp = sext i32 %tmp to i64
+ %sexttmp1 = sext i32 %tmp1 to i64
+ %add = add nsw i64 %sexttmp1, %sexttmp
+ ret i64 %add
+}
+
+; CHECK: ldp_sext_int_post
+; CHECK: ldpsw x{{[0-9]+}}, x{{[0-9]+}}, [x0], #8
+define i64 @ldp_sext_int_post(i32* %p) nounwind {
+ %tmp = load i32, i32* %p, align 4
+ %add.ptr = getelementptr inbounds i32, i32* %p, i64 1
+ %tmp1 = load i32, i32* %add.ptr, align 4
+ %sexttmp = sext i32 %tmp to i64
+ %sexttmp1 = sext i32 %tmp1 to i64
+ %ptr = getelementptr inbounds i32, i32* %add.ptr, i64 1
+ call void @use-ptr(i32* %ptr)
+ %add = add nsw i64 %sexttmp1, %sexttmp
+ ret i64 %add
+}