[llvm] a879971 - [AArch64] Introduce tests for PR67879 (NFC)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 30 11:30:33 PDT 2023
Author: Antonio Frighetto
Date: 2023-10-30T19:27:48+01:00
New Revision: a8799719f704fc80640c59b26f6c9ad2631ee103
URL: https://github.com/llvm/llvm-project/commit/a8799719f704fc80640c59b26f6c9ad2631ee103
DIFF: https://github.com/llvm/llvm-project/commit/a8799719f704fc80640c59b26f6c9ad2631ee103.diff
LOG: [AArch64] Introduce tests for PR67879 (NFC)
Added:
llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-load-rcpc_immo.ll
llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-store-rcpc_immo.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-load-rcpc_immo.ll b/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-load-rcpc_immo.ll
new file mode 100644
index 000000000000000..05f37a4e440eb03
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-load-rcpc_immo.ll
@@ -0,0 +1,827 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --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)"
+; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+v8.4a -mattr=+rcpc-immo -global-isel=true -global-isel-abort=2 -O0 | FileCheck %s --check-prefixes=CHECK,GISEL
+; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+v8.4a -mattr=+rcpc-immo -global-isel=false -O1 | FileCheck %s --check-prefixes=CHECK,SDAG
+
+define i8 @load_atomic_i8_aligned_unordered(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_unordered:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep unordered, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_aligned_unordered_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_unordered_const:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep unordered, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_aligned_monotonic(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_monotonic:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep monotonic, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_aligned_monotonic_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_monotonic_const:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep monotonic, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_aligned_acquire(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_acquire:
+; CHECK: add x8, x0, #4
+; CHECK: ldaprb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep acquire, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_aligned_acquire_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_acquire_const:
+; CHECK: add x8, x0, #4
+; CHECK: ldaprb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep acquire, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_aligned_seq_cst(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_seq_cst:
+; CHECK: add x8, x0, #4
+; CHECK: ldarb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep seq_cst, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_aligned_seq_cst_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_aligned_seq_cst_const:
+; CHECK: add x8, x0, #4
+; CHECK: ldarb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep seq_cst, align 1
+ ret i8 %r
+}
+
+define i16 @load_atomic_i16_aligned_unordered(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_unordered:
+; CHECK: ldrh w0, [x0, #8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep unordered, align 2
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_aligned_unordered_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_unordered_const:
+; CHECK: ldrh w0, [x0, #8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep unordered, align 2
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_aligned_monotonic(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_monotonic:
+; CHECK: ldrh w0, [x0, #8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep monotonic, align 2
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_aligned_monotonic_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_monotonic_const:
+; CHECK: ldrh w0, [x0, #8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep monotonic, align 2
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_aligned_acquire(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_acquire:
+; CHECK: add x8, x0, #8
+; CHECK: ldaprh w0, [x8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep acquire, align 2
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_aligned_acquire_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_acquire_const:
+; CHECK: add x8, x0, #8
+; CHECK: ldaprh w0, [x8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep acquire, align 2
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_aligned_seq_cst(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_seq_cst:
+; CHECK: add x8, x0, #8
+; CHECK: ldarh w0, [x8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep seq_cst, align 2
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_aligned_seq_cst_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i16_aligned_seq_cst_const:
+; CHECK: add x8, x0, #8
+; CHECK: ldarh w0, [x8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep seq_cst, align 2
+ ret i16 %r
+}
+
+define i32 @load_atomic_i32_aligned_unordered(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_unordered:
+; CHECK: ldr w0, [x0, #16]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep unordered, align 4
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_aligned_unordered_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_unordered_const:
+; CHECK: ldr w0, [x0, #16]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep unordered, align 4
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_aligned_monotonic(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_monotonic:
+; CHECK: ldr w0, [x0, #16]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep monotonic, align 4
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_aligned_monotonic_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_monotonic_const:
+; CHECK: ldr w0, [x0, #16]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep monotonic, align 4
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_aligned_acquire(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_acquire:
+; CHECK: add x8, x0, #16
+; CHECK: ldapr w0, [x8]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep acquire, align 4
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_aligned_acquire_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_acquire_const:
+; CHECK: add x8, x0, #16
+; CHECK: ldapr w0, [x8]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep acquire, align 4
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_aligned_seq_cst(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_seq_cst:
+; CHECK: add x8, x0, #16
+; CHECK: ldar w0, [x8]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep seq_cst, align 4
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_aligned_seq_cst_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i32_aligned_seq_cst_const:
+; CHECK: add x8, x0, #16
+; CHECK: ldar w0, [x8]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep seq_cst, align 4
+ ret i32 %r
+}
+
+define i64 @load_atomic_i64_aligned_unordered(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_unordered:
+; CHECK: ldr x0, [x0, #32]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep unordered, align 8
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_aligned_unordered_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_unordered_const:
+; CHECK: ldr x0, [x0, #32]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep unordered, align 8
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_aligned_monotonic(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_monotonic:
+; CHECK: ldr x0, [x0, #32]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep monotonic, align 8
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_aligned_monotonic_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_monotonic_const:
+; CHECK: ldr x0, [x0, #32]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep monotonic, align 8
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_aligned_acquire(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_acquire:
+; CHECK: add x8, x0, #32
+; CHECK: ldapr x0, [x8]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep acquire, align 8
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_aligned_acquire_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_acquire_const:
+; CHECK: add x8, x0, #32
+; CHECK: ldapr x0, [x8]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep acquire, align 8
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_aligned_seq_cst(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_seq_cst:
+; CHECK: add x8, x0, #32
+; CHECK: ldar x0, [x8]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep seq_cst, align 8
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_aligned_seq_cst_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i64_aligned_seq_cst_const:
+; CHECK: add x8, x0, #32
+; CHECK: ldar x0, [x8]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep seq_cst, align 8
+ ret i64 %r
+}
+
+define i128 @load_atomic_i128_aligned_unordered(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_unordered:
+; CHECK: ldp x0, x1, [x0, #64]
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep unordered, align 16
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_aligned_unordered_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_unordered_const:
+; CHECK: ldp x0, x1, [x0, #64]
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep unordered, align 16
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_aligned_monotonic(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_monotonic:
+; CHECK: ldp x0, x1, [x0, #64]
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep monotonic, align 16
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_aligned_monotonic_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_monotonic_const:
+; CHECK: ldp x0, x1, [x0, #64]
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep monotonic, align 16
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_aligned_acquire(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_acquire:
+; CHECK: ldp x0, x1, [x0, #64]
+; CHECK: dmb ishld
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep acquire, align 16
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_aligned_acquire_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_acquire_const:
+; CHECK: ldp x0, x1, [x0, #64]
+; CHECK: dmb ishld
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep acquire, align 16
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_aligned_seq_cst(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_seq_cst:
+; CHECK: ldp x0, x1, [x0, #64]
+; CHECK: dmb ish
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep seq_cst, align 16
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_aligned_seq_cst_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i128_aligned_seq_cst_const:
+; CHECK: ldp x0, x1, [x0, #64]
+; CHECK: dmb ish
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep seq_cst, align 16
+ ret i128 %r
+}
+
+define i8 @load_atomic_i8_unaligned_unordered(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_unordered:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep unordered, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_unaligned_unordered_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_unordered_const:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep unordered, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_unaligned_monotonic(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_monotonic:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep monotonic, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_unaligned_monotonic_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_monotonic_const:
+; CHECK: ldrb w0, [x0, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep monotonic, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_unaligned_acquire(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_acquire:
+; CHECK: add x8, x0, #4
+; CHECK: ldaprb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep acquire, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_unaligned_acquire_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_acquire_const:
+; CHECK: add x8, x0, #4
+; CHECK: ldaprb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep acquire, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_unaligned_seq_cst(ptr %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_seq_cst:
+; CHECK: add x8, x0, #4
+; CHECK: ldarb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep seq_cst, align 1
+ ret i8 %r
+}
+
+define i8 @load_atomic_i8_unaligned_seq_cst_const(ptr readonly %ptr) {
+; CHECK-LABEL: load_atomic_i8_unaligned_seq_cst_const:
+; CHECK: add x8, x0, #4
+; CHECK: ldarb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i8, ptr %gep seq_cst, align 1
+ ret i8 %r
+}
+
+define i16 @load_atomic_i16_unaligned_unordered(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_unordered:
+; GISEL: add x1, x8, #4
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_unordered:
+; SDAG: add x1, x0, #4
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep unordered, align 1
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_unaligned_unordered_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_unordered_const:
+; GISEL: add x1, x8, #4
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_unordered_const:
+; SDAG: add x1, x0, #4
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep unordered, align 1
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_unaligned_monotonic(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_monotonic:
+; GISEL: add x1, x8, #8
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_monotonic:
+; SDAG: add x1, x0, #8
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep monotonic, align 1
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_unaligned_monotonic_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_monotonic_const:
+; GISEL: add x1, x8, #8
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_monotonic_const:
+; SDAG: add x1, x0, #8
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep monotonic, align 1
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_unaligned_acquire(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_acquire:
+; GISEL: add x1, x8, #8
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_acquire:
+; SDAG: add x1, x0, #8
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep acquire, align 1
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_unaligned_acquire_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_acquire_const:
+; GISEL: add x1, x8, #8
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_acquire_const:
+; SDAG: add x1, x0, #8
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep acquire, align 1
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_unaligned_seq_cst(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_seq_cst:
+; GISEL: add x1, x8, #8
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_seq_cst:
+; SDAG: add x1, x0, #8
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep seq_cst, align 1
+ ret i16 %r
+}
+
+define i16 @load_atomic_i16_unaligned_seq_cst_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i16_unaligned_seq_cst_const:
+; GISEL: add x1, x8, #8
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i16_unaligned_seq_cst_const:
+; SDAG: add x1, x0, #8
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ %r = load atomic i16, ptr %gep seq_cst, align 1
+ ret i16 %r
+}
+
+define i32 @load_atomic_i32_unaligned_unordered(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_unordered:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_unordered:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep unordered, align 1
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_unaligned_unordered_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_unordered_const:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_unordered_const:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep unordered, align 1
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_unaligned_monotonic(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_monotonic:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_monotonic:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep monotonic, align 1
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_unaligned_monotonic_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_monotonic_const:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_monotonic_const:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep monotonic, align 1
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_unaligned_acquire(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_acquire:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_acquire:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep acquire, align 1
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_unaligned_acquire_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_acquire_const:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_acquire_const:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep acquire, align 1
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_unaligned_seq_cst(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_seq_cst:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_seq_cst:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep seq_cst, align 1
+ ret i32 %r
+}
+
+define i32 @load_atomic_i32_unaligned_seq_cst_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i32_unaligned_seq_cst_const:
+; GISEL: add x1, x8, #16
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i32_unaligned_seq_cst_const:
+; SDAG: add x1, x0, #16
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ %r = load atomic i32, ptr %gep seq_cst, align 1
+ ret i32 %r
+}
+
+define i64 @load_atomic_i64_unaligned_unordered(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_unordered:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_unordered:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep unordered, align 1
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_unaligned_unordered_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_unordered_const:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_unordered_const:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep unordered, align 1
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_unaligned_monotonic(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_monotonic:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_monotonic:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep monotonic, align 1
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_unaligned_monotonic_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_monotonic_const:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_monotonic_const:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep monotonic, align 1
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_unaligned_acquire(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_acquire:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_acquire:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep acquire, align 1
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_unaligned_acquire_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_acquire_const:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_acquire_const:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep acquire, align 1
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_unaligned_seq_cst(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_seq_cst:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_seq_cst:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep seq_cst, align 1
+ ret i64 %r
+}
+
+define i64 @load_atomic_i64_unaligned_seq_cst_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i64_unaligned_seq_cst_const:
+; GISEL: add x1, x8, #32
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i64_unaligned_seq_cst_const:
+; SDAG: add x1, x0, #32
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ %r = load atomic i64, ptr %gep seq_cst, align 1
+ ret i64 %r
+}
+
+define i128 @load_atomic_i128_unaligned_unordered(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_unordered:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_unordered:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep unordered, align 1
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_unaligned_unordered_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_unordered_const:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_unordered_const:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep unordered, align 1
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_unaligned_monotonic(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_monotonic:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_monotonic:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep monotonic, align 1
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_unaligned_monotonic_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_monotonic_const:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_monotonic_const:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep monotonic, align 1
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_unaligned_acquire(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_acquire:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_acquire:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep acquire, align 1
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_unaligned_acquire_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_acquire_const:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_acquire_const:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep acquire, align 1
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_unaligned_seq_cst(ptr %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_seq_cst:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_seq_cst:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep seq_cst, align 1
+ ret i128 %r
+}
+
+define i128 @load_atomic_i128_unaligned_seq_cst_const(ptr readonly %ptr) {
+; GISEL-LABEL: load_atomic_i128_unaligned_seq_cst_const:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_load
+;
+; SDAG-LABEL: load_atomic_i128_unaligned_seq_cst_const:
+; SDAG: add x1, x0, #64
+; SDAG: bl __atomic_load
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ %r = load atomic i128, ptr %gep seq_cst, align 1
+ ret i128 %r
+}
diff --git a/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-store-rcpc_immo.ll b/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-store-rcpc_immo.ll
new file mode 100644
index 000000000000000..86cb738c5799ddb
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/Atomics/aarch64-atomic-store-rcpc_immo.ll
@@ -0,0 +1,368 @@
+; 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)"
+; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+v8.4a -mattr=+rcpc-immo -global-isel=true -global-isel-abort=2 -O0 | FileCheck %s --check-prefixes=CHECK,GISEL
+; RUN: llc %s -o - -verify-machineinstrs -mtriple=aarch64 -mattr=+v8.4a -mattr=+rcpc-immo -global-isel=false -O1 | FileCheck %s --check-prefixes=CHECK,SDAG
+
+define void @store_atomic_i8_aligned_unordered(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_aligned_unordered:
+; CHECK: strb w0, [x1, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep unordered, align 1
+ ret void
+}
+
+define void @store_atomic_i8_aligned_monotonic(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_aligned_monotonic:
+; CHECK: strb w0, [x1, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep monotonic, align 1
+ ret void
+}
+
+define void @store_atomic_i8_aligned_release(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_aligned_release:
+; CHECK: add x8, x1, #4
+; CHECK: stlrb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep release, align 1
+ ret void
+}
+
+define void @store_atomic_i8_aligned_seq_cst(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_aligned_seq_cst:
+; CHECK: add x8, x1, #4
+; CHECK: stlrb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep seq_cst, align 1
+ ret void
+}
+
+define void @store_atomic_i16_aligned_unordered(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_aligned_unordered:
+; CHECK: strh w0, [x1, #8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep unordered, align 2
+ ret void
+}
+
+define void @store_atomic_i16_aligned_monotonic(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_aligned_monotonic:
+; CHECK: strh w0, [x1, #8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep monotonic, align 2
+ ret void
+}
+
+define void @store_atomic_i16_aligned_release(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_aligned_release:
+; CHECK: add x8, x1, #8
+; CHECK: stlrh w0, [x8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep release, align 2
+ ret void
+}
+
+define void @store_atomic_i16_aligned_seq_cst(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_aligned_seq_cst:
+; CHECK: add x8, x1, #8
+; CHECK: stlrh w0, [x8]
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep seq_cst, align 2
+ ret void
+}
+
+define void @store_atomic_i32_aligned_unordered(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_aligned_unordered:
+; CHECK: str w0, [x1, #16]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep unordered, align 4
+ ret void
+}
+
+define void @store_atomic_i32_aligned_monotonic(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_aligned_monotonic:
+; CHECK: str w0, [x1, #16]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep monotonic, align 4
+ ret void
+}
+
+define void @store_atomic_i32_aligned_release(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_aligned_release:
+; CHECK: add x8, x1, #16
+; CHECK: stlr w0, [x8]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep release, align 4
+ ret void
+}
+
+define void @store_atomic_i32_aligned_seq_cst(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_aligned_seq_cst:
+; CHECK: add x8, x1, #16
+; CHECK: stlr w0, [x8]
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep seq_cst, align 4
+ ret void
+}
+
+define void @store_atomic_i64_aligned_unordered(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_aligned_unordered:
+; CHECK: str x0, [x1, #32]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep unordered, align 8
+ ret void
+}
+
+define void @store_atomic_i64_aligned_monotonic(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_aligned_monotonic:
+; CHECK: str x0, [x1, #32]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep monotonic, align 8
+ ret void
+}
+
+define void @store_atomic_i64_aligned_release(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_aligned_release:
+; CHECK: add x8, x1, #32
+; CHECK: stlr x0, [x8]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep release, align 8
+ ret void
+}
+
+define void @store_atomic_i64_aligned_seq_cst(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_aligned_seq_cst:
+; CHECK: add x8, x1, #32
+; CHECK: stlr x0, [x8]
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep seq_cst, align 8
+ ret void
+}
+
+define void @store_atomic_i128_aligned_unordered(i128 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i128_aligned_unordered:
+; CHECK: stp x0, x1, [x2, #64]
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep unordered, align 16
+ ret void
+}
+
+define void @store_atomic_i128_aligned_monotonic(i128 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i128_aligned_monotonic:
+; CHECK: stp x0, x1, [x2, #64]
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep monotonic, align 16
+ ret void
+}
+
+define void @store_atomic_i128_aligned_release(i128 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i128_aligned_release:
+; CHECK: dmb ish
+; CHECK: stp x0, x1, [x2, #64]
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep release, align 16
+ ret void
+}
+
+define void @store_atomic_i128_aligned_seq_cst(i128 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i128_aligned_seq_cst:
+; CHECK: dmb ish
+; CHECK: stp x0, x1, [x2, #64]
+; CHECK: dmb ish
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep seq_cst, align 16
+ ret void
+}
+
+define void @store_atomic_i8_unaligned_unordered(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_unaligned_unordered:
+; CHECK: strb w0, [x1, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep unordered, align 1
+ ret void
+}
+
+define void @store_atomic_i8_unaligned_monotonic(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_unaligned_monotonic:
+; CHECK: strb w0, [x1, #4]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep monotonic, align 1
+ ret void
+}
+
+define void @store_atomic_i8_unaligned_release(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_unaligned_release:
+; CHECK: add x8, x1, #4
+; CHECK: stlrb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep release, align 1
+ ret void
+}
+
+define void @store_atomic_i8_unaligned_seq_cst(i8 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i8_unaligned_seq_cst:
+; CHECK: add x8, x1, #4
+; CHECK: stlrb w0, [x8]
+ %gep = getelementptr inbounds i8, ptr %ptr, i32 4
+ store atomic i8 %value, ptr %gep seq_cst, align 1
+ ret void
+}
+
+define void @store_atomic_i16_unaligned_unordered(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_unaligned_unordered:
+; CHECK: add x1, x1, #8
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep unordered, align 1
+ ret void
+}
+
+define void @store_atomic_i16_unaligned_monotonic(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_unaligned_monotonic:
+; CHECK: add x1, x1, #8
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep monotonic, align 1
+ ret void
+}
+
+define void @store_atomic_i16_unaligned_release(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_unaligned_release:
+; CHECK: add x1, x1, #8
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep release, align 1
+ ret void
+}
+
+define void @store_atomic_i16_unaligned_seq_cst(i16 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i16_unaligned_seq_cst:
+; CHECK: add x1, x1, #8
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i16, ptr %ptr, i32 4
+ store atomic i16 %value, ptr %gep seq_cst, align 1
+ ret void
+}
+
+define void @store_atomic_i32_unaligned_unordered(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_unaligned_unordered:
+; CHECK: add x1, x1, #16
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep unordered, align 1
+ ret void
+}
+
+define void @store_atomic_i32_unaligned_monotonic(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_unaligned_monotonic:
+; CHECK: add x1, x1, #16
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep monotonic, align 1
+ ret void
+}
+
+define void @store_atomic_i32_unaligned_release(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_unaligned_release:
+; CHECK: add x1, x1, #16
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep release, align 1
+ ret void
+}
+
+define void @store_atomic_i32_unaligned_seq_cst(i32 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i32_unaligned_seq_cst:
+; CHECK: add x1, x1, #16
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i32, ptr %ptr, i32 4
+ store atomic i32 %value, ptr %gep seq_cst, align 1
+ ret void
+}
+
+define void @store_atomic_i64_unaligned_unordered(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_unaligned_unordered:
+; CHECK: add x1, x1, #32
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep unordered, align 1
+ ret void
+}
+
+define void @store_atomic_i64_unaligned_monotonic(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_unaligned_monotonic:
+; CHECK: add x1, x1, #32
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep monotonic, align 1
+ ret void
+}
+
+define void @store_atomic_i64_unaligned_release(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_unaligned_release:
+; CHECK: add x1, x1, #32
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep release, align 1
+ ret void
+}
+
+define void @store_atomic_i64_unaligned_seq_cst(i64 %value, ptr %ptr) {
+; CHECK-LABEL: store_atomic_i64_unaligned_seq_cst:
+; CHECK: add x1, x1, #32
+; CHECK: bl __atomic_store
+ %gep = getelementptr inbounds i64, ptr %ptr, i32 4
+ store atomic i64 %value, ptr %gep seq_cst, align 1
+ ret void
+}
+
+define void @store_atomic_i128_unaligned_unordered(i128 %value, ptr %ptr) {
+; GISEL-LABEL: store_atomic_i128_unaligned_unordered:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_store
+;
+; SDAG-LABEL: store_atomic_i128_unaligned_unordered:
+; SDAG: add x1, x2, #64
+; SDAG: bl __atomic_store
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep unordered, align 1
+ ret void
+}
+
+define void @store_atomic_i128_unaligned_monotonic(i128 %value, ptr %ptr) {
+; GISEL-LABEL: store_atomic_i128_unaligned_monotonic:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_store
+;
+; SDAG-LABEL: store_atomic_i128_unaligned_monotonic:
+; SDAG: add x1, x2, #64
+; SDAG: bl __atomic_store
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep monotonic, align 1
+ ret void
+}
+
+define void @store_atomic_i128_unaligned_release(i128 %value, ptr %ptr) {
+; GISEL-LABEL: store_atomic_i128_unaligned_release:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_store
+;
+; SDAG-LABEL: store_atomic_i128_unaligned_release:
+; SDAG: add x1, x2, #64
+; SDAG: bl __atomic_store
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep release, align 1
+ ret void
+}
+
+define void @store_atomic_i128_unaligned_seq_cst(i128 %value, ptr %ptr) {
+; GISEL-LABEL: store_atomic_i128_unaligned_seq_cst:
+; GISEL: add x1, x8, #64
+; GISEL: bl __atomic_store
+;
+; SDAG-LABEL: store_atomic_i128_unaligned_seq_cst:
+; SDAG: add x1, x2, #64
+; SDAG: bl __atomic_store
+ %gep = getelementptr inbounds i128, ptr %ptr, i32 4
+ store atomic i128 %value, ptr %gep seq_cst, align 1
+ ret void
+}
More information about the llvm-commits
mailing list