Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"
; The base test file was generated by ./llvm/test/CodeGen/AArch64/Atomics/generate-tests.py
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+outline-atomics -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+outline-atomics -O1 | FileCheck %s --check-prefixes=CHECK,-O1

define dso_local void @store_atomic_i8_aligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_aligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_unordered:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr unordered, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_monotonic:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr monotonic, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_release:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr release, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_seq_cst:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr seq_cst, align 2
ret void
}

define dso_local void @store_atomic_i32_aligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_unordered:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr unordered, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_monotonic:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr monotonic, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_release:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr release, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_seq_cst:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr seq_cst, align 4
ret void
}

define dso_local void @store_atomic_i64_aligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_unordered:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr unordered, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_monotonic:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr monotonic, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_release:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr release, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_seq_cst:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr seq_cst, align 8
ret void
}

define dso_local void @store_atomic_i128_aligned_unordered(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_unordered:
; -O0: bl __aarch64_cas16_relax
; -O0: subs x10, x10, x11
; -O0: ccmp x8, x9, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_unordered:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr unordered, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_monotonic(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_monotonic:
; -O0: bl __aarch64_cas16_relax
; -O0: subs x10, x10, x11
; -O0: ccmp x8, x9, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_monotonic:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr monotonic, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_release(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_release:
; -O0: bl __aarch64_cas16_rel
; -O0: subs x10, x10, x11
; -O0: ccmp x8, x9, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_release:
; -O1: ldxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr release, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_seq_cst(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_seq_cst:
; -O0: bl __aarch64_cas16_acq_rel
; -O0: subs x10, x10, x11
; -O0: ccmp x8, x9, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_seq_cst:
; -O1: ldaxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr seq_cst, align 16
ret void
}

define dso_local void @store_atomic_i8_unaligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_release:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_release:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_release:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_unordered(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_monotonic(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_release(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_release:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_seq_cst(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr seq_cst, align 1
ret void
}
324 changes: 324 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomic-store-rcpc.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"
; The base test file was generated by ./llvm/test/CodeGen/AArch64/Atomics/generate-tests.py
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc -O1 | FileCheck %s --check-prefixes=CHECK,-O1

define dso_local void @store_atomic_i8_aligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_aligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_unordered:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr unordered, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_monotonic:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr monotonic, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_release:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr release, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_seq_cst:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr seq_cst, align 2
ret void
}

define dso_local void @store_atomic_i32_aligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_unordered:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr unordered, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_monotonic:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr monotonic, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_release:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr release, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_seq_cst:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr seq_cst, align 4
ret void
}

define dso_local void @store_atomic_i64_aligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_unordered:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr unordered, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_monotonic:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr monotonic, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_release:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr release, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_seq_cst:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr seq_cst, align 8
ret void
}

define dso_local void @store_atomic_i128_aligned_unordered(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_unordered:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stxp w8, x14, x15, [x9]
; -O0: stxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_unordered:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr unordered, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_monotonic(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_monotonic:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stxp w8, x14, x15, [x9]
; -O0: stxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_monotonic:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr monotonic, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_release(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_release:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stlxp w8, x14, x15, [x9]
; -O0: stlxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_release:
; -O1: ldxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr release, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_seq_cst(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_seq_cst:
; -O0: ldaxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stlxp w8, x14, x15, [x9]
; -O0: stlxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_seq_cst:
; -O1: ldaxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr seq_cst, align 16
ret void
}

define dso_local void @store_atomic_i8_unaligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_release:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_release:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_release:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_unordered(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_monotonic(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_release(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_release:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_seq_cst(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr seq_cst, align 1
ret void
}
324 changes: 324 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomic-store-rcpc3.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"
; The base test file was generated by ./llvm/test/CodeGen/AArch64/Atomics/generate-tests.py
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc3 -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc3 -O1 | FileCheck %s --check-prefixes=CHECK,-O1

define dso_local void @store_atomic_i8_aligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_aligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_unordered:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr unordered, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_monotonic:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr monotonic, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_release:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr release, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_seq_cst:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr seq_cst, align 2
ret void
}

define dso_local void @store_atomic_i32_aligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_unordered:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr unordered, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_monotonic:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr monotonic, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_release:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr release, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_seq_cst:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr seq_cst, align 4
ret void
}

define dso_local void @store_atomic_i64_aligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_unordered:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr unordered, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_monotonic:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr monotonic, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_release:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr release, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_seq_cst:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr seq_cst, align 8
ret void
}

define dso_local void @store_atomic_i128_aligned_unordered(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_unordered:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stxp w8, x14, x15, [x9]
; -O0: stxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_unordered:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr unordered, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_monotonic(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_monotonic:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stxp w8, x14, x15, [x9]
; -O0: stxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_monotonic:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr monotonic, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_release(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_release:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stlxp w8, x14, x15, [x9]
; -O0: stlxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_release:
; -O1: ldxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr release, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_seq_cst(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_seq_cst:
; -O0: ldaxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stlxp w8, x14, x15, [x9]
; -O0: stlxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_seq_cst:
; -O1: ldaxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr seq_cst, align 16
ret void
}

define dso_local void @store_atomic_i8_unaligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_release:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_release:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_release:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_unordered(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_monotonic(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_release(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_release:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_seq_cst(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr seq_cst, align 1
ret void
}
316 changes: 316 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomic-store-v8_1a.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,316 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"
; The base test file was generated by ./llvm/test/CodeGen/AArch64/Atomics/generate-tests.py
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8.1a -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8.1a -O1 | FileCheck %s --check-prefixes=CHECK,-O1

define dso_local void @store_atomic_i8_aligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_aligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_unordered:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr unordered, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_monotonic:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr monotonic, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_release:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr release, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_seq_cst:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr seq_cst, align 2
ret void
}

define dso_local void @store_atomic_i32_aligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_unordered:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr unordered, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_monotonic:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr monotonic, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_release:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr release, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_seq_cst:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr seq_cst, align 4
ret void
}

define dso_local void @store_atomic_i64_aligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_unordered:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr unordered, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_monotonic:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr monotonic, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_release:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr release, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_seq_cst:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr seq_cst, align 8
ret void
}

define dso_local void @store_atomic_i128_aligned_unordered(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_unordered:
; -O0: casp x0, x1, x2, x3, [x8]
; -O0: subs x11, x9, x11
; -O0: ccmp x8, x10, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_unordered:
; -O1: ldp x4, x5, [x2]
; -O1: casp x6, x7, x0, x1, [x2]
; -O1: cmp x6, x4
; -O1: ccmp x7, x5, #0, eq
store atomic i128 %value, ptr %ptr unordered, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_monotonic(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_monotonic:
; -O0: casp x0, x1, x2, x3, [x8]
; -O0: subs x11, x9, x11
; -O0: ccmp x8, x10, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_monotonic:
; -O1: ldp x4, x5, [x2]
; -O1: casp x6, x7, x0, x1, [x2]
; -O1: cmp x6, x4
; -O1: ccmp x7, x5, #0, eq
store atomic i128 %value, ptr %ptr monotonic, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_release(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_release:
; -O0: caspl x0, x1, x2, x3, [x8]
; -O0: subs x11, x9, x11
; -O0: ccmp x8, x10, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_release:
; -O1: ldp x4, x5, [x2]
; -O1: caspl x6, x7, x0, x1, [x2]
; -O1: cmp x6, x4
; -O1: ccmp x7, x5, #0, eq
store atomic i128 %value, ptr %ptr release, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_seq_cst(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_seq_cst:
; -O0: caspal x0, x1, x2, x3, [x8]
; -O0: subs x11, x9, x11
; -O0: ccmp x8, x10, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_seq_cst:
; -O1: ldp x4, x5, [x2]
; -O1: caspal x6, x7, x0, x1, [x2]
; -O1: cmp x6, x4
; -O1: ccmp x7, x5, #0, eq
store atomic i128 %value, ptr %ptr seq_cst, align 16
ret void
}

define dso_local void @store_atomic_i8_unaligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_release:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_release:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_release:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_unordered(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_monotonic(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_release(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_release:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_seq_cst(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr seq_cst, align 1
ret void
}
324 changes: 324 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomic-store-v8a.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"
; The base test file was generated by ./llvm/test/CodeGen/AArch64/Atomics/generate-tests.py
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8a -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8a -O1 | FileCheck %s --check-prefixes=CHECK,-O1

define dso_local void @store_atomic_i8_aligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_aligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_aligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_aligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_unordered:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr unordered, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_monotonic:
; CHECK: strh w0, [x1]
store atomic i16 %value, ptr %ptr monotonic, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_release:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr release, align 2
ret void
}

define dso_local void @store_atomic_i16_aligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_aligned_seq_cst:
; CHECK: stlrh w0, [x1]
store atomic i16 %value, ptr %ptr seq_cst, align 2
ret void
}

define dso_local void @store_atomic_i32_aligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_unordered:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr unordered, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_monotonic:
; CHECK: str w0, [x1]
store atomic i32 %value, ptr %ptr monotonic, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_release:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr release, align 4
ret void
}

define dso_local void @store_atomic_i32_aligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_aligned_seq_cst:
; CHECK: stlr w0, [x1]
store atomic i32 %value, ptr %ptr seq_cst, align 4
ret void
}

define dso_local void @store_atomic_i64_aligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_unordered:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr unordered, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_monotonic:
; CHECK: str x0, [x1]
store atomic i64 %value, ptr %ptr monotonic, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_release:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr release, align 8
ret void
}

define dso_local void @store_atomic_i64_aligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_aligned_seq_cst:
; CHECK: stlr x0, [x1]
store atomic i64 %value, ptr %ptr seq_cst, align 8
ret void
}

define dso_local void @store_atomic_i128_aligned_unordered(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_unordered:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stxp w8, x14, x15, [x9]
; -O0: stxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_unordered:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr unordered, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_monotonic(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_monotonic:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stxp w8, x14, x15, [x9]
; -O0: stxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_monotonic:
; -O1: ldxp xzr, x8, [x2]
; -O1: stxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr monotonic, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_release(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_release:
; -O0: ldxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stlxp w8, x14, x15, [x9]
; -O0: stlxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_release:
; -O1: ldxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr release, align 16
ret void
}

define dso_local void @store_atomic_i128_aligned_seq_cst(i128 %value, ptr %ptr) {
; -O0-LABEL: store_atomic_i128_aligned_seq_cst:
; -O0: ldaxp x10, x12, [x9]
; -O0: cmp x10, x11
; -O0: cmp x12, x13
; -O0: stlxp w8, x14, x15, [x9]
; -O0: stlxp w8, x10, x12, [x9]
; -O0: subs x12, x12, x13
; -O0: ccmp x10, x11, #0, eq
;
; -O1-LABEL: store_atomic_i128_aligned_seq_cst:
; -O1: ldaxp xzr, x8, [x2]
; -O1: stlxp w8, x1, x0, [x2]
store atomic i128 %value, ptr %ptr seq_cst, align 16
ret void
}

define dso_local void @store_atomic_i8_unaligned_unordered(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_unordered:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_monotonic(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_monotonic:
; CHECK: strb w0, [x1]
store atomic i8 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_release(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_release:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i8_unaligned_seq_cst(i8 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i8_unaligned_seq_cst:
; CHECK: stlrb w0, [x1]
store atomic i8 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_unordered(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_monotonic(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_release(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_release:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i16_unaligned_seq_cst(i16 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i16_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i16 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_unordered(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_monotonic(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_release(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_release:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i32_unaligned_seq_cst(i32 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i32_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i32 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_unordered(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_monotonic(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_release(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_release:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i64_unaligned_seq_cst(i64 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i64_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i64 %value, ptr %ptr seq_cst, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_unordered(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_unordered:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr unordered, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_monotonic(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_monotonic:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr monotonic, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_release(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_release:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr release, align 1
ret void
}

define dso_local void @store_atomic_i128_unaligned_seq_cst(i128 %value, ptr %ptr) {
; CHECK-LABEL: store_atomic_i128_unaligned_seq_cst:
; CHECK: bl __atomic_store
store atomic i128 %value, ptr %ptr seq_cst, align 1
ret void
}
6,289 changes: 6,289 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomicrmw-lse128.ll

Large diffs are not rendered by default.

9,094 changes: 9,094 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomicrmw-lse2.ll

Large diffs are not rendered by default.

7,399 changes: 7,399 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomicrmw-outline_atomics.ll

Large diffs are not rendered by default.

9,094 changes: 9,094 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomicrmw-rcpc.ll

Large diffs are not rendered by default.

9,094 changes: 9,094 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomicrmw-rcpc3.ll

Large diffs are not rendered by default.

6,289 changes: 6,289 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomicrmw-v8_1a.ll

Large diffs are not rendered by default.

9,094 changes: 9,094 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-atomicrmw-v8a.ll

Large diffs are not rendered by default.

2,494 changes: 2,494 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-cmpxchg-lse128.ll

Large diffs are not rendered by default.

3,829 changes: 3,829 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-cmpxchg-lse2.ll

Large diffs are not rendered by default.

2,407 changes: 2,407 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-cmpxchg-outline_atomics.ll

Large diffs are not rendered by default.

3,829 changes: 3,829 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-cmpxchg-rcpc.ll

Large diffs are not rendered by default.

3,829 changes: 3,829 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-cmpxchg-rcpc3.ll

Large diffs are not rendered by default.

2,494 changes: 2,494 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-cmpxchg-v8_1a.ll

Large diffs are not rendered by default.

3,829 changes: 3,829 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-cmpxchg-v8a.ll

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/aarch64_be-fence.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --filter "^\s*(dmb)"
; The base test file was generated by ./llvm/test/CodeGen/AArch64/Atomics/generate-tests.py
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8a -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8a -O1 | FileCheck %s --check-prefixes=CHECK,-O1
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8.1a -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+v8.1a -O1 | FileCheck %s --check-prefixes=CHECK,-O1
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc -O1 | FileCheck %s --check-prefixes=CHECK,-O1
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+lse2 -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+lse2 -O1 | FileCheck %s --check-prefixes=CHECK,-O1
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+outline-atomics -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+outline-atomics -O1 | FileCheck %s --check-prefixes=CHECK,-O1
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc3 -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+rcpc3 -O1 | FileCheck %s --check-prefixes=CHECK,-O1
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+lse128 -O0 | FileCheck %s --check-prefixes=CHECK,-O0
; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64_be -mattr=+lse128 -O1 | FileCheck %s --check-prefixes=CHECK,-O1

define dso_local void @fence_acquire() {
; CHECK-LABEL: fence_acquire:
; CHECK: dmb ishld
fence acquire
ret void
}

define dso_local void @fence_release() {
; CHECK-LABEL: fence_release:
; CHECK: dmb ish
fence release
ret void
}

define dso_local void @fence_acq_rel() {
; CHECK-LABEL: fence_acq_rel:
; CHECK: dmb ish
fence acq_rel
ret void
}

define dso_local void @fence_seq_cst() {
; CHECK-LABEL: fence_seq_cst:
; CHECK: dmb ish
fence seq_cst
ret void
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; -O0: {{.*}}
; -O1: {{.*}}
277 changes: 277 additions & 0 deletions llvm/test/CodeGen/AArch64/Atomics/generate-tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
#!/usr/bin/env python3
import textwrap
import enum
import os
"""
Generate the tests in llvm/test/CodeGen/AArch64/Atomics. Run from top level llvm-project.
"""

TRIPLES = [
'aarch64',
'aarch64_be',
]


# Type name size
class Type(enum.Enum):
# Value is the size in bytes
i8 = 1
i16 = 2
i32 = 4
i64 = 8
i128 = 16

def align(self, aligned: bool) -> int:
return self.value if aligned else 1

def __str__(self) -> str:
return self.name


# Is this an aligned or unaligned access?
class Aligned(enum.Enum):
aligned = True
unaligned = False

def __str__(self) -> str:
return self.name

def __bool__(self) -> bool:
return self.value


class AtomicOrder(enum.Enum):
notatomic = 0
unordered = 1
monotonic = 2
acquire = 3
release = 4
acq_rel = 5
seq_cst = 6

def __str__(self) -> str:
return self.name


ATOMICRMW_ORDERS = [
AtomicOrder.monotonic,
AtomicOrder.acquire,
AtomicOrder.release,
AtomicOrder.acq_rel,
AtomicOrder.seq_cst,
]

ATOMIC_LOAD_ORDERS = [
AtomicOrder.unordered,
AtomicOrder.monotonic,
AtomicOrder.acquire,
AtomicOrder.seq_cst,
]

ATOMIC_STORE_ORDERS = [
AtomicOrder.unordered,
AtomicOrder.monotonic,
AtomicOrder.release,
AtomicOrder.seq_cst,
]

ATOMIC_FENCE_ORDERS = [
AtomicOrder.acquire,
AtomicOrder.release,
AtomicOrder.acq_rel,
AtomicOrder.seq_cst,
]

CMPXCHG_SUCCESS_ORDERS = [
AtomicOrder.monotonic,
AtomicOrder.acquire,
AtomicOrder.release,
AtomicOrder.acq_rel,
AtomicOrder.seq_cst,
]

CMPXCHG_FAILURE_ORDERS = [
AtomicOrder.monotonic,
AtomicOrder.acquire,
AtomicOrder.seq_cst,
]

FENCE_ORDERS = [
AtomicOrder.acquire,
AtomicOrder.release,
AtomicOrder.acq_rel,
AtomicOrder.seq_cst,
]


class Feature(enum.Flag):
v8a = enum.auto()
v8_1a = enum.auto() # -mattr=+v8.1a, mandatory FEAT_LOR, FEAT_LSE
rcpc = enum.auto() # FEAT_LRCPC
lse2 = enum.auto() # FEAT_LSE2
outline_atomics = enum.auto() # -moutline-atomics
rcpc3 = enum.auto() # FEAT_LRCPC3
lse128 = enum.auto() # FEAT_LSE128

@property
def mattr(self):
if self == Feature.outline_atomics:
return 'outline-atomics'
if self == Feature.v8_1a:
return 'v8.1a'
return self.name


ATOMICRMW_OPS = [
'xchg',
'add',
'sub',
'and',
'nand',
'or',
'xor',
'max',
'min',
'umax',
'umin',
]


def all_atomicrmw(f):
for op in ATOMICRMW_OPS:
for aligned in Aligned:
for ty in Type:
for ordering in ATOMICRMW_ORDERS:
name = f'atomicrmw_{op}_{ty}_{aligned}_{ordering}'
instr = 'atomicrmw'
f.write(
textwrap.dedent(f'''
define dso_local {ty} @{name}(ptr %ptr, {ty} %value) {{
%r = {instr} {op} ptr %ptr, {ty} %value {ordering}, align {ty.align(aligned)}
ret {ty} %r
}}
'''))


def all_load(f):
for aligned in Aligned:
for ty in Type:
for ordering in ATOMIC_LOAD_ORDERS:
for const in [False, True]:
name = f'load_atomic_{ty}_{aligned}_{ordering}'
instr = 'load atomic'
if const:
name += '_const'
arg = 'ptr readonly %ptr' if const else 'ptr %ptr'
f.write(
textwrap.dedent(f'''
define dso_local {ty} @{name}({arg}) {{
%r = {instr} {ty}, ptr %ptr {ordering}, align {ty.align(aligned)}
ret {ty} %r
}}
'''))


def all_store(f):
for aligned in Aligned:
for ty in Type:
for ordering in ATOMIC_STORE_ORDERS: # FIXME stores
name = f'store_atomic_{ty}_{aligned}_{ordering}'
instr = 'store atomic'
f.write(
textwrap.dedent(f'''
define dso_local void @{name}({ty} %value, ptr %ptr) {{
{instr} {ty} %value, ptr %ptr {ordering}, align {ty.align(aligned)}
ret void
}}
'''))


def all_cmpxchg(f):
for aligned in Aligned:
for ty in Type:
for success_ordering in CMPXCHG_SUCCESS_ORDERS:
for failure_ordering in CMPXCHG_FAILURE_ORDERS:
for weak in [False, True]:
name = f'cmpxchg_{ty}_{aligned}_{success_ordering}_{failure_ordering}'
instr = 'cmpxchg'
if weak:
name += '_weak'
instr += ' weak'
f.write(
textwrap.dedent(f'''
define dso_local {ty} @{name}({ty} %expected, {ty} %new, ptr %ptr) {{
%pair = {instr} ptr %ptr, {ty} %expected, {ty} %new {success_ordering} {failure_ordering}, align {ty.align(aligned)}
%r = extractvalue {{ {ty}, i1 }} %pair, 0
ret {ty} %r
}}
'''))


def all_fence(f):
for ordering in FENCE_ORDERS:
name = f'fence_{ordering}'
f.write(
textwrap.dedent(f'''
define dso_local void @{name}() {{
fence {ordering}
ret void
}}
'''))


def header(f, triple, features, filter_args: str):
f.write('; NOTE: Assertions have been autogenerated by '
'utils/update_llc_test_checks.py UTC_ARGS: ')
f.write(filter_args)
f.write('\n')
f.write(f'; The base test file was generated by {__file__}\n')
for feat in features:
for OptFlag in ['-O0', '-O1']:
f.write(' '.join([
';', 'RUN:', 'llc', '%s', '-o', '-', '-verify-machineinstrs',
f'-mtriple={triple}', f'-mattr=+{feat.mattr}', OptFlag, '|',
'FileCheck', '%s', f'--check-prefixes=CHECK,{OptFlag}\n'
]))


def write_lit_tests():
os.chdir('llvm/test/CodeGen/AArch64/Atomics/')
for triple in TRIPLES:
# Feature has no effect on fence, so keep it to one file.
with open(f'{triple}-fence.ll', 'w') as f:
filter_args = r'--filter "^\s*(dmb)"'
header(f, triple, Feature, filter_args)
all_fence(f)

for feat in Feature:
with open(f'{triple}-atomicrmw-{feat.name}.ll', 'w') as f:
filter_args = r'--filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st[^r]|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"'
header(f, triple, [feat], filter_args)
all_atomicrmw(f)

with open(f'{triple}-cmpxchg-{feat.name}.ll', 'w') as f:
filter_args = r'--filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st[^r]|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"'
header(f, triple, [feat], filter_args)
all_cmpxchg(f)

with open(f'{triple}-atomic-load-{feat.name}.ll', 'w') as f:
filter_args = r'--filter-out "\b(sp)\b" --filter "^\s*(ld|st[^r]|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"'
header(f, triple, [feat], filter_args)
all_load(f)

with open(f'{triple}-atomic-store-{feat.name}.ll', 'w') as f:
filter_args = r'--filter-out "\b(sp)\b" --filter "^\s*(ld[^r]|st|swp|cas|bl|add|and|eor|orn|orr|sub|mvn|sxt|cmp|ccmp|csel|dmb)"'
header(f, triple, [feat], filter_args)
all_store(f)

if __name__ == '__main__':
write_lit_tests()

print(textwrap.dedent('''
Testcases written. To update checks run:
$ ./llvm/utils/update_llc_test_checks.py -u llvm/test/CodeGen/AArch64/Atomics/*.ll
Or in parallel:
$ parallel ./llvm/utils/update_llc_test_checks.py -u ::: llvm/test/CodeGen/AArch64/Atomics/*.ll
'''))