Skip to content

Commit 051ce26

Browse files
committed
Fixed test and updated naming convention for the intrinsic
1 parent f071e6d commit 051ce26

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

llvm/include/llvm/IR/IntrinsicsSPIRV.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ let TargetPrefix = "spv" in {
8585
def int_spv_wave_is_first_lane : DefaultAttrsIntrinsic<[llvm_i1_ty], [], [IntrConvergent]>;
8686
def int_spv_sign : DefaultAttrsIntrinsic<[LLVMScalarOrSameVectorWidth<0, llvm_i32_ty>], [llvm_any_ty], [IntrNoMem]>;
8787
def int_spv_radians : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
88-
def int_spv_groupMemoryBarrierWithGroupSync : DefaultAttrsIntrinsic<[], [], []>;
88+
def int_spv_group_memory_barrier_with_group_sync : DefaultAttrsIntrinsic<[], [], []>;
8989

9090
// Create resource handle given the binding information. Returns a
9191
// type appropriate for the kind of resource given the set id, binding id,

llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,16 +2521,16 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
25212521
return selectExtInst(ResVReg, ResType, I, CL::rsqrt, GL::InverseSqrt);
25222522
case Intrinsic::spv_sign:
25232523
return selectSign(ResVReg, ResType, I);
2524-
case Intrinsic::spv_groupMemoryBarrierWithGroupSync: {
2525-
Register MemSemReg = buildI32Constant(SPIRV::MemorySemantics::SequentiallyConsistent, I);
2524+
case Intrinsic::spv_group_memory_barrier_with_group_sync: {
2525+
Register MemSemReg =
2526+
buildI32Constant(SPIRV::MemorySemantics::SequentiallyConsistent, I);
25262527
Register ScopeReg = buildI32Constant(SPIRV::Scope::Workgroup, I);
25272528
MachineBasicBlock &BB = *I.getParent();
25282529
return BuildMI(BB, I, I.getDebugLoc(), TII.get(SPIRV::OpControlBarrier))
25292530
.addUse(ScopeReg)
25302531
.addUse(ScopeReg)
25312532
.addUse(MemSemReg)
25322533
.constrainAllUses(TII, TRI, RBI);
2533-
//return selectBarrier(ResVReg, ResType, I, SPIRV::OpControlBarrier, );
25342534
} break;
25352535
case Intrinsic::spv_lifetime_start:
25362536
case Intrinsic::spv_lifetime_end: {

llvm/test/CodeGen/SPIRV/hlsl-intrinsics/GroupMemoryBarrierWithGroupSync.ll

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpMemoryModel Logical GLSL450
5+
6+
define void @test_group_memory_barrier_with_group_sync() {
7+
entry:
8+
; CHECK: %[[#TY:]] = OpTypeInt 32 0
9+
; CHECK-DAG: %[[#MEM_SEM:]] = OpConstant %[[#TY]] 16
10+
; CHECK-DAG: %[[#EXEC_AND_MEM_SCOPE:]] = OpConstant %[[#TY]] 2
11+
; CHECK: OpControlBarrier %[[#EXEC_AND_MEM_SCOPE]] %[[#EXEC_AND_MEM_SCOPE]] %[[#MEM_SEM]]
12+
call void @llvm.spv.group.memory.barrier.with.group.sync()
13+
ret void
14+
}

0 commit comments

Comments
 (0)