-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[NFC][PowerPC] Pre-commit adding test case: use millicode for strcpy #174243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-backend-powerpc Author: zhijian lin (diggerlin) Changesadd test case to test lib call are used for the ___strcpy milicode. Full diff: https://github.com/llvm/llvm-project/pull/174243.diff 2 Files Affected:
diff --git a/llvm/test/CodeGen/PowerPC/milicode32.ll b/llvm/test/CodeGen/PowerPC/milicode32.ll
index b69b997254d2c..17261642f0040 100644
--- a/llvm/test/CodeGen/PowerPC/milicode32.ll
+++ b/llvm/test/CodeGen/PowerPC/milicode32.ll
@@ -159,3 +159,46 @@ entry:
}
declare void @llvm.memmove.p0.p0.i32(ptr writeonly captures(none), ptr readonly captures(none), i32, i1 immarg)
+
+define void @copy_string(ptr noundef %dest, ptr noundef %src) {
+; CHECK-AIX-32-P9-LABEL: copy_string:
+; CHECK-AIX-32-P9: # %bb.0: # %entry
+; CHECK-AIX-32-P9-NEXT: mflr r0
+; CHECK-AIX-32-P9-NEXT: stwu r1, -80(r1)
+; CHECK-AIX-32-P9-NEXT: stw r0, 88(r1)
+; CHECK-AIX-32-P9-NEXT: stw r3, 72(r1)
+; CHECK-AIX-32-P9-NEXT: stw r4, 64(r1)
+; CHECK-AIX-32-P9-NEXT: bl .strcpy[PR]
+; CHECK-AIX-32-P9-NEXT: nop
+; CHECK-AIX-32-P9-NEXT: addi r1, r1, 80
+; CHECK-AIX-32-P9-NEXT: lwz r0, 8(r1)
+; CHECK-AIX-32-P9-NEXT: mtlr r0
+; CHECK-AIX-32-P9-NEXT: blr
+;
+; CHECK-LINUX32-P9-LABEL: copy_string:
+; CHECK-LINUX32-P9: # %bb.0: # %entry
+; CHECK-LINUX32-P9-NEXT: mflr r0
+; CHECK-LINUX32-P9-NEXT: stwu r1, -32(r1)
+; CHECK-LINUX32-P9-NEXT: stw r0, 36(r1)
+; CHECK-LINUX32-P9-NEXT: .cfi_def_cfa_offset 32
+; CHECK-LINUX32-P9-NEXT: .cfi_offset lr, 4
+; CHECK-LINUX32-P9-NEXT: stw r3, 24(r1)
+; CHECK-LINUX32-P9-NEXT: stw r4, 16(r1)
+; CHECK-LINUX32-P9-NEXT: bl strcpy
+; CHECK-LINUX32-P9-NEXT: lwz r0, 36(r1)
+; CHECK-LINUX32-P9-NEXT: addi r1, r1, 32
+; CHECK-LINUX32-P9-NEXT: mtlr r0
+; CHECK-LINUX32-P9-NEXT: blr
+entry:
+ %dest.addr = alloca ptr, align 8
+ %src.addr = alloca ptr, align 8
+ store ptr %dest, ptr %dest.addr, align 8
+ store ptr %src, ptr %src.addr, align 8
+ %0 = load ptr, ptr %dest.addr, align 8
+ %1 = load ptr, ptr %src.addr, align 8
+ %call = call ptr @strcpy(ptr noundef %0, ptr noundef %1)
+ ret void
+}
+
+
+declare ptr @strcpy(ptr noundef, ptr noundef)
diff --git a/llvm/test/CodeGen/PowerPC/milicode64.ll b/llvm/test/CodeGen/PowerPC/milicode64.ll
index 2dbf4140a0fa4..7d51f177f98bb 100644
--- a/llvm/test/CodeGen/PowerPC/milicode64.ll
+++ b/llvm/test/CodeGen/PowerPC/milicode64.ll
@@ -179,3 +179,63 @@ entry:
}
declare void @llvm.memmove.p0.p0.i32(ptr writeonly captures(none), ptr readonly captures(none), i32, i1 immarg)
+
+define dso_local void @copy_string(ptr noundef %dest, ptr noundef %src) {
+; CHECK-LE-P9-LABEL: copy_string:
+; CHECK-LE-P9: # %bb.0: # %entry
+; CHECK-LE-P9-NEXT: mflr r0
+; CHECK-LE-P9-NEXT: stdu r1, -48(r1)
+; CHECK-LE-P9-NEXT: std r0, 64(r1)
+; CHECK-LE-P9-NEXT: .cfi_def_cfa_offset 48
+; CHECK-LE-P9-NEXT: .cfi_offset lr, 16
+; CHECK-LE-P9-NEXT: std r3, 40(r1)
+; CHECK-LE-P9-NEXT: std r4, 32(r1)
+; CHECK-LE-P9-NEXT: bl strcpy
+; CHECK-LE-P9-NEXT: nop
+; CHECK-LE-P9-NEXT: addi r1, r1, 48
+; CHECK-LE-P9-NEXT: ld r0, 16(r1)
+; CHECK-LE-P9-NEXT: mtlr r0
+; CHECK-LE-P9-NEXT: blr
+;
+; CHECK-BE-P9-LABEL: copy_string:
+; CHECK-BE-P9: # %bb.0: # %entry
+; CHECK-BE-P9-NEXT: mflr r0
+; CHECK-BE-P9-NEXT: stdu r1, -128(r1)
+; CHECK-BE-P9-NEXT: std r0, 144(r1)
+; CHECK-BE-P9-NEXT: .cfi_def_cfa_offset 128
+; CHECK-BE-P9-NEXT: .cfi_offset lr, 16
+; CHECK-BE-P9-NEXT: std r3, 120(r1)
+; CHECK-BE-P9-NEXT: std r4, 112(r1)
+; CHECK-BE-P9-NEXT: bl strcpy
+; CHECK-BE-P9-NEXT: nop
+; CHECK-BE-P9-NEXT: addi r1, r1, 128
+; CHECK-BE-P9-NEXT: ld r0, 16(r1)
+; CHECK-BE-P9-NEXT: mtlr r0
+; CHECK-BE-P9-NEXT: blr
+;
+; CHECK-AIX-64-P9-LABEL: copy_string:
+; CHECK-AIX-64-P9: # %bb.0: # %entry
+; CHECK-AIX-64-P9-NEXT: mflr r0
+; CHECK-AIX-64-P9-NEXT: stdu r1, -128(r1)
+; CHECK-AIX-64-P9-NEXT: std r0, 144(r1)
+; CHECK-AIX-64-P9-NEXT: std r3, 120(r1)
+; CHECK-AIX-64-P9-NEXT: std r4, 112(r1)
+; CHECK-AIX-64-P9-NEXT: bl .strcpy[PR]
+; CHECK-AIX-64-P9-NEXT: nop
+; CHECK-AIX-64-P9-NEXT: addi r1, r1, 128
+; CHECK-AIX-64-P9-NEXT: ld r0, 16(r1)
+; CHECK-AIX-64-P9-NEXT: mtlr r0
+; CHECK-AIX-64-P9-NEXT: blr
+entry:
+ %dest.addr = alloca ptr, align 8
+ %src.addr = alloca ptr, align 8
+ store ptr %dest, ptr %dest.addr, align 8
+ store ptr %src, ptr %src.addr, align 8
+ %0 = load ptr, ptr %dest.addr, align 8
+ %1 = load ptr, ptr %src.addr, align 8
+ %call = call ptr @strcpy(ptr noundef %0, ptr noundef %1)
+ ret void
+}
+
+
+declare ptr @strcpy(ptr noundef, ptr noundef)
|
|
|
||
| declare void @llvm.memmove.p0.p0.i32(ptr writeonly captures(none), ptr readonly captures(none), i32, i1 immarg) | ||
|
|
||
| define void @copy_string(ptr noundef %dest, ptr noundef %src) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this function to strcpy_test and and the nounwind attribute to suppress the CFI stuff.
|
|
||
| declare void @llvm.memmove.p0.p0.i32(ptr writeonly captures(none), ptr readonly captures(none), i32, i1 immarg) | ||
|
|
||
| define dso_local void @copy_string(ptr noundef %dest, ptr noundef %src) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
RolandF77
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/129/builds/35936 Here is the relevant piece of the build log for the reference |
add test case to test lib call are used for the ___strcpy milicode.