Author: Ting Wang
Date: 2022-10-13T22:57:40-04:00
New Revision: 00b9bed1f05a72962643f8a41d30256c55bd19f5

URL: 
https://github.com/llvm/llvm-project/commit/00b9bed1f05a72962643f8a41d30256c55bd19f5
DIFF: 
https://github.com/llvm/llvm-project/commit/00b9bed1f05a72962643f8a41d30256c55bd19f5.diff

LOG: [clang][PowerPC][NFC] Add base test case for PPC64 VAArg aggregate smaller 
than a slot

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D133488

Added: 
    

Modified: 
    clang/test/CodeGen/PowerPC/ppc64-align-struct.c

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/PowerPC/ppc64-align-struct.c 
b/clang/test/CodeGen/PowerPC/ppc64-align-struct.c
index ab179e3654010..273b187483bde 100644
--- a/clang/test/CodeGen/PowerPC/ppc64-align-struct.c
+++ b/clang/test/CodeGen/PowerPC/ppc64-align-struct.c
@@ -9,6 +9,8 @@ struct test4 { int x; int y; int z; };
 struct test5 { int x[17]; };
 struct test6 { int x[17]; } __attribute__((aligned (16)));
 struct test7 { int x[17]; } __attribute__((aligned (32)));
+struct test8 { char x; };
+struct test9 { _Complex char x; };
 
 // CHECK: define{{.*}} void @test1(i32 noundef signext %x, i64 %y.coerce)
 void test1 (int x, struct test1 y)
@@ -48,6 +50,16 @@ void test7 (int x, struct test7 y)
 {
 }
 
+// CHECK: define{{.*}} void @test8(i32 noundef signext %x, i8 %y.coerce)
+void test8 (int x, struct test8 y)
+{
+}
+
+// CHECK: define{{.*}} void @test9(i32 noundef signext %x, i16 %y.coerce)
+void test9 (int x, struct test9 y)
+{
+}
+
 // CHECK: define{{.*}} void @test1va(ptr noalias sret(%struct.test1) align 4 
%[[AGG_RESULT:.*]], i32 noundef signext %x, ...)
 // CHECK: %[[CUR:[^ ]+]] = load ptr, ptr %ap
 // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i64 8
@@ -116,6 +128,38 @@ struct test4 test4va (int x, ...)
   return y;
 }
 
+// Error pattern will be fixed in https://reviews.llvm.org/D133338
+// CHECK: define{{.*}} void @test8va(ptr noalias sret(%struct.test8) align 1 
%[[AGG_RESULT:.*]], i32 noundef signext %x, ...)
+// CHECK: %[[CUR:[^ ]+]] = load ptr, ptr %ap
+// CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i64 8
+// CHECK: store ptr %[[NEXT]], ptr %ap
+// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %[[AGG_RESULT]], ptr 
align 8 %[[CUR]], i64 1, i1 false)
+struct test8 test8va (int x, ...)
+{
+  struct test8 y;
+  va_list ap;
+  va_start(ap, x);
+  y = va_arg (ap, struct test8);
+  va_end(ap);
+  return y;
+}
+
+// Error pattern will be fixed in https://reviews.llvm.org/D133338
+// CHECK: define{{.*}} void @test9va(ptr noalias sret(%struct.test9) align 1 
%[[AGG_RESULT:.*]], i32 noundef signext %x, ...)
+// CHECK: %[[CUR:[^ ]+]] = load ptr, ptr %ap
+// CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i64 8
+// CHECK: store ptr %[[NEXT]], ptr %ap
+// CHECK: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %[[AGG_RESULT]], ptr 
align 8 %[[CUR]], i64 2, i1 false)
+struct test9 test9va (int x, ...)
+{
+  struct test9 y;
+  va_list ap;
+  va_start(ap, x);
+  y = va_arg (ap, struct test9);
+  va_end(ap);
+  return y;
+}
+
 // CHECK: define{{.*}} void @testva_longdouble(ptr noalias 
sret(%struct.test_longdouble) align 16 %[[AGG_RESULT:.*]], i32 noundef signext 
%x, ...)
 // CHECK: %[[CUR:[^ ]+]] = load ptr, ptr %ap
 // CHECK: %[[NEXT:[^ ]+]] = getelementptr inbounds i8, ptr %[[CUR]], i64 16


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to