diff options
author | Jonas Paulsson <paulson1@linux.ibm.com> | 2023-12-21 20:48:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-21 20:48:00 +0100 |
commit | 74a09bd1ec6066d56880df1ae1a2c0258442cee9 (patch) | |
tree | cbbc635377bd7daf9672e9ca460565b5b804c3cf | |
parent | 809f2f3d7dfaff7c239dd99742175287f76560c7 (diff) | |
download | llvm-74a09bd1ec6066d56880df1ae1a2c0258442cee9.zip llvm-74a09bd1ec6066d56880df1ae1a2c0258442cee9.tar.gz llvm-74a09bd1ec6066d56880df1ae1a2c0258442cee9.tar.bz2 |
[SystemZ] Test improvements for atomic load/store instructions (NFC). (#75630)
Improve tests for atomic loads and stores, mainly by testing 128-bit atomic load and store instructions both with and w/out natural alignment.
-rw-r--r-- | llvm/test/CodeGen/SystemZ/atomic-load-05.ll | 18 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/atomic-load-08.ll | 26 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/atomic-store-05.ll | 9 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/atomic-store-06.ll | 14 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/atomic-store-07.ll | 7 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/atomic-store-08.ll | 26 |
6 files changed, 67 insertions, 33 deletions
diff --git a/llvm/test/CodeGen/SystemZ/atomic-load-05.ll b/llvm/test/CodeGen/SystemZ/atomic-load-05.ll index 979f1e6..f406bc6 100644 --- a/llvm/test/CodeGen/SystemZ/atomic-load-05.ll +++ b/llvm/test/CodeGen/SystemZ/atomic-load-05.ll @@ -1,14 +1,22 @@ -; Test 128-bit atomic loads. +; Test 128-bit integer atomic loads. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s define i128 @f1(ptr %src) { ; CHECK-LABEL: f1: -; CHECK: lpq %r0, 0(%r3) -; CHECK-DAG: stg %r1, 8(%r2) -; CHECK-DAG: stg %r0, 0(%r2) -; CHECK: br %r14 +; CHECK: # %bb.0: +; CHECK-NEXT: lpq %r0, 0(%r3) +; CHECK-NEXT: stg %r1, 8(%r2) +; CHECK-NEXT: stg %r0, 0(%r2) +; CHECK-NEXT: br %r14 %val = load atomic i128, ptr %src seq_cst, align 16 ret i128 %val } + +define i128 @f2(ptr %src) { +; CHECK-LABEL: f2: +; CHECK: brasl %r14, __atomic_load@PLT + %val = load atomic i128, ptr %src seq_cst, align 8 + ret i128 %val +} diff --git a/llvm/test/CodeGen/SystemZ/atomic-load-08.ll b/llvm/test/CodeGen/SystemZ/atomic-load-08.ll index 069d216..4d914e3 100644 --- a/llvm/test/CodeGen/SystemZ/atomic-load-08.ll +++ b/llvm/test/CodeGen/SystemZ/atomic-load-08.ll @@ -1,19 +1,25 @@ -; Test long double atomic loads. Expect a libcall. +; Test long double atomic loads. These are emitted by the Clang FE as i128 +; loads with a bitcast, and this test case gets converted into that form as +; well by the AtomicExpand pass. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s +; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s define void @f1(ptr %ret, ptr %src) { ; CHECK-LABEL: f1: -; CHECK: lgr [[RET:%r[0-9]+]], %r2 -; CHECK: la %r4, 160(%r15) -; CHECK: lghi %r2, 16 -; CHECK: lhi %r5, 5 +; CHECK: # %bb.0: +; CHECK-NEXT: lpq %r0, 0(%r3) +; CHECK-NEXT: stg %r1, 8(%r2) +; CHECK-NEXT: stg %r0, 0(%r2) +; CHECK-NEXT: br %r14 + %val = load atomic fp128, ptr %src seq_cst, align 16 + store fp128 %val, ptr %ret, align 8 + ret void +} + +define void @f2(ptr %ret, ptr %src) { +; CHECK-LABEL: f2: ; CHECK: brasl %r14, __atomic_load@PLT -; CHECK: ld [[FL:%f[0-9]+]], 160(%r15) -; CHECK: ld [[FH:%f[0-9]+]], 168(%r15) -; CHECK: std [[FL]], 0([[RET]]) -; CHECK: std [[FH]], 8([[RET]]) -; CHECK: br %r14 %val = load atomic fp128, ptr %src seq_cst, align 8 store fp128 %val, ptr %ret, align 8 ret void diff --git a/llvm/test/CodeGen/SystemZ/atomic-store-05.ll b/llvm/test/CodeGen/SystemZ/atomic-store-05.ll index dad7d95..e4af7ad 100644 --- a/llvm/test/CodeGen/SystemZ/atomic-store-05.ll +++ b/llvm/test/CodeGen/SystemZ/atomic-store-05.ll @@ -1,4 +1,4 @@ -; Test 128-bit atomic stores. +; Test 128-bit integer atomic stores. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s @@ -24,3 +24,10 @@ define void @f2(i128 %val, ptr %src) { store atomic i128 %val, ptr %src monotonic, align 16 ret void } + +define void @f3(i128 %val, ptr %src) { +; CHECK-LABEL: f3: +; CHECK: brasl %r14, __atomic_store@PLT + store atomic i128 %val, ptr %src seq_cst, align 8 + ret void +} diff --git a/llvm/test/CodeGen/SystemZ/atomic-store-06.ll b/llvm/test/CodeGen/SystemZ/atomic-store-06.ll index fd39793..b748bfc 100644 --- a/llvm/test/CodeGen/SystemZ/atomic-store-06.ll +++ b/llvm/test/CodeGen/SystemZ/atomic-store-06.ll @@ -1,13 +1,17 @@ -; Test float atomic loads. +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 +; Test float atomic stores. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s define void @f1(ptr %src, float %val) { ; CHECK-LABEL: f1: -; CHECK: lgdr [[R:%r[0-9]+]], %f0 -; CHECK: srlg [[R]], [[R]], 32 -; CHECK: st [[R]], 0(%r2) -; CHECK: br %r14 +; CHECK: # %bb.0: +; CHECK-NEXT: # kill: def $f0s killed $f0s def $f0d +; CHECK-NEXT: lgdr %r0, %f0 +; CHECK-NEXT: srlg %r0, %r0, 32 +; CHECK-NEXT: st %r0, 0(%r2) +; CHECK-NEXT: bcr 15, %r0 +; CHECK-NEXT: br %r14 store atomic float %val, ptr %src seq_cst, align 4 ret void } diff --git a/llvm/test/CodeGen/SystemZ/atomic-store-07.ll b/llvm/test/CodeGen/SystemZ/atomic-store-07.ll index c904b73..11f81ae1 100644 --- a/llvm/test/CodeGen/SystemZ/atomic-store-07.ll +++ b/llvm/test/CodeGen/SystemZ/atomic-store-07.ll @@ -1,11 +1,14 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4 ; Test double atomic stores. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s define void @f1(ptr %dst, double %val) { ; CHECK-LABEL: f1: -; CHECK: std %f0, 0(%r2) -; CHECK: br %r14 +; CHECK: # %bb.0: +; CHECK-NEXT: std %f0, 0(%r2) +; CHECK-NEXT: bcr 15, %r0 +; CHECK-NEXT: br %r14 store atomic double %val, ptr %dst seq_cst, align 8 ret void } diff --git a/llvm/test/CodeGen/SystemZ/atomic-store-08.ll b/llvm/test/CodeGen/SystemZ/atomic-store-08.ll index b33b283..f7f4f4d 100644 --- a/llvm/test/CodeGen/SystemZ/atomic-store-08.ll +++ b/llvm/test/CodeGen/SystemZ/atomic-store-08.ll @@ -1,19 +1,25 @@ -; Test long double atomic stores. Expect a libcall. +; Test long double atomic stores. The atomic store is converted to i128 by +; the AtomicExpand pass. ; ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s +; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s define void @f1(ptr %dst, ptr %src) { ; CHECK-LABEL: f1: -; CHECK: ld [[FL:%f[0-9]+]], 0(%r3) -; CHECK: ld [[FH:%f[0-9]+]], 8(%r3) -; CHECK: lgr %r3, %r2 -; CHECK: std [[FL]], 160(%r15) -; CHECK: std [[FH]], 168(%r15) -; CHECK: la %r4, 160(%r15) -; CHECK: lghi %r2, 16 -; CHECK: lhi %r5, 5 +; CHECK: # %bb.0: +; CHECK-NEXT: lg %r1, 8(%r3) +; CHECK-NEXT: lg %r0, 0(%r3) +; CHECK-NEXT: stpq %r0, 0(%r2) +; CHECK-NEXT: bcr 1{{[45]}}, %r0 +; CHECK-NEXT: br %r14 + %val = load fp128, ptr %src, align 8 + store atomic fp128 %val, ptr %dst seq_cst, align 16 + ret void +} + +define void @f2(ptr %dst, ptr %src) { +; CHECK-LABEL: f2: ; CHECK: brasl %r14, __atomic_store@PLT -; CHECK: br %r14 %val = load fp128, ptr %src, align 8 store atomic fp128 %val, ptr %dst seq_cst, align 8 ret void |