CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
95 lines
3.3 KiB
LLVM
95 lines
3.3 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -S -passes=gvn < %s | FileCheck %s
|
|
|
|
@u = global i32 5, align 4
|
|
@w = global i32 10, align 4
|
|
|
|
define i32 @test_load() {
|
|
; CHECK-LABEL: @test_load(
|
|
; CHECK-NEXT: [[LV:%.*]] = load volatile i32, ptr @u, align 4
|
|
; CHECK-NEXT: ret i32 [[LV]]
|
|
;
|
|
%l1 = load atomic i32, ptr @w unordered, align 4
|
|
%lv = load volatile i32, ptr @u, align 4
|
|
%l2 = load atomic i32, ptr @w unordered, align 4
|
|
%res.1 = sub i32 %l1, %l2
|
|
%res = add i32 %res.1, %lv
|
|
ret i32 %res
|
|
}
|
|
|
|
define i32 @test_load_with_acquire_load() {
|
|
; CHECK-LABEL: @test_load_with_acquire_load(
|
|
; CHECK-NEXT: [[L1:%.*]] = load atomic i32, ptr @w acquire, align 4
|
|
; CHECK-NEXT: [[LV:%.*]] = load volatile i32, ptr @u, align 4
|
|
; CHECK-NEXT: [[L2:%.*]] = load atomic i32, ptr @w acquire, align 4
|
|
; CHECK-NEXT: [[RES_1:%.*]] = sub i32 [[L1]], [[L2]]
|
|
; CHECK-NEXT: [[RES:%.*]] = add i32 [[RES_1]], [[LV]]
|
|
; CHECK-NEXT: ret i32 [[RES]]
|
|
;
|
|
%l1 = load atomic i32, ptr @w acquire, align 4
|
|
%lv = load volatile i32, ptr @u, align 4
|
|
%l2 = load atomic i32, ptr @w acquire, align 4
|
|
%res.1 = sub i32 %l1, %l2
|
|
%res = add i32 %res.1, %lv
|
|
ret i32 %res
|
|
}
|
|
|
|
define i32 @test_load_with_seq_cst_load() {
|
|
; CHECK-LABEL: @test_load_with_seq_cst_load(
|
|
; CHECK-NEXT: [[L1:%.*]] = load atomic i32, ptr @w seq_cst, align 4
|
|
; CHECK-NEXT: [[LV:%.*]] = load volatile i32, ptr @u, align 4
|
|
; CHECK-NEXT: [[L2:%.*]] = load atomic i32, ptr @w seq_cst, align 4
|
|
; CHECK-NEXT: [[RES_1:%.*]] = sub i32 [[L1]], [[L2]]
|
|
; CHECK-NEXT: [[RES:%.*]] = add i32 [[RES_1]], [[LV]]
|
|
; CHECK-NEXT: ret i32 [[RES]]
|
|
;
|
|
%l1 = load atomic i32, ptr @w seq_cst, align 4
|
|
%lv = load volatile i32, ptr @u, align 4
|
|
%l2 = load atomic i32, ptr @w seq_cst, align 4
|
|
%res.1 = sub i32 %l1, %l2
|
|
%res = add i32 %res.1, %lv
|
|
ret i32 %res
|
|
}
|
|
|
|
define i32 @test_store(i32 %x) {
|
|
; CHECK-LABEL: @test_store(
|
|
; CHECK-NEXT: store volatile i32 [[X:%.*]], ptr @u, align 4
|
|
; CHECK-NEXT: ret i32 0
|
|
;
|
|
%l1 = load atomic i32, ptr @w unordered, align 4
|
|
store volatile i32 %x, ptr @u, align 4
|
|
%l2 = load atomic i32, ptr @w unordered, align 4
|
|
%res = sub i32 %l1, %l2
|
|
ret i32 %res
|
|
}
|
|
|
|
define i32 @test_store_with_acquire_load(i32 %x) {
|
|
; CHECK-LABEL: @test_store_with_acquire_load(
|
|
; CHECK-NEXT: [[L1:%.*]] = load atomic i32, ptr @w acquire, align 4
|
|
; CHECK-NEXT: store volatile i32 [[X:%.*]], ptr @u, align 4
|
|
; CHECK-NEXT: [[L2:%.*]] = load atomic i32, ptr @w acquire, align 4
|
|
; CHECK-NEXT: [[RES:%.*]] = sub i32 [[L1]], [[L2]]
|
|
; CHECK-NEXT: ret i32 [[RES]]
|
|
;
|
|
%l1 = load atomic i32, ptr @w acquire, align 4
|
|
store volatile i32 %x, ptr @u, align 4
|
|
%l2 = load atomic i32, ptr @w acquire, align 4
|
|
%res = sub i32 %l1, %l2
|
|
ret i32 %res
|
|
}
|
|
|
|
define i32 @test_store_with_seq_cst_load(i32 %x) {
|
|
; CHECK-LABEL: @test_store_with_seq_cst_load(
|
|
; CHECK-NEXT: [[L1:%.*]] = load atomic i32, ptr @w seq_cst, align 4
|
|
; CHECK-NEXT: store volatile i32 [[X:%.*]], ptr @u, align 4
|
|
; CHECK-NEXT: [[L2:%.*]] = load atomic i32, ptr @w seq_cst, align 4
|
|
; CHECK-NEXT: [[RES:%.*]] = sub i32 [[L1]], [[L2]]
|
|
; CHECK-NEXT: ret i32 [[RES]]
|
|
;
|
|
%l1 = load atomic i32, ptr @w seq_cst, align 4
|
|
store volatile i32 %x, ptr @u, align 4
|
|
%l2 = load atomic i32, ptr @w seq_cst, align 4
|
|
%res = sub i32 %l1, %l2
|
|
ret i32 %res
|
|
}
|