aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2025-06-04 08:13:13 +0100
committerSimon Pilgrim <llvm-dev@redking.me.uk>2025-06-04 08:20:05 +0100
commite8b0a16f0c0126555fbb4062c715b59e3e5e727b (patch)
treeb5a7c64b460503d813bb09743af659d0d02946b7
parent4b6c608615a285d81132acf8e33b81b2ec2c9bf9 (diff)
downloadllvm-e8b0a16f0c0126555fbb4062c715b59e3e5e727b.zip
llvm-e8b0a16f0c0126555fbb4062c715b59e3e5e727b.tar.gz
llvm-e8b0a16f0c0126555fbb4062c715b59e3e5e727b.tar.bz2
[X86] Add test coverage for #55714
-rw-r--r--llvm/test/CodeGen/X86/addr-mode-matcher-3.ll45
1 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/addr-mode-matcher-3.ll b/llvm/test/CodeGen/X86/addr-mode-matcher-3.ll
index 0c7275e..522b42e 100644
--- a/llvm/test/CodeGen/X86/addr-mode-matcher-3.ll
+++ b/llvm/test/CodeGen/X86/addr-mode-matcher-3.ll
@@ -98,3 +98,48 @@ define i64 @add_shl_zext(ptr %ptr, i8 %arg) nounwind {
%sum = add i64 %val, %shl
ret i64 %sum
}
+
+define i32 @PR55714_i32(i32 %n, i32 %q) {
+; X86-LABEL: PR55714_i32:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: leal (,%ecx,8), %eax
+; X86-NEXT: subl %ecx, %eax
+; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: retl
+;
+; X64-LABEL: PR55714_i32:
+; X64: # %bb.0:
+; X64-NEXT: # kill: def $esi killed $esi def $rsi
+; X64-NEXT: leal (,%rsi,8), %eax
+; X64-NEXT: subl %esi, %eax
+; X64-NEXT: addl %edi, %eax
+; X64-NEXT: retq
+ %mul = mul i32 %q, 7
+ %add = add i32 %mul, %n
+ ret i32 %add
+}
+
+define i64 @PR55714_i64(i64 %n, i64 %q) {
+; X86-LABEL: PR55714_i64:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: leal (,%eax,8), %ecx
+; X86-NEXT: subl %eax, %ecx
+; X86-NEXT: movl $7, %eax
+; X86-NEXT: mull {{[0-9]+}}(%esp)
+; X86-NEXT: addl %ecx, %edx
+; X86-NEXT: addl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: adcl {{[0-9]+}}(%esp), %edx
+; X86-NEXT: retl
+;
+; X64-LABEL: PR55714_i64:
+; X64: # %bb.0:
+; X64-NEXT: leaq (,%rsi,8), %rax
+; X64-NEXT: subq %rsi, %rax
+; X64-NEXT: addq %rdi, %rax
+; X64-NEXT: retq
+ %mul = mul i64 %q, 7
+ %add = add i64 %mul, %n
+ ret i64 %add
+}