Skip to content

Commit 752c21b

Browse files
authored
[clang][NFC] Reorder Atomic builtins to be consistent. (#72718)
1 parent 6a082ed commit 752c21b

File tree

1 file changed

+83
-83
lines changed

1 file changed

+83
-83
lines changed

clang/lib/CodeGen/CGAtomic.cpp

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -861,10 +861,10 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
861861
case AtomicExpr::AO__opencl_atomic_init:
862862
llvm_unreachable("Already handled above with EmitAtomicInit!");
863863

864+
case AtomicExpr::AO__atomic_load_n:
864865
case AtomicExpr::AO__c11_atomic_load:
865866
case AtomicExpr::AO__opencl_atomic_load:
866867
case AtomicExpr::AO__hip_atomic_load:
867-
case AtomicExpr::AO__atomic_load_n:
868868
break;
869869

870870
case AtomicExpr::AO__atomic_load:
@@ -880,14 +880,14 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
880880
Dest = EmitPointerWithAlignment(E->getVal2());
881881
break;
882882

883-
case AtomicExpr::AO__c11_atomic_compare_exchange_strong:
883+
case AtomicExpr::AO__atomic_compare_exchange:
884+
case AtomicExpr::AO__atomic_compare_exchange_n:
884885
case AtomicExpr::AO__c11_atomic_compare_exchange_weak:
885-
case AtomicExpr::AO__opencl_atomic_compare_exchange_strong:
886+
case AtomicExpr::AO__c11_atomic_compare_exchange_strong:
887+
case AtomicExpr::AO__hip_atomic_compare_exchange_weak:
886888
case AtomicExpr::AO__hip_atomic_compare_exchange_strong:
887889
case AtomicExpr::AO__opencl_atomic_compare_exchange_weak:
888-
case AtomicExpr::AO__hip_atomic_compare_exchange_weak:
889-
case AtomicExpr::AO__atomic_compare_exchange_n:
890-
case AtomicExpr::AO__atomic_compare_exchange:
890+
case AtomicExpr::AO__opencl_atomic_compare_exchange_strong:
891891
Val1 = EmitPointerWithAlignment(E->getVal1());
892892
if (E->getOp() == AtomicExpr::AO__atomic_compare_exchange)
893893
Val2 = EmitPointerWithAlignment(E->getVal2());
@@ -938,32 +938,32 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
938938
ShouldCastToIntPtrTy = !MemTy->isFloatingType();
939939
[[fallthrough]];
940940

941-
case AtomicExpr::AO__c11_atomic_store:
942-
case AtomicExpr::AO__c11_atomic_exchange:
943-
case AtomicExpr::AO__opencl_atomic_store:
944-
case AtomicExpr::AO__hip_atomic_store:
945-
case AtomicExpr::AO__opencl_atomic_exchange:
946-
case AtomicExpr::AO__hip_atomic_exchange:
941+
case AtomicExpr::AO__atomic_fetch_and:
942+
case AtomicExpr::AO__atomic_fetch_nand:
943+
case AtomicExpr::AO__atomic_fetch_or:
944+
case AtomicExpr::AO__atomic_fetch_xor:
945+
case AtomicExpr::AO__atomic_and_fetch:
946+
case AtomicExpr::AO__atomic_nand_fetch:
947+
case AtomicExpr::AO__atomic_or_fetch:
948+
case AtomicExpr::AO__atomic_xor_fetch:
947949
case AtomicExpr::AO__atomic_store_n:
948950
case AtomicExpr::AO__atomic_exchange_n:
949951
case AtomicExpr::AO__c11_atomic_fetch_and:
952+
case AtomicExpr::AO__c11_atomic_fetch_nand:
950953
case AtomicExpr::AO__c11_atomic_fetch_or:
951954
case AtomicExpr::AO__c11_atomic_fetch_xor:
952-
case AtomicExpr::AO__c11_atomic_fetch_nand:
953-
case AtomicExpr::AO__opencl_atomic_fetch_and:
954-
case AtomicExpr::AO__opencl_atomic_fetch_or:
955-
case AtomicExpr::AO__opencl_atomic_fetch_xor:
956-
case AtomicExpr::AO__atomic_fetch_and:
955+
case AtomicExpr::AO__c11_atomic_store:
956+
case AtomicExpr::AO__c11_atomic_exchange:
957957
case AtomicExpr::AO__hip_atomic_fetch_and:
958-
case AtomicExpr::AO__atomic_fetch_or:
959958
case AtomicExpr::AO__hip_atomic_fetch_or:
960-
case AtomicExpr::AO__atomic_fetch_xor:
961959
case AtomicExpr::AO__hip_atomic_fetch_xor:
962-
case AtomicExpr::AO__atomic_fetch_nand:
963-
case AtomicExpr::AO__atomic_and_fetch:
964-
case AtomicExpr::AO__atomic_or_fetch:
965-
case AtomicExpr::AO__atomic_xor_fetch:
966-
case AtomicExpr::AO__atomic_nand_fetch:
960+
case AtomicExpr::AO__hip_atomic_store:
961+
case AtomicExpr::AO__hip_atomic_exchange:
962+
case AtomicExpr::AO__opencl_atomic_fetch_and:
963+
case AtomicExpr::AO__opencl_atomic_fetch_or:
964+
case AtomicExpr::AO__opencl_atomic_fetch_xor:
965+
case AtomicExpr::AO__opencl_atomic_store:
966+
case AtomicExpr::AO__opencl_atomic_exchange:
967967
Val1 = EmitValToTemp(*this, E->getVal1());
968968
break;
969969
}
@@ -1002,44 +1002,44 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
10021002
case AtomicExpr::AO__opencl_atomic_init:
10031003
llvm_unreachable("Already handled above with EmitAtomicInit!");
10041004

1005-
case AtomicExpr::AO__c11_atomic_fetch_add:
1006-
case AtomicExpr::AO__opencl_atomic_fetch_add:
10071005
case AtomicExpr::AO__atomic_fetch_add:
1008-
case AtomicExpr::AO__hip_atomic_fetch_add:
1009-
case AtomicExpr::AO__c11_atomic_fetch_and:
1010-
case AtomicExpr::AO__opencl_atomic_fetch_and:
1011-
case AtomicExpr::AO__hip_atomic_fetch_and:
10121006
case AtomicExpr::AO__atomic_fetch_and:
1013-
case AtomicExpr::AO__c11_atomic_fetch_or:
1014-
case AtomicExpr::AO__opencl_atomic_fetch_or:
1015-
case AtomicExpr::AO__hip_atomic_fetch_or:
1016-
case AtomicExpr::AO__atomic_fetch_or:
1017-
case AtomicExpr::AO__c11_atomic_fetch_nand:
1007+
case AtomicExpr::AO__atomic_fetch_max:
1008+
case AtomicExpr::AO__atomic_fetch_min:
10181009
case AtomicExpr::AO__atomic_fetch_nand:
1019-
case AtomicExpr::AO__c11_atomic_fetch_sub:
1020-
case AtomicExpr::AO__opencl_atomic_fetch_sub:
1010+
case AtomicExpr::AO__atomic_fetch_or:
10211011
case AtomicExpr::AO__atomic_fetch_sub:
1022-
case AtomicExpr::AO__hip_atomic_fetch_sub:
1023-
case AtomicExpr::AO__c11_atomic_fetch_xor:
1024-
case AtomicExpr::AO__opencl_atomic_fetch_xor:
1025-
case AtomicExpr::AO__opencl_atomic_fetch_min:
1026-
case AtomicExpr::AO__opencl_atomic_fetch_max:
10271012
case AtomicExpr::AO__atomic_fetch_xor:
1028-
case AtomicExpr::AO__hip_atomic_fetch_xor:
1029-
case AtomicExpr::AO__c11_atomic_fetch_max:
1030-
case AtomicExpr::AO__c11_atomic_fetch_min:
10311013
case AtomicExpr::AO__atomic_add_fetch:
10321014
case AtomicExpr::AO__atomic_and_fetch:
1015+
case AtomicExpr::AO__atomic_max_fetch:
1016+
case AtomicExpr::AO__atomic_min_fetch:
10331017
case AtomicExpr::AO__atomic_nand_fetch:
10341018
case AtomicExpr::AO__atomic_or_fetch:
10351019
case AtomicExpr::AO__atomic_sub_fetch:
10361020
case AtomicExpr::AO__atomic_xor_fetch:
1037-
case AtomicExpr::AO__atomic_fetch_max:
1021+
case AtomicExpr::AO__c11_atomic_fetch_add:
1022+
case AtomicExpr::AO__c11_atomic_fetch_and:
1023+
case AtomicExpr::AO__c11_atomic_fetch_max:
1024+
case AtomicExpr::AO__c11_atomic_fetch_min:
1025+
case AtomicExpr::AO__c11_atomic_fetch_nand:
1026+
case AtomicExpr::AO__c11_atomic_fetch_or:
1027+
case AtomicExpr::AO__c11_atomic_fetch_sub:
1028+
case AtomicExpr::AO__c11_atomic_fetch_xor:
1029+
case AtomicExpr::AO__hip_atomic_fetch_add:
1030+
case AtomicExpr::AO__hip_atomic_fetch_and:
10381031
case AtomicExpr::AO__hip_atomic_fetch_max:
1039-
case AtomicExpr::AO__atomic_fetch_min:
10401032
case AtomicExpr::AO__hip_atomic_fetch_min:
1041-
case AtomicExpr::AO__atomic_max_fetch:
1042-
case AtomicExpr::AO__atomic_min_fetch:
1033+
case AtomicExpr::AO__hip_atomic_fetch_or:
1034+
case AtomicExpr::AO__hip_atomic_fetch_sub:
1035+
case AtomicExpr::AO__hip_atomic_fetch_xor:
1036+
case AtomicExpr::AO__opencl_atomic_fetch_add:
1037+
case AtomicExpr::AO__opencl_atomic_fetch_and:
1038+
case AtomicExpr::AO__opencl_atomic_fetch_max:
1039+
case AtomicExpr::AO__opencl_atomic_fetch_min:
1040+
case AtomicExpr::AO__opencl_atomic_fetch_or:
1041+
case AtomicExpr::AO__opencl_atomic_fetch_sub:
1042+
case AtomicExpr::AO__opencl_atomic_fetch_xor:
10431043
// For these, only library calls for certain sizes exist.
10441044
UseOptimizedLibcall = true;
10451045
break;
@@ -1053,25 +1053,25 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
10531053
if (Misaligned)
10541054
break;
10551055
[[fallthrough]];
1056+
case AtomicExpr::AO__atomic_load_n:
1057+
case AtomicExpr::AO__atomic_store_n:
1058+
case AtomicExpr::AO__atomic_exchange_n:
1059+
case AtomicExpr::AO__atomic_compare_exchange_n:
10561060
case AtomicExpr::AO__c11_atomic_load:
10571061
case AtomicExpr::AO__c11_atomic_store:
10581062
case AtomicExpr::AO__c11_atomic_exchange:
10591063
case AtomicExpr::AO__c11_atomic_compare_exchange_weak:
10601064
case AtomicExpr::AO__c11_atomic_compare_exchange_strong:
1065+
case AtomicExpr::AO__hip_atomic_load:
1066+
case AtomicExpr::AO__hip_atomic_store:
1067+
case AtomicExpr::AO__hip_atomic_exchange:
1068+
case AtomicExpr::AO__hip_atomic_compare_exchange_weak:
10611069
case AtomicExpr::AO__hip_atomic_compare_exchange_strong:
10621070
case AtomicExpr::AO__opencl_atomic_load:
1063-
case AtomicExpr::AO__hip_atomic_load:
10641071
case AtomicExpr::AO__opencl_atomic_store:
1065-
case AtomicExpr::AO__hip_atomic_store:
10661072
case AtomicExpr::AO__opencl_atomic_exchange:
1067-
case AtomicExpr::AO__hip_atomic_exchange:
10681073
case AtomicExpr::AO__opencl_atomic_compare_exchange_weak:
1069-
case AtomicExpr::AO__hip_atomic_compare_exchange_weak:
10701074
case AtomicExpr::AO__opencl_atomic_compare_exchange_strong:
1071-
case AtomicExpr::AO__atomic_load_n:
1072-
case AtomicExpr::AO__atomic_store_n:
1073-
case AtomicExpr::AO__atomic_exchange_n:
1074-
case AtomicExpr::AO__atomic_compare_exchange_n:
10751075
// Only use optimized library calls for sizes for which they exist.
10761076
// FIXME: Size == 16 optimized library functions exist too.
10771077
if (Size == 1 || Size == 2 || Size == 4 || Size == 8)
@@ -1124,14 +1124,14 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
11241124
// void *desired, int success, int failure)
11251125
// bool __atomic_compare_exchange_N(T *mem, T *expected, T desired,
11261126
// int success, int failure)
1127+
case AtomicExpr::AO__atomic_compare_exchange:
1128+
case AtomicExpr::AO__atomic_compare_exchange_n:
11271129
case AtomicExpr::AO__c11_atomic_compare_exchange_weak:
11281130
case AtomicExpr::AO__c11_atomic_compare_exchange_strong:
1129-
case AtomicExpr::AO__opencl_atomic_compare_exchange_weak:
11301131
case AtomicExpr::AO__hip_atomic_compare_exchange_weak:
1131-
case AtomicExpr::AO__opencl_atomic_compare_exchange_strong:
11321132
case AtomicExpr::AO__hip_atomic_compare_exchange_strong:
1133-
case AtomicExpr::AO__atomic_compare_exchange:
1134-
case AtomicExpr::AO__atomic_compare_exchange_n:
1133+
case AtomicExpr::AO__opencl_atomic_compare_exchange_weak:
1134+
case AtomicExpr::AO__opencl_atomic_compare_exchange_strong:
11351135
LibCallName = "__atomic_compare_exchange";
11361136
RetTy = getContext().BoolTy;
11371137
HaveRetTy = true;
@@ -1146,22 +1146,22 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
11461146
// void __atomic_exchange(size_t size, void *mem, void *val, void *return,
11471147
// int order)
11481148
// T __atomic_exchange_N(T *mem, T val, int order)
1149-
case AtomicExpr::AO__c11_atomic_exchange:
1150-
case AtomicExpr::AO__opencl_atomic_exchange:
1151-
case AtomicExpr::AO__atomic_exchange_n:
11521149
case AtomicExpr::AO__atomic_exchange:
1150+
case AtomicExpr::AO__atomic_exchange_n:
1151+
case AtomicExpr::AO__c11_atomic_exchange:
11531152
case AtomicExpr::AO__hip_atomic_exchange:
1153+
case AtomicExpr::AO__opencl_atomic_exchange:
11541154
LibCallName = "__atomic_exchange";
11551155
AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
11561156
MemTy, E->getExprLoc(), TInfo.Width);
11571157
break;
11581158
// void __atomic_store(size_t size, void *mem, void *val, int order)
11591159
// void __atomic_store_N(T *mem, T val, int order)
1160-
case AtomicExpr::AO__c11_atomic_store:
1161-
case AtomicExpr::AO__opencl_atomic_store:
1162-
case AtomicExpr::AO__hip_atomic_store:
11631160
case AtomicExpr::AO__atomic_store:
11641161
case AtomicExpr::AO__atomic_store_n:
1162+
case AtomicExpr::AO__c11_atomic_store:
1163+
case AtomicExpr::AO__hip_atomic_store:
1164+
case AtomicExpr::AO__opencl_atomic_store:
11651165
LibCallName = "__atomic_store";
11661166
RetTy = getContext().VoidTy;
11671167
HaveRetTy = true;
@@ -1170,22 +1170,22 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
11701170
break;
11711171
// void __atomic_load(size_t size, void *mem, void *return, int order)
11721172
// T __atomic_load_N(T *mem, int order)
1173-
case AtomicExpr::AO__c11_atomic_load:
1174-
case AtomicExpr::AO__opencl_atomic_load:
1175-
case AtomicExpr::AO__hip_atomic_load:
11761173
case AtomicExpr::AO__atomic_load:
11771174
case AtomicExpr::AO__atomic_load_n:
1175+
case AtomicExpr::AO__c11_atomic_load:
1176+
case AtomicExpr::AO__hip_atomic_load:
1177+
case AtomicExpr::AO__opencl_atomic_load:
11781178
LibCallName = "__atomic_load";
11791179
break;
11801180
// T __atomic_add_fetch_N(T *mem, T val, int order)
11811181
// T __atomic_fetch_add_N(T *mem, T val, int order)
11821182
case AtomicExpr::AO__atomic_add_fetch:
11831183
PostOp = llvm::Instruction::Add;
11841184
[[fallthrough]];
1185-
case AtomicExpr::AO__c11_atomic_fetch_add:
1186-
case AtomicExpr::AO__opencl_atomic_fetch_add:
11871185
case AtomicExpr::AO__atomic_fetch_add:
1186+
case AtomicExpr::AO__c11_atomic_fetch_add:
11881187
case AtomicExpr::AO__hip_atomic_fetch_add:
1188+
case AtomicExpr::AO__opencl_atomic_fetch_add:
11891189
LibCallName = "__atomic_fetch_add";
11901190
AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
11911191
LoweredMemTy, E->getExprLoc(), TInfo.Width);
@@ -1195,10 +1195,10 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
11951195
case AtomicExpr::AO__atomic_and_fetch:
11961196
PostOp = llvm::Instruction::And;
11971197
[[fallthrough]];
1198+
case AtomicExpr::AO__atomic_fetch_and:
11981199
case AtomicExpr::AO__c11_atomic_fetch_and:
1199-
case AtomicExpr::AO__opencl_atomic_fetch_and:
12001200
case AtomicExpr::AO__hip_atomic_fetch_and:
1201-
case AtomicExpr::AO__atomic_fetch_and:
1201+
case AtomicExpr::AO__opencl_atomic_fetch_and:
12021202
LibCallName = "__atomic_fetch_and";
12031203
AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
12041204
MemTy, E->getExprLoc(), TInfo.Width);
@@ -1208,10 +1208,10 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
12081208
case AtomicExpr::AO__atomic_or_fetch:
12091209
PostOp = llvm::Instruction::Or;
12101210
[[fallthrough]];
1211+
case AtomicExpr::AO__atomic_fetch_or:
12111212
case AtomicExpr::AO__c11_atomic_fetch_or:
1212-
case AtomicExpr::AO__opencl_atomic_fetch_or:
12131213
case AtomicExpr::AO__hip_atomic_fetch_or:
1214-
case AtomicExpr::AO__atomic_fetch_or:
1214+
case AtomicExpr::AO__opencl_atomic_fetch_or:
12151215
LibCallName = "__atomic_fetch_or";
12161216
AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
12171217
MemTy, E->getExprLoc(), TInfo.Width);
@@ -1221,10 +1221,10 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
12211221
case AtomicExpr::AO__atomic_sub_fetch:
12221222
PostOp = llvm::Instruction::Sub;
12231223
[[fallthrough]];
1224+
case AtomicExpr::AO__atomic_fetch_sub:
12241225
case AtomicExpr::AO__c11_atomic_fetch_sub:
1225-
case AtomicExpr::AO__opencl_atomic_fetch_sub:
12261226
case AtomicExpr::AO__hip_atomic_fetch_sub:
1227-
case AtomicExpr::AO__atomic_fetch_sub:
1227+
case AtomicExpr::AO__opencl_atomic_fetch_sub:
12281228
LibCallName = "__atomic_fetch_sub";
12291229
AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
12301230
LoweredMemTy, E->getExprLoc(), TInfo.Width);
@@ -1234,19 +1234,19 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
12341234
case AtomicExpr::AO__atomic_xor_fetch:
12351235
PostOp = llvm::Instruction::Xor;
12361236
[[fallthrough]];
1237+
case AtomicExpr::AO__atomic_fetch_xor:
12371238
case AtomicExpr::AO__c11_atomic_fetch_xor:
1238-
case AtomicExpr::AO__opencl_atomic_fetch_xor:
12391239
case AtomicExpr::AO__hip_atomic_fetch_xor:
1240-
case AtomicExpr::AO__atomic_fetch_xor:
1240+
case AtomicExpr::AO__opencl_atomic_fetch_xor:
12411241
LibCallName = "__atomic_fetch_xor";
12421242
AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
12431243
MemTy, E->getExprLoc(), TInfo.Width);
12441244
break;
12451245
case AtomicExpr::AO__atomic_min_fetch:
12461246
PostOpMinMax = true;
12471247
[[fallthrough]];
1248-
case AtomicExpr::AO__c11_atomic_fetch_min:
12491248
case AtomicExpr::AO__atomic_fetch_min:
1249+
case AtomicExpr::AO__c11_atomic_fetch_min:
12501250
case AtomicExpr::AO__hip_atomic_fetch_min:
12511251
case AtomicExpr::AO__opencl_atomic_fetch_min:
12521252
LibCallName = E->getValueType()->isSignedIntegerType()
@@ -1258,8 +1258,8 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
12581258
case AtomicExpr::AO__atomic_max_fetch:
12591259
PostOpMinMax = true;
12601260
[[fallthrough]];
1261-
case AtomicExpr::AO__c11_atomic_fetch_max:
12621261
case AtomicExpr::AO__atomic_fetch_max:
1262+
case AtomicExpr::AO__c11_atomic_fetch_max:
12631263
case AtomicExpr::AO__hip_atomic_fetch_max:
12641264
case AtomicExpr::AO__opencl_atomic_fetch_max:
12651265
LibCallName = E->getValueType()->isSignedIntegerType()
@@ -1273,8 +1273,8 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
12731273
case AtomicExpr::AO__atomic_nand_fetch:
12741274
PostOp = llvm::Instruction::And; // the NOT is special cased below
12751275
[[fallthrough]];
1276-
case AtomicExpr::AO__c11_atomic_fetch_nand:
12771276
case AtomicExpr::AO__atomic_fetch_nand:
1277+
case AtomicExpr::AO__c11_atomic_fetch_nand:
12781278
LibCallName = "__atomic_fetch_nand";
12791279
AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(),
12801280
MemTy, E->getExprLoc(), TInfo.Width);

0 commit comments

Comments
 (0)