@@ -1238,35 +1238,55 @@ isReMaterializable = 1 in
1238
1238
Requires<[HasSRAM]>;
1239
1239
}
1240
1240
1241
- class AtomicLoad<PatFrag Op, RegisterClass DRC> :
1242
- Pseudo<(outs DRC:$rd), (ins PTRREGS:$rr), "atomic_op",
1241
+ class AtomicLoad<PatFrag Op, RegisterClass DRC,
1242
+ RegisterClass PTRRC> :
1243
+ Pseudo<(outs DRC:$rd), (ins PTRRC:$rr), "atomic_op",
1243
1244
[(set DRC:$rd, (Op i16:$rr))]>;
1244
1245
1245
- class AtomicStore<PatFrag Op, RegisterClass DRC> :
1246
- Pseudo<(outs), (ins PTRDISPREGS:$rd, DRC:$rr), "atomic_op",
1246
+ class AtomicStore<PatFrag Op, RegisterClass DRC,
1247
+ RegisterClass PTRRC> :
1248
+ Pseudo<(outs), (ins PTRRC:$rd, DRC:$rr), "atomic_op",
1247
1249
[(Op i16:$rd, DRC:$rr)]>;
1248
1250
1249
- class AtomicLoadOp<PatFrag Op, RegisterClass DRC> :
1250
- Pseudo<(outs DRC:$rd), (ins PTRREGS:$rr, DRC:$operand),
1251
+ class AtomicLoadOp<PatFrag Op, RegisterClass DRC,
1252
+ RegisterClass PTRRC> :
1253
+ Pseudo<(outs DRC:$rd), (ins PTRRC:$rr, DRC:$operand),
1251
1254
"atomic_op",
1252
1255
[(set DRC:$rd, (Op i16:$rr, DRC:$operand))]>;
1253
1256
1254
- def AtomicLoad8 : AtomicLoad<atomic_load_8, GPR8>;
1255
- def AtomicLoad16 : AtomicLoad<atomic_load_16, DREGS>;
1256
-
1257
- def AtomicStore8 : AtomicStore<atomic_store_8, GPR8>;
1258
- def AtomicStore16 : AtomicStore<atomic_store_16, DREGS>;
1259
-
1260
- def AtomicLoadAdd8 : AtomicLoadOp<atomic_load_add_8, GPR8>;
1261
- def AtomicLoadAdd16 : AtomicLoadOp<atomic_load_add_16, DREGS>;
1262
- def AtomicLoadSub8 : AtomicLoadOp<atomic_load_sub_8, GPR8>;
1263
- def AtomicLoadSub16 : AtomicLoadOp<atomic_load_sub_16, DREGS>;
1264
- def AtomicLoadAnd8 : AtomicLoadOp<atomic_load_and_8, GPR8>;
1265
- def AtomicLoadAnd16 : AtomicLoadOp<atomic_load_and_16, DREGS>;
1266
- def AtomicLoadOr8 : AtomicLoadOp<atomic_load_or_8, GPR8>;
1267
- def AtomicLoadOr16 : AtomicLoadOp<atomic_load_or_16, DREGS>;
1268
- def AtomicLoadXor8 : AtomicLoadOp<atomic_load_xor_8, GPR8>;
1269
- def AtomicLoadXor16 : AtomicLoadOp<atomic_load_xor_16, DREGS>;
1257
+ // FIXME: I think 16-bit atomic binary ops need to mark
1258
+ // r0 as clobbered.
1259
+
1260
+ // Atomic instructions
1261
+ // ===================
1262
+ //
1263
+ // These are all expanded by AVRExpandPseudoInsts
1264
+ //
1265
+ // 8-bit operations can use any pointer register because
1266
+ // they are expanded directly into an LD/ST instruction.
1267
+ //
1268
+ // 16-bit operations use 16-bit load/store postincrement instructions,
1269
+ // which require PTRDISPREGS.
1270
+
1271
+ def AtomicLoad8 : AtomicLoad<atomic_load_8, GPR8, PTRREGS>;
1272
+ def AtomicLoad16 : AtomicLoad<atomic_load_16, DREGS, PTRDISPREGS>;
1273
+
1274
+ def AtomicStore8 : AtomicStore<atomic_store_8, GPR8, PTRREGS>;
1275
+ def AtomicStore16 : AtomicStore<atomic_store_16, DREGS, PTRDISPREGS>;
1276
+
1277
+ class AtomicLoadOp8<PatFrag Op> : AtomicLoadOp<Op, GPR8, PTRREGS>;
1278
+ class AtomicLoadOp16<PatFrag Op> : AtomicLoadOp<Op, DREGS, PTRDISPREGS>;
1279
+
1280
+ def AtomicLoadAdd8 : AtomicLoadOp8<atomic_load_add_8>;
1281
+ def AtomicLoadAdd16 : AtomicLoadOp16<atomic_load_add_16>;
1282
+ def AtomicLoadSub8 : AtomicLoadOp8<atomic_load_sub_8>;
1283
+ def AtomicLoadSub16 : AtomicLoadOp16<atomic_load_sub_16>;
1284
+ def AtomicLoadAnd8 : AtomicLoadOp8<atomic_load_and_8>;
1285
+ def AtomicLoadAnd16 : AtomicLoadOp16<atomic_load_and_16>;
1286
+ def AtomicLoadOr8 : AtomicLoadOp8<atomic_load_or_8>;
1287
+ def AtomicLoadOr16 : AtomicLoadOp16<atomic_load_or_16>;
1288
+ def AtomicLoadXor8 : AtomicLoadOp8<atomic_load_xor_8>;
1289
+ def AtomicLoadXor16 : AtomicLoadOp16<atomic_load_xor_16>;
1270
1290
def AtomicFence : Pseudo<(outs), (ins), "atomic_fence",
1271
1291
[(atomic_fence imm, imm)]>;
1272
1292
0 commit comments