From 1013967436694f362097a7c12f675c0ad7de90b7 Mon Sep 17 00:00:00 2001 From: Nemanja Ivanovic Date: Tue, 31 May 2022 21:49:28 -0500 Subject: [PATCH] [PowerPC] Remove const from paired vector store builtins For some reason, we implemented the xx_stxvp intrinsics to require a const pointer. This absolutely doesn't make sense for a store. Remove the const from the definition. --- clang/include/clang/Basic/BuiltinsPPC.def | 4 +-- .../CodeGen/PowerPC/builtins-ppc-pair-mma.c | 28 +++++++++---------- clang/test/Sema/ppc-mma-builtins.c | 2 +- clang/test/Sema/ppc-pair-mma-types.c | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsPPC.def b/clang/include/clang/Basic/BuiltinsPPC.def index 923215cc3e5d..04934ec2b9e1 100644 --- a/clang/include/clang/Basic/BuiltinsPPC.def +++ b/clang/include/clang/Basic/BuiltinsPPC.def @@ -843,7 +843,7 @@ BUILTIN(__builtin_dcbf, "vvC*", "") // Provided builtins with _mma_ prefix for compatibility. CUSTOM_BUILTIN(mma_lxvp, vsx_lxvp, "W256SLiW256C*", false) -CUSTOM_BUILTIN(mma_stxvp, vsx_stxvp, "vW256SLiW256C*", false) +CUSTOM_BUILTIN(mma_stxvp, vsx_stxvp, "vW256SLiW256*", false) CUSTOM_BUILTIN(mma_assemble_pair, vsx_assemble_pair, "vW256*VV", false) CUSTOM_BUILTIN(mma_disassemble_pair, vsx_disassemble_pair, "vv*W256*", false) CUSTOM_BUILTIN(vsx_build_pair, vsx_assemble_pair, "vW256*VV", false) @@ -855,7 +855,7 @@ CUSTOM_BUILTIN(mma_build_acc, mma_assemble_acc, "vW512*VVVV", false) // This avoids repeating the ID and INTR in the macro expression. UNALIASED_CUSTOM_BUILTIN(vsx_lxvp, "W256SLiW256C*", false) -UNALIASED_CUSTOM_BUILTIN(vsx_stxvp, "vW256SLiW256C*", false) +UNALIASED_CUSTOM_BUILTIN(vsx_stxvp, "vW256SLiW256*", false) UNALIASED_CUSTOM_BUILTIN(vsx_assemble_pair, "vW256*VV", false) UNALIASED_CUSTOM_BUILTIN(vsx_disassemble_pair, "vv*W256*", false) diff --git a/clang/test/CodeGen/PowerPC/builtins-ppc-pair-mma.c b/clang/test/CodeGen/PowerPC/builtins-ppc-pair-mma.c index 72867007afdd..f7811a4d1129 100644 --- a/clang/test/CodeGen/PowerPC/builtins-ppc-pair-mma.c +++ b/clang/test/CodeGen/PowerPC/builtins-ppc-pair-mma.c @@ -1048,7 +1048,7 @@ void test65(unsigned char *vqp, unsigned char *vpp, vector unsigned char vc, uns // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP1]], i8* [[TMP2]]) // CHECK-NEXT: ret void // -void test66(const __vector_pair *vpp, const __vector_pair *vp2) { +void test66(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(0L, vpp); __builtin_vsx_stxvp(vp, 0L, vp2); } @@ -1063,7 +1063,7 @@ void test66(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test67(const __vector_pair *vpp, signed long offset, const __vector_pair *vp2) { +void test67(const __vector_pair *vpp, signed long offset, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(offset, vpp); __builtin_vsx_stxvp(vp, offset, vp2); } @@ -1078,7 +1078,7 @@ void test67(const __vector_pair *vpp, signed long offset, const __vector_pair *v // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test68(const __vector_pair *vpp, const __vector_pair *vp2) { +void test68(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(18L, vpp); __builtin_vsx_stxvp(vp, 18L, vp2); } @@ -1093,7 +1093,7 @@ void test68(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test69(const __vector_pair *vpp, const __vector_pair *vp2) { +void test69(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(1L, vpp); __builtin_vsx_stxvp(vp, 1L, vp2); } @@ -1108,7 +1108,7 @@ void test69(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test70(const __vector_pair *vpp, const __vector_pair *vp2) { +void test70(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(42L, vpp); __builtin_vsx_stxvp(vp, 42L, vp2); } @@ -1123,7 +1123,7 @@ void test70(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test71(const __vector_pair *vpp, const __vector_pair *vp2) { +void test71(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(32768L, vpp); __builtin_vsx_stxvp(vp, 32768L, vp2); } @@ -1138,7 +1138,7 @@ void test71(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test72(const __vector_pair *vpp, const __vector_pair *vp2) { +void test72(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(32799L, vpp); __builtin_vsx_stxvp(vp, 32799L, vp2); } @@ -1240,7 +1240,7 @@ void test77(unsigned char *vqp, unsigned char *vpp, vector unsigned char vc, uns // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP1]], i8* [[TMP2]]) // CHECK-NEXT: ret void // -void test78(const __vector_pair *vpp, const __vector_pair *vp2) { +void test78(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_mma_lxvp(0L, vpp); __builtin_mma_stxvp(vp, 0L, vp2); } @@ -1255,7 +1255,7 @@ void test78(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test79(const __vector_pair *vpp, signed long offset, const __vector_pair *vp2) { +void test79(const __vector_pair *vpp, signed long offset, __vector_pair *vp2) { __vector_pair vp = __builtin_mma_lxvp(offset, vpp); __builtin_mma_stxvp(vp, offset, vp2); } @@ -1270,7 +1270,7 @@ void test79(const __vector_pair *vpp, signed long offset, const __vector_pair *v // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test80(const __vector_pair *vpp, const __vector_pair *vp2) { +void test80(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_mma_lxvp(18L, vpp); __builtin_mma_stxvp(vp, 18L, vp2); } @@ -1285,7 +1285,7 @@ void test80(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test81(const __vector_pair *vpp, const __vector_pair *vp2) { +void test81(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_mma_lxvp(1L, vpp); __builtin_mma_stxvp(vp, 1L, vp2); } @@ -1300,7 +1300,7 @@ void test81(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test82(const __vector_pair *vpp, const __vector_pair *vp2) { +void test82(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_mma_lxvp(42L, vpp); __builtin_mma_stxvp(vp, 42L, vp2); } @@ -1315,7 +1315,7 @@ void test82(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test83(const __vector_pair *vpp, const __vector_pair *vp2) { +void test83(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_mma_lxvp(32768L, vpp); __builtin_mma_stxvp(vp, 32768L, vp2); } @@ -1330,7 +1330,7 @@ void test83(const __vector_pair *vpp, const __vector_pair *vp2) { // CHECK-NEXT: tail call void @llvm.ppc.vsx.stxvp(<256 x i1> [[TMP2]], i8* [[TMP4]]) // CHECK-NEXT: ret void // -void test84(const __vector_pair *vpp, const __vector_pair *vp2) { +void test84(const __vector_pair *vpp, __vector_pair *vp2) { __vector_pair vp = __builtin_mma_lxvp(32799L, vpp); __builtin_mma_stxvp(vp, 32799L, vp2); } diff --git a/clang/test/Sema/ppc-mma-builtins.c b/clang/test/Sema/ppc-mma-builtins.c index 66cb54266f6c..20d779557d28 100644 --- a/clang/test/Sema/ppc-mma-builtins.c +++ b/clang/test/Sema/ppc-mma-builtins.c @@ -11,7 +11,7 @@ void test2(unsigned char *vqp, unsigned char *vpp, vector unsigned char vc, unsi __builtin_vsx_disassemble_pair(resp, (__vector_pair*)vpp); } -void test3(const __vector_pair *vpp, signed long offset, const __vector_pair *vp2) { +void test3(const __vector_pair *vpp, signed long offset, __vector_pair *vp2) { __vector_pair vp = __builtin_vsx_lxvp(offset, vpp); __builtin_vsx_stxvp(vp, offset, vp2); } diff --git a/clang/test/Sema/ppc-pair-mma-types.c b/clang/test/Sema/ppc-pair-mma-types.c index 293688d49813..6a7cfac03105 100644 --- a/clang/test/Sema/ppc-pair-mma-types.c +++ b/clang/test/Sema/ppc-pair-mma-types.c @@ -209,7 +209,7 @@ void testBuiltinTypes2(__vector_pair *vpp, const __vector_pair *vp2, unsigned ch void testBuiltinTypes3(vector int v, __vector_pair *vp2, signed long l, unsigned short s) { __vector_pair vp = __builtin_vsx_lxvp(l, v); // expected-error {{passing '__vector int' (vector of 4 'int' values) to parameter of incompatible type 'const __vector_pair *'}} - __builtin_vsx_stxvp(vp, l, s); // expected-error {{passing 'unsigned short' to parameter of incompatible type 'const __vector_pair *'}} + __builtin_vsx_stxvp(vp, l, s); // expected-error {{passing 'unsigned short' to parameter of incompatible type '__vector_pair *'}} } void testRestrictQualifiedPointer1(int *__restrict acc) {