================
@@ -0,0 +1,35 @@
+;; Check if manually reserved EDI is always excluded from being saved by the
+;; function prolog/epilog, as per GCC behavior, and that REP MOVS/STOS are not
+;; selected when EDI is reserved on x86-32.
+
+; RUN: llc < %s -mtriple=i386-unknown-linux-gnu -verify-machineinstrs | 
FileCheck %s
+
+declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture 
readonly, i32, i1 immarg)
+declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1 immarg)
+
+define void @tedi() "target-features"="+reserve-edi" {
+; CHECK-LABEL: tedi:
+; CHECK: # %bb.0:
+; CHECK-NOT:        pushl   %edi
+; CHECK-NEXT:        movl    $256, %edi
+; CHECK-NEXT:        #APP
+; CHECK-NEXT:        #NO_APP
+; CHECK-NOT:        popl    %edi
+; CHECK-NEXT:        retl
+  call i32 asm sideeffect "", "={edi},{edi}"(i32 256)
+  ret void
+}
+
+define void @copy_reserved_edi(ptr %dst, ptr %src) minsize 
"target-features"="+reserve-edi" {
+; CHECK-LABEL: copy_reserved_edi:
+; CHECK-NOT:        rep;movs
+  call void @llvm.memcpy.p0.p0.i32(ptr align 4 %dst, ptr align 4 %src, i32 
128, i1 false)
+  ret void
+}
+
+define void @set_reserved_edi(ptr %dst) minsize 
"target-features"="+reserve-edi" {
+; CHECK-LABEL: set_reserved_edi:
+; CHECK-NOT:        rep;stos
----------------
efriedma-quic wrote:

I'd like to see a positive test showing that we do generate rep;stos when EDI 
is not reserved, so this doesn't bitrot.

https://github.com/llvm/llvm-project/pull/186123
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to