From e316f762227846bb2eb8b68c17392a1b2bf073cc Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Mon, 8 Feb 2016 19:33:18 +0000 Subject: AArch64: match correct order in subtraction pattern. The accumulator in multiply-and-subtract instructions is actually subtracted *from* so these patterns were computing the wrong value. llvm-svn: 260131 --- llvm/test/CodeGen/AArch64/arm64-mul.ll | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'llvm/test/CodeGen') diff --git a/llvm/test/CodeGen/AArch64/arm64-mul.ll b/llvm/test/CodeGen/AArch64/arm64-mul.ll index 99924d8b794..a424dc761bc 100644 --- a/llvm/test/CodeGen/AArch64/arm64-mul.ll +++ b/llvm/test/CodeGen/AArch64/arm64-mul.ll @@ -137,6 +137,16 @@ entry: ; CHECK: umsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}} %tmp1 = zext i32 %a to i64 %tmp3 = mul i64 %tmp1, 12345678 - %tmp4 = sub i64 %tmp3, %b + %tmp4 = sub i64 %b, %tmp3 + ret i64 %tmp4 +} + +define i64 @t14(i32 %a, i64 %b) nounwind { +entry: +; CHECK-LABEL: t14: +; CHECK: smsubl {{x[0-9]+}}, {{w[0-9]+}}, {{w[0-9]+}}, {{x[0-9]+}} + %tmp1 = sext i32 %a to i64 + %tmp3 = mul i64 %tmp1, -12345678 + %tmp4 = sub i64 %b, %tmp3 ret i64 %tmp4 } -- cgit v1.2.3