[llvm] r328929 - [X86] Add test case to show failure to promote i16 subtract when the LHS is a load and the result is stored to a different address.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 31 23:29:27 PDT 2018
Author: ctopper
Date: Sat Mar 31 23:29:27 2018
New Revision: 328929
URL: http://llvm.org/viewvc/llvm-project?rev=328929&view=rev
Log:
[X86] Add test case to show failure to promote i16 subtract when the LHS is a load and the result is stored to a different address.
We mistakenly believe we might be able to fold this as a RMW operation, but that doesn't end up happening.
Modified:
llvm/trunk/test/CodeGen/X86/promote-i16.ll
Modified: llvm/trunk/test/CodeGen/X86/promote-i16.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/promote-i16.ll?rev=328929&r1=328928&r2=328929&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/promote-i16.ll (original)
+++ llvm/trunk/test/CodeGen/X86/promote-i16.ll Sat Mar 31 23:29:27 2018
@@ -57,3 +57,26 @@ entry:
%sub = sub i16 %0, %y
ret i16 %sub
}
+
+define void @bat(i16* %a, i16* %x, i16 signext %y) nounwind {
+; X86-LABEL: bat:
+; X86: # %bb.0: # %entry
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT: movzwl (%ecx), %ecx
+; X86-NEXT: subw {{[0-9]+}}(%esp), %cx
+; X86-NEXT: movw %cx, (%eax)
+; X86-NEXT: retl
+;
+; X64-LABEL: bat:
+; X64: # %bb.0: # %entry
+; X64-NEXT: movzwl (%rsi), %eax
+; X64-NEXT: subw %dx, %ax
+; X64-NEXT: movw %ax, (%rdi)
+; X64-NEXT: retq
+entry:
+ %0 = load i16, i16* %x
+ %sub = sub i16 %0, %y
+ store i16 %sub, i16* %a
+ ret void
+}
More information about the llvm-commits
mailing list