mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 12:12:47 +01:00
1e7a7bb573
Adds NVPTX builtins and intrinsics for the CUDA PTX `redux.sync` instructions for `sm_80` architecture or newer. PTX ISA description of `redux.sync`: https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-redux-sync Authored-by: Steffen Larsen <steffen.larsen@codeplay.com> Differential Revision: https://reviews.llvm.org/D100124
66 lines
2.1 KiB
LLVM
66 lines
2.1 KiB
LLVM
; RUN: llc < %s -march=nvptx64 -mcpu=sm_80 -mattr=+ptx70 | FileCheck %s
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.umin(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_min_u32
|
|
define i32 @redux_sync_min_u32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.min.u32
|
|
%val = call i32 @llvm.nvvm.redux.sync.umin(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.umax(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_max_u32
|
|
define i32 @redux_sync_max_u32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.max.u32
|
|
%val = call i32 @llvm.nvvm.redux.sync.umax(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.add(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_add_s32
|
|
define i32 @redux_sync_add_s32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.add.s32
|
|
%val = call i32 @llvm.nvvm.redux.sync.add(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.min(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_min_s32
|
|
define i32 @redux_sync_min_s32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.min.s32
|
|
%val = call i32 @llvm.nvvm.redux.sync.min(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.max(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_max_s32
|
|
define i32 @redux_sync_max_s32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.max.s32
|
|
%val = call i32 @llvm.nvvm.redux.sync.max(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.and(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_and_b32
|
|
define i32 @redux_sync_and_b32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.and.b32
|
|
%val = call i32 @llvm.nvvm.redux.sync.and(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.xor(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_xor_b32
|
|
define i32 @redux_sync_xor_b32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.xor.b32
|
|
%val = call i32 @llvm.nvvm.redux.sync.xor(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.redux.sync.or(i32, i32)
|
|
; CHECK-LABEL: .func{{.*}}redux_sync_or_b32
|
|
define i32 @redux_sync_or_b32(i32 %src, i32 %mask) {
|
|
; CHECK: redux.sync.or.b32
|
|
%val = call i32 @llvm.nvvm.redux.sync.or(i32 %src, i32 %mask)
|
|
ret i32 %val
|
|
}
|