1; RUN: sed -e "s/ORDER/monotonic/" -e "s/BINARY_OP/and/" %s | llc -march=hexagon | FileCheck %s 2; RUN: sed -e "s/ORDER/acquire/" -e "s/BINARY_OP/and/" %s | llc -march=hexagon | FileCheck %s 3; RUN: sed -e "s/ORDER/release/" -e "s/BINARY_OP/and/" %s | llc -march=hexagon | FileCheck %s 4; RUN: sed -e "s/ORDER/acq_rel/" -e "s/BINARY_OP/and/" %s | llc -march=hexagon | FileCheck %s 5; RUN: sed -e "s/ORDER/seq_cst/" -e "s/BINARY_OP/and/" %s | llc -march=hexagon | FileCheck %s 6; RUN: sed -e "s/ORDER/monotonic/" -e "s/BINARY_OP/xor/" %s | llc -march=hexagon | FileCheck %s 7; RUN: sed -e "s/ORDER/acquire/" -e "s/BINARY_OP/xor/" %s | llc -march=hexagon | FileCheck %s 8; RUN: sed -e "s/ORDER/release/" -e "s/BINARY_OP/xor/" %s | llc -march=hexagon | FileCheck %s 9; RUN: sed -e "s/ORDER/acq_rel/" -e "s/BINARY_OP/xor/" %s | llc -march=hexagon | FileCheck %s 10; RUN: sed -e "s/ORDER/seq_cst/" -e "s/BINARY_OP/xor/" %s | llc -march=hexagon | FileCheck %s 11; RUN: sed -e "s/ORDER/monotonic/" -e "s/BINARY_OP/or/" %s | llc -march=hexagon | FileCheck %s 12; RUN: sed -e "s/ORDER/acquire/" -e "s/BINARY_OP/or/" %s | llc -march=hexagon | FileCheck %s 13; RUN: sed -e "s/ORDER/release/" -e "s/BINARY_OP/or/" %s | llc -march=hexagon | FileCheck %s 14; RUN: sed -e "s/ORDER/acq_rel/" -e "s/BINARY_OP/or/" %s | llc -march=hexagon | FileCheck %s 15; RUN: sed -e "s/ORDER/seq_cst/" -e "s/BINARY_OP/or/" %s | llc -march=hexagon | FileCheck %s 16 17@g0 = global i32 0, align 4 18@g1 = global i32 0, align 4 19@g2 = global i32 0, align 4 20@g3 = global i64 0, align 8 21@g4 = global i64 0, align 8 22@g5 = global i64 0, align 8 23 24; CHECK-LABEL: f0: 25; CHECK: // %[[BINARY_OP:[a-z_]*]]_entry 26; CHECK-DAG: [[SECOND_ADDR:r[0-9]+]] = ##g1 27; CHECK-DAG: [[FIRST_VALUE:r[0-9]+]] = memw(gp+#g0) 28 29; CHECK: [[FAIL_LABEL:\.LBB.*]]: 30 31; CHECK: [[LOCKED_READ_REG:r[0-9]+]] = memw_locked([[SECOND_ADDR]]) 32; CHECK: [[RESULT_REG:r[0-9]+]] = [[BINARY_OP]]([[LOCKED_READ_REG]],[[FIRST_VALUE]]) 33; CHECK: memw_locked([[SECOND_ADDR]],[[LOCK_PRED_REG:p[0-9]+]]) = [[RESULT_REG]] 34 35; CHECK: if (![[LOCK_PRED_REG]]) jump{{.*}}[[FAIL_LABEL]] 36; CHECK-DAG: memw(gp+#g2) = [[LOCKED_READ_REG]] 37; CHECK-DAG: jumpr r31 38define void @f0() { 39BINARY_OP_entry: 40 %v0 = load i32, i32* @g0, align 4 41 %v1 = atomicrmw BINARY_OP i32* @g1, i32 %v0 ORDER 42 store i32 %v1, i32* @g2, align 4 43 ret void 44} 45 46; CHECK-LABEL: f1: 47; CHECK-DAG: [[SECOND_ADDR:r[0-9]+]] = ##g4 48; CHECK-DAG: [[FIRST_VALUE:r[:0-9]+]] = memd(gp+#g3) 49 50; CHECK: [[FAIL_LABEL:\.LBB.*]]: 51 52; CHECK: [[LOCKED_READ_REG:r[:0-9]+]] = memd_locked([[SECOND_ADDR]]) 53; CHECK: [[RESULT_REG:r[:0-9]+]] = [[BINARY_OP]]([[LOCKED_READ_REG]],[[FIRST_VALUE]]) 54; CHECK: memd_locked([[SECOND_ADDR]],[[LOCK_PRED_REG:p[0-9]+]]) = [[RESULT_REG]] 55 56; CHECK: if (![[LOCK_PRED_REG]]) jump{{.*}}[[FAIL_LABEL]] 57; CHECK-DAG: memd(gp+#g5) = [[LOCKED_READ_REG]] 58; CHECK-DAG: jumpr r31 59define void @f1() { 60b0: 61 %v0 = load i64, i64* @g3, align 8 62 %v1 = atomicrmw BINARY_OP i64* @g4, i64 %v0 ORDER 63 store i64 %v1, i64* @g5, align 8 64 ret void 65} 66