This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGe4902e69e99d: [PowerPC] Fix return type of XL compat CAS (authored by lkail).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D107077/new/ https://reviews.llvm.org/D107077 Files: clang/lib/CodeGen/CGBuiltin.cpp clang/test/CodeGen/builtins-ppc-xlcompat-cas.c Index: clang/test/CodeGen/builtins-ppc-xlcompat-cas.c =================================================================== --- clang/test/CodeGen/builtins-ppc-xlcompat-cas.c +++ clang/test/CodeGen/builtins-ppc-xlcompat-cas.c @@ -20,10 +20,11 @@ // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP2]], 0 // CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP2]], 1 // CHECK-NEXT: store i32 [[TMP3]], i32* [[B_ADDR]], align 4 -// CHECK-NEXT: ret void +// CHECK-NEXT: [[TMP5:%.*]] = zext i1 [[TMP4]] to i32 +// CHECK-NEXT: ret i32 [[TMP5]] // -void test_builtin_ppc_compare_and_swap(int a, int b, int c) { - __compare_and_swap(&a, &b, c); +int test_builtin_ppc_compare_and_swap(int a, int b, int c) { + return __compare_and_swap(&a, &b, c); } @@ -41,9 +42,10 @@ // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP2]], 0 // CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i64, i1 } [[TMP2]], 1 // CHECK-NEXT: store i64 [[TMP3]], i64* [[B_ADDR]], align 8 -// CHECK-NEXT: ret void +// CHECK-NEXT: [[TMP5:%.*]] = zext i1 [[TMP4]] to i32 +// CHECK-NEXT: ret i32 [[TMP5]] // -void test_builtin_ppc_compare_and_swaplp(long a, long b, long c) { - __compare_and_swaplp(&a, &b, c); +int test_builtin_ppc_compare_and_swaplp(long a, long b, long c) { + return __compare_and_swaplp(&a, &b, c); } Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -15808,7 +15808,7 @@ // store. Value *LoadedVal = Pair.first.getScalarVal(); Builder.CreateStore(LoadedVal, OldValAddr); - return Pair.second; + return Builder.CreateZExt(Pair.second, Builder.getInt32Ty()); } case PPC::BI__builtin_ppc_fetch_and_add: case PPC::BI__builtin_ppc_fetch_and_addlp: {
Index: clang/test/CodeGen/builtins-ppc-xlcompat-cas.c =================================================================== --- clang/test/CodeGen/builtins-ppc-xlcompat-cas.c +++ clang/test/CodeGen/builtins-ppc-xlcompat-cas.c @@ -20,10 +20,11 @@ // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP2]], 0 // CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP2]], 1 // CHECK-NEXT: store i32 [[TMP3]], i32* [[B_ADDR]], align 4 -// CHECK-NEXT: ret void +// CHECK-NEXT: [[TMP5:%.*]] = zext i1 [[TMP4]] to i32 +// CHECK-NEXT: ret i32 [[TMP5]] // -void test_builtin_ppc_compare_and_swap(int a, int b, int c) { - __compare_and_swap(&a, &b, c); +int test_builtin_ppc_compare_and_swap(int a, int b, int c) { + return __compare_and_swap(&a, &b, c); } @@ -41,9 +42,10 @@ // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i64, i1 } [[TMP2]], 0 // CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i64, i1 } [[TMP2]], 1 // CHECK-NEXT: store i64 [[TMP3]], i64* [[B_ADDR]], align 8 -// CHECK-NEXT: ret void +// CHECK-NEXT: [[TMP5:%.*]] = zext i1 [[TMP4]] to i32 +// CHECK-NEXT: ret i32 [[TMP5]] // -void test_builtin_ppc_compare_and_swaplp(long a, long b, long c) { - __compare_and_swaplp(&a, &b, c); +int test_builtin_ppc_compare_and_swaplp(long a, long b, long c) { + return __compare_and_swaplp(&a, &b, c); } Index: clang/lib/CodeGen/CGBuiltin.cpp =================================================================== --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -15808,7 +15808,7 @@ // store. Value *LoadedVal = Pair.first.getScalarVal(); Builder.CreateStore(LoadedVal, OldValAddr); - return Pair.second; + return Builder.CreateZExt(Pair.second, Builder.getInt32Ty()); } case PPC::BI__builtin_ppc_fetch_and_add: case PPC::BI__builtin_ppc_fetch_and_addlp: {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits